/* ─────────────────────────────────────────────────────────────────────────
   Furcate OS
   One typeface family at one weight. Emphasis by size, never by bold.
   Near-black on white, the inverse for the machine's own surfaces.
   Hairline rules, a 12-column grid, mono for indices and metadata.
   Amber is the only highlight: the value in branding/palette.json.
   ───────────────────────────────────────────────────────────────────────── */

@font-face {
  font-family: 'Instrument Sans';
  src: url('/assets/fonts/instrumentsans-latin.woff2') format('woff2');
  font-weight: 400 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/assets/fonts/geistmono-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #ffffff;
  --ink: #1a1a1a;
  --ink-2: #767676;
  --ink-3: #a8a8a8;
  --rule: #e3e4e5;
  --panel: #f5f5f4;
  --selection: #1a1a1a;
  --selection-ink: #ffffff;

  /* Furcate's highlights */
  --amber:     oklch(0.805 0.170 82);
  --amber-ink: oklch(0.520 0.135 85);   /* amber that can carry type on white */
  --amber-lit: oklch(0.840 0.175 80);
  --fault:     oklch(0.550 0.200 28);
  --accent: var(--amber-ink);

  --sans: 'Instrument Sans', "Helvetica Neue", Arial, sans-serif;
  --mono: 'Geist Mono', ui-monospace, "SF Mono", Menlo, monospace;

  --f-display: clamp(2.75rem, 7.2vw, 6.5rem);
  --f-h2: clamp(1.875rem, 3.6vw, 3rem);
  --f-h3: clamp(1.375rem, 2.2vw, 1.875rem);
  --f-h4: clamp(1.125rem, 1.5vw, 1.375rem);
  --f-body-lg: clamp(1.125rem, 1.4vw, 1.375rem);
  --f-body: 1rem;
  --f-caption: 0.8125rem;
  --f-number: 0.75rem;

  --cols: 12;
  --gutter: 12px;
  --outer: 16px;
  --measure: 34em;

  --s-1: 0.5rem; --s-2: 1rem; --s-3: 1.5rem; --s-4: 2rem;
  --s-5: 3rem; --s-6: 4.5rem; --s-7: 7rem; --s-8: 10rem;

  --radius: 4px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --t: 300ms;
  color-scheme: light;
}
@media (min-width: 640px)  { :root { --gutter: 16px; --outer: 24px; } }
@media (min-width: 1024px) { :root { --outer: 32px; } }
@media (min-width: 1440px) { :root { --outer: 40px; } }

.band-dark {
  --bg: #0e0e0f;
  --ink: #f2f2f0;
  --ink-2: #8f8f8f;
  --ink-3: #5c5c5c;
  --rule: #2a2a2c;
  --panel: #161617;
  --selection: #f2f2f0;
  --selection-ink: #0e0e0f;
  --accent: var(--amber);
  color-scheme: dark;
  background: var(--bg);
  color: var(--ink);
}

/* ── reset ─────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-weight: 400; font-size: var(--f-body); line-height: 1.4;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility; font-feature-settings: "kern", "liga", "ss01";
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
::selection { background: var(--selection); color: var(--selection-ink); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 3px; }

/* ── type roles ────────────────────────────────────────────────────────── */
.t-display { font-size: var(--f-display); line-height: 0.98; letter-spacing: -0.03em; font-weight: 400; text-wrap: balance; }
.t-h2 { font-size: var(--f-h2); line-height: 1.06; letter-spacing: -0.02em; font-weight: 400; text-wrap: balance; }
.t-h3 { font-size: var(--f-h3); line-height: 1.12; letter-spacing: -0.015em; font-weight: 400; text-wrap: balance; }
.t-h4 { font-size: var(--f-h4); line-height: 1.2; letter-spacing: -0.01em; font-weight: 400; }
.t-lg { font-size: var(--f-body-lg); line-height: 1.32; letter-spacing: -0.01em; }
.t-body { font-size: var(--f-body); line-height: 1.45; }
.t-caption { font-size: var(--f-caption); line-height: 1.45; }
.t-mono { font-family: var(--mono); font-size: var(--f-number); line-height: 1.2; letter-spacing: 0.02em; text-transform: uppercase; }
.t-2 { color: var(--ink-2); }
.measure { max-width: var(--measure); }
.count { font-family: var(--mono); font-size: var(--f-number); line-height: 1; letter-spacing: 0.02em; color: var(--ink-2); margin-left: 0.6em; vertical-align: 0.9em; }
code, .v { font-family: var(--mono); font-size: 0.9em; }

/* ── layout ────────────────────────────────────────────────────────────── */
.wrap { padding-inline: var(--outer); }
.grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-4); }
.c-6, .c-5, .c-3 { grid-column: span 12; }
.c-3 { grid-column: span 6; }
@media (min-width: 768px) {
  .c-6 { grid-column: span 6; }
  .c-5.start-7 { grid-column: 7 / span 5; }
  .c-3 { grid-column: span 3; }
}
.section { padding-block: var(--s-6); }
@media (min-width: 1024px) { .section { padding-block: var(--s-7); } }
.stack > * + * { margin-top: var(--s-2); }
.mt-1 { margin-top: var(--s-1); } .mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); }
.mt-4 { margin-top: var(--s-4); } .mt-5 { margin-top: var(--s-5); }

/* ── section head: index, title, aside ────────────────────────────────── */
.head { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-2); align-items: baseline; padding-top: var(--s-2); border-top: 1px solid var(--rule); }
.head .idx, .head .title, .head .aside { grid-column: span 12; }
@media (min-width: 768px) {
  .head .idx { grid-column: span 2; }
  .head .title { grid-column: span 7; }
  .head .aside { grid-column: 10 / span 3; }
}

/* ── index list: numbered rows separated by hairlines ─────────────────── */
.index { border-top: 1px solid var(--rule); }
.index > li { display: grid; grid-template-columns: 3rem 1fr; column-gap: var(--gutter); padding-block: var(--s-3); border-bottom: 1px solid var(--rule); align-items: baseline; }
.index > li .n { font-family: var(--mono); font-size: var(--f-number); letter-spacing: 0.02em; color: var(--ink-2); line-height: 1.6; }
.index > li .body { display: grid; grid-template-columns: 1fr; column-gap: var(--gutter); row-gap: var(--s-1); }
@media (min-width: 768px) {
  .index > li { grid-template-columns: 4rem 1fr; }
  .index > li .body { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); }
}
.index .meta { font-family: var(--mono); font-size: var(--f-number); letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2); line-height: 1.6; max-width: 32em; }
.index > li .body p { max-width: var(--measure); }

/* ── key / value ──────────────────────────────────────────────────────── */
.kv { border-top: 1px solid var(--rule); }
.kv > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); column-gap: var(--gutter); padding-block: 0.7rem; border-bottom: 1px solid var(--rule); }
.kv dt { font-family: var(--mono); font-size: var(--f-number); letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2); line-height: 1.6; }
.kv dd { font-size: var(--f-caption); line-height: 1.45; overflow-wrap: anywhere; }
.kv .note { color: var(--ink-2); }

/* ── chips ────────────────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 0.45em; border: 1px solid var(--rule); border-radius: 999px; padding: 0.3rem 0.7rem; font-family: var(--mono); font-size: var(--f-number); letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2); line-height: 1; }
.chip.now { color: var(--ink); border-color: var(--ink); }
.chip.now::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }

/* ── cards ────────────────────────────────────────────────────────────── */
.cards { display: grid; grid-template-columns: 1fr; gap: var(--gutter); }
@media (min-width: 900px) { .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { display: flex; flex-direction: column; gap: var(--s-2); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.1rem 1rem 1.2rem; }
.card > p { color: var(--ink-2); font-size: var(--f-caption); line-height: 1.45; }
.card .kv { margin-top: auto; }

/* ── figures ──────────────────────────────────────────────────────────── */
.fig { border-top: 1px solid var(--rule); padding-top: var(--s-2); display: flex; flex-direction: column; gap: var(--s-2); }
.fig .num { font-size: var(--f-h2); line-height: 1; letter-spacing: -0.02em; }
.fig .num small { font-family: var(--mono); font-size: var(--f-number); letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2); margin-left: 0.4em; }
.fig p { color: var(--ink-2); font-size: var(--f-caption); line-height: 1.45; max-width: 24em; }

/* ── a note where something was not measured ─────────────────────────── */
.notebox { background: var(--panel); border: 1px solid var(--rule); border-left: 2px solid var(--amber); border-radius: var(--radius); padding: 1rem 1.1rem; display: grid; gap: 0.6rem; max-width: 46em; }
.notebox p { font-size: var(--f-caption); line-height: 1.5; }

/* ── terminal specimens: the machine's own surface ───────────────────── */
.specimen { display: grid; gap: 0.6rem; }
.term {
  font-family: var(--mono); font-size: 0.8125rem; line-height: 1.6; white-space: pre; overflow-x: auto;
  background: #0e0e0f; color: #d9d9d6; border: 1px solid #2a2a2c; border-radius: var(--radius); padding: 1rem 1.1rem;
}
.band-dark .term { background: #161617; }
.term .p { color: #8f8f8f; }
.term .c { color: #f2f2f0; }
.term .a { color: #8f8f8f; }
.term .b { color: var(--amber-lit); }
.term .h { color: #5c5c5c; }

/* ── links and buttons ────────────────────────────────────────────────── */
.u { background-image: linear-gradient(currentColor, currentColor); background-size: 100% 1px; background-repeat: no-repeat; background-position: 0 100%; padding-bottom: 1px; transition: color var(--t) var(--ease); }
.u:hover { color: var(--accent); }
.arrow::after { content: " \2192"; white-space: nowrap; }
.btn { display: inline-flex; align-items: center; gap: 0.6em; padding: 0.8rem 1.1rem; border: 1px solid var(--ink); border-radius: var(--radius); font-size: var(--f-caption); line-height: 1; transition: background var(--t) var(--ease), color var(--t) var(--ease), border-color var(--t) var(--ease); }
.btn:hover { background: var(--ink); color: var(--bg); }
.btn.solid { background: var(--ink); color: var(--bg); }
.btn.solid:hover { background: var(--amber); border-color: var(--amber); color: #1a1a1a; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* ── nav ──────────────────────────────────────────────────────────────── */
.nav { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(140%) blur(10px); border-bottom: 1px solid var(--rule); }
.nav .bar { display: flex; align-items: center; justify-content: space-between; height: 3.5rem; position: relative; }
.wordmark { display: inline-flex; align-items: center; gap: 0.6rem; font-size: 1rem; letter-spacing: -0.01em; }
.wordmark svg { width: 16px; height: 16px; color: var(--amber-ink); }
.wordmark .os { font-family: var(--mono); font-size: var(--f-number); letter-spacing: 0.02em; color: var(--ink-2); }
.nav .links { display: none; gap: 1.5rem; align-items: center; }
.nav .links a { font-size: var(--f-caption); color: var(--ink-2); transition: color var(--t) var(--ease); }
.nav .links a:hover { color: var(--ink); }
.nav .links a.btn { color: var(--ink); padding: 0.55rem 0.8rem; }
.nav .links a.btn:hover { color: var(--bg); }
@media (min-width: 1024px) { .nav .links { display: flex; } .nav .menu { display: none; } }
.nav summary { list-style: none; cursor: pointer; font-size: var(--f-caption); color: var(--ink-2); padding: 0.4rem 0; }
.nav summary::-webkit-details-marker { display: none; }
.nav details[open] summary { color: var(--ink); }
.nav .sheet { position: absolute; left: calc(-1 * var(--outer)); right: calc(-1 * var(--outer)); top: 3.5rem; background: var(--bg); border-bottom: 1px solid var(--rule); }
.nav .sheet a { display: block; padding: 0.9rem var(--outer); border-top: 1px solid var(--rule); font-size: var(--f-h4); }

/* ── hero ─────────────────────────────────────────────────────────────── */
.hero { padding-block: var(--s-6); }
@media (min-width: 1024px) { .hero { padding-block: var(--s-7); } }
.hero .top { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-4); justify-content: space-between; margin-bottom: var(--s-5); }

/* ── footer ───────────────────────────────────────────────────────────── */
.footer { border-top: 1px solid var(--rule); padding-block: var(--s-5) var(--s-4); }
.footer .cols { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: var(--gutter); row-gap: var(--s-4); }
.footer .col { grid-column: span 6; }
@media (min-width: 768px) { .footer .col { grid-column: span 2; } .footer .col.lead { grid-column: span 4; } }
.footer a { font-size: var(--f-caption); color: var(--ink-2); transition: color var(--t) var(--ease); }
.footer a:hover { color: var(--ink); }
.footer .list > * + * { margin-top: 0.5rem; }
.footer .legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2); margin-top: var(--s-5); padding-top: var(--s-2); border-top: 1px solid var(--rule); }
.footer .legal p { max-width: 46em; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } html { scroll-behavior: auto; } }
