/* ===== TapeWarden · terminal theme ===== */

/* ---- Tokens: dark (default) ---- */
:root {
  --bg: #0b0b09;
  --panel: #11110e;
  --fg: #e9e2cf;
  --dim: #9a9482;
  --faint: #6b6656;
  --rule: #2a2821;
  --rule-2: #3d3a2f;
  --accent: #ffb000;
  --accent-ink: #0b0b09;
  --up: #3fd97a;
  --down: #ff5a4f;
  --sel: rgba(255, 176, 0, 0.1);
  color-scheme: dark;
}

/* ---- Tokens: light ---- */
:root[data-theme="light"] {
  --bg: #f3efe4;
  --panel: #fbf9f2;
  --fg: #16150f;
  --dim: #5a5547;
  --faint: #868070;
  --rule: #ddd7c6;
  --rule-2: #bfb8a3;
  --accent: #9a5200;
  --accent-ink: #fbf9f2;
  --up: #0b7a3a;
  --down: #c0261d;
  --sel: rgba(154, 82, 0, 0.08);
  color-scheme: light;
}

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 8px; top: 8px; z-index: 30; background: var(--accent); color: var(--accent-ink); padding: 4px 8px; }

h1, h2, h3 { font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
h2 { font-size: clamp(20px, 2.4vw, 27px); margin-bottom: 8px; }
h3 { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
p + p { margin-top: 12px; }
em { font-style: normal; color: var(--fg); border-bottom: 1px solid var(--accent); }
.lead { color: var(--dim); max-width: 68ch; }
.up { color: var(--up); }
.dn { color: var(--down); }
.dim { color: var(--faint); }

/* ---- Top bar ---- */
.bar { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--rule-2); }
.bar__in { display: flex; align-items: center; gap: 24px; min-height: 48px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: 0.1em; text-decoration: none; }
.brand b { background: var(--accent); color: var(--accent-ink); padding: 0 6px; font-weight: 600; letter-spacing: 0.04em; }
.keys { display: flex; flex-wrap: wrap; gap: 2px 18px; flex: 1; }
.keys a { display: inline-flex; align-items: center; gap: 7px; padding: 4px 0; font-size: 13px; letter-spacing: 0.06em; color: var(--dim); text-decoration: none; }
.keys a:hover, .keys a[aria-current="page"] { color: var(--fg); }
kbd { font: inherit; font-size: 11px; line-height: 18px; padding: 0 5px; border: 1px solid var(--rule-2); color: var(--accent); }
.clock { font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.theme-btn { font: inherit; font-size: 13px; padding: 3px 8px; background: none; color: var(--fg); border: 1px solid var(--rule-2); cursor: pointer; }
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---- Pane grid ---- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 12px; padding-top: 16px; padding-bottom: 16px; }
.pane { grid-column: span 12; min-width: 0; background: var(--panel); border: 1px solid var(--rule-2); }
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.pane__head {
  display: flex; align-items: center; gap: 12px; height: 32px; padding: 0 12px;
  border-bottom: 1px solid var(--rule-2);
  font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim);
  white-space: nowrap; overflow: hidden;
}
.pane__head .no { background: var(--accent); color: var(--accent-ink); padding: 0 6px; font-weight: 600; }
.pane__head .ttl { color: var(--fg); font-weight: 600; }
.pane__head .meta { margin-left: auto; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.pane__body { padding: 20px; }
.pane__body .lead { margin-top: 4px; }
.note { padding: 10px 12px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--faint); }

/* status dot */
.dot { display: inline-block; width: 7px; height: 7px; margin-right: 7px; background: var(--up); vertical-align: 1px; }
.is-live::before { content: "● "; color: var(--up); }
.is-off { color: var(--down); }
.is-off::before { content: "● "; }
.sample { border: 1px solid var(--accent); color: var(--accent); padding: 0 6px; }

/* ---- Hero ---- */
.hero { padding: clamp(24px, 5vw, 56px) 20px; }
.prompt { margin-bottom: 18px; font-size: 13px; color: var(--dim); overflow-wrap: anywhere; }
.prompt b { color: var(--accent); font-weight: 500; }
.cursor { display: inline-block; width: 0.6em; height: 1.1em; margin-left: 4px; vertical-align: -0.2em; background: var(--accent); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.h1 { font-size: clamp(26px, 4.2vw, 46px); max-width: 24ch; }
.hero .lead { margin-top: 18px; }
.back { display: inline-block; margin-bottom: 18px; font-size: 13px; color: var(--dim); text-decoration: none; }
.back:hover { color: var(--accent); }

/* ---- Buttons ---- */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px;
  font: inherit; font-size: 13px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; text-decoration: none;
  color: var(--fg); background: transparent; border: 1px solid var(--fg); cursor: pointer;
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn--go { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn--go:hover { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.flags { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 28px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--dim); }
.flags li::before { content: "■ "; color: var(--accent); }

/* ---- Data tables ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th { padding: 8px 12px; border-bottom: 1px solid var(--rule); text-align: left; font-size: 11px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.tbl td { padding: 7px 12px; border-bottom: 1px dashed var(--rule); white-space: nowrap; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: var(--sel); }
.tbl .r { text-align: right; }
.tbl td:first-child { font-weight: 600; }

/* ---- Cells (bordered sub-grid) ---- */
.cells { display: grid; gap: 1px; background: var(--rule); border-top: 1px solid var(--rule); }
.cells--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cells--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cell { background: var(--panel); padding: 18px 20px; }
.cell p { font-size: 14px; color: var(--dim); }
.tag { display: block; margin-bottom: 10px; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }

/* ---- Pipeline ---- */
.pipe { list-style: none; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 1px; background: var(--rule); border-top: 1px solid var(--rule); }
.pipe li { position: relative; background: var(--panel); padding: 18px 20px; }
.pipe li p { font-size: 14px; color: var(--dim); }
.pipe li:not(:last-child)::after {
  content: "▶"; position: absolute; z-index: 1; right: -7px; top: 50%; transform: translateY(-50%);
  font-size: 11px; line-height: 1; color: var(--accent); background: var(--panel);
}

/* ---- Stats strip ---- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--rule); border-top: 1px solid var(--rule); }
.stat { background: var(--panel); padding: 16px 20px; }
.stat b { display: block; font-size: 26px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); }

/* ---- FAQ ---- */
.faq details { border-top: 1px solid var(--rule); }
.faq summary { display: flex; gap: 12px; padding: 13px 20px; list-style: none; cursor: pointer; font-weight: 500; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: "[+]"; flex: none; color: var(--accent); }
.faq details[open] summary::before { content: "[−]"; }
.faq summary:hover { background: var(--sel); }
.faq details p { padding: 0 20px 16px calc(20px + 3ch + 12px); font-size: 14px; color: var(--dim); }

/* ---- Access form (command line) ---- */
.cmd { display: flex; margin-top: 18px; background: var(--bg); border: 1px solid var(--rule-2); }
.cmd:focus-within { border-color: var(--accent); }
.cmd label { padding: 10px 0 10px 12px; color: var(--accent); white-space: nowrap; }
.cmd input { flex: 1; min-width: 0; padding: 10px 10px; font: inherit; color: var(--fg); background: transparent; border: 0; outline: none; }
.cmd input::placeholder { color: var(--faint); }
.cmd .btn { border: 0; }
.form-note { margin-top: 10px; font-size: 12px; color: var(--faint); }
.form-note.is-ok { color: var(--up); }
.form-note.is-err { color: var(--down); }

/* ---- Product: alert anatomy ---- */
.split { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1px; background: var(--rule); border-top: 1px solid var(--rule); }
.split > * { background: var(--panel); padding: 20px; }
.msg { background: var(--bg); border: 1px solid var(--rule-2); padding: 16px; font-size: 14px; line-height: 1.75; overflow-x: auto; }
.msg div { white-space: pre; }
.msg sup { color: var(--accent); font-size: 10px; margin-left: 4px; }
.legend { list-style: none; counter-reset: lg; }
.legend li { counter-increment: lg; display: grid; grid-template-columns: 3ch 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--rule); font-size: 14px; }
.legend li:last-child { border-bottom: 0; }
.legend li::before { content: counter(lg); color: var(--accent); }
.legend b { display: block; font-weight: 600; }
.legend span { color: var(--dim); }

/* ---- Product: spec table ---- */
.spec div { display: grid; grid-template-columns: 170px minmax(0, 1fr); border-top: 1px solid var(--rule); }
.spec dt { padding: 10px 20px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.spec dd { padding: 10px 20px; }

/* ---- Footer ---- */
.foot { border-top: 1px solid var(--rule-2); }
.foot__in { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 14px 16px 28px; font-size: 12px; letter-spacing: 0.04em; color: var(--faint); }
.foot a { color: var(--dim); text-decoration: none; }
.foot a:hover { color: var(--accent); }

/* ---- 404 ---- */
.nf { min-height: calc(100vh - 49px); display: grid; place-items: center; padding: 24px 16px; }
.nf .pane { width: 100%; max-width: 620px; }
.nf .code { font-size: clamp(56px, 12vw, 96px); font-weight: 600; line-height: 1; color: var(--accent); }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .cells--3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .span-8, .span-7, .span-5, .span-4 { grid-column: span 12; }
  .split { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .bar__in { flex-wrap: wrap; gap: 6px 16px; padding: 8px 16px; }
  .keys { order: 3; flex-basis: 100%; gap: 2px 16px; }
  .keys kbd { display: none; }
  .clock { margin-left: auto; }
  .pipe { grid-auto-flow: row; }
  .pipe li:not(:last-child)::after { content: "▼"; right: auto; left: 20px; top: auto; bottom: -6px; transform: none; }
  .cells--2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec div { grid-template-columns: minmax(0, 1fr); }
  .spec dt { padding-bottom: 0; }
  .hide-sm { display: none; }
}
@media (max-width: 420px) {
  .clock { display: none; }
  .theme-btn { margin-left: auto; }
  .tbl th, .tbl td { padding-left: 8px; padding-right: 8px; }
  .pane__body, .hero, .cell, .pipe li, .stat { padding-left: 14px; padding-right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cursor { animation: none; }
}
