/* GANDER application styles, Arcadus design system (spec 6.2).
   Colour, shape and type come from tokens.css, which is generated from
   arc-engine's palette.py. Never put a literal colour in this file. */

@import url("vendor-fonts.css");

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink-soft);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink-2);
  font-weight: 600;
  letter-spacing: -0.022em;
  line-height: 1.14;
  text-wrap: balance;
}

p { margin: 0; }
a { color: var(--blue); }
strong, b { color: var(--ink); font-weight: 600; }

code, .mono {
  font-family: var(--mono);
  font-size: 0.86em;
  color: var(--ink);
}

.wrap {
  max-width: 64rem;
  margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* ── masthead ─────────────────────────────────────────────── */
.mast { background: var(--bg); }
.mast .wrap {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding-block: 0.85rem;
  flex-wrap: wrap;
}

.logo-pill {
  display: grid;
  place-items: center;
  width: 62px;
  height: 46px;
  flex: none;
  /* The logo artwork is drawn for a white ground, so the pill stays white in
     both themes rather than following the surface token. */
  background: #FFFFFF;
  border-radius: var(--pill);
  box-shadow: var(--shadow);
}
.logo-pill img { width: 40px; height: auto; display: block; }

.mast .nm {
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.25;
}
.mast .sub {
  display: block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
}
.mast nav {
  margin-left: auto;
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.mast nav a {
  font-size: 0.86rem;
  text-decoration: none;
  color: var(--ink-soft);
  padding: 0.3rem 0.8rem;
  border-radius: var(--pill);
}
.mast nav a:hover { background: var(--tint-blue); color: var(--blue); }
.mast nav a[aria-current="page"] { background: var(--tint-blue); color: var(--blue); }

/* ── pills and buttons ────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  border-radius: var(--pill);
  padding: 0.62rem 1.25rem;
  font-family: var(--font);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
/* Near-black on the orange fill: the ink is fixed because the fill is. */
.btn-1 { background: var(--orange); color: #1D1205; }
.btn-1 span { text-decoration: underline; text-underline-offset: 3px; }
.btn-2 {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--blue);
}
.btn-2 span { text-decoration: underline; text-underline-offset: 3px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.chip {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.69rem;
  padding: 0.26rem 0.68rem;
  border-radius: var(--pill);
  background: var(--tint-blue);
  color: var(--blue);
  white-space: nowrap;
}
.chip.warn { background: var(--tint-orange); color: var(--orange); }
.chip.ok { background: var(--tint-green); color: var(--green); }
.chip.off { background: var(--surface-2); color: var(--muted); }

/* ── panels ───────────────────────────────────────────────── */
.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.panel + .panel { margin-top: 1.1rem; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}
.grid > * { min-width: 0; }

.stat {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.15rem;
}
.stat .k {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.stat .v {
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 0.6rem;
}

/* ── tables ───────────────────────────────────────────────── */
.scroller { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
thead th {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 0.75rem 0.9rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; }

/* ── forms ────────────────────────────────────────────────── */
.field { display: block; margin-bottom: 1rem; }
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}
.field input {
  width: 100%;
  font-family: var(--font);
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
}
.field input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}
.field input.code {
  font-family: var(--mono);
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  text-align: center;
}

.flash {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}
.flash.error { background: var(--tint-orange); color: var(--orange); }
.flash.ok { background: var(--tint-green); color: var(--green); }

/* ── notices ──────────────────────────────────────────────── */
.notice {
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  font-size: 0.9rem;
  background: var(--tint-orange);
  color: var(--ink);
  margin-bottom: 1.1rem;
}
.notice .lbl {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--orange);
  display: block;
  margin-bottom: 0.25rem;
}

/* ── centred single-card pages ────────────────────────────── */
.solo {
  min-height: 70vh;
  display: grid;
  place-items: center;
  padding-block: 2rem;
}
.solo .panel { width: 100%; max-width: 26rem; }

footer {
  margin-top: 2.5rem;
  border-top: 1px solid var(--line);
  padding-block: 1.3rem 2.5rem;
}
footer p {
  font-family: var(--mono);
  font-size: 0.73rem;
  color: var(--muted);
  line-height: 1.7;
}

a:focus-visible, .btn:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

@media (max-width: 40rem) {
  .panel { padding: 1.15rem; }
  .mast nav { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── atlas tabs ───────────────────────────────────────────── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-block: 1.1rem;
}
.tabs a {
  font-size: 0.89rem;
  text-decoration: none;
  color: var(--ink-soft);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 0.42rem 1rem;
  border-radius: var(--pill);
}
.tabs a:hover { color: var(--blue); }
/* White on the blue fill, fixed for the same reason. */
.tabs a[aria-current="page"] { background: var(--blue); color: #FFFFFF; }

select {
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.55rem 0.75rem;
}
select:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

/* ── platform walk ────────────────────────────────────────── */
.phasestrip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}
.phase {
  flex: 1 1 7rem;
  min-width: 0;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 0.7rem 0.8rem;
  opacity: 0.55;
}
.phase.lit {
  background: var(--tint-blue);
  opacity: 1;
}
.phase .pn {
  display: block;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--muted);
}
.phase.lit .pn { color: var(--blue); }
.phase .pname {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.phase .pstep {
  display: block;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange);
  margin-top: 0.15rem;
}

.step .stepname {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
}

/* ── node scout ───────────────────────────────────────────── */
.sliders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 0.8rem 1.2rem;
  margin-top: 1.3rem;
}
.slider label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.slider .val { color: var(--blue); font-size: 0.78rem; }
.slider input[type="range"] { width: 100%; accent-color: var(--blue); }

.bar {
  display: inline-block;
  width: 3.4rem;
  height: 0.45rem;
  background: var(--surface-2);
  border-radius: var(--pill);
  overflow: hidden;
  vertical-align: middle;
}
.bar-fill { display: block; height: 100%; background: var(--blue); }
.bar-fill.ok { background: var(--green); }
.bar-fill.warn { background: var(--orange); }
.bar-fill.off { background: var(--muted); }

.matrix td.cell {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.76rem;
  background: var(--surface-2);
}
.matrix td.cell.heavy { background: var(--tint-orange); color: var(--orange); font-weight: 600; }
.matrix th { font-family: var(--mono); font-size: 0.72rem; }

/* ── mission control ──────────────────────────────────────── */
/* The replay console is a deliberately single-look component: it sits on the brand
   navy in BOTH themes, because a terminal that inverts with the page reads as a
   different thing in each. Its palette is therefore fixed rather than theme-derived,
   and is declared here once so the intent is explicit. */
.console {
  --con-time: #7E96C4;
  --con-phase: #6BA2EC;
  --con-agent: #EAF0FA;
  --con-metric: #9FB3D4;
  --con-rev: #5C7099;
}
.progress {
  height: 0.4rem;
  background: var(--surface-2);
  border-radius: var(--pill);
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--blue);
  transition: width 0.15s linear;
}

.console {
  margin-top: 0.9rem;
  height: 20rem;
  overflow-y: auto;
  overflow-x: auto;
  background: var(--navy);
  border-radius: var(--radius);
  padding: 0.8rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  line-height: 1.75;
}
.console .cline {
  display: flex;
  gap: 0.75rem;
  white-space: nowrap;
  align-items: baseline;
}
.console .ct { color: var(--con-time); }
.console .cp { color: var(--con-phase); min-width: 2rem; }
.console .ca { color: var(--con-agent); min-width: 10rem; }
.console .cm { color: var(--con-metric); }
.console .cr { color: var(--con-rev); margin-left: auto; padding-left: 1rem; }
.console .chip { font-size: 0.66rem; padding: 0.08rem 0.45rem; }

.dispatch {
  min-width: 0;
  background: var(--surface-2);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
}
.dispatch.blocked { background: var(--tint-orange); }

/* ── gate desk ────────────────────────────────────────────── */
.field textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.65rem 0.85rem;
  resize: vertical;
}
.field textarea:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-color: var(--blue);
}

/* The masthead carries the three phases and nothing else. The older pages are
   still routed and still work, they just do not compete for attention here: the
   site is the pipeline, and eleven links made that impossible to see. */
.mast nav a.ph { display: inline-flex; align-items: baseline; gap: 7px; }
.mast nav a.ph b {
  font-family: var(--mono); font-size: .72em; font-weight: 600;
  letter-spacing: .08em; color: var(--muted);
}
.mast nav a.ph[aria-current="page"] b { color: var(--orange); }
.mast nav .navgap { flex: 1 1 auto; min-width: 8px; }
