/* ==========================================================================
   TRANSMISSIONS — THE CHANNEL TERMINAL
   Each platform is a channel you tune to. The feed is a monospace readout.

   Everything here references tokens.css. Two palette notes, both deliberate:
   - Crimson is used ONLY for the live indicator and the active channel
     underline. Per the brand audit it is a "rare interruption" — two uses on
     the page is the budget, so do not reach for it again.
   - Moonlight is not used at all. tokens.css reserves it for imagery and
     forbids it in UI chrome, and everything here is chrome.
   ========================================================================== */

.terminal-page {
  padding-top: calc(var(--space-24) + 3rem);
  padding-bottom: var(--space-24);
}

.terminal-intro { margin-bottom: var(--space-8); }
.terminal-intro h1 {
  font-family: var(--font-display-stencil);
  font-size: var(--fs-h1);
  line-height: var(--lh-tight);
  margin: var(--space-2) 0 var(--space-3);
  text-transform: uppercase;
}
.terminal-intro p {
  color: var(--text-secondary);
  max-width: 64ch;
  margin: 0;
}

/* ---- The set ---- */
.terminal {
  border: var(--border-hairline, 1px solid var(--border-subtle));
  background: linear-gradient(180deg, #070707, var(--color-black));
}

/* ---- Top bar ---- */
.terminal__bar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-gray-700);
  flex-wrap: wrap;
}
.terminal__live {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--color-crimson-lit);
  box-shadow: 0 0 8px var(--color-crimson-lit);
  animation: terminal-pulse 2.4s ease-in-out infinite;
  flex: none;
}
@keyframes terminal-pulse { 0%, 100% { opacity: .35 } 50% { opacity: 1 } }

.terminal__id {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-bone);
}
.terminal__status {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  color: var(--color-gray-400);
}

/* ---- Channel tabs ---- */
.terminal__channels {
  display: flex;
  margin-left: auto;
  flex-wrap: wrap;
}
.terminal__channel {
  /* A channel tab is interface, not data — label face, not the readout mono.
     (Moved to Rajdhani with the Aug 13 2026 type system.) */
  font-family: var(--font-label);
  font-weight: 600;
  font-size: var(--fs-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-gray-400);
  padding: 8px 14px;
  cursor: pointer;
  transition: color var(--motion-fast, .18s) ease, border-color var(--motion-fast, .18s) ease;
}
.terminal__channel:hover { color: var(--text-primary); }
.terminal__channel[aria-selected="true"] {
  color: var(--text-primary);
  border-bottom-color: var(--color-crimson-lit);
}
.terminal__channel:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: -2px;
}
/* An empty channel is still worth tuning to — it just says so. */
.terminal__channel[data-count="0"] { color: var(--color-gray-500); }

/* ---- Screen ---- */
.terminal__screen {
  position: relative;
  padding: var(--space-8) var(--space-6);
  min-height: 340px;
}
.terminal__scanlines {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, .022) 0 1px,
    transparent 1px 3px
  );
}
.terminal__readout {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--color-gray-400);
  margin: 0 0 var(--space-6);
}
.terminal__caret {
  display: inline-block;
  width: 8px; height: 1em;
  background: var(--color-bone);
  vertical-align: -2px;
  margin-left: 4px;
  animation: terminal-blink 1.1s steps(2) infinite;
}
@keyframes terminal-blink { 0%, 50% { opacity: 1 } 51%, 100% { opacity: 0 } }

/* ---- Rows ---- */
.terminal__list {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}

.trow {
  border-left: 2px solid var(--color-gray-700);
  background: rgba(255, 255, 255, .012);
  transition: background var(--motion-fast, .18s) ease, border-color var(--motion-fast, .18s) ease;
}
.trow:hover,
.trow.is-open { background: rgba(255, 255, 255, .045); border-left-color: var(--color-bone); }

.trow__btn {
  width: 100%;
  display: grid;
  grid-template-columns: 132px 96px minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-3);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font: inherit;
}
.trow__btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }

.trow__time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--color-gray-400);
  white-space: nowrap;
}
.trow__channel {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--color-bone);
}
.trow__text {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.trow__text b { color: var(--text-primary); font-weight: 600; }
.trow__go {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--color-gray-500);
  transition: transform var(--motion-fast, .18s) ease, color var(--motion-fast, .18s) ease;
}
.trow:hover .trow__go,
.trow.is-open .trow__go { color: var(--text-primary); }
.trow.is-open .trow__go { transform: rotate(90deg); }

/* ---- Expanded detail ----
   The terminal is text-forward by design, which is its one weakness against
   the artwork. Opening a row in place is the answer: the list stays scannable
   and the image only costs space when it is asked for. */
.trow__detail {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: var(--space-6);
  padding: 0 var(--space-3) var(--space-6) calc(132px + var(--space-4) + var(--space-3));
}
.trow__detail[hidden] { display: none; }
.trow__media {
  border: 1px solid var(--color-gray-700);
  position: relative;
  overflow: hidden;
  align-self: start;
}
.trow__media img { width: 100%; height: auto; display: block; }
.trow__play {
  position: absolute;
  inset: auto var(--space-3) var(--space-3) auto;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: rgba(3, 4, 15, .72);
  border: 1px solid rgba(228, 232, 235, .5);
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  color: var(--text-primary);
}
.trow__body { margin: 0 0 var(--space-4); color: var(--text-secondary); }
.trow__link {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-primary);
  text-decoration: none;
  border-bottom: 1px solid var(--color-gray-600);
  padding-bottom: 2px;
}
.trow__link:hover { border-color: var(--color-bone); }

/* ---- Empty / loading / error ----
   This is why the terminal was chosen over the mosaic: a channel with nothing
   in it reads as a correct state of the world, not as a broken page. */
.terminal__msg {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--color-gray-400);
  text-align: center;
  padding: var(--space-16) var(--space-4);
  /* base.css caps every <p> at 65ch. Without overriding it here the message
     centres inside that narrower box rather than the screen, and lands
     noticeably left of centre. */
  max-width: none;
  margin: 0 auto;
}
.terminal__msg span { display: block; letter-spacing: 0.08em; margin-top: var(--space-3); color: var(--color-gray-500); }

/* ---- No-JS ---- */
.terminal__nojs {
  border: 1px solid var(--color-gray-700);
  padding: var(--space-6);
  margin-top: var(--space-6);
  color: var(--text-secondary);
}

@media (max-width: 900px) {
  /* Four columns will not fit. Squeezing them just makes the nowrap timestamp
     run underneath the title. Stack instead: meta on one line, the text on the
     next, and keep the channel visible — it is the whole point of the page. */
  .trow__btn {
    grid-template-columns: auto auto 1fr;
    grid-template-areas:
      "time chan go"
      "text text text";
    gap: 6px var(--space-3);
    align-items: baseline;
  }
  .trow__time    { grid-area: time; }
  .trow__channel { grid-area: chan; }
  .trow__go      { grid-area: go; justify-self: end; align-self: center; }
  .trow__text {
    grid-area: text;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .trow__detail { grid-template-columns: 1fr; padding-left: var(--space-3); }
  .terminal__screen { padding: var(--space-6) var(--space-4); }
  .terminal__channels { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .terminal__live,
  .terminal__caret { animation: none; }
  .terminal__caret { opacity: 1; }
  .trow, .trow__go { transition: none; }
}
