/* =========================================================================
   movchan.net
   The page is a document, not a dashboard: hairline rules instead of card
   borders, section numbers in the margin, serif for prose and mono for
   structure. Exactly one element gets card chrome — the BGP hex artifact.
   ========================================================================= */

/* ── Tokens ─────────────────────────────────────────────────────────────
   Dark is the default. Light is a separate palette (warm paper), not an
   inversion — the ink stays warm in both, so the page reads as printed
   matter rather than as a UI with the lights turned off.               */

:root,
:root[data-theme="dark"] {
  color-scheme: dark;

  --bg:        #0b0c0c;   /* page */
  --bg-raise:  #121514;   /* the single card */
  --bg-sink:   #070808;   /* code wells — recessive, not raised */
  --bg-hover:  #141817;

  --rule:      #1d2120;   /* hairlines, default weight */
  --rule-2:    #2b302e;   /* hairlines that need to be seen */

  --ink:       #e7e8e3;   /* body — 15.9:1 */
  --ink-2:     #9aa09a;   /* secondary prose, metadata — 7.3:1 */
  --ink-3:     #7d837d;   /* 11px mono labels — 5.0:1, clears AA for small text */
  --ink-faint: #6b706b;   /* the repeating marker bytes only — 4.0:1 */

  --accent:    #4ed6b4;   /* links, focus, one CTA. Never a gradient. */
  --accent-2:  #d6a15e;   /* second signal — capability bytes, warnings */
  --accent-ink:#062019;   /* text on a filled accent surface */

  --shadow: 0 1px 2px rgb(0 0 0 / .5);
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg:        #f6f5f0;
  --bg-raise:  #fffefa;
  --bg-sink:   #edece5;
  --bg-hover:  #eeece4;

  --rule:      #e0ded4;
  --rule-2:    #c8c5b8;

  --ink:       #1b1c18;
  --ink-2:     #575a52;
  --ink-3:     #666961;
  --ink-faint: #797c72;

  --accent:    #0d7a65;
  --accent-2:  #8a5a13;
  --accent-ink:#ffffff;

  --shadow: 0 1px 2px rgb(27 28 24 / .06);
}

:root {
  --bar: 3.5rem;                 /* top bar height */
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --maxw: 1240px;
  --measure: 64ch;               /* prose line length */

  --serif: "Newsreader", ui-serif, Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --dur: 200ms;
  --dur-lg: 340ms;
  --ease: cubic-bezier(.2, 0, 0, 1);
}


/* ── Base ───────────────────────────────────────────────────────────── */

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: 1.0625rem;
  font-weight: 380;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--accent); color: var(--accent-ink); }

h1, h2, h3 { margin: 0; font-weight: 400; }
p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: inherit; }

/* A tint rather than a chip — a bordered box is too heavy inside serif prose. */
code {
  font-family: var(--mono);
  font-size: .875em;
  background: color-mix(in srgb, var(--ink) 9%, transparent);
  border-radius: 3px;
  padding: .1em .28em;
  white-space: nowrap;
}

/* Emphasis brightens rather than colours: the accent stays reserved for links,
   focus and the one CTA, so emphasised words never read as clickable. */
em { font-style: normal; color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: .5rem;
  z-index: 100;
  padding: .6rem 1rem;
  background: var(--bg-raise);
  border: 1px solid var(--rule-2);
  font-family: var(--mono);
  font-size: .8rem;
  text-decoration: none;
}
.skip:focus { left: 1rem; }

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


/* ── Shared type primitives ─────────────────────────────────────────── */

.label,
.eyebrow {
  font-family: var(--mono);
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.sub {
  color: var(--ink-2);
  font-size: 1rem;
  max-width: var(--measure);
  margin-bottom: 2rem;
}

.prose {
  max-width: var(--measure);
  color: var(--ink-2);
}
.prose p + p { margin-top: 1rem; }
.prose a { color: var(--ink); text-decoration: underline;
           text-decoration-color: var(--rule-2);
           text-underline-offset: .22em;
           text-decoration-thickness: 1px;
           transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease); }
.prose a:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* Hairline-separated list — the page's default way of showing a set. */
.ruled > li {
  padding: .6rem 0;
  border-top: 1px solid var(--rule);
}
.ruled > li:first-child { border-top: 0; }


/* ── Top bar ────────────────────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
}

.topbar-in {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: .6rem;
  text-decoration: none;
  margin-right: auto;
}
.brand-mark {
  font-family: var(--mono);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--accent);
}
.brand-name {
  font-family: var(--mono);
  font-size: .8125rem;
  color: var(--ink-2);
  transition: color var(--dur) var(--ease);
}
.brand:hover .brand-name { color: var(--ink); }

.nav { display: flex; gap: 1.5rem; }
.nav a {
  font-family: var(--mono);
  font-size: .8125rem;
  color: var(--ink-3);
  text-decoration: none;
  padding-block: .35rem;
  border-bottom: 1px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.nav a:hover { color: var(--ink); }
.nav a.current { color: var(--ink); border-bottom-color: var(--accent); }

.theme {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  color: var(--ink-2);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease);
}
.theme:hover { color: var(--ink); border-color: var(--rule-2); background: var(--bg-hover); }
.theme svg { width: 1rem; height: 1rem; grid-area: 1 / 1; }

/* Show the destination, not the current state. */
[data-theme="dark"]  .i-moon,
[data-theme="light"] .i-sun { display: none; }


/* ── Hero ───────────────────────────────────────────────────────────── */

.hero {
  padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3.5rem, 8vw, 6rem);
  border-bottom: 1px solid var(--rule);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* minmax guards the <pre> */
  gap: clamp(2.5rem, 5vw, 4rem);
  align-items: start;
}

.hero .eyebrow { margin-bottom: 1.75rem; }

h1 {
  font-size: clamp(2.6rem, 6.2vw, 4.4rem);
  line-height: 1.04;
  letter-spacing: -.022em;
  /* em-based measure: the line breaks stay put as the size scales, so the
     second line never orphans its last word. */
  max-width: 7.6em;
  text-wrap: pretty;
}
h1 .accent { color: var(--accent); }

.lede {
  margin-top: 1.75rem;
  max-width: 46ch;
  font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
  line-height: 1.62;
  color: var(--ink-2);
}

.hero-meta {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--ink-3);
}
.hero-meta .sep { color: var(--rule-2); }
.status { display: inline-flex; align-items: center; gap: .5rem; color: var(--ink-2); }

.dot {
  width: .4rem;
  height: .4rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.hero-cta {
  margin-top: 2.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .68rem 1.15rem;
  border: 1px solid var(--rule-2);
  border-radius: 8px;             /* buttons 8 / card 14 / hex well 4 — deliberate */
  font-family: var(--mono);
  font-size: .8125rem;
  text-decoration: none;
  color: var(--ink);
  background: transparent;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.btn:hover { background: var(--bg-hover); border-color: var(--ink-3); }
.btn svg { width: .95rem; height: .95rem; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover {
  background: color-mix(in srgb, var(--accent) 86%, var(--ink));
  border-color: color-mix(in srgb, var(--accent) 86%, var(--ink));
  color: var(--accent-ink);
}


/* ── The artifact (the only card on the page) ───────────────────────── */

.artifact {
  margin: 0;
  min-width: 0;
  background: var(--bg-raise);
  border: 1px solid var(--rule-2);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.artifact-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .8rem 1.1rem;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .06em;
}
.artifact-title { color: var(--ink-2); text-transform: uppercase; }
.artifact-state {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  color: var(--ink-3);
}

.artifact-body { padding: 1.1rem; }

.hex {
  margin: 0;
  padding: .9rem 1rem;
  background: var(--bg-sink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: clamp(.6875rem, 1.6vw, .8125rem);
  line-height: 1.9;
  white-space: pre;
  tab-size: 2;
}
.hex .hx { transition: opacity 160ms var(--ease); }
.hex .off      { color: var(--ink-3); }
.hex .f-marker { color: var(--ink-faint); }
.hex .f-hdr    { color: var(--accent); }
.hex .f-fix    { color: var(--ink); }
.hex .f-cap    { color: var(--accent-2); }

/* Legend hover dims every byte that isn't the field you're pointing at. */
.hex[data-hl] .hx                   { opacity: .2; }
.hex[data-hl="marker"] .f-marker,
.hex[data-hl="hdr"]    .f-hdr,
.hex[data-hl="fix"]    .f-fix,
.hex[data-hl="cap"]    .f-cap       { opacity: 1; }

.legend { margin-top: .9rem; display: grid; gap: 1px; }
.legend button {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: .6rem;
  padding: .3rem .25rem;
  background: transparent;
  border: 0;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: .6875rem;
  color: var(--ink-2);
  text-align: left;
  cursor: default;
  transition: background-color var(--dur) var(--ease);
}
.legend button:hover { background: var(--bg-hover); }
.legend button span { color: var(--ink-3); min-width: 0; }
.sw { flex: none; width: .5rem; height: .5rem; border-radius: 1px; transform: translateY(-1px); }
.sw-marker { background: var(--ink-3); }
.sw-hdr    { background: var(--accent); }
.sw-fix    { background: var(--ink); }
.sw-cap    { background: var(--accent-2); }

.artifact-foot {
  padding: .75rem 1.1rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: .6875rem;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}
.artifact-foot a {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--rule-2);
  text-underline-offset: .2em;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}
.artifact-foot a:hover { color: var(--accent); text-decoration-color: var(--accent); }


/* ── Document sections ──────────────────────────────────────────────── */

.doc {
  padding-block: clamp(3.5rem, 7vw, 5.5rem);
  border-bottom: 1px solid var(--rule);
  scroll-margin-top: var(--bar);
}

.doc-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2rem;
}

/* The margin column carries the section number — like a spec's running head. */
.sec {
  display: flex;
  align-items: baseline;
  gap: .75rem;
  font-family: var(--mono);
  font-size: .6875rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.sec-num  { color: var(--accent); font-variant-numeric: tabular-nums; }
.sec-name { color: var(--ink-3); }


/* ── 01 Method ──────────────────────────────────────────────────────── */

.bias {
  margin-top: 2.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.25rem;
}
.bias .label { margin-bottom: .85rem; }
.bias li {
  display: grid;
  grid-template-columns: 1.25rem minmax(0, 1fr);
  gap: .35rem;
  font-size: 1rem;
  color: var(--ink-2);
}
.mk { font-family: var(--mono); font-size: .8125rem; line-height: 1.75; }
.mk.plus  { color: var(--accent); }
.mk.minus { color: var(--ink-3); }

.strip { margin-top: 2.75rem; border-top: 1px solid var(--rule); }
.strip-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .4rem;
  padding: .9rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: .9375rem;
  color: var(--ink-2);
}
.strip-row .label { padding-top: .18rem; }
.strip-row.meta { color: var(--ink-3); font-size: .875rem; }

.tags { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; }
.tags span { font-family: var(--mono); font-size: .8125rem; color: var(--ink-3); }


/* ── 02 Work ────────────────────────────────────────────────────────── */

.record {
  padding-top: 1.1rem;
  border-top: 1px solid var(--rule-2);
  margin-bottom: 4rem;
}

.record-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.record-num  { color: var(--accent); font-variant-numeric: tabular-nums; }
.record-tags { color: var(--ink-3); }

.record h3 {
  margin-top: 1.5rem;
  font-size: clamp(1.65rem, 2.7vw, 2.15rem);
  line-height: 1.1;
  letter-spacing: -.015em;
}

.tagline {
  margin-top: .5rem;
  max-width: var(--measure);
  font-size: clamp(1.0625rem, 1.35vw, 1.1875rem);
  color: var(--accent);
}

.record .prose { margin-top: 1.1rem; }

/* Datasheet rows — the densest thing on the page, deliberately. The rules run
   the full column so they line up with the section rule above; the values keep
   their own measure. */
.spec { margin-top: 1.75rem; border-bottom: 1px solid var(--rule); }
.spec > div {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: .25rem 1.25rem;
  padding: .55rem 0;
  border-top: 1px solid var(--rule);
}
.spec dt {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: .2rem;
}
.spec dd { font-size: .9688rem; color: var(--ink-2); max-width: 52ch; }

.links { margin-top: 1.5rem; display: flex; flex-wrap: wrap; gap: 1.5rem; }
.links a {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-family: var(--mono);
  font-size: .8125rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--rule-2);
  padding-bottom: .15rem;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.links a:hover { color: var(--accent); border-color: var(--accent); }
.links svg { width: .85rem; height: .85rem; }

.also-label { margin: 3.5rem 0 1.25rem; }

.index > li {
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule);
  transition: background-color var(--dur) var(--ease);
}
.index > li:last-child { border-bottom: 1px solid var(--rule); }

.index-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.index-name {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.index-name:hover { color: var(--accent); border-color: var(--accent); }
.index-tags {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.index-desc {
  margin-top: .5rem;
  max-width: var(--measure);
  color: var(--ink-2);
  font-size: .9688rem;
}
.index-facts {
  margin-top: .5rem;
  font-family: var(--mono);
  font-size: .75rem;
  color: var(--ink-3);
}
.index-facts code { background: transparent; border: 0; padding: 0; font-size: 1em; }


/* ── 03 Notes ───────────────────────────────────────────────────────── */

.notes { border-top: 1px solid var(--rule-2); }

.note { padding: 1.6rem 0; border-bottom: 1px solid var(--rule); }
.note h3 {
  font-size: 1.25rem;
  line-height: 1.35;
  max-width: var(--measure);
  letter-spacing: -.01em;
}
.note h3 code { font-size: .8em; }
.note dl { margin-top: .9rem; max-width: var(--measure); }
.note dl > div {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: .2rem .75rem;
  padding: .25rem 0;
}
.note dt {
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: .28rem;
}
.note dd { color: var(--ink-2); font-size: .9688rem; }

.open { margin-top: 3.5rem; }
.open .label { margin-bottom: .6rem; }
.open .sub { margin-bottom: 1.25rem; }
.open-list { counter-reset: q; max-width: var(--measure); border-top: 1px solid var(--rule-2); }
.open-list > li {
  position: relative;
  padding: .95rem 0 .95rem 2.5rem;
  color: var(--ink-2);
  font-size: 1rem;
}
.open-list > li::before {
  counter-increment: q;
  content: counter(q, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 1.15rem;
  font-family: var(--mono);
  font-size: .6875rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}


/* ── 04 Log ─────────────────────────────────────────────────────────── */

.log { border-top: 1px solid var(--rule-2); }
.log > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: .5rem;
  padding: 1.4rem 0;
  border-bottom: 1px solid var(--rule);
}
.log-year {
  font-family: var(--mono);
  font-size: .8125rem;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.log ul { display: grid; gap: .5rem; max-width: var(--measure); }
.log ul li {
  position: relative;
  padding-left: 1.1rem;
  color: var(--ink-2);
  font-size: .9688rem;
}
.log ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .72em;
  width: .3rem;
  height: 1px;
  background: var(--ink-3);
}


/* ── Contact ────────────────────────────────────────────────────────── */

.contact { border-bottom: 0; }

.contact-q {
  font-size: clamp(1.85rem, 3.6vw, 2.75rem);
  line-height: 1.14;
  letter-spacing: -.018em;
  max-width: 20ch;
  margin-bottom: 1.25rem;
  text-wrap: balance;
}

.mail { margin-top: 2.25rem; display: flex; align-items: center; flex-wrap: wrap; gap: 1rem; }
.mail-link {
  font-family: var(--mono);
  font-size: clamp(1.05rem, 2.4vw, 1.5rem);
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: .2rem;
  transition: color var(--dur) var(--ease);
}
.mail-link:hover { color: var(--accent); }

.copy {
  padding: .35rem .7rem;
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: .6875rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-3);
  cursor: pointer;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease);
}
.copy:hover { color: var(--ink); border-color: var(--rule-2); background: var(--bg-hover); }
.copy[data-done] { color: var(--accent); border-color: var(--accent); }

.socials { margin-top: 2.75rem; display: grid; gap: 0; max-width: 34rem; }
.socials li { border-top: 1px solid var(--rule); }
.socials li:last-child { border-bottom: 1px solid var(--rule); }
.socials a {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .85rem .25rem;
  font-family: var(--mono);
  font-size: .875rem;
  color: var(--ink-2);
  text-decoration: none;
  transition: color var(--dur) var(--ease), padding-left var(--dur) var(--ease);
}
.socials a:hover { color: var(--accent); padding-left: .6rem; }
.socials svg { width: 1rem; height: 1rem; flex: none; }
/* Temporarily disabled social link (icon kept, link neutralized) */
.socials a.contact-link-disabled {
  color: var(--ink-3);
  cursor: not-allowed;
  opacity: .5;
}
.socials a.contact-link-disabled:hover { color: var(--ink-3); padding-left: .25rem; }
.socials a.contact-link-disabled:focus { outline: none; }


/* ── Footer ─────────────────────────────────────────────────────────── */

.foot { border-top: 1px solid var(--rule); padding-block: 2rem 2.5rem; }
.foot-in {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
}
.foot-left {
  font-family: var(--mono);
  font-size: .8125rem;
  color: var(--accent);
}
.foot-right {
  font-family: var(--mono);
  font-size: .6875rem;
  color: var(--ink-3);
}


/* ── Scroll reveal (progressive enhancement only) ───────────────────── */

.js .reveal {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--dur-lg) var(--ease), transform var(--dur-lg) var(--ease);
}
.js .reveal.in { opacity: 1; transform: none; }


/* ── Breakpoints ────────────────────────────────────────────────────── */

@media (min-width: 640px) {
  .bias      { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3rem; }
  .strip-row { grid-template-columns: 7rem minmax(0, 1fr); gap: 1.25rem; }
  .log > li  { grid-template-columns: 7rem minmax(0, 1fr); gap: 1.5rem; }
}

@media (min-width: 1024px) {
  .hero-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 25rem); align-items: center; }
  .doc-grid  { grid-template-columns: 9rem minmax(0, 1fr); gap: 3rem; }

  /* The running head tracks you down the section. */
  .margin { position: sticky; top: calc(var(--bar) + 2.5rem); align-self: start; }
  .sec    { flex-direction: column; gap: .5rem; align-items: flex-start; }

  .index > li { padding-inline: .75rem; margin-inline: -.75rem; border-radius: 6px; }
  .index > li:hover { background: var(--bg-hover); }
}

@media (max-width: 719px) {
  .nav { display: none; }
}

/* The card header is two mono strings competing for one narrow line. */
@media (max-width: 640px) {
  .artifact-head { font-size: .625rem; letter-spacing: .04em; }
}

/* Below this the label column squeezes values into ragged two-line wraps;
   stacking keeps the datasheet reading order without the raggedness. */
@media (max-width: 560px) {
  .spec > div,
  .note dl > div { grid-template-columns: minmax(0, 1fr); }
  .spec dt, .note dt { padding-top: 0; }
}


/* ── Reduced motion ─────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .socials a:hover { padding-left: .25rem; }
}


/* ── Print ──────────────────────────────────────────────────────────── */

@media print {
  .topbar, .theme, .hero-cta, .copy, .legend { display: none; }
  body { background: #fff; color: #000; }
  .doc, .hero { border-color: #ccc; }
}
