/* ==========================================================================
   After Hours Repair — "DISPATCH"
   --------------------------------------------------------------------------
   A mobile repair unit, presented as a dispatch board: live status, coverage,
   service window, monospace readouts. Gold is the only accent and it carries
   signal as well as brand — lit when open, dim when closed.

   Dark only. A backlit board has no light mode.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Cool near-blacks: they make the warm gold read as light, not paint. */
  --bg:        #08090a;
  --panel:     #0e1012;
  --panel-2:   #14171a;
  --raised:    #191d21;
  --line:      #23282d;
  --line-soft: #171b1f;

  --text:      #eef1f3;
  --dim:       #8b949c;
  --dimmer:    #5d666d;

  --gold:        #d4af37;
  --gold-bright: #f2d06b;
  --gold-deep:   #8a6a12;
  --gold-tint:   rgba(212, 175, 55, 0.08);
  --gold-edge:   rgba(212, 175, 55, 0.28);
  --gold-glow:   rgba(212, 175, 55, 0.20);
  --on-gold:     #0b0c0d;

  --mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
  --body:    "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;

  --gutter: clamp(1.15rem, 4vw, 2.75rem);
  --max:    1180px;
}

/* --------------------------------------------------------------------------
   2. Reset and base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: clamp(1rem, 0.97rem + 0.18vw, 1.08rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* Faint scanline, the tell of a lit panel rather than printed paper. */
  background-image: repeating-linear-gradient(
    to bottom, rgba(255,255,255,0.012) 0 1px, transparent 1px 3px);
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--gold); color: var(--on-gold);
  padding: 0.7rem 1.2rem;
  font-family: var(--mono); font-size: 0.78rem;
  text-transform: uppercase; letter-spacing: 0.1em;
}
.skip:focus { left: 0; }

/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%; max-width: var(--max);
  margin-inline: auto; padding-inline: var(--gutter);
}

.band { padding-block: clamp(3rem, 7vw, 5.5rem); }
.band--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.band--panel { background: var(--panel); border-block: 1px solid var(--line); }

/* --------------------------------------------------------------------------
   4. Type
   -------------------------------------------------------------------------- */
.display {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.6rem, 8vw, 5.4rem);
  line-height: 0.94;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  margin: 0;
  text-wrap: balance;
}
.display em { font-style: normal; color: var(--gold); }

.h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.02;
  text-transform: uppercase;
  margin: 0;
}

.h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  line-height: 1.12;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 0;
}

/* Monospace readout text: labels, values, coordinates. */
.mono {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0;
}
.mono--gold { color: var(--gold); }

.lede {
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.24rem);
  line-height: 1.55;
  color: var(--dim);
  max-width: 48ch;
  margin: 1.4rem 0 0;
  text-wrap: pretty;
}

.prose { max-width: 66ch; }
.prose p { margin: 0 0 1.1rem; color: var(--dim); }
.prose > :last-child { margin-bottom: 0; }
.prose strong { color: var(--text); font-weight: 600; }

/* Section header: a ruled bar with a channel label, like a board section. */
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem 2rem; flex-wrap: wrap;
  padding-bottom: 0.9rem; margin-bottom: 2.1rem;
  border-bottom: 1px solid var(--line);
}

/* --------------------------------------------------------------------------
   5. Panels with corner brackets
   -------------------------------------------------------------------------- */
.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
}
/* Gold corner ticks, drawn with two gradients per corner. */
.panel--marked::before,
.panel--marked::after {
  content: ""; position: absolute; width: 14px; height: 14px;
  border-color: var(--gold); pointer-events: none;
}
.panel--marked::before { top: -1px; left: -1px; border-top: 2px solid; border-left: 2px solid; }
.panel--marked::after { bottom: -1px; right: -1px; border-bottom: 2px solid; border-right: 2px solid; }

/* --------------------------------------------------------------------------
   6. Header
   -------------------------------------------------------------------------- */
.topbar { background: #050506; border-bottom: 1px solid var(--line); }
.topbar__in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 34px; flex-wrap: wrap;
}

.masthead {
  position: sticky; top: 0; z-index: 40;
  background: rgba(8, 9, 10, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.masthead__in {
  display: flex; align-items: center; gap: clamp(0.85rem, 2.5vw, 2rem);
  min-height: 68px;
}

.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; margin-right: auto; }
.brand__mark {
  font-family: var(--display); font-weight: 700; font-size: 1.35rem;
  letter-spacing: 0.04em; color: var(--on-gold);
  background: var(--gold); padding: 0.18rem 0.5rem 0.1rem;
  box-shadow: 0 0 18px var(--gold-glow);
}
.brand__name {
  font-family: var(--display); font-weight: 600; font-size: 1.18rem;
  text-transform: uppercase; letter-spacing: 0.05em; line-height: 1;
}

.nav { display: flex; gap: clamp(0.85rem, 2vw, 1.7rem); }
.nav a {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; text-decoration: none;
  color: var(--dim); padding: 0.35rem 0;
  border-bottom: 1px solid transparent;
  white-space: nowrap; transition: color 0.15s, border-color 0.15s;
}
.nav a:hover { color: var(--gold); border-bottom-color: var(--gold-edge); }
.nav a.is-current { color: var(--text); border-bottom-color: var(--gold); }

/* --------------------------------------------------------------------------
   7. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  font-family: var(--mono); font-size: 0.78rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
  padding: 0.9rem 1.4rem; border: 1px solid var(--gold);
  background: var(--gold); color: var(--on-gold);
  cursor: pointer; transition: background 0.15s, box-shadow 0.15s, transform 0.15s, color 0.15s;
}
.btn:hover { background: var(--gold-bright); box-shadow: 0 0 24px var(--gold-glow); transform: translateY(-1px); }

.btn--ghost { background: transparent; color: var(--gold); border-color: var(--gold-edge); }
.btn--ghost:hover { background: var(--gold-tint); color: var(--gold-bright); border-color: var(--gold); box-shadow: none; }

.btn--sm { padding: 0.55rem 0.9rem; font-size: 0.7rem; }

/* Stacked button: small label above a large value. */
.btn--stack {
  flex-direction: column; gap: 0.2rem; align-items: flex-start;
  padding: 0.95rem 1.3rem; text-align: left;
}
.btn__label { font-size: 0.64rem; letter-spacing: 0.16em; opacity: 0.75; }
.btn__value { font-size: 0.95rem; letter-spacing: 0.03em; }

/* --------------------------------------------------------------------------
   8. Live status
   -------------------------------------------------------------------------- */
.status { display: inline-flex; align-items: center; gap: 0.55rem; }
.status__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--dimmer); flex: none;
}
.status__text {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim);
}
/* Lit state: gold is the signal, so no third colour enters the palette. */
.status.is-open .status__dot {
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-tint), 0 0 14px var(--gold);
  animation: pulse 2.6s ease-in-out infinite;
}
.status.is-open .status__text { color: var(--gold); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

/* --------------------------------------------------------------------------
   9. Hero
   -------------------------------------------------------------------------- */
.hero { padding-block: clamp(2.5rem, 6vw, 5rem); position: relative; overflow: hidden; }
/* Light spill from the top-right, as if a work lamp is on. */
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 55% at 78% 8%, rgba(212,175,55,0.10), transparent 70%);
}
.hero__in {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: clamp(2rem, 4.5vw, 4rem); align-items: start;
}
.hero__ctas { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2.1rem; }
.hero__note {
  margin: 1.15rem 0 0; font-size: 0.94rem; color: var(--dim);
}
.hero__note strong { color: var(--gold); font-weight: 600; }

/* --------------------------------------------------------------------------
   10. The board — label/value readout rows
   -------------------------------------------------------------------------- */
.board__head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.65rem 1rem;
  background: var(--panel-2); border-bottom: 1px solid var(--line);
}
.board__body { padding: 0.35rem 1rem 1rem; }

.row {
  display: grid; grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 0.75rem 1rem; align-items: baseline;
  padding: 0.72rem 0; border-bottom: 1px solid var(--line-soft);
}
.row:last-child { border-bottom: 0; }
.row__k {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--dimmer);
}
.row__v {
  font-family: var(--display); font-weight: 600; font-size: 1.08rem;
  text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.2;
}
.row__v em { font-style: normal; color: var(--gold); }
.row__v small {
  display: block; font-family: var(--body); font-weight: 400;
  font-size: 0.82rem; text-transform: none; letter-spacing: 0;
  color: var(--dim); margin-top: 0.15rem;
}

/* --------------------------------------------------------------------------
   11. Units — the three services
   -------------------------------------------------------------------------- */
.units { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.unit { background: var(--bg); }
.unit__link {
  display: flex; flex-direction: column; height: 100%; gap: 0.6rem;
  padding: 1.6rem 1.45rem 1.4rem; text-decoration: none;
  transition: background 0.18s, box-shadow 0.18s;
}
.unit__no {
  font-family: var(--mono); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.16em; color: var(--gold);
}
.unit__desc { margin: 0; font-size: 0.93rem; line-height: 1.5; color: var(--dim); flex: 1; }
.unit__go {
  font-family: var(--mono); font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--dimmer);
  margin-top: 0.55rem; transition: color 0.18s;
}
.unit__link:hover { background: var(--panel); box-shadow: inset 0 0 0 1px var(--gold-edge); }
.unit__link:hover .unit__go { color: var(--gold); }
.unit__link:hover .h3 { color: var(--gold-bright); }

/* Bullet list inside a unit or sheet. */
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.55rem; }
.ticks li { position: relative; padding-left: 1.35rem; color: var(--dim); font-size: 0.95rem; line-height: 1.5; }
.ticks li::before {
  content: ""; position: absolute; left: 0; top: 0.62em;
  width: 0.6rem; height: 1px; background: var(--gold);
}
.ticks--two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem 1.75rem; }

/* --------------------------------------------------------------------------
   12. Coverage — the county grid
   -------------------------------------------------------------------------- */
.sectors { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.sector { background: var(--panel); padding: 1.05rem 1rem; display: grid; gap: 0.3rem; }
.sector__no { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.14em; color: var(--dimmer); }
.sector__name { font-family: var(--display); font-weight: 600; font-size: 1.05rem; text-transform: uppercase; letter-spacing: 0.02em; }
.sector--more { background: var(--bg); }
.sector--more .sector__name { color: var(--gold); }

/* --------------------------------------------------------------------------
   13. Schedule
   -------------------------------------------------------------------------- */
.sched { width: 100%; border-collapse: collapse; }
.sched th, .sched td { text-align: left; padding: 0.85rem 0; border-bottom: 1px solid var(--line-soft); }
.sched th {
  font-family: var(--mono); font-size: 0.68rem; font-weight: 500;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--dimmer);
}
.sched td {
  font-family: var(--display); font-weight: 600; font-size: 1.1rem;
  text-transform: uppercase; letter-spacing: 0.02em; text-align: right;
}
.sched tr.is-today th { color: var(--gold); }
.sched tr.is-today td { color: var(--gold); }

/* --------------------------------------------------------------------------
   14. Footer
   -------------------------------------------------------------------------- */
.foot { background: #050506; border-top: 1px solid var(--line); padding-top: clamp(2.25rem, 5vw, 3.5rem); }
.foot__cols {
  display: grid; grid-template-columns: 1.5fr repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 2.75rem); padding-bottom: 2.25rem;
}
.foot__cols h4 {
  font-family: var(--mono); font-size: 0.66rem; font-weight: 500;
  letter-spacing: 0.15em; text-transform: uppercase; color: var(--gold);
  margin: 0 0 0.9rem;
}
.foot__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.foot__list a { text-decoration: none; color: var(--dim); font-size: 0.93rem; overflow-wrap: anywhere; }
.foot__list a:hover { color: var(--gold); }
.foot__brand p { color: var(--dimmer); font-size: 0.9rem; margin: 0.9rem 0 0; max-width: 30ch; }
.foot__base {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--line); padding-block: 1.05rem;
}
.foot__base a { color: var(--dim); text-decoration: none; border-bottom: 1px solid var(--line); }
.foot__base a:hover { color: var(--gold); border-bottom-color: var(--gold-edge); }

/* --------------------------------------------------------------------------
   15. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .hero__in { grid-template-columns: minmax(0, 1fr); }
  .board { max-width: 32rem; }
  .units { grid-template-columns: minmax(0, 1fr); }
  .sectors { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .foot__brand { grid-column: 1 / -1; }
}

@media (max-width: 700px) {
  .masthead__in { flex-wrap: wrap; min-height: 0; padding-block: 0.75rem; row-gap: 0.1rem; }
  .nav {
    order: 3; width: 100%; overflow-x: auto; gap: 1.15rem;
    padding-top: 0.4rem; border-top: 1px solid var(--line); scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
  .brand__name { display: none; }
  .ticks--two { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  .row__v { text-align: left; }
  .hero__ctas .btn { flex: 1 1 100%; }
}

@media (max-width: 480px) {
  .sectors { grid-template-columns: minmax(0, 1fr); }
  .foot__cols { grid-template-columns: minmax(0, 1fr); }
}

/* --------------------------------------------------------------------------
   16. Motion and print
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  body { background: #fff; color: #000; }
  .topbar, .masthead, .foot, .hero::before { display: none; }
}

/* --------------------------------------------------------------------------
   17. Photographs — logged evidence, not decoration
   -------------------------------------------------------------------------- */
.shot {
  position: relative;
  border: 1px solid var(--line);
  background: var(--panel);
  overflow: hidden;
}
.shot img {
  display: block; width: 100%; height: 100%; object-fit: cover;
  filter: contrast(1.04) saturate(0.96);
  transition: transform 0.5s ease, filter 0.5s ease;
}
.shot--wide { aspect-ratio: 16 / 9; }
.shot--tall { aspect-ratio: 3 / 4; }

/* Gold corner ticks so photos sit inside the same frame language as panels. */
.shot::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to right, var(--gold) 0 14px, transparent 14px) 0 0 / 100% 2px no-repeat,
    linear-gradient(to bottom, var(--gold) 0 14px, transparent 14px) 0 0 / 2px 100% no-repeat,
    linear-gradient(to left, var(--gold) 0 14px, transparent 14px) 100% 100% / 100% 2px no-repeat,
    linear-gradient(to top, var(--gold) 0 14px, transparent 14px) 100% 100% / 2px 100% no-repeat;
  opacity: 0.85;
}

@media (hover: hover) and (pointer: fine) {
  .shot:hover img { transform: scale(1.03); filter: contrast(1.08) saturate(1); }
}

.shot__cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; gap: 0.6rem; align-items: baseline; flex-wrap: wrap;
  padding: 1.5rem 1rem 0.75rem;
  background: linear-gradient(to top, rgba(5,6,7,0.92), transparent);
  font-family: var(--mono); font-size: 0.64rem; font-weight: 500;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--dim);
}
.shot__cap b { color: var(--gold); font-weight: 600; }

/* The log: a run of shots across the width. */
.log { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.log .shot { border: 0; }
.log .shot::after { opacity: 0; }

/* A photo paired with text. */
.split {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.25rem); align-items: center;
}
.split--flip > :first-child { order: 2; }

/* --------------------------------------------------------------------------
   18. Interior sheets
   -------------------------------------------------------------------------- */
.sheet-top { padding-block: clamp(2.25rem, 5vw, 3.75rem); border-bottom: 1px solid var(--line); position: relative; }
.sheet-top::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(55% 60% at 82% 10%, rgba(212,175,55,0.09), transparent 70%);
}
.sheet-top__in {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: clamp(1.75rem, 4vw, 3.25rem); align-items: end;
}
.sheet-top .display { font-size: clamp(2.3rem, 6.5vw, 4.2rem); }

.crumbs {
  font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.13em;
  text-transform: uppercase; color: var(--dimmer); margin: 0 0 1rem;
}
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--gold); }
.crumbs span { color: var(--line); margin: 0 0.4rem; }

/* Two-column sheet body. */
.sheet {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: clamp(2rem, 4.5vw, 3.75rem); align-items: start;
}

/* --------------------------------------------------------------------------
   19. Interior responsive
   -------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .sheet-top__in { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .sheet { grid-template-columns: minmax(0, 1fr); }
  .split { grid-template-columns: minmax(0, 1fr); }
  .split--flip > :first-child { order: 0; }
  .log { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 480px) {
  .log { grid-template-columns: minmax(0, 1fr); }
}

/* Three-up note columns collapse before they get too narrow to read. */
@media (max-width: 860px) {
  .notes-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 560px) {
  .notes-grid { grid-template-columns: minmax(0, 1fr) !important; }
}
