/*
 * theme.css — T-Minus design tokens.
 * A launch console: near-black canvas, phosphor-amber signal, monospace
 * everywhere. Opens DARK (color-scheme: dark in :root); html[data-theme="light"]
 * holds the daylight variant for the toggle.
 */

:root {
  color-scheme: dark;

  --canvas: #0a0d0c;
  --surface: #232524;
  --surface-2: #2b2e2c;
  --border: #2d302e;
  --border-strong: #454944;
  --ink: #e9efe9;
  --muted: #909591;

  --accent: #ffb454;
  --accent-hover: #ffc272;
  --accent-ink: #14100a;
  --accent-text: #ffb454;
  --accent-strong: #ffb454;
  --accent-soft: #2e2716;
  --accent-border: #4d3d1f;

  --success: #34d399;
  --success-ink: #06251a;
  --success-soft: #142822;
  --success-strong: #6ee7b7;

  --warning: #fb923c;
  --warning-ink: #1c0f02;
  --warning-soft: #2c1c10;
  --warning-strong: #fdba74;

  --danger: #ef4444;
  --danger-ink: #200404;
  --danger-soft: #2c1414;
  --danger-strong: #fca5a5;

  --chart-1: #ffb454;
  --chart-2: #34d399;
  --chart-3: #38bdf8;
  --chart-4: #f87171;
  --chart-5: #a78bfa;
  --chart-6: #fbbf24;

  --font-display: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-body: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-weight: 700;
  --display-tracking: -0.01em;
  --eyebrow-tracking: 0.08em;

  --radius-btn: 4px;
  --radius-card: 4px;
  --radius-input: 4px;
  --border-w: 1px;
  --border-strong-w: 1px;
  --shadow-card: none;
  --shadow-raised: 0 12px 32px -12px rgb(0 0 0 / 0.6);
  --shadow-btn: none;
  --card-pad: 1.25rem;
  --caps: uppercase;
  --caps-tracking: 0.08em;
  --btn-weight: 600;
  --measure: 68ch;
}

html[data-theme="light"] {
  color-scheme: light;

  --canvas: #f3f1ea;
  --surface: #ffffff;
  --surface-2: #ece8dd;
  --border: #ddd7c6;
  --border-strong: #b9b09a;
  --ink: #191712;
  --muted: #5f594c;

  --accent: #d97e0e;
  --accent-hover: #c06f0a;
  --accent-ink: #14100a;
  --accent-text: #a35e0a;
  --accent-strong: #8f5107;
  --accent-soft: #f7e6c8;
  --accent-border: #e3c48c;

  --success: #15803d;
  --success-ink: #ffffff;
  --success-soft: #dcf0e3;
  --success-strong: #0f6b32;

  --warning: #9a4508;
  --warning-ink: #ffffff;
  --warning-soft: #fbe4d1;
  --warning-strong: #9c460a;

  --danger: #c53030;
  --danger-ink: #ffffff;
  --danger-soft: #fbdede;
  --danger-strong: #a02626;

  --chart-1: #a35e0a;
  --chart-2: #15803d;
  --chart-3: #0369a1;
  --chart-4: #b91c1c;
  --chart-5: #6d28d9;
  --chart-6: #a16207;
}

/*
 * app.css — T-Minus's own screens: the side rail shell, the countdown
 * timeline, the adaptive-skip explainer and the closing statement band.
 * Tokens only, per theme.css.
 */

@keyframes blink-caret { 0%, 45% { opacity: 1; } 50%, 95% { opacity: 0; } 100% { opacity: 1; } }
@keyframes tl-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); }
  100% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 0%, transparent); }
}

.caret { display: inline-block; width: 0.5em; margin-left: 0.15em; background: currentColor; animation: blink-caret 1.1s steps(1) infinite; }
html.reduced-motion .caret { animation: none; opacity: 1; }

/* ---- Shell ------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; align-items: stretch; }
.shell-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }

.rail {
  display: none;
  flex-direction: column;
  width: 15rem;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: var(--border-w, 1px) solid var(--border);
  background: var(--surface);
}
@media (width >= 64rem) { .rail { display: flex; } }

.rail-brand { display: flex; align-items: center; gap: 0.6rem; padding: 1.4rem 1.25rem 1.1rem; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.rail-brand-mark { display: inline-flex; color: var(--accent-text); }
.rail-nav { flex: 1 1 auto; display: flex; flex-direction: column; gap: 0.15rem; padding: 0.5rem 0.75rem; }
.rail-link {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0.75rem;
  border-radius: 3px; font-family: var(--font-display); font-size: 0.82rem; font-weight: 500;
  color: var(--muted); text-decoration: none; border-left: 2px solid transparent;
  transition: background-color 150ms, color 150ms;
}
.rail-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.rail-link.is-active { background: var(--accent-soft); color: var(--accent-strong); border-left-color: var(--accent-strong); }
.rail-foot { padding: 0.75rem 1.25rem 1.25rem; border-top: var(--border-w, 1px) solid var(--border); }

.railbar {
  display: flex; justify-content: space-around; position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
  border-top: var(--border-w, 1px) solid var(--border); background: var(--surface);
  padding: 0.4rem 0.25rem calc(0.4rem + env(safe-area-inset-bottom));
}
@media (width >= 64rem) { .railbar { display: none; } }
.railbar-link { display: flex; flex-direction: column; align-items: center; gap: 0.2rem; padding: 0.25rem 0.5rem; font-family: var(--font-display); font-size: 0.6rem; letter-spacing: 0.02em; color: var(--muted); text-decoration: none; }
.railbar-link .icon { width: 1.1rem; height: 1.1rem; }
.railbar-link.is-active { color: var(--accent-text); }
@media (width < 64rem) { .shell-main { padding-bottom: 4.25rem; } }

/* ---- App head ------------------------------------------------------------ */
.status-pill {
  display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--font-display);
  font-size: 0.72rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.3rem 0.65rem;
  border-radius: 3px; border: 1px solid var(--accent-border); background: var(--accent-soft); color: var(--accent-strong);
}
.status-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.is-paused { border-color: var(--border-strong); background: var(--surface-2); color: var(--muted); }

/* ---- Timeline ------------------------------------------------------------
   Each node shows only its step number on the rule itself — thirteen full
   names at true (compressed) spacing cannot share a rule without colliding,
   so the number is the label, a native title="" gives the name and offset on
   hover, and the full detail lives in the legend grid underneath. */
.tl-wrap { overflow-x: auto; overscroll-behavior-x: contain; padding: 0.5rem 0 1rem; }
.tl-track { position: relative; min-width: 62rem; height: 8rem; margin: 2.25rem 2rem 0; }
.tl-line { position: absolute; inset-inline: 0; top: 50%; height: 2px; background: var(--border-strong); transform: translateY(-1px); }
.tl-line-done { position: absolute; top: 50%; left: 0; height: 2px; background: var(--accent); transform: translateY(-1px); }
.tl-now { position: absolute; top: -0.75rem; bottom: -0.75rem; width: 2px; background: var(--accent); }
.tl-now-tag {
  position: absolute; top: -1.9rem; left: 50%; transform: translateX(-50%); white-space: nowrap;
  font-family: var(--font-display); font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em;
  color: var(--accent-ink); background: var(--accent); padding: 0.2rem 0.5rem; border-radius: 2px;
}
.tl-node { position: absolute; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; z-index: 1; cursor: default; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border-strong); }
.tl-node.is-sent .tl-dot { background: var(--accent); border-color: var(--accent); animation: tl-pulse 2.4s ease-out infinite; }
html.reduced-motion .tl-node.is-sent .tl-dot { animation: none; }
.tl-label { position: absolute; text-align: center; font-family: var(--font-display); }
.tl-node.is-above .tl-label { bottom: calc(100% + 0.5rem); }
.tl-node.is-below .tl-label { top: calc(100% + 0.5rem); }
.tl-label .tl-num { display: block; font-size: 0.68rem; font-weight: 700; color: var(--muted); }
.tl-node.is-sent .tl-label .tl-num { color: var(--accent-text); }

.tl-legend {
  margin-top: 1.5rem; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem 1.25rem;
}
@media (width >= 40rem) { .tl-legend { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (width >= 64rem) { .tl-legend { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tl-legend-item { display: flex; align-items: baseline; gap: 0.5rem; font-family: var(--font-display); font-size: 0.74rem; min-width: 0; }
.tl-legend-num { color: var(--muted); flex-shrink: 0; }
.tl-legend-name { flex: 1 1 auto; min-width: 0; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-legend-item.is-sent .tl-legend-name { color: var(--ink); }
.tl-legend-off { margin-left: auto; flex-shrink: 0; color: var(--accent-text); font-size: 0.68rem; }

/* ---- Skip explainer -------------------------------------------------------- */
.skip-row { display: flex; align-items: center; gap: 0.4rem; overflow-x: auto; padding: 0.35rem 0; }
.skip-pill {
  flex-shrink: 0; display: inline-flex; align-items: center; font-family: var(--font-display); font-size: 0.7rem;
  white-space: nowrap; border: 1px solid var(--border-strong); border-radius: 2px; padding: 0.4rem 0.65rem; color: var(--muted);
}
.skip-pill.is-hit { border-color: var(--accent-border); color: var(--accent-strong); background: var(--accent-soft); }
.skip-pill.is-skip { border-style: dashed; border-color: var(--danger); color: var(--danger-strong); background: var(--danger-soft); }
.skip-arrow { flex-shrink: 0; color: var(--muted); width: 0.9rem; height: 0.9rem; }

/* ---- Code pane / preview -------------------------------------------------- */
.code-pane {
  font-family: var(--font-mono); font-size: 0.84rem; line-height: 1.6; background: var(--surface-2);
  border: var(--border-w, 1px) solid var(--border); border-radius: 3px; padding: 1rem;
}
.mail-preview { border: var(--border-w, 1px) solid var(--border); border-radius: 3px; overflow: hidden; background: var(--surface); }
.mail-preview-head { padding: 0.85rem 1.1rem; border-bottom: var(--border-w, 1px) solid var(--border); background: var(--surface-2); }
.mail-preview-body { padding: 1.25rem 1.1rem; font-size: 0.9rem; line-height: 1.7; white-space: pre-wrap; color: var(--ink); }

/* ---- Closing statement band ------------------------------------------------
   accent-ink is near-black in BOTH modes (it is what sits under the amber
   button label), which is exactly what makes this read as a deliberate dark
   statement band regardless of the visitor's theme, using only real tokens. */
.closing-band { background: var(--accent-ink); color: var(--accent); padding: 3rem 1.5rem; text-align: center; }
.closing-band .line { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.05rem, 2.4vw, 1.6rem); letter-spacing: -0.01em; }
.closing-band .sub { margin-top: 0.6rem; font-family: var(--font-mono); font-size: 0.8rem; color: color-mix(in srgb, var(--accent) 70%, transparent); }
