/* Layout: a loom. Twelve chapter strips run across the top bar like the Woven Field; each chapter opens through
   the arch window of the mark; the content sits on the 12-column Field Grid with wide margins for labels. */
:root {
  --bg: #FBF4E2;        /* Husk: the page */
  --paper: #FFFDF6;     /* card and specimen ground */
  --ink: #0F2016;       /* text */
  --soft: #4B5B50;      /* secondary text, a green-biased grey */
  --line: rgba(13, 74, 43, .16);
  --head: #0D4A2B;      /* headings: Forest */
  --accent: #0D4A2B;    /* links, active states */
  --accent-ink: #FBF4E2;
  --hi: #F8C12D;        /* Sunflower: the one highlight */
  --deep: #0D4A2B;      /* opener and hero ground */
  --deep-ink: #FBF4E2;
  --ok: #23883F; --warn: #A86A00; --bad: #B23A12;
  --display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --text: 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
  --fr: 'opsz' 144, 'SOFT' 20, 'WONK' 0;
  --fri: 'opsz' 144, 'SOFT' 40, 'WONK' 0;
  --gut: clamp(16px, 4vw, 56px);
  --max: 1240px;
  --r: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #071E13; --paper: #0C2A1B; --ink: #F1ECDB; --soft: #B5C2B3; --line: rgba(251, 244, 226, .14);
    --head: #FBF4E2; --accent: #F8C12D; --accent-ink: #0F2016; --hi: #F8C12D; --deep: #0A3420; --deep-ink: #FBF4E2;
    --ok: #6FCB86; --warn: #F2B544; --bad: #FF8A63; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #071E13; --paper: #0C2A1B; --ink: #F1ECDB; --soft: #B5C2B3; --line: rgba(251, 244, 226, .14);
  --head: #FBF4E2; --accent: #F8C12D; --accent-ink: #0F2016; --hi: #F8C12D; --deep: #0A3420; --deep-ink: #FBF4E2;
  --ok: #6FCB86; --warn: #F2B544; --bad: #FF8A63; color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.6 var(--text); -webkit-font-smoothing: antialiased; }
img, video, svg { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--hi); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--paper); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }
h1, h2, h3 { font-family: var(--display); font-weight: 500; font-variation-settings: var(--fr); color: var(--head); letter-spacing: -.02em; line-height: 1.05; margin: 0; text-wrap: balance; }
.it { font-style: italic; font-weight: 400; font-variation-settings: var(--fri); letter-spacing: -.012em; }
.eyebrow { font: 600 12px/1.3 var(--text); letter-spacing: .16em; text-transform: uppercase; color: var(--soft); }
.muted { color: var(--soft); }
.sel { user-select: all; }

/* ---------- buttons, segmented controls, chips ---------- */
.btn { font: 500 14px/1 var(--text); color: var(--ink); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; cursor: pointer; transition: background .2s, border-color .2s; }
.btn:hover { border-color: var(--accent); }
.btn.solid { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.quiet { border-color: transparent; }
.btn.tiny { font-size: 12px; padding: 4px 10px; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.seg button { font: 500 13px/1 var(--text); color: var(--soft); background: none; border: 0; border-radius: 999px; padding: 8px 13px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.controls { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-block: 0 16px; }
.controls label { font-size: 13px; color: var(--soft); display: inline-flex; align-items: center; gap: 8px; }
.chip { display: inline-block; font: 600 11px/1 var(--text); letter-spacing: .12em; text-transform: uppercase; padding: 5px 8px; border-radius: 999px; border: 1px solid currentColor; }
.chip.ok { color: var(--ok); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); }
input[type="range"] { accent-color: var(--accent); }
textarea, select, input[type="text"] { font: 400 15px/1.4 var(--text); color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; }

/* ---------- the bar and the loom ---------- */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 18px; padding: 10px var(--gut); background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.bar-brand { display: block; width: 92px; color: var(--head); line-height: 0; flex: none; }
.loom { display: flex; gap: 3px; flex: 1; justify-content: center; min-width: 0; }
.loom a { position: relative; flex: 0 1 34px; height: 34px; border-radius: 2px; overflow: hidden; outline-offset: 1px; opacity: .55; transition: opacity .2s, transform .25s; }
.loom a svg { display: block; width: 100%; height: 100%; }
.loom a:hover, .loom a[aria-current="page"] { opacity: 1; transform: translateY(-2px); }
.loom a[aria-current="page"]::after { content: ''; position: absolute; inset: auto 0 0 0; height: 4px; background: var(--hi); }
.loom a span { position: absolute; left: -999px; }
@media (max-width: 720px) { .loom { display: none; } .bar { justify-content: space-between; } }

/* ---------- contents overlay ---------- */
.index { position: fixed; inset: 0; z-index: 40; background: var(--deep); color: var(--deep-ink); overflow-y: auto; padding: calc(env(safe-area-inset-top, 0px) + 20px) var(--gut) 40px; }
.index-in { max-width: var(--max); margin: 0 auto; }
.index-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.index .eyebrow, .index .btn { color: var(--deep-ink); }
.index-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px; }
.index-list a { display: grid; grid-template-columns: 40px 1fr; gap: 4px 12px; padding: 16px; color: var(--deep-ink); text-decoration: none; border-top: 1px solid rgba(251, 244, 226, .18); }
.index-list a:hover { background: rgba(251, 244, 226, .06); }
.index-list .n { font: 500 15px/1.4 var(--display); font-variant-numeric: lining-nums tabular-nums; color: #F8C12D; }
.index-list .t { font: 500 24px/1.1 var(--display); font-variation-settings: var(--fr); }
.index-list .t i { font-style: italic; font-weight: 400; font-variation-settings: var(--fri); color: #F8C12D; }
.index-list .d { grid-column: 2; font-size: 14px; opacity: .78; }

/* ---------- page frame ---------- */
main { display: block; outline: none; }
.wrap { max-width: var(--max); margin: 0 auto; padding-inline: var(--gut); }
.seam { height: 28px; line-height: 0; overflow: hidden; }
.seam svg { width: 100%; height: 100%; display: block; }

/* ---------- home hero ---------- */
.hero { background: var(--deep); color: var(--deep-ink); }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); gap: clamp(24px, 5vw, 72px); align-items: end; padding-block: clamp(40px, 7vw, 96px) 0; }
.hero h1 { color: var(--deep-ink); font-size: clamp(44px, 7vw, 104px); }
.hero h1 .it { color: #F8C12D; display: block; }
.hero .lede { font-size: 18px; max-width: 34em; opacity: .9; margin: 22px 0 0; }
.hero .meta { display: flex; flex-wrap: wrap; gap: 8px 24px; margin-top: 28px; font-size: 13px; opacity: .75; }
.hero-lock { width: min(220px, 50%); color: var(--deep-ink); margin-bottom: 36px; }
.hero .arch { align-self: end; }

/* the arch window, from the mark */
.arch { position: relative; aspect-ratio: 1455 / 1947; max-width: 100%; border-radius: 999px 999px 0 0; overflow: hidden; background: var(--line); }
.arch img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.arch .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 10px 14px; font: 600 11px/1.3 var(--text); letter-spacing: .14em; text-transform: uppercase; color: #FBF4E2; background: linear-gradient(transparent, rgba(8, 30, 18, .7)); }

/* ---------- chapter opener ---------- */
.opener { background: var(--deep); color: var(--deep-ink); }
.opener .wrap { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .55fr); gap: clamp(24px, 5vw, 80px); align-items: end; padding-block: clamp(36px, 6vw, 72px) 0; }
.opener .kick { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.opener .kick .eyebrow { color: var(--deep-ink); opacity: .75; }
.opener h1 { color: var(--deep-ink); font-size: clamp(44px, 7.4vw, 112px); }
.opener h1 .it { display: block; color: #F8C12D; }
.opener p { font-size: 18px; max-width: 36em; margin: 22px 0 clamp(28px, 4vw, 56px); opacity: .9; }
.opener .arch { width: 100%; max-width: 300px; justify-self: end; }
@media (max-width: 760px) { .hero .wrap, .opener .wrap { grid-template-columns: 1fr; } .opener .arch, .hero .arch { max-width: 200px; justify-self: start; } }

/* ---------- sections ---------- */
.sec { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: 16px clamp(20px, 4vw, 56px); padding-block: clamp(36px, 5vw, 64px); border-top: 1px solid var(--line); }
.sec:first-child { border-top: 0; }
.sec > header .k { font: 500 15px/1 var(--display); font-variant-numeric: lining-nums tabular-nums; color: var(--soft); display: block; margin-bottom: 10px; }
.sec > header h2 { font-size: clamp(28px, 3vw, 38px); }
.sec > header p { color: var(--soft); margin: 12px 0 0; font-size: 15px; max-width: 26em; }
.sec > .content { min-width: 0; }
.sec.full { grid-template-columns: 1fr; }
@media (max-width: 860px) { .sec { grid-template-columns: 1fr; } }
.lead { font-size: 19px; line-height: 1.55; max-width: 38em; margin: 0 0 18px; }
.prose p { max-width: 40em; margin: 0 0 14px; }
.big { font: 500 clamp(30px, 3.6vw, 48px)/1.12 var(--display); font-variation-settings: var(--fr); color: var(--head); letter-spacing: -.02em; margin: 0 0 8px; max-width: 18em; text-wrap: balance; }
.big .it { color: var(--accent); }

/* grids of things */
.grid { display: grid; gap: 14px; grid-template-columns: repeat(var(--cols, 3), minmax(0, 1fr)); }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(min(var(--cols, 3), 2), minmax(0, 1fr)); } }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr; } }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; min-width: 0; }
.card h3 { font-size: 22px; margin-bottom: 6px; }
.card p { margin: 0; font-size: 15px; color: var(--soft); }
.card .eyebrow { display: block; margin-bottom: 10px; }
.defs { display: grid; gap: 0; }
.defs > div { display: grid; grid-template-columns: minmax(0, 13em) minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--line); }
.defs .t { font-weight: 600; }
.defs .d { color: var(--soft); }
@media (max-width: 560px) { .defs > div { grid-template-columns: 1fr; gap: 2px; } }
.ticks { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 26px; max-width: 42em; }
.ticks li::before { content: ''; position: absolute; left: 2px; top: .5em; width: 12px; height: 9.7px; background: var(--accent); -webkit-mask: var(--xmask) center / contain no-repeat; mask: var(--xmask) center / contain no-repeat; }

/* specimen stage */
.stage { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r); padding: clamp(16px, 3vw, 32px); }
.stage.flush { padding: 0; overflow: hidden; }
.player { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.player .canvas { display: grid; place-items: center; min-height: clamp(300px, 42vw, 460px); border-radius: var(--r); transition: background .3s; }
.player .canvas svg { width: auto; height: clamp(220px, 30vw, 340px); max-width: 82%; }
.scrub { display: flex; align-items: center; gap: 12px; }
.scrub input { flex: 1; }

/* swatches */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.sw { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--paper); }
.sw .chipc { height: 120px; }
.sw .body { padding: 12px 14px; display: grid; gap: 2px; font-size: 13px; }
.sw .body b { font: 500 20px/1.2 var(--display); font-variation-settings: var(--fr); color: var(--head); }
.sw .val { display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; color: var(--soft); background: none; border: 0; padding: 2px 0; cursor: pointer; font: inherit; text-align: left; }
.sw .val:hover { color: var(--ink); }
.share { display: flex; height: 64px; border-radius: var(--r); overflow: hidden; border: 1px solid var(--line); }
.share div { min-width: 0; }
.share-l { display: flex; margin-top: 8px; font-size: 12px; color: var(--soft); }
.share-l span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* galleries */
.gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.gallery.wide { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
.tile { position: relative; margin: 0; border-radius: var(--r); overflow: hidden; background: var(--line); cursor: zoom-in; border: 0; padding: 0; text-align: left; }
.tile img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .5s; }
.tile.tall img { aspect-ratio: 4 / 5; }
.tile:hover img { transform: scale(1.03); }
.tile figcaption, .tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 12px 10px; font-size: 13px; color: #FBF4E2; background: linear-gradient(transparent, rgba(8, 30, 18, .78)); display: flex; justify-content: space-between; gap: 8px; align-items: end; }
.tile .code { font: 600 11px/1 var(--text); letter-spacing: .12em; text-transform: uppercase; opacity: .85; white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

/* patterns */
.pat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.pat-grid figure { margin: 0; }
.pat-grid svg { display: block; width: 100%; height: auto; border-radius: 4px; }
.pat-grid figcaption { font-size: 13px; margin-top: 6px; color: var(--soft); }
.pat-grid figcaption b { display: block; color: var(--ink); font-weight: 600; }
.pat-stage svg { display: block; width: 100%; height: auto; border-radius: var(--r); }

/* type */
.specimen { font-family: var(--display); font-variation-settings: var(--fr); color: var(--head); }
.tester-out { min-height: 160px; display: grid; align-items: center; padding: 24px; border-radius: var(--r); overflow-wrap: anywhere; transition: background .3s; }
.rule-out { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; font-size: 14px; }
.scale { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.scale td, .scale th { text-align: left; padding: 12px 10px 12px 0; border-top: 1px solid var(--line); vertical-align: baseline; }
.scale th { font: 600 11px/1 var(--text); letter-spacing: .14em; text-transform: uppercase; color: var(--soft); }
.scroll-x { overflow-x: auto; }

/* misc */
.pairing { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 700px) { .pairing { grid-template-columns: 1fr; } }
.pair-preview { border-radius: var(--r); padding: 28px; display: grid; gap: 6px; align-content: center; min-height: 180px; }
.ratio { font: 500 52px/1 var(--display); font-variation-settings: var(--fr); font-variant-numeric: lining-nums; color: var(--head); }
.film video { display: block; width: 100%; border-radius: var(--r); background: #000; }
.manifesto { font: 500 clamp(26px, 3.2vw, 42px)/1.25 var(--display); font-variation-settings: var(--fr); color: var(--head); max-width: 22em; }
.manifesto .it { color: var(--accent); }
.vs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2px; }
.vs > div { padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); font-size: 15px; }
.vs .no { color: var(--soft); text-decoration: line-through; text-decoration-color: var(--bad); }
@media (max-width: 600px) { .vs { grid-template-columns: 1fr; } }
.files { display: grid; gap: 0; }
.files a, .files .f { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 14px; min-width: 0; }
.files a span:first-child, .files .f span:first-child { overflow-wrap: anywhere; min-width: 0; }
.files .kb { color: var(--soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.note { border-left: 3px solid var(--hi); padding: 10px 16px; background: var(--paper); border-radius: 0 var(--r) var(--r) 0; font-size: 15px; max-width: 46em; }

/* chapter navigation */
.next { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-top: 24px; }
.next a { padding: 26px var(--gut); background: var(--deep); color: var(--deep-ink); text-decoration: none; display: grid; gap: 6px; }
.next a:last-child { text-align: right; }
.next .eyebrow { color: var(--deep-ink); opacity: .7; }
.next .t { font: 500 26px/1.1 var(--display); font-variation-settings: var(--fr); }

/* footer */
.foot { border-top: 1px solid var(--line); }
.foot-in { max-width: var(--max); margin: 0 auto; padding: 40px var(--gut) calc(40px + env(safe-area-inset-bottom, 0px)); display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1fr); gap: 28px; }
.foot-lock { color: var(--head); width: 96px; }
.foot p { margin: 8px 0 0; font-size: 14px; }
@media (max-width: 760px) { .foot-in { grid-template-columns: 1fr; } }

/* lightbox and toast */
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(1400px, 94vw); max-height: 92vh; }
.lightbox::backdrop { background: rgba(5, 20, 12, .9); }
.lightbox figure { margin: 0; }
.lightbox img { display: block; max-width: 100%; max-height: 84vh; border-radius: var(--r); margin: 0 auto; }
.lightbox figcaption { color: #FBF4E2; font-size: 14px; padding: 10px 2px; }
.lb-close { position: sticky; float: right; color: #FBF4E2; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px; font-size: 14px; }

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