/* ===========================================================================
   Politiko Time Wire
   ---------------------------------------------------------------------------
   Visual idea: a wire-service master clock. Ink-on-newsprint, rules instead of
   boxes, telex labels, and one big tabular clock as the hero. Dark is the
   primary identity (a newsroom at night); light is a designed newsprint
   alternate, not an inversion.

   No webfonts by design — this is an offline-first PWA, so type comes from
   system stacks that are always present: monospace for every number, a system
   sans for prose.
   ======================================================================== */

:root {
  /* dark — ink */
  --bg:        #12110e;
  --surface:   #1a1815;
  --surface-2: #211e1a;
  --line:      #2e2a24;
  --line-soft: #221f1a;
  --ink:       #ece7dd;
  --dim:       #a2988a;
  --faint:     #8d8474;

  --brass:     #e3a63a;
  --brass-dim: #8a6a25;
  /* Text that sits *on* the brass fill. Brass is light in dark mode and dark in
     light mode, so this has to flip with it or the primary button loses all
     contrast. */
  --on-brass:  #12110e;
  --live:      #5cb98d;
  --alert:     #e0705f;

  --night:     #1e1c24;
  --daylight:  #2b2721;

  --focus:     var(--brass);
  --shadow:    0 1px 0 rgba(0,0,0,.4);

  --measure: 68ch;
  --pad: clamp(16px, 4vw, 28px);
  --maxw: 760px;

  --mono: ui-monospace, "Cascadia Mono", "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;

  color-scheme: dark light;
}

@media (prefers-color-scheme: light) {
  :root {
    /* light — newsprint. Grey-beige stock, not cream. */
    --bg:        #e8e5dd;
    --surface:   #f5f3ee;
    --surface-2: #efece5;
    --line:      #cdc7b9;
    --line-soft: #ded9cd;
    --ink:       #1b1913;
    --dim:       #5b5447;
    --faint:     #655e51;

    --brass:     #7d5400;
    --brass-dim: #8f7530;
    --on-brass:  #fdfbf6;
    --live:      #0c6647;
    --alert:     #9e3521;

    --night:     #d8d4ca;
    --daylight:  #f2efe6;

    --shadow: 0 1px 0 rgba(0,0,0,.06);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 var(--sans);
  overflow-wrap: break-word;
}

/* Rules that separate bands are drawn as a repeating hairline, teletype-ish. */
main { display: block; }

a { color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

code {
  font-family: var(--mono);
  font-size: .92em;
  background: var(--surface-2);
  padding: .1em .35em;
  border-radius: 2px;
}

.dim { color: var(--dim); }

/* ── Masthead ───────────────────────────────────────────────────────────── */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.masthead-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px var(--pad);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-rule {
  width: 22px;
  height: 10px;
  flex: none;
  border-top: 2px solid var(--brass);
  border-bottom: 2px solid var(--brass);
}

.brand-name {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-name b { color: var(--ink); font-weight: 600; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .06em;
  color: var(--dim);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  max-width: 46vw;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.chip-button { cursor: pointer; font: inherit; font-family: var(--mono); font-size: 11px; }
.chip-button:hover { color: var(--ink); border-color: var(--brass-dim); }

.chip-dot {
  width: 6px; height: 6px; flex: none;
  border-radius: 50%;
  background: var(--brass);
}
.chip-dot.is-exact { background: var(--live); }
.chip-dot.is-stale { background: #fbbf24; }

/* Section nav — a horizontally scrollable strip of telex labels. */
.secnav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad) 8px;
  display: flex;
  gap: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.secnav::-webkit-scrollbar { display: none; }
.secnav a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  text-decoration: none;
  white-space: nowrap;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.secnav a:hover { color: var(--ink); border-bottom-color: var(--brass); }

/* ── Bands ──────────────────────────────────────────────────────────────── */

.band {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 34px var(--pad);
  border-top: 1px solid var(--line-soft);
}
.band:first-child { border-top: 0; }
.band-hero { padding-top: 26px; }
.band-quiet { color: var(--dim); }

.band-head { margin-bottom: 18px; }

h2 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 6px;
}
.h-small { color: var(--dim); }

.h2-tag {
  color: var(--faint);
  font-weight: 400;
  letter-spacing: .1em;
  margin-left: 8px;
}

h3 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 10px;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--faint);
  margin: 0 0 6px;
}

.lede {
  margin: 0;
  color: var(--dim);
  font-size: 14.5px;
  max-width: var(--measure);
  text-wrap: pretty;
}

.note {
  margin: 12px 0 0;
  color: var(--faint);
  font-size: 13px;
  max-width: var(--measure);
}

.prose p { max-width: var(--measure); font-size: 14.5px; color: var(--dim); text-wrap: pretty; }
.prose p b { color: var(--ink); font-weight: 600; }

/* ── The clock ──────────────────────────────────────────────────────────── */

.gameclock {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(27px, 7.2vw, 46px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.01em;
  margin: 0;
  text-wrap: balance;
}
.gameclock .yr { color: var(--dim); font-weight: 400; }
.skeleton { color: var(--faint); opacity: .45; }

.clock-real {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--ink);
  margin: 6px 0 0;
}

.rate-facts {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 26px;
  margin: 20px 0 0;
  padding: 14px 0 0;
  border-top: 1px solid var(--line-soft);
}
.rate-facts li { display: flex; flex-direction: column; gap: 1px; }
.rate-facts b {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 600;
}
.rate-facts span {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}

/* ── Status card ────────────────────────────────────────────────────────── */

.statuscard {
  display: flex;
  gap: 14px;
  margin-top: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
}
.statuscard-rail { width: 3px; flex: none; background: var(--brass); }
.statuscard.is-live .statuscard-rail { background: var(--live); }
.statuscard.is-soon .statuscard-rail { background: var(--alert); }
.statuscard-body { padding: 14px 16px 15px 2px; min-width: 0; }

.statuscard-kicker {
  margin: 0 0 7px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--brass-dim);
  color: var(--brass);
}
.pill.is-live { color: var(--live); border-color: var(--live); }
.pill.is-soon { color: var(--alert); border-color: var(--alert); }

.statuscard-headline {
  margin: 0;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(15px, 3.6vw, 19px);
  font-weight: 600;
  line-height: 1.35;
  text-wrap: balance;
}
.statuscard-sub { margin: 5px 0 0; color: var(--dim); font-size: 13.5px; }

/* ── Tables ─────────────────────────────────────────────────────────────── */

.tz-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.tz-row label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}

.scroller { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-weight: 400;
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 14px 6px 0;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: 6px 14px 6px 0;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap;
  vertical-align: top;
}
table.data tr:last-child td { border-bottom: 0; }
table.data td.t-what { white-space: normal; color: var(--dim); min-width: 15ch; }
table.data td.t-len { color: var(--faint); }

table.data tr.is-now td { color: var(--brass); }
table.data tr.is-now td:first-child::before { content: "▸ "; }
table.data tr.is-key td:first-child { font-weight: 600; }

/* ── Event feed ─────────────────────────────────────────────────────────── */

.feed { list-style: none; margin: 0; padding: 0; }
.feed li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 4px 14px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
}
.feed li:last-child { border-bottom: 0; }

.feed .f-when {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12.5px;
  color: var(--ink);
  white-space: nowrap;
}
.feed .f-what { font-size: 14px; min-width: 0; }
.feed .f-what b { font-weight: 600; }
.feed .f-what .f-game {
  display: block;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 1px;
}
.feed .f-in {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--dim);
  white-space: nowrap;
  text-align: right;
}
.feed li.k-registration .f-what b { color: var(--brass); }
.feed li.k-election .f-what b,
.feed li.k-court .f-what b { color: var(--ink); }
.feed li.k-month .f-what b { color: var(--dim); font-weight: 400; }

@media (max-width: 520px) {
  .feed li { grid-template-columns: 1fr auto; }
  .feed .f-when { grid-column: 1 / -1; color: var(--dim); font-size: 11.5px; }
}

/* ── Crew board ─────────────────────────────────────────────────────────── */

.crewboard { display: flex; flex-direction: column; gap: 2px; }

.zone {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.zone:last-child { border-bottom: 0; }

.zone-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.zone-name {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.zone-name .z-region { color: var(--faint); font-weight: 400; }
.zone.is-you .zone-name::after {
  content: "you";
  font-size: 9.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--brass);
  border: 1px solid var(--brass-dim);
  border-radius: 999px;
  padding: 1px 6px;
  margin-left: 8px;
  vertical-align: 1px;
}
.zone-time {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  white-space: nowrap;
  flex: none;
}
.zone-verdict {
  font-size: 11px;
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: var(--mono);
  margin-left: 10px;
}
.v-good  { color: var(--live); }
.v-ok    { color: var(--brass); }
.v-rough { color: var(--alert); }

/* 24-hour day strip: night/day bands with the registration window overlaid. */
.strip {
  position: relative;
  height: 22px;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: linear-gradient(to right,
    var(--night) 0%, var(--night) 25%,
    var(--daylight) 29%, var(--daylight) 71%,
    var(--night) 75%, var(--night) 100%);
}
.strip-win {
  position: absolute;
  top: 0; bottom: 0;
  background: color-mix(in srgb, var(--brass) 34%, transparent);
  border-left: 2px solid var(--brass);
  border-right: 1px solid var(--brass-dim);
}
.strip-tick {
  position: absolute;
  top: 0; bottom: 0;
  width: 1px;
  background: var(--line);
}
.strip-labels {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--faint);
  margin-top: 3px;
  letter-spacing: .06em;
}

.zone-remove {
  background: none;
  border: 0;
  color: var(--faint);
  font: inherit;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  margin-left: 6px;
}
.zone-remove:hover { color: var(--alert); }

/* ── Forms ──────────────────────────────────────────────────────────────── */

input, select, button, textarea { font: inherit; }

input[type="text"], input[type="number"], input[type="time"],
input[type="datetime-local"], input:not([type]), select {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 7px 9px;
  min-width: 0;
  max-width: 100%;
}
input::placeholder { color: var(--faint); }

.btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .08em;
  text-transform: uppercase;
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.btn:hover { border-color: var(--brass-dim); }
.btn-primary {
  background: var(--brass);
  border-color: var(--brass);
  color: var(--on-brass);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.08); }
.btn-quiet { background: none; color: var(--dim); }

.field-msg { font-family: var(--mono); font-size: 11.5px; color: var(--dim); }
.field-msg.is-ok { color: var(--live); }
.field-msg.is-err { color: var(--alert); }

.addzone { margin-top: 18px; }
.addzone > label,
.calform > label {
  display: block;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 6px;
}
.addzone-row { display: flex; gap: 8px; flex-wrap: wrap; }
.addzone-row input { flex: 1 1 220px; }

.converters { display: grid; gap: 22px; }
@media (min-width: 620px) { .converters { grid-template-columns: 1fr 1fr; gap: 26px; } }

.conv-fields { display: flex; flex-wrap: wrap; gap: 10px; }
.f { display: flex; flex-direction: column; gap: 4px; flex: 1 1 90px; }
.f-wide { flex-basis: 100%; }
.f > span {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
}
.conv-actions { margin-top: 10px; }

.conv-out {
  display: block;
  margin-top: 12px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass);
  border-radius: 2px;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 13.5px;
  line-height: 1.5;
  min-height: 2.6em;
}
.conv-out .out-sub { display: block; color: var(--dim); font-size: 11.5px; margin-top: 3px; }

.export fieldset {
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 12px 14px;
  margin: 0 0 16px;
}
.export legend {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 0 6px;
}
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 3px 0; }
.check input { accent-color: var(--brass); width: 15px; height: 15px; }

.export-opts { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.export-opts .f { flex: 0 1 200px; }
.export-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.calnow {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--dim);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 11px 13px;
  margin-bottom: 18px;
  overflow-wrap: anywhere;
}
.calnow b { color: var(--ink); font-weight: 600; }
.calnow .cal-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.calnow .cal-row + .cal-row { margin-top: 4px; }

.calform input { width: 100%; }
.calform-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.howto { margin-top: 20px; }
.howto p { max-width: var(--measure); font-size: 13.5px; color: var(--dim); }
.howto p b { color: var(--ink); font-weight: 600; }

/* ── Footer ─────────────────────────────────────────────────────────────── */

.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px var(--pad) 48px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--faint);
}
.foot p { margin: 4px 0; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

html { scroll-behavior: smooth; }
:target { scroll-margin-top: 84px; }
