/* The Countdown — a headline board that ticks.
   Same family as css/pulse-live.css: one dark look in both themes, Inter 900
   display, wide-tracked mono labels, cells cut from a black ground with 2px
   gutters. Unlike the live board this page scrolls; the grid just keeps
   going. Palette is Btown Brief's: orange / cream / brown / black. */

@font-face {
  font-family: 'InterBlack';
  src: url('../assets/fonts/inter-900-latin.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: #000;
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  --display: 'InterBlack', -apple-system, BlinkMacSystemFont, "Segoe UI",
             Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --orange: #fc560a;
  --cream: #efd9b9;
  --brown: #4e342e;
  --ink: #140d08;
  --dim: #7a6c58;
  --pad-x: clamp(14px, 3vw, 40px);
  --pad-y: clamp(14px, 2.4vw, 30px);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

button { font: inherit; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; }
a { color: inherit; }

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

/* ---------- masthead ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  padding-top: max(8px, env(safe-area-inset-top));
  background: #000;
  border-bottom: 3px solid var(--orange);
  white-space: nowrap;
}

.brand {
  justify-self: start;
  font-family: var(--display);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: .3em;
  color: var(--cream);
  text-decoration: none;
  text-transform: uppercase;
}
.brand b { color: var(--orange); font-weight: 900; }

.broadcast {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 16px;
}
.dayrow {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
}
.day {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .26em;
  color: var(--cream);
  line-height: 1.1;
}
.date {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .2em;
  color: var(--cream);
  opacity: .55;
  margin-top: 2px;
}
.clock-wrap { display: inline-flex; align-items: baseline; gap: 5px; }
.clock {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 26px;
  letter-spacing: .04em;
  color: var(--orange);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.ampm {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--orange);
  opacity: .75;
}

.status {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 14px;
}

.modes {
  display: flex;
  border: 1px solid rgba(252, 86, 10, .4);
  overflow: hidden;
}
.mode {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .14em;
  padding: 6px 9px;
  color: var(--orange);
  opacity: .75;
  text-decoration: none;
  text-transform: uppercase;
}
.mode + .mode { border-left: 1px solid rgba(252, 86, 10, .4); }
.mode:hover { opacity: 1; }

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: .3em;
  background: var(--orange);
  color: var(--ink);
  text-decoration: none;
  padding: 6px 10px 5px;
  text-transform: uppercase;
}
.live-badge i {
  width: 8px; height: 8px;
  background: var(--ink);
  animation: blink 1.2s steps(2) infinite;
}
@keyframes blink { 50% { opacity: .12; } }

.hint {
  margin: 0;
  padding: 6px 14px;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid rgba(252, 86, 10, .28);
}
.hint b { color: var(--orange); font-weight: 700; }

/* phones: the switch as its own row under the bar */
.modes-row { display: none; }

/* ---------- the tabs: which deck ---------- */

.chips {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid rgba(252, 86, 10, .28);
}
.chip {
  flex: 1 1 auto;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--orange);
  border-left: 1px solid rgba(252, 86, 10, .18);
  padding: 0 12px;
  height: 38px;
  white-space: nowrap;
  text-align: center;
  opacity: .95;
  transition: opacity .18s ease, background .18s ease, color .18s ease;
}
.chip:first-child { border-left: none; }
.chip[aria-pressed="false"] { opacity: .55; }
.chip[aria-pressed="false"]:hover { opacity: .9; }
.chip[aria-pressed="true"] { background: var(--orange); color: var(--ink); font-weight: 900; }

/* ---------- the board ---------- */

.board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: minmax(clamp(190px, 26vh, 260px), auto);
  grid-auto-flow: dense;
  gap: 2px;
  background: #000;
  padding-bottom: 2px;
}

.cell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  row-gap: clamp(10px, 1.6vh, 18px);
  min-height: 0;
  min-width: 0;
  position: relative;
  overflow: hidden;
  padding: var(--pad-y) var(--pad-x) clamp(12px, 2vw, 22px);
  text-decoration: none;
  color: inherit;
}

.lead {
  grid-column: span 2;
  grid-row: span 2;
}

.bg-orange      { background: var(--orange); color: var(--ink); }
.bg-brown       { background: var(--brown);  color: var(--cream); }
.bg-black       { background: #0d0d0d;       color: var(--orange); }
.bg-black-cream { background: #0d0d0d;       color: var(--cream); }

/* "expected" cells have no clock: dim the ground so a real date reads louder */
.cell.expected { color: var(--cream); opacity: .78; }

.cell .top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(10px, 1.1vw, 13px);
  letter-spacing: .26em;
  text-transform: uppercase;
}
.cell .topic-tag::before {
  content: "";
  display: inline-block;
  width: .55em; height: .55em;
  background: currentColor;
  margin-right: .7em;
  vertical-align: 1px;
}
.cell .age-tag { opacity: .65; font-variant-numeric: tabular-nums; }

.cell .body { min-width: 0; }

.cell .head {
  display: block;
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: .95;
  letter-spacing: -.02em;
  text-wrap: balance;
  -webkit-font-smoothing: antialiased;
}
.lead .head { font-size: clamp(2.2rem, 5.6vw, 5.4rem); }

/* the clock — mono, tabular, one row */
.clock-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px clamp(8px, 1.2vw, 20px);
  margin-top: clamp(12px, 1.8vh, 22px);
  font-family: var(--mono);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.unit { display: inline-flex; align-items: baseline; gap: 4px; }
.num { font-size: clamp(1.4rem, 2vw, 1.9rem); letter-spacing: -.02em; }
.lab { font-size: clamp(9px, .95vw, 12px); letter-spacing: .2em; text-transform: uppercase; opacity: .65; }
.lead .num { font-size: clamp(2.4rem, 5vw, 4.6rem); }
.lead .lab { font-size: clamp(10px, 1.2vw, 15px); }

/* replaces the clock: happening now, or the usual-window line */
.window {
  margin: clamp(12px, 1.8vh, 22px) 0 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(11px, 1.2vw, 15px);
  letter-spacing: .14em;
  text-transform: uppercase;
  line-height: 1.4;
}
.lead .window { font-size: clamp(13px, 1.6vw, 20px); }

.kicker {
  margin: clamp(8px, 1.2vh, 14px) 0 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(9px, .95vw, 11px);
  letter-spacing: .16em;
  text-transform: uppercase;
  opacity: .6;
}
.why {
  margin: clamp(10px, 1.6vh, 18px) 0 0;
  font-size: clamp(.86rem, 1vw, 1rem);
  line-height: 1.45;
  max-width: 42em;
  opacity: .82;
}
.lead .why { font-size: clamp(.95rem, 1.2vw, 1.15rem); opacity: .88; }

.cell .meta {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  white-space: nowrap;
  overflow: hidden;
  gap: 0;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: .2em;
  text-transform: uppercase;
  padding-top: clamp(10px, 1.4vh, 16px);
  min-height: 14px;
}
.lead .meta { font-size: clamp(10px, 1.25vw, 15px); letter-spacing: .16em; }
.meta .dot {
  display: inline-block;
  width: 4px; height: 4px;
  background: currentColor;
  margin: 0 12px;
  flex: none;
}
.meta .venue { flex: 1 1 0; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.meta .when { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
/* the venue only fits on the lead; elsewhere the date and the chips are the row */
.cell:not(.lead) .meta .venue,
.cell:not(.lead) .meta .venue + .dot { display: none; }
.meta .ptrack {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: currentColor;
  opacity: .22;
}
.meta .pbar {
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: currentColor;
  pointer-events: none;
}

/* the chips the meta row ends on */
.meta .go {
  flex: none;
  margin-left: auto;
  padding-left: 12px;
  display: inline-flex;
  gap: 8px;
}
.meta .go span,
.meta .go a {
  text-decoration: none;
  color: inherit;
  border: 1px solid currentColor;
  padding: 4px 7px;
  opacity: .8;
}
.meta .go span:hover,
.meta .go a:hover { opacity: 1; }

.board-msg {
  grid-column: 1 / -1;
  padding: 40px var(--pad-x);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--dim);
}

/* ---------- add your event ---------- */

.add {
  margin: 2px 0 0;
  padding: clamp(24px, 4vw, 48px) var(--pad-x) clamp(28px, 4vw, 56px);
  background: #0d0d0d;
  border-top: 3px solid var(--orange);
}
.add-inner { max-width: 720px; }

.add-kicker {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--orange);
  margin: 0 0 12px;
}
.add-kicker::before {
  content: "";
  display: inline-block;
  width: .55em; height: .55em;
  background: currentColor;
  margin-right: .7em;
  vertical-align: 1px;
}
.add h2 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: .95;
  letter-spacing: -.02em;
  margin: 0 0 14px;
}
.add-lede {
  margin: 0 0 26px;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--cream);
  opacity: .75;
  max-width: 38em;
}

.cd-form label {
  display: block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 10px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 16px;
}
.cd-form label small {
  font-weight: 400;
  letter-spacing: .1em;
  color: var(--dim);
  text-transform: none;
}

.cd-form input,
.cd-form textarea {
  display: block;
  width: 100%;
  margin-top: 7px;
  padding: 11px 12px;
  font: inherit;
  font-size: 1rem;
  color: var(--cream);
  background: #000;
  border: 1px solid rgba(252, 86, 10, .4);
  border-radius: 0;
  color-scheme: dark;
}
.cd-form input::placeholder,
.cd-form textarea::placeholder { color: var(--dim); }
.cd-form textarea { resize: vertical; }
.cd-form input:focus,
.cd-form textarea:focus { outline: 2px solid var(--orange); outline-offset: -1px; }

.cd-row { display: flex; gap: 14px; flex-wrap: wrap; }
.cd-row > label { flex: 1 1 200px; min-width: 0; }

.cd-err {
  margin: 0 0 14px;
  font-family: var(--mono);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--orange);
}

.cd-submit {
  font-family: var(--display);
  font-weight: 900;
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  padding: 12px 18px 11px;
  background: var(--orange);
  color: var(--ink);
}
.cd-submit:hover { background: var(--cream); }
.cd-submit[disabled] { opacity: .6; cursor: default; }

.cd-thanks {
  margin: 0;
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  line-height: 1.05;
  letter-spacing: -.02em;
  color: var(--orange);
}

/* ---------- bottom bar ---------- */

.lbar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 6px 14px;
  padding-bottom: max(6px, env(safe-area-inset-bottom));
  background: #000;
  border-top: 1px solid rgba(252, 86, 10, .28);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
}
.lbar::-webkit-scrollbar { display: none; }
.lgroup { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.llbl { margin-right: 6px; }
.lopt {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .14em;
  border: 1px solid transparent;
  color: var(--dim);
  padding: 3px 6px;
  text-decoration: none;
}
.lopt.on { color: var(--orange); border-color: rgba(252, 86, 10, .4); }
a.lopt:hover { color: var(--orange); }
.lright { margin-left: auto; display: inline-flex; align-items: center; gap: 14px; flex: none; }
.lexit { color: #a08a6d; text-decoration: none; letter-spacing: .14em; }
.lexit:hover { color: var(--cream); }

/* ---------- responsive ---------- */

@media (max-width: 1000px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lead { grid-column: span 2; grid-row: span 1; min-height: clamp(360px, 52vh, 520px); }
  .bar { grid-template-columns: auto 1fr auto; gap: 12px; }
  .broadcast { justify-self: end; }
  .modes .mode-read { display: none; }
}

@media (max-width: 720px) {
  .board { grid-template-columns: minmax(0, 1fr); grid-auto-rows: auto; }
  .lead { grid-column: span 1; min-height: 0; }
  .cell { min-height: 170px; }
  .lead .head { font-size: clamp(2rem, 11vw, 3rem); }
  .cell .head { font-size: clamp(1.3rem, 6.4vw, 1.8rem); }
  .lead .num { font-size: clamp(2rem, 9vw, 2.8rem); }
  .num { font-size: clamp(1.4rem, 6.4vw, 1.9rem); }
  .bar { grid-template-columns: auto 1fr auto; padding: 6px 10px; gap: 8px; }
  .broadcast { justify-self: end; }
  .modes { display: none; }
  .modes-row { display: flex; border-bottom: 1px solid rgba(252, 86, 10, .28); }
  .modes-row .mode { flex: 1; text-align: center; padding: 8px 4px; letter-spacing: .18em; }
  .modes-row .mode + .mode { border-left: 1px solid rgba(252, 86, 10, .18); }
  .chip { padding: 0 8px; letter-spacing: .12em; }
  .brand { font-size: 11px; letter-spacing: .22em; }
  .clock { font-size: 18px; }
  .ampm { display: none; }
  .live-badge { font-size: 10px; letter-spacing: .18em; padding: 6px 8px 5px; }
  .dayrow { display: none; }
  .meta .venue { display: none; }
  .meta .venue + .dot { display: none; }
  .why { display: none; }
  .lead .why { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .live-badge i { animation: none; }
}
