/* Informed Kinetics — Brand Guidelines stylesheet
   Tokens are the single source of truth for the website build.
   DARK (ink) is the standard theme — its values live in :root.
   [data-theme="light"] is the opt-in light surface. */

:root {
  /* ---- Core palette (source of truth = hex) ---- */
  --ink:    #1C1C1C;   /* oklch(0.27 0.00 0)    primary dark surface + text */
  --paper:  #FFFFFF;   /* oklch(1.00 0.00 0)    primary light surface */
  --lavender: #8884FF;   /* oklch(0.69 0.17 285)  accent · eyebrows · info */
  --green:  #1C7C54;   /* oklch(0.50 0.11 159)  accent · links · positive */
  --mint:   #73E2A7;   /* oklch(0.85 0.13 158)  accent · CTA fill · highlight */

  /* ---- Accent roles (defaults = DARK standard) ---- */
  --accent-bright: var(--lavender); /* bright lavender — fills & large/decorative only */
  --lavender-text:   #5B4FD1;       /* deep lavender — accessible accent text on PAPER (6.0:1) */
  --accent:        var(--mint);   /* accent text — mint on ink (default) */
  --link:          var(--mint);   /* inline links — mint on ink (default) */
  --link-hover:    #A6ECC6;        /* link hover — lighter mint on ink */
  --focus:         var(--mint);   /* focus ring */

  /* ---- Interaction shades (button hover / active) ---- */
  --mint-700: #54C98D;
  --mint-800: #43B97D;
  --ink-700:  #343330;
  --green-700:#15633F;

  /* ---- Extended hues (data + semantics, share the brand chroma band) ---- */
  --amber:  #E0A24A;   /* oklch(0.76 0.12 75) */
  --slate:  #3D5A9E;   /* oklch(0.45 0.11 270) — data cat. 5, CVD-distinct */
  --teal:   #2F8E8E;   /* oklch(0.57 0.08 197) */
  --rose:   #C76590;   /* oklch(0.62 0.13 350) */

  /* ---- Tints (callout backgrounds) — DARK standard defaults ---- */
  --lavender-tint: #2A2740;
  --green-tint:  #16302A;
  --mint-tint:   #1E3A2C;
  --amber-tint:  #3A3220;
  --slate-tint:  #23283A;
  --danger-tint: #3A2422;

  /* ---- Semantic ---- */
  --success: var(--green);
  --warning: var(--amber);
  --danger:  #D6534F;
  --info:    var(--lavender);

  /* ---- Surface + text ramp — DARK (ink) is the standard ---- */
  --bg:        #1C1C1C;
  --bg-sunk:   #161616;   /* page / sunk panels */
  --surface:   #232220;   /* cards */
  --text:      #FFFFFF;   /* primary text */
  --muted:     #B4B2AB;   /* secondary / body-muted */
  --faint:     #76746D;   /* captions, axis labels, meta */
  --line:      #34332F;   /* hairlines, borders */
  --chip:      #262522;   /* pills, code chips, swatches frame */

  /* ---- Type ---- */
  --impact: 'Mozilla Text', sans-serif;   /* eyebrows, headings, display */
  --body:   'IBM Plex Sans', sans-serif;  /* paragraphs, UI */
  --mono:   'IBM Plex Mono', monospace;   /* labels, code, data, kickers */

  /* ---- Type scale (base 16px = 1rem) ---- */
  --t-display: 3.5rem;     /* 56 */
  --t-h1:      2.75rem;    /* 44 */
  --t-h2:      2rem;       /* 32 */
  --t-h3:      1.5625rem;  /* 25 */
  --t-h4:      1.25rem;    /* 20 */
  --t-lede:    1.0625rem;  /* 17 */
  --t-body:    1rem;       /* 16 */
  --t-small:   0.875rem;   /* 14 */
  --t-caption: 0.8125rem;  /* 13 */
  --t-eyebrow: 0.75rem;    /* 12 */

  --radius-sm:   6px;
  --radius:      10px;
  --radius-lg:   16px;
  --radius-pill: 999px;
  --maxw:        1080px;

  /* ---- Spacing scale — matches Tailwind defaults (step n = n × 0.25rem) ---- */
  --space-1:  0.25rem;  /* 4  · Tailwind 1 */
  --space-2:  0.5rem;   /* 8  · Tailwind 2 */
  --space-3:  0.75rem;  /* 12 · Tailwind 3 */
  --space-4:  1rem;     /* 16 · Tailwind 4 */
  --space-5:  1.25rem;  /* 20 · Tailwind 5 */
  --space-6:  1.5rem;   /* 24 · Tailwind 6 */
  --space-8:  2rem;     /* 32 · Tailwind 8 */
  --space-10: 2.5rem;   /* 40 · Tailwind 10 */
  --space-12: 3rem;     /* 48 · Tailwind 12 */
  --space-16: 4rem;     /* 64 · Tailwind 16 */
  --space-20: 5rem;     /* 80 · Tailwind 20 */
  --space-24: 6rem;     /* 96 · Tailwind 24 */
}

[data-theme="light"] {
  --bg:      #FFFFFF;
  --bg-sunk: #F4F2EF;
  --surface: #FFFFFF;
  --text:    #1C1C1C;
  --muted:   #56544E;
  --faint:   #9A988F;
  --line:    #E9E7E2;
  --chip:    #F3F1EC;
  --accent:  #5B4FD1;
  --link:    var(--green);
  --link-hover: #15633F;
  --focus:   #5B4FD1;
  /* tints on paper */
  --lavender-tint: #ECEBFF; --green-tint: #E2F1EA; --mint-tint: #E4F8EE;
  --amber-tint: #FBF0DD; --slate-tint: #E7EBF5; --danger-tint: #FBE4E3;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-sunk);
  color: var(--text);
  font-family: var(--body);
  font-size: var(--t-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- Layout ---------- */
.page { max-width: 1080px; margin: 0 auto; background: var(--bg); }
.pad  { padding: 0 72px; }
.sec  { padding: 76px 72px; border-top: 1px solid var(--line); }
.sec:first-of-type { border-top: 0; }

.sec-head { display: flex; align-items: baseline; gap: 18px; margin-bottom: 8px; }
.sec-num {
  font-family: var(--mono); font-size: var(--t-caption); font-weight: 600;
  letter-spacing: 0.14em; color: var(--accent);
}
.sec h2 {
  font-family: var(--impact); font-weight: 600; font-size: var(--t-h2);
  letter-spacing: -0.015em; line-height: 1.1; margin: 0;
}
.sec-intro {
  max-width: 640px; color: var(--muted); font-size: var(--t-lede);
  line-height: 1.55; margin: 0 0 44px;
}
.sec-intro b { color: var(--text); font-weight: 600; }

/* sub block */
.block { margin: 52px 0 0; }
.block-label {
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--faint); margin: 0 0 20px;
  padding-bottom: 12px; border-bottom: 1px solid var(--line);
}
.note { color: var(--muted); font-size: var(--t-small); line-height: 1.6; max-width: 600px; }
.note + .note { margin-top: 10px; }
code, .kbd {
  font-family: var(--mono); font-size: 0.8125em; background: var(--chip);
  padding: 2px 7px; border-radius: 5px; color: var(--text);
}

.grid { display: grid; gap: 22px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- Cover ---------- */
.cover { background: var(--ink); color: #fff; padding: 96px 72px 84px; }
.cover .eyebrow, .cover .s-eyebrow { color: var(--mint); }
.cover h1 {
  font-family: var(--impact); font-weight: 600; font-size: var(--t-display);
  letter-spacing: -0.03em; line-height: 1.0; margin: 22px 0 0;
}
.cover p { color: #B4B2AB; font-size: var(--t-lede); max-width: 460px; margin: 24px 0 0; }
.cover-meta {
  margin-top: 60px; padding-top: 22px; border-top: 1px solid #34332F;
  display: flex; flex-wrap: wrap; gap: 14px 48px; font-family: var(--mono); font-size: var(--t-caption);
  letter-spacing: 0.06em; text-transform: uppercase; color: #76746D;
}
.cover-meta span { display: inline-flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.cover-meta b { color: #fff; font-weight: 500; }

/* ---------- shared eyebrow ---------- */
/* .eyebrow is the canonical token; .s-eyebrow is an alias used in specimens. Keep identical. */
.eyebrow, .s-eyebrow {
  font-family: var(--body); font-weight: 600; font-size: var(--t-eyebrow);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent);
}

/* ---------- Logo tiles ---------- */
.tile {
  border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  min-height: 188px; position: relative;
}
.tile.dark  { background: var(--ink); }
.tile.lite  { background: #FFFFFF; }
.tile.sunk  { background: #F4F2EF; }
.tile-cap {
  font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--faint);
  position: absolute; left: 14px; top: 12px;
}
.tile.dark .tile-cap { color: #76746D; }

.usage { width: 100%; border-collapse: collapse; font-size: var(--t-small); }
.usage th, .usage td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.usage th {
  font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--faint); font-weight: 600;
}
.usage td:first-child { font-weight: 600; white-space: nowrap; }
.usage td.use { color: var(--muted); }

/* clear-space + min-size diagram */
.spacing-demo { background: var(--bg-sunk); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 40px; }

/* do / dont */
.dd { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.dd-fig { min-height: 150px; display: flex; align-items: center; justify-content: center; background: #F4F2EF; }
.dd-fig.dark { background: var(--ink); }
.dd-body { padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.dd-tag { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.14em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 7px; font-weight: 600; }
.dd-tag.yes { color: var(--green); }
.dd-tag.no  { color: var(--danger); }
.dd-tag .mk { width: 14px; height: 14px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 9px; }
.dd-tag.yes .mk { background: var(--green); }
.dd-tag.no  .mk { background: var(--danger); }
.dd p { margin: 8px 0 0; font-size: var(--t-small); color: var(--muted); line-height: 1.5; }

/* ---------- Color swatches ---------- */
.swatches { display: grid; gap: 18px; grid-template-columns: repeat(5, 1fr); }
.sw { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.sw-chip { height: 96px; }
.sw-meta { padding: 12px 14px 14px; }
.sw-name { font-weight: 600; font-size: var(--t-small); }
.sw-hex { font-family: var(--mono); font-size: var(--t-caption); color: var(--muted); margin-top: 3px; text-transform: uppercase; }
.sw-use { font-size: var(--t-caption); color: var(--faint); margin-top: 8px; line-height: 1.45; }

/* text ramp demo */
.ramp { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.ramp-head { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.16em; text-transform: uppercase; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.ramp.onlite { background: #fff; color: #1C1C1C; }
.ramp.ondark { background: #1C1C1C; color: #fff; border-color: #34332F; }
.ramp.ondark .ramp-head { border-color: #34332F; color: #76746D; }
.ramp-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 16px; }
.ramp-row + .ramp-row { border-top: 1px solid currentColor; border-image: linear-gradient(transparent, transparent) 1; }
.ramp.onlite .ramp-row + .ramp-row { border-top: 1px solid var(--line); }
.ramp.ondark .ramp-row + .ramp-row { border-top: 1px solid #34332F; }
.ramp-sample { font-size: var(--t-lede); font-weight: 500; }
.ramp-token { font-family: var(--mono); font-size: var(--t-caption); opacity: 0.7; }

/* buttons */
.btnrow { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; }
.btn { font-family: var(--body); font-weight: 600; font-size: var(--t-small); padding: 11px 20px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; transition: background .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease; }
.btn-primary  { background: var(--mint); color: var(--ink); }
.btn-ink      { background: var(--ink); color: #fff; }
.btn-paper    { background: #FFFFFF; color: var(--ink); }
.btn-outline  { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost    { background: var(--chip); color: var(--text); }
.btn-link     { background: transparent; color: var(--link); padding-left: 0; padding-right: 0; min-height: 0; }
/* states */
.btn-primary:hover { background: var(--mint-700); }
.btn-primary:active { background: var(--mint-800); }
.btn-ink:hover { background: var(--ink-700); }
.btn-ink:active { background: #000; }
.btn-paper:hover { background: #ECEAE5; }
.btn-paper:active { background: #DCDAD4; }
.btn-outline:hover { background: var(--chip); border-color: var(--faint); }
.btn-outline:active { background: var(--line); }
.btn-link:hover { text-decoration: underline; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.38; cursor: not-allowed; box-shadow: none; }
.surface-dark .btn:focus-visible { box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--mint); }

/* ---------- inline links ---------- */
.lnk, .prose a {
  color: var(--link); text-decoration: underline; text-underline-offset: 2px;
  text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
  border-radius: 3px; transition: color .12s ease, text-decoration-color .12s ease;
}
.lnk:hover, .prose a:hover { color: var(--link-hover); text-decoration-color: currentColor; }
.lnk:focus-visible, .prose a:focus-visible {
  outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--focus); text-decoration: none;
}
/* badges + token table for accessibility / layout sections */
.pill { display: inline-block; padding: 3px 9px; border-radius: var(--radius-pill); font-family: var(--mono); font-size: 0.625rem; font-weight: 600; letter-spacing: 0.06em; }
.pill.pass { background: var(--green-tint); color: var(--mint); }
.pill.fail { background: var(--danger-tint); color: #EE8A86; }
[data-theme="light"] .pill.pass { color: var(--green); }
[data-theme="light"] .pill.fail { color: var(--danger); }
.tintrow { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; }
.tint { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.tint .swatchset { display: flex; height: 56px; }
.tint .swatchset > div { flex: 1; }
.tint .tint-meta { padding: 10px 12px; font-size: var(--t-caption); }
.tint .tint-meta .nm { font-weight: 600; }
.tint .tint-meta .mono { font-family: var(--mono); color: var(--faint); font-size: 0.625rem; margin-top: 2px; }

.surface-dark { background: var(--ink); border-radius: var(--radius-lg); padding: 30px; }
.surface-dark .btn-outline { color: #fff; border-color: #34332F; }

/* data viz */
.cats { display: grid; gap: 14px; grid-template-columns: repeat(5, 1fr); }
.cat { display: flex; align-items: center; gap: 10px; font-size: var(--t-caption); }
.cat .dot { width: 18px; height: 18px; border-radius: 50%; flex: 0 0 auto; }
.cat .mono { font-family: var(--mono); color: var(--muted); }
.seq { display: flex; height: 44px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.seq > div { flex: 1; }
.chart-wrap { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 26px 30px; background: var(--surface); }

/* type specimen */
.spec-row { display: grid; grid-template-columns: 200px 1fr; gap: 40px; padding: 26px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.spec-row:last-child { border-bottom: 0; }
.spec-meta .tk { font-family: var(--mono); font-size: var(--t-caption); font-weight: 600; color: var(--accent); }
.spec-meta dl { margin: 12px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: var(--t-caption); }
.spec-meta dt { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.spec-meta dd { margin: 0; color: var(--muted); }
.specimen { color: var(--text); }

.s-display { font-family: var(--impact); font-weight: 600; font-size: var(--t-display); line-height: 1.0;  letter-spacing: -0.03em; }
.s-h1 { font-family: var(--impact); font-weight: 600; font-size: var(--t-h1); line-height: 1.05; letter-spacing: -0.02em; }
.s-h2 { font-family: var(--impact); font-weight: 600; font-size: var(--t-h2); line-height: 1.1;  letter-spacing: -0.015em; }
.s-h3 { font-family: var(--impact); font-weight: 600; font-size: var(--t-h3); line-height: 1.2;  letter-spacing: -0.01em; }
.s-h4 { font-family: var(--impact); font-weight: 600; font-size: var(--t-h4); line-height: 1.3; }
.s-lede { font-family: var(--body); font-weight: 400; font-size: var(--t-lede); line-height: 1.55; color: var(--muted); }
.s-body { font-family: var(--body); font-weight: 400; font-size: var(--t-body); line-height: 1.6; color: var(--muted); }
.s-small { font-family: var(--body); font-weight: 400; font-size: var(--t-small); line-height: 1.55; color: var(--muted); }
.s-eyebrow { font-family: var(--body); font-weight: 600; font-size: var(--t-eyebrow); letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }

/* anatomy of a heading */
.anatomy { background: var(--bg-sunk); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 40px 44px; }

/* asset download list */
.dl-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.dl-row {
  display: flex; align-items: center; gap: 16px; padding: 13px 18px;
  text-decoration: none; color: var(--text); border-top: 1px solid var(--line);
  transition: background .12s ease;
}
.dl-row:first-child { border-top: 0; }
.dl-row:hover { background: var(--chip); }
.dl-row:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.dl-thumb { width: 40px; height: 40px; border-radius: 8px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.dl-thumb img { max-width: 78%; max-height: 78%; }
.dl-thumb.ink { background: var(--ink); }
.dl-thumb.paper { background: #fff; border: 1px solid var(--line); }
.dl-thumb.sunk { background: var(--bg-sunk); }
.dl-thumb.code { background: var(--chip); font-family: var(--mono); font-size: 0.625rem; font-weight: 600; color: var(--accent); letter-spacing: 0.04em; }
.dl-name { font-family: var(--mono); font-size: var(--t-small); font-weight: 600; }
.dl-desc { font-size: var(--t-caption); color: var(--faint); margin-top: 2px; }
.dl-meta { flex: 1; min-width: 0; }
.dl-fmt { font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); flex: 0 0 auto; }
.dl-arrow { flex: 0 0 auto; color: var(--faint); font-size: 14px; }
.dl-row:hover .dl-arrow { color: var(--accent); }

/* section nav */
.nav {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 4px;
  padding: 12px 72px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.nav .nav-brand { width: 24px; height: 24px; margin-right: 14px; flex: 0 0 auto; line-height: 0; }
.nav a {
  font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--muted); text-decoration: none; padding: 7px 12px; border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: color .12s ease, background .12s ease;
}
.nav a:hover { color: var(--text); background: var(--chip); }
.nav a.active { color: var(--accent); background: var(--chip); }
.nav .nav-spacer { flex: 1; }

/* theme toggle */
.toggle {
  position: fixed; top: 20px; right: 20px; z-index: 50;
  display: inline-flex; align-items: center; gap: 9px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 8px 15px 8px 12px;
  font-family: var(--mono); font-size: 0.625rem; letter-spacing: 0.14em; text-transform: uppercase;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.toggle .dot { width: 13px; height: 13px; border-radius: 50%;
  background: conic-gradient(from 220deg, var(--lavender), var(--mint), var(--green), var(--lavender)); }

@media (max-width: 900px) {
  .pad, .sec, .cover { padding-left: 28px; padding-right: 28px; }
  .nav { padding-left: 16px; padding-right: 16px; gap: 0; overflow-x: auto; }
  .nav a { padding: 7px 9px; }
  .g4, .g3 { grid-template-columns: repeat(2, 1fr); }
  .swatches, .cats, .tintrow { grid-template-columns: repeat(2, 1fr); }
  .spec-row { grid-template-columns: 1fr; gap: 18px; }
  .grid.g2 { grid-template-columns: 1fr; }
}

/* Responsive type — mobile scale (documented in the type table) */
@media (max-width: 640px) {
  :root {
    --t-display: 2.25rem;  /* 36 */
    --t-h1:      2rem;     /* 32 */
    --t-h2:      1.625rem; /* 26 */
    --t-h3:      1.375rem; /* 22 */
    --t-h4:      1.125rem; /* 18 */
    --t-lede:    1rem;     /* 16 */
    --t-eyebrow: 0.6875rem;/* 11 */
  }
}

@media print {
  .toggle, .nav { display: none; }
  .sec { break-inside: avoid; }
}
