/* Sandman AI - site styles, Phase 1
   Alpine Instrument: dark instrument surfaces, warm paper document surfaces,
   hairline rules, one red accent. No gradients, no shadows as decoration. */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--basalt-800);
  color: var(--chalk-50);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg { max-width: 100%; }

a { color: inherit; }

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }

ul, ol { padding: 0; list-style: none; }

::selection { background: var(--signal); color: #fff; }

.wrap { width: min(var(--measure), 100% - (var(--gutter) * 2)); margin-inline: auto; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--chalk-50); color: var(--ink-900);
  padding: 12px 16px; font-family: var(--mono); font-size: 13px;
}
.skip:focus { left: 12px; top: 12px; }

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

/* ---------- review banner (style tile only, not a site element) ---------- */

.review {
  background: var(--basalt-700);
  border-bottom: 1px solid var(--hairline-dark);
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.03em;
  color: var(--chalk-400); padding: 9px 0;
}
.review .wrap { display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; }
.review strong { color: var(--chalk-50); font-weight: 500; }
.review .tag {
  color: var(--chalk-50); border: 1px solid var(--hairline-dark-strong);
  border-radius: var(--radius); padding: 1px 6px; white-space: nowrap;
}

/* ---------- navigation ---------- */

.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 13, 15, 0.72);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hairline-dark);
}
.nav-inner { display: flex; align-items: center; gap: 28px; min-height: 64px; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--chalk-50);
  font-weight: 600; letter-spacing: -0.01em; font-size: 15.5px;
}
.brand .mark { width: 20px; height: 20px; color: var(--chalk-50); flex: none; }

.nav-links { display: flex; align-items: center; gap: 22px; margin-left: auto; }
.nav-links a {
  font-family: var(--mono); font-size: 13px; color: var(--chalk-400);
  text-decoration: underline; text-decoration-color: var(--chalk-400);
  text-underline-offset: 0.28em; padding: 10px 0; border-bottom: 0;
}
.nav-links a:hover { color: var(--chalk-50); text-decoration-color: var(--chalk-50); }
.nav-links a[aria-current="page"] { color: var(--chalk-50); text-decoration-color: var(--signal); text-decoration-thickness: 2px; }
.lang {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em;
  color: var(--chalk-500);
}
.lang a { text-decoration: underline; text-underline-offset: 0.25em; padding: 2px 4px; border-radius: var(--radius); }
.lang a:hover { color: var(--chalk-50); }
.lang a[aria-current] { color: var(--chalk-50); text-decoration-color: var(--signal); text-decoration-thickness: 2px; }
.lang .sep { color: var(--chalk-500); opacity: 0.6; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--mono); font-size: 12.5px; letter-spacing: 0.06em;
  text-transform: uppercase; text-decoration: none;
  padding: 13px 18px; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn-primary { background: var(--signal); color: #fff; border-color: var(--signal); }
.btn-primary:hover { background: var(--signal-ink); border-color: var(--signal-ink); }
.btn-ghost { background: transparent; color: var(--chalk-50); border-color: var(--hairline-dark-strong); }
.btn-ghost:hover { border-color: var(--chalk-400); }
.surface-document .btn-ghost { color: var(--ink-900); border-color: var(--hairline-light-strong); }
.surface-document .btn-ghost:hover { border-color: var(--ink-500); }
.btn-sm { padding: 9px 13px; font-size: 11.5px; }

:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(242, 241, 236, 0.16);
}
.surface-document :focus-visible { box-shadow: 0 0 0 5px rgba(20, 23, 27, 0.12); }

/* ---------- hero ---------- */

.hero { padding: 76px 0 0; }
.eyebrow {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--chalk-400);
}
h1 {
  margin-top: 18px; max-width: 21ch;
  font-size: clamp(2.125rem, 6.2vw, 5rem); line-height: 0.96;
  letter-spacing: -0.028em; font-weight: 600;
  overflow-wrap: break-word; hyphens: none;
  text-wrap: balance;
}
.lead { margin-top: 26px; max-width: 56ch; color: var(--chalk-400); font-size: clamp(1rem, 1.3vw, 1.1875rem); text-wrap: pretty; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

/* ---------- spec strip ---------- */

.spec {
  margin-top: 60px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid var(--hairline-dark);
  border-bottom: 1px solid var(--hairline-dark);
}
.spec > div { padding: 20px 20px 22px 0; min-width: 0; }
.spec > div + div { border-left: 1px solid var(--hairline-dark); padding-left: 24px; }
.spec dt {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--chalk-500);
}
.spec dd {
  margin-top: 9px; font-size: 1.375rem; font-weight: 500;
  letter-spacing: -0.01em; font-variant-numeric: tabular-nums;
  overflow-wrap: break-word;
}
.pending {
  display: inline-block; font-family: var(--mono); font-size: 0.8125rem;
  color: var(--chalk-400); border: 1px dashed var(--hairline-dark-strong);
  border-radius: var(--radius); padding: 2px 7px; white-space: nowrap;
}
.footnote {
  padding: 14px 0 0; font-size: 0.8125rem; color: var(--chalk-500);
  max-width: 72ch;
}
.footnote sup { color: var(--chalk-400); }

/* ---------- sections ---------- */

.section { padding: var(--space-section) 0; scroll-margin-top: 84px; }
.section + .section { border-top: 1px solid var(--hairline-dark); }
/* the paper surface needs its own rule colour, otherwise the seam disappears */
.surface-document .section + .section { border-top-color: var(--hairline-light); }

.section-head { display: grid; grid-template-columns: 3.25rem minmax(0, 1fr); gap: 0; align-items: baseline; }
.num { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; color: var(--chalk-400); }
h2 {
  font-size: clamp(1.75rem, 3.2vw, 2.625rem); line-height: 1.06;
  letter-spacing: -0.025em; font-weight: 600; max-width: 26ch;
  text-wrap: balance;
}
.sub { margin-top: 16px; color: var(--chalk-400); max-width: 62ch; text-wrap: pretty; }
.head-sub { margin-left: 3.25rem; }

.surface-document {
  background: var(--paper-50); color: var(--ink-900);
  border-top: 1px solid var(--basalt-900);
  border-bottom: 1px solid var(--basalt-900);
}
.surface-document .eyebrow { color: var(--ink-500); }
.surface-document .sub { color: var(--ink-500); }
.surface-document .num { color: var(--signal); }
.surface-document .footnote { color: var(--ink-500); }

/* ---------- tables ---------- */

.data { width: 100%; border-collapse: collapse; margin-top: 34px; }
.table-scroll { overflow-x: auto; }
.data thead th {
  text-align: left; vertical-align: bottom;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.13em; text-transform: uppercase; color: var(--chalk-500);
  padding: 0 16px 12px 0; border-bottom: 1px solid var(--hairline-dark);
}
.data tbody th {
  text-align: left; font-weight: 500; font-size: 0.9375rem;
  padding: 17px 16px 17px 0; border-bottom: 1px solid var(--hairline-dark);
  vertical-align: top; overflow-wrap: break-word;
}
.data tbody tr:hover { background: rgba(255, 255, 255, 0.028); }
.surface-document .data tbody th { border-bottom-color: var(--hairline-light); }
.data td {
  padding: 17px 16px 17px 0; border-bottom: 1px solid var(--hairline-dark);
  vertical-align: top; font-size: 0.9375rem; overflow-wrap: anywhere;
}
.data tbody tr { transition: background-color 120ms ease; }
.data .model { font-weight: 500; }
.data .muted { color: var(--chalk-400); }
.surface-document .data thead th { color: var(--ink-500); border-bottom-color: var(--hairline-light-strong); }
.surface-document .data td { border-bottom-color: var(--hairline-light); }
.surface-document .data tbody tr:hover { background: rgba(20, 23, 27, 0.03); }
.surface-document .data .muted { color: var(--ink-500); }

.mono { font-family: var(--mono); font-size: 0.8125rem; letter-spacing: 0.01em; }
.tbd { font-family: var(--mono); font-size: 0.8125rem; }
.status {
  display: inline-block; font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
  border: 1px solid var(--hairline-dark-strong); border-radius: var(--radius);
  padding: 2px 7px; color: var(--chalk-400); white-space: nowrap;
}
.surface-document .status { border-color: var(--hairline-light-strong); color: var(--ink-500); }

/* ---------- note box ---------- */

.note {
  margin-top: 30px; padding: 20px 22px;
  border: 1px solid var(--hairline-light-strong); background: var(--paper-100);
  font-size: 0.9375rem; max-width: 74ch;
}
.note dl { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 8px 16px; }
.note dt {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-500); padding-top: 3px;
}
.note dd { color: var(--ink-900); }

/* ---------- flow diagram ---------- */

.flow { margin-top: 34px; color: var(--ink-500); overflow-x: auto; padding-bottom: 4px; }
.flow svg { display: block; width: 100%; min-width: 660px; height: auto; }
.flow .n-label { font-family: var(--mono); font-size: 11px; fill: var(--ink-900); letter-spacing: 0.06em; }
.flow .n-note { font-family: var(--mono); font-size: 11px; fill: var(--ink-500); }
.flow .edge { stroke: var(--hairline-light-strong); stroke-width: 1; fill: none; }
.flow .edge-dash { stroke: var(--hairline-light-strong); stroke-width: 1; fill: none; stroke-dasharray: 3 4; }
.flow .node { fill: var(--paper-50); stroke: var(--hairline-light-strong); }
.flow .node-key { fill: var(--paper-100); stroke: var(--ink-500); }

/* mobile path: same request, stacked, nothing clipped */
.flow-list { display: none; margin-top: 30px; border-top: 1px solid var(--hairline-light); }
.flow-list li {
  display: flex; gap: 14px; align-items: baseline;
  padding: 13px 0; border-bottom: 1px solid var(--hairline-light); font-size: 0.9375rem;
}
.flow-list .n { font-family: var(--mono); font-size: 11px; color: var(--ink-500); flex: none; }
.flow-list .branch { color: var(--ink-500); font-size: 0.875rem; }

/* ---------- terminal ---------- */

.term {
  margin-top: 30px; background: var(--basalt-900);
  border: 1px solid var(--hairline-dark-strong); border-radius: var(--radius-lg);
  overflow: hidden;
}
.term-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--hairline-dark);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--chalk-500);
}
.term-bar .file { text-transform: none; letter-spacing: 0.02em; color: var(--chalk-400); }
.term pre {
  margin: 0; padding: 18px 16px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.75; color: #DDE0E4;
}
.term .c { color: #8A9099; }

/* ---------- levers ---------- */

.levers {
  margin-top: 34px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px; background: var(--hairline-light); border: 1px solid var(--hairline-light);
}
.levers > div { background: var(--paper-50); padding: 20px 22px; min-width: 0; }
.lever-label {
  display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-500);
}
.lever-value { display: block; margin-top: 8px; font-size: 1rem; color: var(--ink-900); }

/* ---------- appendix ---------- */

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; margin-top: 30px; }
.sw { border: 1px solid var(--hairline-dark); padding: 10px; }
.sw i { display: block; height: 42px; border: 1px solid var(--hairline-dark-strong); }
.sw b { display: block; margin-top: 9px; font-family: var(--mono); font-size: 11px; font-weight: 500; color: var(--chalk-50); }
.sw span { display: block; margin-top: 3px; font-family: var(--mono); font-size: 11px; color: var(--chalk-500); }

.scale { margin-top: 30px; border-top: 1px solid var(--hairline-dark); }
.scale > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; padding: 14px 0; border-bottom: 1px solid var(--hairline-dark); min-width: 0; }
.scale .tag { font-family: var(--mono); font-size: 11px; color: var(--chalk-500); min-width: 5.5rem; letter-spacing: 0.1em; text-transform: uppercase; }
.scale .s1 { font-size: clamp(2.5rem, 6.2vw, 5rem); line-height: 1; letter-spacing: -0.035em; font-weight: 600; }
.scale .s2 { font-size: clamp(1.5rem, 4.4vw, 2.625rem); line-height: 1.06; letter-spacing: -0.025em; font-weight: 600; overflow-wrap: anywhere; min-width: 0; }
.scale .s3 { font-size: 1.375rem; font-weight: 500; letter-spacing: -0.01em; overflow-wrap: anywhere; min-width: 0; }
.scale .s4 { font-size: 1rem; color: var(--chalk-400); }
.scale .s5 { font-family: var(--mono); font-size: 0.8125rem; color: var(--chalk-400); }

/* ---------- footer ---------- */

.foot { border-top: 1px solid var(--hairline-dark); padding: 56px 0 64px; font-size: 0.875rem; color: var(--chalk-400); }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 32px; }
.foot h3 {
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--chalk-500); margin-bottom: 10px;
}
.foot address { font-style: normal; line-height: 1.75; }
.foot a { text-decoration: none; border-bottom: 1px solid var(--hairline-dark-strong); }
.foot a:hover { color: var(--chalk-50); border-bottom-color: var(--chalk-400); }
.foot li + li { margin-top: 6px; }
.foot .inactive { color: var(--chalk-500); border-bottom: 1px dotted var(--hairline-dark-strong); cursor: default; }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .hero > .wrap > * { animation: rise 220ms ease both; }
  .hero h1 { animation-delay: 40ms; }
  .hero .lead { animation-delay: 80ms; }
  .hero .cta-row { animation-delay: 120ms; }
  .hero .spec { animation-delay: 160ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

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

@media (max-width: 1080px) {
  .nav-inner { flex-wrap: wrap; padding-block: 10px; row-gap: 8px; }
  .nav-links { order: 3; width: 100%; margin-left: 0; flex-wrap: wrap; gap: 6px 18px; }
  .lang { margin-left: auto; }
  .foot-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  :root { --space-section: var(--space-section-sm); }
  .hero { padding-top: 52px; }
  .spec { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .spec > div { padding: 16px 16px 18px 0; }
  .spec > div + div { padding-left: 16px; }
  .spec > div:nth-child(3) { border-left: 0; border-top: 1px solid var(--hairline-dark); padding-left: 0; }
  .spec > div:nth-child(4) { border-top: 1px solid var(--hairline-dark); }
  .section-head { grid-template-columns: 1fr; gap: 8px; }
  .head-sub { margin-left: 0; }
  .levers { grid-template-columns: 1fr; }
  .note dl { grid-template-columns: 1fr; gap: 4px; }
  .note dd + dt { margin-top: 12px; }
  .foot-grid { grid-template-columns: 1fr; }
  /* tables keep native semantics and wrap; no horizontal trap on a phone */
  .table-scroll .data { min-width: 0; width: 100%; }
  .data thead th, .data td, .data tbody th { padding-right: 8px; font-size: 0.875rem; }
  .data tbody th { width: 32%; }
  .flow { display: none; }
  .flow-list { display: block; }
  .term pre { font-size: 11.5px; }
}

@media (max-width: 480px) {
  /* brand, language switch and links only: the CTA repeats in the hero */
  .nav .btn-primary { display: none; }
}
