/* HyperData Terminal — site stylesheet.
   Dark-committed. Warm charcoal, amber data, serif display, mono figures.
   No framework, no build step. */

:root {
  --bg: #0d0d0f;
  --bg-2: #121113;
  --bg-3: #171618;
  --ink: #ebe6da;
  --ink-2: #a8a195;
  --ink-3: #8a8472;
  --amber: #f0b429;
  --amber-hi: #f7c64a;
  --gold: #c9962a;
  --rule-gold: rgba(240, 180, 41, 0.22);
  --rule-gold-strong: rgba(240, 180, 41, 0.5);
  --rule: #232125;
  --red: #e5484d;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-soft: cubic-bezier(0.22, 0.61, 0.36, 1);

  --wrap: 1240px;
  --gutter: clamp(16px, 4vw, 48px);
  --section: clamp(72px, 10vw, 136px);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: #0d0d0f; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.55;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
h1, h2, h3, p, dl, dd, figure, table, pre { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
code, kbd, pre, samp { font-family: var(--mono); }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 1px; }
::selection { background: var(--amber); color: var(--bg); }

.vh {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.skip {
  position: absolute; left: var(--gutter); top: -60px; z-index: 100;
  background: var(--amber); color: var(--bg); font-family: var(--mono); font-size: 13px;
  padding: 8px 12px; text-decoration: none; transition: top 220ms var(--ease-out);
}
.skip:focus { top: 12px; }

/* ---------- Typography ---------- */
.mono { font-family: var(--mono); }

h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(42px, 4.7vw, 68px);
  line-height: 0.98;
  letter-spacing: -0.035em;
  text-wrap: balance;
  color: var(--ink);
}
h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(34px, 4.4vw, 56px);
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 26px;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.lede {
  font-size: clamp(18px, 1.6vw, 21px);
  line-height: 1.5;
  color: var(--ink-2);
  max-width: 54ch;
}
.prose p { max-width: 62ch; color: var(--ink-2); }
.prose p + p { margin-top: 1em; }
.prose strong { color: var(--ink); font-weight: 500; }
.prose code, .note code, .inline-code {
  font-size: 0.86em; color: var(--ink);
  background: var(--bg-3); padding: 1px 5px; border: 1px solid var(--rule);
}

.text-link {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--rule-gold-strong), var(--rule-gold-strong));
  background-repeat: no-repeat;
  background-size: 100% 1px;
  background-position: 0 100%;
  transition: background-size 300ms var(--ease-out), color 300ms var(--ease-out);
}
.text-link:hover { color: var(--amber); background-size: 100% 2px; }

/* ---------- Rules ---------- */
.rule {
  height: 1px; background: var(--rule-gold-strong); border: 0;
  transform-origin: left center;
  transition: transform 1100ms var(--ease-out);
}
/* Hidden start states apply only once the page is known to run script.js
   (html.js), so the page stays fully readable if JavaScript is off or fails. */
.js .rule { transform: scaleX(0); }
.js .rule.in { transform: scaleX(1); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 13.5px; font-weight: 500; letter-spacing: 0.01em;
  padding: 13px 20px; text-decoration: none; border: 1px solid var(--rule-gold-strong);
  color: var(--ink); background: transparent; cursor: pointer; line-height: 1;
  transition: background-color 260ms var(--ease-out), color 260ms var(--ease-out),
              border-color 260ms var(--ease-out), transform 260ms var(--ease-out);
}
.btn:hover { background: var(--bg-3); border-color: var(--amber); transform: translateY(-1px); }
.btn:active { transform: translateY(0); transition-duration: 80ms; }
.btn-primary { background: var(--amber); color: var(--bg); border-color: var(--amber); }
.btn-primary:hover { background: var(--amber-hi); border-color: var(--amber-hi); color: var(--bg); }
.btn svg { width: 15px; height: 15px; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--rule-gold);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  height: 60px;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none;
  font-family: var(--serif); font-size: 21px; letter-spacing: -0.01em; color: var(--ink);
  white-space: nowrap;
}
.brand .mark {
  display: inline-block; width: 9px; height: 15px; background: var(--amber);
  transform: translateY(1px);
}
.brand .sub { color: var(--ink-2); font-style: italic; }
.site-nav { display: flex; align-items: center; gap: 28px; }
.site-nav a {
  font-family: var(--mono); font-size: 13px; color: var(--ink-2); text-decoration: none;
  transition: color 240ms var(--ease-out);
}
.site-nav a:hover { color: var(--amber); }
.site-nav .btn { padding: 9px 14px; color: var(--ink); }
.site-nav .btn:hover { color: var(--amber); }
@media (max-width: 860px) {
  .site-nav a:not(.btn) { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding-block: clamp(40px, 4.5vw, 60px) clamp(48px, 6vw, 80px); }
.hero-grid {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(28px, 4vw, 64px); align-items: start;
}
.hero-copy .lede { margin-top: 28px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.ledger {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr));
  font-family: var(--mono); margin-top: 0;
}
.ledger div {
  padding: 18px 16px 18px 0; border-right: 1px solid var(--rule); margin-right: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.ledger div:last-child { border-right: 0; margin-right: 0; }
.ledger dt { color: var(--ink-2); font-size: 12px; }
.ledger dd { color: var(--amber); font-size: 24px; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1; }
.ledger dd.plain { color: var(--ink); font-weight: 400; font-size: 17px; line-height: 1.2; }

.hero .rule { margin-top: clamp(32px, 4vw, 48px); }

@media (max-width: 1100px) {
  .ledger { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ledger div:nth-child(3) { border-right: 0; }
  .ledger div:nth-child(n+4) { border-top: 1px solid var(--rule); }
}
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 480px) {
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger div:nth-child(3) { border-right: 1px solid var(--rule); }
  .ledger div:nth-child(even) { border-right: 0; }
  .ledger div:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .ledger div:nth-child(-n+2) { border-top: 0; }
}

/* ---------- Terminal ---------- */
.term {
  margin-top: 0;
  background: #0a0a0b;
  border: 1px solid var(--rule-gold-strong);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.6), 0 40px 80px -40px rgba(0, 0, 0, 0.9);
}
.term-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 36px; padding: 0 16px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  border-bottom: 1px solid var(--rule-gold);
}
.term-bar .dot {
  display: inline-block; width: 7px; height: 7px; background: var(--ink-3);
  margin-right: 10px; vertical-align: 0; transition: background-color 400ms var(--ease-out);
}
.term-bar .dot.on { background: var(--amber); }
.term-screen {
  height: clamp(340px, 34vw, 480px);
  padding: 18px 20px;
  overflow: hidden;
}
.term-out {
  font-family: var(--mono); font-size: clamp(11.5px, 0.95vw, 13px); line-height: 1.6;
  color: var(--ink); white-space: pre; margin: 0;
  font-variant-numeric: tabular-nums;
}
.term-out .ln { display: block; min-height: 1.6em; }
.term-out .p { color: var(--ink-3); }
.term-out .a { color: var(--amber); }
.term-out .d { color: var(--ink-2); }
.term-out .m { color: var(--ink-3); }
.term-out .r { color: var(--red); }
.term-out .k { color: var(--ink); font-weight: 500; }
.term-out .cell { display: inline-block; transition: color 1200ms var(--ease-soft); }
.term-out .cell.up { color: var(--amber-hi); transition-duration: 80ms; }
.term-out .cell.dn { color: var(--red); transition-duration: 80ms; }
.term-cur {
  display: inline-block; width: 0.6em; height: 1.15em; background: var(--amber);
  vertical-align: -0.2em; margin-left: 1px;
  animation: blink 1.05s steps(1, end) infinite;
}
@keyframes blink { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0; } }
.term-caption {
  margin-top: 12px; font-family: var(--mono); font-size: 12px; color: var(--ink-3);
  display: flex; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap;
}
@media (max-width: 1100px) {
  .term-out .td { display: none; }
}
@media (max-width: 900px) {
  .term-out .td { display: inline; }
}
@media (max-width: 600px) {
  .term-screen { padding: 14px; height: 400px; }
  .term-out .td { display: none; }
  .term-out .tf { display: none; }
}

/* ---------- Sections ---------- */
.section { padding-block: var(--section); border-top: 1px solid var(--rule-gold); }
.section-head { display: grid; grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); gap: clamp(24px, 4vw, 72px); align-items: end; }
.section-head p { color: var(--ink-2); max-width: 52ch; font-size: 18px; }
@media (max-width: 800px) { .section-head { grid-template-columns: minmax(0, 1fr); } }

.split { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(32px, 5vw, 88px); align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%; border-collapse: collapse;
  font-family: var(--mono); font-size: 13.5px; line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
thead th {
  text-align: left; font-weight: 500; color: var(--ink-3);
  padding: 0 14px 10px 0; border-bottom: 1px solid var(--rule-gold-strong);
  font-size: 12px; white-space: nowrap;
}
tbody td {
  padding: 12px 14px 12px 0; border-bottom: 1px solid var(--rule); vertical-align: top;
  color: var(--ink-2);
  transition: color 260ms var(--ease-out);
}
tbody tr { transition: background-color 260ms var(--ease-out), box-shadow 260ms var(--ease-out), padding-left 260ms var(--ease-out); }
tbody tr:hover { background: var(--bg-2); box-shadow: inset 2px 0 0 var(--amber); }
tbody tr:hover td { color: var(--ink); }
tbody td:first-child { color: var(--ink); padding-left: 10px; }
thead th:first-child { padding-left: 10px; }
tbody td:last-child, thead th:last-child { padding-right: 10px; }
td.key { color: var(--amber); white-space: nowrap; }
td.name { color: var(--ink); white-space: nowrap; }
td.serif { font-family: var(--serif); font-size: 16px; line-height: 1.45; }
td.r { text-align: right; }

/* ---------- Dashboards ---------- */
.dash-table { margin-top: clamp(36px, 5vw, 64px); }
.dash-table td.desc { font-family: var(--serif); font-size: 16.5px; }
.dash-table .col-src { white-space: nowrap; }
@media (max-width: 700px) {
  .dash-table thead { display: none; }
  .dash-table table, .dash-table tbody { display: block; }
  .dash-table tbody { border-top: 1px solid var(--rule-gold-strong); }
  .dash-table tr {
    display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 14px; row-gap: 6px;
    padding: 14px 10px 16px 0; border-bottom: 1px solid var(--rule);
  }
  .dash-table td { display: block; border: 0; padding: 0; }
  .dash-table td.desc { grid-column: 1 / -1; }
  .dash-table td.col-src { grid-column: 1 / -1; font-size: 12px; color: var(--ink-3); }
  .dash-table tbody tr:hover { padding-left: 10px; }
}

.frame { margin-top: clamp(40px, 6vw, 80px); }
.frame-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 14px; height: 34px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  border: 1px solid var(--rule-gold-strong); border-bottom: 0; background: var(--bg-2);
}
.frame img { border: 1px solid var(--rule-gold-strong); width: 100%; }
.frame figcaption {
  margin-top: 12px; font-family: var(--mono); font-size: 12.5px; color: var(--ink-3);
  max-width: 70ch;
}

/* ---------- Data ---------- */
.components { margin-top: 36px; border-top: 1px solid var(--rule-gold-strong); }
.components li {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--rule);
  font-family: var(--mono); font-size: 13.5px; color: var(--ink);
  transition: color 240ms var(--ease-out), box-shadow 240ms var(--ease-out), padding-left 240ms var(--ease-out);
}
.components li:hover { color: var(--amber); box-shadow: inset 2px 0 0 var(--amber); padding-left: 10px; }
.components li span { color: var(--ink-3); font-size: 12px; text-align: right; }
.components-note { margin-top: 12px; font-family: var(--mono); font-size: 12px; color: var(--ink-3); }

/* ---------- Build ---------- */
.build-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(32px, 5vw, 80px);
  margin-top: clamp(40px, 5vw, 64px);
}
@media (max-width: 960px) { .build-grid { grid-template-columns: minmax(0, 1fr); } }
.build-grid > div > p { color: var(--ink-2); margin-top: 12px; max-width: 56ch; }
.build-grid > div > p code { font-size: 0.86em; color: var(--ink); background: var(--bg-3); padding: 1px 5px; border: 1px solid var(--rule); }

.code {
  margin-top: 24px;
  background: #0a0a0b; border: 1px solid var(--rule-gold-strong);
}
.code-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 34px; padding: 0 14px; font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  border-bottom: 1px solid var(--rule-gold);
}
.code pre {
  padding: 18px 20px; overflow-x: auto; font-size: 13px; line-height: 1.6; color: var(--ink);
  font-variant-numeric: tabular-nums;
}
@media (max-width: 600px) {
  .code.shell pre { white-space: pre-wrap; word-break: break-all; }
}
.code .c { color: var(--ink-3); }
.code .kw { color: var(--amber); }
.code .st { color: var(--ink-2); }
.code .fn { color: var(--ink); font-weight: 500; }
.code .p { color: var(--ink-3); }

details { margin-top: 18px; border-top: 1px solid var(--rule); }
summary {
  cursor: pointer; list-style: none; font-family: var(--mono); font-size: 13.5px; color: var(--ink);
  padding: 14px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  transition: color 240ms var(--ease-out);
}
summary::-webkit-details-marker { display: none; }
summary::after {
  content: ""; width: 8px; height: 8px; border-right: 1px solid var(--amber); border-bottom: 1px solid var(--amber);
  transform: rotate(45deg) translateY(-3px); transition: transform 320ms var(--ease-out);
}
details[open] summary::after { transform: rotate(-135deg) translateY(-2px); }
summary:hover { color: var(--amber); }
details > :not(summary) { padding-bottom: 20px; }
details p { color: var(--ink-2); max-width: 60ch; }

.endpoints td:first-child { white-space: nowrap; }
@media (max-width: 600px) {
  .endpoints td:first-child, details td.name { white-space: normal; overflow-wrap: anywhere; }
}

/* ---------- Integrity ---------- */
.note {
  border-left: 2px solid var(--amber); padding-left: 20px; margin-top: 28px;
}
.note p { color: var(--ink-2); max-width: 60ch; }
.states td:first-child { white-space: nowrap; font-weight: 500; }
.states td.warn:first-child { color: var(--amber); }
.states td.bad:first-child { color: var(--red); }

/* ---------- Install ---------- */
.install .reqs { margin-top: 32px; font-family: var(--mono); font-size: 13.5px; border-top: 1px solid var(--rule-gold-strong); }
.install .reqs div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule); }
.install .reqs dt { color: var(--ink-3); }
.install .reqs dd { color: var(--ink); }
.install-box { position: relative; margin-top: 0; }
.install-box pre { padding: 24px 22px; font-size: 14px; line-height: 1.9; }
.install-box .p { color: var(--ink-3); user-select: none; }
.copy {
  position: absolute; top: 0; right: 0; height: 34px; padding: 0 14px;
  background: transparent; border: 0; border-left: 1px solid var(--rule-gold);
  color: var(--ink-2); font-family: var(--mono); font-size: 12px; cursor: pointer;
  transition: color 240ms var(--ease-out), background-color 240ms var(--ease-out);
}
.copy:hover { color: var(--amber); background: var(--bg-3); }
.copy.done { color: var(--amber); }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--rule-gold-strong);
  padding-block: 40px 56px;
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-3);
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 14px 32px; align-items: baseline; }
.site-footer .spacer { flex: 1; }
.site-footer a { color: var(--ink-2); text-decoration: none; transition: color 240ms var(--ease-out); }
.site-footer a:hover { color: var(--amber); }

/* ---------- Reveal (scroll) ---------- */
.rv {
  transition: opacity 900ms var(--ease-out), transform 1000ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 110ms);
}
.js .rv { opacity: 0; transform: translateY(20px); }
.js .rv.in { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    transition-delay: 0ms !important;
  }
  .js .rv { opacity: 1; transform: none; }
  .js .rule { transform: none; }
  .term-cur { animation: none; }
}
