/* Korea Spinner — design tokens and layout.
   Light by default, dark when the viewer asks for it; [data-theme] on <html>
   wins over the media query in both directions so the toggle always works. */

:root {
  color-scheme: light;

  --ink: #14110E;
  --ink-2: #5B534A;
  --ink-3: #8C8277;
  --paper: #FFF9EC;
  --paper-2: #F6EEDD;
  --card: #FFFFFF;
  --line: #E6DCC7;
  --line-2: #D6C9AE;

  --seal: #FF2E6E;
  --seal-ink: #FFFFFF;
  --gold: #FFD23F;
  --teal: #17BEBB;
  --indigo: #2D3A8C;
  --night: #120F1C;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 28px;
  --shadow: 0 2px 4px rgba(20, 17, 14, .04), 0 12px 32px rgba(20, 17, 14, .08);
  --shadow-lg: 0 4px 8px rgba(20, 17, 14, .06), 0 24px 64px rgba(20, 17, 14, .14);

  --shell: 1120px;
  --gap: clamp(16px, 2.2vw, 28px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);

  --sans: "Outfit", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --kr: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", ui-sans-serif, sans-serif;
}

:root:not([data-theme="light"]) {
  @media (prefers-color-scheme: dark) {
    color-scheme: dark;
    --ink: #F5EFE4;
    --ink-2: #B3A899;
    --ink-3: #857B6E;
    --paper: #14110E;
    --paper-2: #1C1813;
    --card: #221D17;
    --line: #322B23;
    --line-2: #463D32;
    --gold: #FFCE2B;
    --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .4);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, .35), 0 24px 64px rgba(0, 0, 0, .5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #F5EFE4;
  --ink-2: #B3A899;
  --ink-3: #857B6E;
  --paper: #14110E;
  --paper-2: #1C1813;
  --card: #221D17;
  --line: #322B23;
  --line-2: #463D32;
  --gold: #FFCE2B;
  --shadow: 0 2px 4px rgba(0, 0, 0, .3), 0 12px 32px rgba(0, 0, 0, .4);
  --shadow-lg: 0 4px 8px rgba(0, 0, 0, .35), 0 24px 64px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

body {
  margin: 0;
  padding: 0 0 calc(64px + var(--safe-b));
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

:is(h1, h2, h3) { letter-spacing: -.035em; line-height: 1.1; margin: 0; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
img, svg { max-width: 100%; }
:focus-visible { outline: 3px solid var(--seal); outline-offset: 3px; border-radius: 6px; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.shell { width: 100%; max-width: var(--shell); margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }
.kr { font-family: var(--kr); }
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ------------------------------------------------------------------ nav -- */

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: var(--safe-t);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.nav.stuck { border-bottom-color: var(--line); }
.nav-in { display: flex; align-items: center; gap: 12px; height: 60px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.04em; font-size: 1.02rem; text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; flex: 0 0 auto;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--seal), #FF7A3D 55%, var(--gold));
  display: grid; place-items: center;
  color: #fff; font-family: var(--kr); font-weight: 900; font-size: 15px;
  box-shadow: 0 2px 10px color-mix(in srgb, var(--seal) 40%, transparent);
}
.nav-links { display: none; gap: 4px; margin-left: auto; }
@media (min-width: 860px) { .nav-links { display: flex; } }
.nav-links a {
  padding: 7px 12px; border-radius: 999px; font-size: .9rem; font-weight: 600;
  color: var(--ink-2); text-decoration: none; transition: background .16s, color .16s;
}
.nav-links a:hover { background: var(--paper-2); color: var(--ink); }
.nav-act { margin-left: auto; display: flex; gap: 8px; align-items: center; }
@media (min-width: 860px) { .nav-act { margin-left: 8px; } }

.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center;
  border-radius: 12px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); transition: border-color .16s, transform .12s;
}
.icon-btn:hover { border-color: var(--line-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 19px; height: 19px; }

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

.hero { position: relative; isolation: isolate; overflow: hidden; background: var(--night); color: #F7F2E8; }
.hero-art { position: absolute; inset: 0; z-index: -1; }
.hero-art svg { width: 100%; height: 100%; object-fit: cover; display: block; }
/* The skyline is busy exactly where the copy sits, so darken it behind the text. */
.hero-art::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(100deg, rgba(18, 15, 28, .92) 0%, rgba(18, 15, 28, .78) 42%, rgba(18, 15, 28, .34) 72%, rgba(18, 15, 28, .12) 100%),
    linear-gradient(to bottom, rgba(18, 15, 28, .5), rgba(18, 15, 28, 0) 34%);
}
@media (max-width: 720px) {
  .hero-art::after {
    background: linear-gradient(to bottom, rgba(18, 15, 28, .82) 0%, rgba(18, 15, 28, .72) 55%, rgba(18, 15, 28, .86) 100%);
  }
}
.hero-in { padding-block: clamp(40px, 7vw, 80px) clamp(32px, 5vw, 56px); }
.hero h1 {
  font-size: clamp(2.1rem, 6.2vw, 3.9rem);
  max-width: 17ch;
  text-wrap: balance;
}
.hero h1 em { font-style: normal; color: var(--gold); }
.hero-sub { margin-top: 14px; max-width: 46ch; color: #C8BFB0; font-size: clamp(.98rem, 1.6vw, 1.1rem); }

.tryit { margin-top: clamp(24px, 4vw, 36px); max-width: 640px; }
.tryit-label { display: block; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); font-weight: 700; margin-bottom: 10px; }
.tryit-row { display: flex; gap: 10px; }
.tryit-row input {
  flex: 1 1 auto; min-width: 0;
  font: inherit; font-size: clamp(1.05rem, 2.4vw, 1.3rem); font-weight: 600;
  padding: 15px 18px;
  color: #fff;
  background: rgba(255, 255, 255, .07);
  border: 1.5px solid rgba(255, 255, 255, .22);
  border-radius: 14px;
  transition: border-color .18s, background .18s;
}
.tryit-row input::placeholder { color: rgba(247, 242, 232, .42); font-weight: 400; }
.tryit-row input:focus { outline: none; border-color: var(--gold); background: rgba(255, 255, 255, .11); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px;
  border-radius: 999px; font-weight: 700; font-size: .95rem;
  background: var(--seal); color: var(--seal-ink);
  border: 1.5px solid transparent;
  transition: transform .12s, filter .16s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: scale(.96); }
.btn.ghost { background: transparent; color: inherit; border-color: currentColor; opacity: .85; }
.btn.ghost:hover { opacity: 1; background: color-mix(in srgb, currentColor 10%, transparent); }
.btn.sm { min-height: 38px; padding: 0 15px; font-size: .86rem; }
.btn[disabled] { opacity: .45; pointer-events: none; }

/* result card in the hero */
.namecard {
  margin-top: 20px;
  border-radius: var(--radius-lg);
  padding: clamp(20px, 3.5vw, 30px);
  background: linear-gradient(150deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .05));
  border: 1.5px solid rgba(255, 255, 255, .16);
  backdrop-filter: blur(8px);
}
.namecard[hidden] { display: none; }
.namecard-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.namecard-h {
  font-family: var(--kr); font-weight: 900;
  font-size: clamp(2.6rem, 9vw, 4.4rem); line-height: 1;
  letter-spacing: .02em;
  background: linear-gradient(120deg, #fff 20%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.namecard-r { margin-top: 6px; color: #C8BFB0; font-size: .96rem; }
.namecard-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.blocks { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.block {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  min-width: 58px; padding: 9px 10px 7px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .14);
  transition: transform .14s, background .16s;
}
.block:hover { background: rgba(255, 255, 255, .17); transform: translateY(-2px); }
.block-h { font-family: var(--kr); font-size: 1.55rem; font-weight: 700; line-height: 1.1; }
.block-r { font-size: .67rem; letter-spacing: .07em; text-transform: uppercase; color: #B6ACA0; }
.namecard-note { margin-top: 14px; font-size: .83rem; color: #A99F92; }

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

.sec { padding: clamp(48px, 7vw, 88px) 0 0; }
.sec-head { max-width: 62ch; margin-bottom: clamp(20px, 3vw, 32px); }
.sec-kicker { font-size: .76rem; letter-spacing: .13em; text-transform: uppercase; font-weight: 700; color: var(--seal); }
.sec-head h2 { font-size: clamp(1.6rem, 3.6vw, 2.4rem); margin-top: 8px; text-wrap: balance; }
.sec-head p { margin-top: 10px; color: var(--ink-2); }

/* ------------------------------------------------------------ tool grid -- */

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 22px; }
.chip {
  padding: 8px 15px; border-radius: 999px; font-size: .88rem; font-weight: 600;
  border: 1.5px solid var(--line); background: var(--card); color: var(--ink-2);
  transition: border-color .16s, color .16s, background .16s;
}
.chip:hover { border-color: var(--line-2); color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

.grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 620px) { .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 980px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.tool {
  min-width: 0;
  display: flex; flex-direction: column;
  border-radius: var(--radius);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.tool:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--line-2); }
.tool[hidden] { display: none; }
.tool-art { position: relative; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: var(--paper-2); }
.tool-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.tool-tag {
  position: absolute; left: 12px; top: 12px;
  padding: 5px 11px; border-radius: 999px;
  font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  background: rgba(20, 17, 14, .58); color: #fff; backdrop-filter: blur(6px);
}
.tool-body { padding: 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.tool-body h3 { font-size: 1.15rem; }
.tool-body p { color: var(--ink-2); font-size: .92rem; }
.tool-out {
  margin-top: 4px; padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--paper-2);
  border: 1px dashed var(--line-2);
  min-height: 84px;
  /* Cards in a row are stretched to the tallest; let the result panel take the
     slack so shorter cards do not show a white void above their buttons. */
  flex: 1 1 auto;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
}
.tool-out .big { font-size: 1.18rem; font-weight: 700; letter-spacing: -.02em; }
.tool-out .big .kr { color: var(--seal); }
.tool-out .sub { font-size: .88rem; color: var(--ink-2); }
.tool-out .idle { color: var(--ink-3); font-size: .9rem; }
.tool-acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 12px; }

.swatches { display: flex; gap: 6px; margin-top: 8px; }
.swatch { width: 34px; height: 34px; border-radius: 9px; border: 1px solid rgba(0, 0, 0, .12); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3); }

.tally { margin-top: 10px; display: flex; flex-direction: column; gap: 5px; }
.tally-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; font-size: .78rem; color: var(--ink-2); }
.tally-bar { position: relative; height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; }
.tally-bar i { position: absolute; inset: 0 auto 0 0; background: var(--teal); border-radius: 3px; }

/* --------------------------------------------------------------- wheel -- */

.wheel-wrap { position: relative; width: min(100%, 320px); margin: 0 auto; aspect-ratio: 1; }

/* Inside a tool card the wheel lives in the art box, with the illustration
   left behind it as a backdrop. Sized from the width — a percentage height
   against an aspect-ratio box does not resolve the way you would hope. */
.tool-art.has-wheel { aspect-ratio: 1 / 1; padding: 18px 18px 14px; }
.tool-art.has-wheel > svg { opacity: .26; }
.tool-art .wheel-wrap { position: relative; width: 100%; height: auto; margin: 0; }
.wheel-wrap canvas { width: 100%; height: 100%; display: block; border-radius: 50%; box-shadow: var(--shadow-lg); }
.wheel-pin {
  position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 13px solid transparent; border-right: 13px solid transparent;
  border-top: 22px solid var(--seal);
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .3));
  z-index: 2;
}
.wheel-hub {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 23%; aspect-ratio: 1; border-radius: 50%;
  background: var(--card); border: 3px solid var(--ink);
  display: grid; place-items: center;
  font-family: var(--kr); font-weight: 900; font-size: clamp(.9rem, 3.4vw, 1.2rem);
  color: var(--ink);
}

/* ---------------------------------------------------------------- card -- */

.passport {
  display: grid; gap: var(--gap);
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
@media (min-width: 900px) { .passport { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); } }

.passport-card {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  padding: clamp(22px, 3.4vw, 34px);
  color: #F7F2E8;
  background: linear-gradient(155deg, #1B1428, var(--night) 45%, #241118);
  box-shadow: var(--shadow-lg);
}
.passport-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120% 80% at 88% 4%, color-mix(in srgb, var(--seal) 30%, transparent), transparent 62%);
}
.passport-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; }
.passport-head .k { font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.passport-head .k.quiet { letter-spacing: .08em; color: #8E8578; font-weight: 600; text-transform: none; font-size: .76rem; }
.passport-name { font-family: var(--kr); font-weight: 900; font-size: clamp(2rem, 6.6vw, 3rem); line-height: 1.05; margin-top: 12px; }
.passport-name.empty { color: #6E6458; font-family: var(--sans); font-size: clamp(1.1rem, 3vw, 1.4rem); font-weight: 600; }
.passport-rom { color: #C0B6A8; font-size: .94rem; margin-top: 2px; }
.passport-rows { margin-top: 22px; display: flex; flex-direction: column; gap: 1px; background: rgba(255, 255, 255, .11); border-radius: 14px; overflow: hidden; }
.passport-row { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 12px 15px; background: rgba(18, 15, 28, .72); font-size: .92rem; align-items: baseline; }
.passport-row dt { color: #9A9184; font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; }
.passport-row dd { margin: 0; font-weight: 600; }
.passport-row dd .kr { color: var(--gold); }
.passport-row.empty dd { color: #6E6458; font-weight: 400; }
.passport-foot { margin-top: 18px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.passport-count { font-size: .82rem; color: #9A9184; margin-right: auto; }

.howto { border-radius: var(--radius); border: 1px solid var(--line); background: var(--card); padding: clamp(20px, 3vw, 28px); box-shadow: var(--shadow); }
.howto h3 { font-size: 1.1rem; }
.howto ol { margin: 14px 0 0; padding-left: 1.15rem; display: flex; flex-direction: column; gap: 10px; color: var(--ink-2); font-size: .93rem; }
.howto li strong { color: var(--ink); }
.howto .db-note { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .85rem; color: var(--ink-3); }
.howto code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--paper-2); padding: 2px 6px; border-radius: 5px; }

/* --------------------------------------------------------------- misc --- */

.prose { max-width: 68ch; }
.prose h3 { font-size: 1.05rem; margin-top: 26px; }
.prose p { margin-top: 9px; color: var(--ink-2); font-size: .94rem; }

.foot { margin-top: clamp(56px, 8vw, 96px); border-top: 1px solid var(--line); padding-top: 28px; }
.foot-in { display: flex; flex-wrap: wrap; gap: 14px 26px; align-items: center; font-size: .88rem; color: var(--ink-2); }
.foot a { font-weight: 600; text-decoration: none; }
.foot a:hover { text-decoration: underline; }
.foot .sister { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line);
  font-weight: 700; font-size: .84rem; text-decoration: none; background: var(--card);
  transition: border-color .16s, transform .12s;
}
.pill:hover { border-color: var(--seal); transform: translateY(-1px); }
.pill .age { font-size: .7em; color: var(--ink-3); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translate(-50%, 16px);
  z-index: 60; max-width: min(92vw, 420px);
  padding: 12px 20px; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font-size: .9rem; font-weight: 600; text-align: center;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  box-shadow: var(--shadow-lg);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

dialog {
  border: 0; padding: 0; color: var(--ink);
  background: var(--card);
  border-radius: var(--radius-lg);
  width: min(460px, calc(100vw - 28px));
  box-shadow: var(--shadow-lg);
}
dialog::backdrop { background: rgba(20, 17, 14, .58); backdrop-filter: blur(3px); }
.modal { padding: clamp(22px, 4vw, 30px); }
.modal h2 { font-size: 1.35rem; }
.modal p { margin-top: 10px; color: var(--ink-2); font-size: .94rem; }
.modal .close-row { margin-top: 20px; display: flex; gap: 8px; justify-content: flex-end; }

.jamo-big { font-family: var(--kr); font-size: 3.6rem; font-weight: 900; line-height: 1; text-align: center; color: var(--seal); }
.jamo-parts { display: flex; justify-content: center; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.jamo-part { text-align: center; padding: 10px 14px; border-radius: 12px; background: var(--paper-2); border: 1px solid var(--line); }
.jamo-part b { display: block; font-family: var(--kr); font-size: 1.6rem; font-weight: 700; }
.jamo-part span { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }

/* --------------------------------------------------------------- article -- */
/* Long-form guide pages. Generated by build.js as plain HTML so the crawler
   and a reader with JavaScript off both get the whole thing. */

.crumbs { font-size: .84rem; color: var(--ink-3); margin-bottom: 18px; }
.crumbs a { text-decoration: none; font-weight: 600; }
.crumbs a:hover { text-decoration: underline; }
.crumbs span { margin: 0 6px; }

.article { padding-top: clamp(28px, 5vw, 52px); }
/* The measure belongs to the headline, not the block: on the block it also
   squeezed the standfirst below its own 58ch and left half the page empty. */
.article-head h1 { max-width: 18ch; font-size: clamp(1.85rem, 4.6vw, 3rem); margin-top: 8px; text-wrap: balance; }
@media (min-width: 760px) { .article-head h1 { max-width: 24ch; } }
.article-standfirst { margin-top: 14px; font-size: clamp(1rem, 1.7vw, 1.15rem); color: var(--ink-2); line-height: 1.5; max-width: 58ch; }
.article-meta { margin-top: 12px; font-size: .84rem; color: var(--ink-3); }

.toc {
  margin: clamp(28px, 4vw, 40px) 0;
  padding: 18px 22px;
  border-radius: var(--radius);
  background: var(--paper-2);
  border: 1px solid var(--line);
  max-width: 62ch;
}
.toc-title { font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; color: var(--ink-3); }
.toc ol { margin: 10px 0 0; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 6px; }
.toc a { font-size: .93rem; font-weight: 600; text-decoration: none; }
.toc a:hover { text-decoration: underline; }

.article-body { max-width: 68ch; }
.article-body h2 {
  font-size: clamp(1.3rem, 2.6vw, 1.7rem);
  margin-top: clamp(34px, 4vw, 48px);
  scroll-margin-top: 80px;
}
.article-body h3 { font-size: 1.08rem; margin-top: 26px; }
.article-body p { margin-top: 12px; color: var(--ink-2); line-height: 1.68; font-size: 1rem; }
.article-body p b, .article-body p strong { color: var(--ink); }
.article-body ul, .article-body ol { margin: 14px 0 0; padding-left: 1.3rem; display: flex; flex-direction: column; gap: 9px; color: var(--ink-2); line-height: 1.6; }
.article-body li b, .article-body li strong { color: var(--ink); }
.article-body a { font-weight: 600; text-underline-offset: 3px; }

.callout {
  margin: 22px 0 0;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--gold) 16%, var(--card));
  border-left: 4px solid var(--gold);
}
.callout p { margin: 0; color: var(--ink); font-size: .95rem; line-height: 1.6; }

.table-wrap { margin: 22px 0 0; overflow-x: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); }
table { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--card); }
thead th {
  text-align: left; padding: 11px 14px;
  background: var(--paper-2); color: var(--ink);
  font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; font-weight: 700;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody th { text-align: left; padding: 11px 14px; font-weight: 700; color: var(--ink); vertical-align: top; }
tbody td { padding: 11px 14px; color: var(--ink-2); vertical-align: top; line-height: 1.5; }
tbody tr + tr th, tbody tr + tr td { border-top: 1px solid var(--line); }

.faq-block { max-width: 68ch; margin-top: clamp(34px, 4vw, 48px); }
.faq-block h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); scroll-margin-top: 80px; }
.faq-block details {
  margin-top: 10px; padding: 14px 18px;
  border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--card);
}
.faq-block summary { font-weight: 700; cursor: pointer; list-style: none; }
.faq-block summary::-webkit-details-marker { display: none; }
.faq-block summary::before { content: "＋ "; color: var(--seal); font-weight: 700; }
.faq-block details[open] summary::before { content: "－ "; }
.faq-block details p { margin-top: 10px; color: var(--ink-2); line-height: 1.6; font-size: .95rem; }

.author-box {
  margin-top: clamp(34px, 4vw, 48px); max-width: 68ch;
  padding: 20px 24px; border-radius: var(--radius);
  background: var(--paper-2); border: 1px solid var(--line);
}
.author-name { font-weight: 700; }
.author-box p + p { margin-top: 6px; color: var(--ink-2); font-size: .93rem; }

.related { margin-top: clamp(44px, 6vw, 72px); }
.related h2 { font-size: clamp(1.3rem, 2.6vw, 1.7rem); margin-bottom: 18px; }
.related-card { text-decoration: none; }
.related-card .tool-body { gap: 6px; }
.related-card h2, .related-card h3 { font-size: 1.1rem; }
.related-card .sec-kicker { font-size: .7rem; }

/* home page reference lists */
.reference-group { margin-top: clamp(30px, 4vw, 44px); }
.reference-group h3 { font-size: 1.12rem; scroll-margin-top: 80px; }
.reference-intro { margin-top: 6px; color: var(--ink-2); font-size: .93rem; }
.ref-alt { color: var(--seal); font-weight: 700; margin-left: 4px; }
#reference tbody th { white-space: nowrap; }

@media (max-width: 560px) {
  #reference tbody th { white-space: normal; min-width: 8rem; }
}

/* ---------------------------------------------------------------- reveal -- */
/* A list the reader opens one card at a time. Without JavaScript every card is
   simply an open-able <details>; reveal.js adds the locking. */

.reveal { margin: 26px 0 0; max-width: 68ch; }
.reveal-intro { color: var(--ink-2); font-size: .95rem; line-height: 1.6; }
.reveal-list { list-style: none; margin: 16px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }

.reveal-card {
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
  overflow: hidden;
  transition: border-color .18s;
}
.reveal-card:hover { border-color: var(--line-2); }
.reveal-card summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 14px;
  align-items: baseline;
  padding: 15px 18px;
  cursor: pointer;
  list-style: none;
}
.reveal-card summary::-webkit-details-marker { display: none; }
.reveal-num {
  grid-row: 1 / span 2;
  font-size: .82rem; font-weight: 700; letter-spacing: .06em;
  color: var(--seal);
  font-variant-numeric: tabular-nums;
}
.reveal-head { font-size: 1.02rem; }
.reveal-head .kr { color: var(--seal); margin-left: 4px; }
.reveal-stat { grid-column: 2; font-size: .82rem; color: var(--ink-3); }
.reveal-card > p { margin: 0; padding: 0 18px 17px; color: var(--ink-2); line-height: 1.65; font-size: .96rem; }
.reveal-card[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 14px; }

.reveal-item.locked .reveal-card { background: var(--paper-2); border-style: dashed; }
.reveal-item.locked .reveal-head,
.reveal-item.locked .reveal-stat { filter: blur(4px); opacity: .55; user-select: none; }
.reveal-item.locked .reveal-num::after {
  content: " 🔒";
  filter: none;
  font-size: .9em;
}
.reveal-item.locked summary { cursor: default; }

.reveal-done {
  margin-top: 14px; font-size: .9rem; font-weight: 700; color: var(--seal);
}

/* ------------------------------------------------------- stat + checklist -- */

.stat-block {
  margin: 26px 0 0;
  padding: 24px 26px;
  border-radius: var(--radius);
  background: linear-gradient(150deg, #1B1428, var(--night) 60%, #241118);
  color: #F7F2E8;
  max-width: 68ch;
}
/* These live inside .article-body, where `.article-body p` (0,1,1) outranks a
   bare class (0,1,0) and would repaint them in body ink on the dark panel. */
.stat-block .stat-value {
  font-family: var(--sans);
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -.04em;
  background: linear-gradient(120deg, #fff 20%, var(--gold));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-block .stat-label { margin-top: 8px; color: #F7F2E8; font-weight: 700; font-size: 1.02rem; }
.stat-block .stat-sub { margin-top: 6px; color: #B8AEA0; font-size: .9rem; line-height: 1.5; }

.checklist { margin: 26px 0 0; max-width: 68ch; }
.checklist-intro { color: var(--ink-2); font-size: .95rem; line-height: 1.6; }
.checklist-score {
  margin-top: 12px; padding: 12px 16px;
  border-radius: var(--radius-sm);
  background: var(--paper-2); border: 1px solid var(--line);
  font-size: .92rem; color: var(--ink-2);
  position: sticky; top: 68px; z-index: 5;
}
.checklist-score b { color: var(--ink); }
.checklist.some .checklist-score { border-color: var(--seal); }

.checklist-group { margin-top: 22px; }
.checklist-group h3 { font-size: 1.02rem; display: flex; align-items: baseline; gap: 8px; }
.checklist-n {
  font-size: .72rem; font-weight: 700; color: var(--seal);
  background: color-mix(in srgb, var(--seal) 12%, transparent);
  padding: 2px 8px; border-radius: 999px;
}
.checklist-items { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.checklist-items label {
  display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap;
  padding: 9px 12px; border-radius: 10px; cursor: pointer;
  transition: background .14s;
}
.checklist-items label:hover { background: var(--paper-2); }
.checklist-items input { margin: 0; accent-color: var(--seal); width: 16px; height: 16px; flex: 0 0 auto; align-self: center; }
.ck-kr { font-weight: 700; font-size: 1.02rem; }
.ck-ro { color: var(--seal); font-weight: 600; font-size: .88rem; }
.ck-note { color: var(--ink-2); font-size: .88rem; flex: 1 1 14ch; }
.checklist-items input:checked ~ .ck-kr { text-decoration: line-through; text-decoration-color: var(--line-2); }

.checklist-done {
  margin-top: 16px; padding: 14px 18px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--gold) 18%, var(--card));
  border-left: 4px solid var(--gold);
  font-size: .94rem; line-height: 1.6;
}

/* -------------------------------------------------------------- anatomy -- */

.anatomy { margin: 26px 0 0; max-width: 68ch; }
.pig {
  width: 100%; height: auto; display: block;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  overflow: hidden;
}
/* The engraving is ink on warm paper; in dark mode it is the one bright
   rectangle on the page, so take the glare off rather than inverting it. */
:root:not([data-theme="light"]) .pig image { filter: brightness(.82) contrast(1.04); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .pig image { filter: none; } }
:root[data-theme="dark"] .pig image { filter: brightness(.82) contrast(1.04); }

.pig-zones .zone path {
  fill: #3A2A1E;
  fill-opacity: .07;
  stroke: #3A2A1E;
  stroke-opacity: .5;
  stroke-width: 2;
  stroke-dasharray: 6 5;
  transition: fill-opacity .18s, fill .18s, stroke .18s, stroke-opacity .18s;
}
.pig-zones .zone.on path {
  fill: var(--seal);
  fill-opacity: .42;
  stroke: var(--seal);
  stroke-opacity: 1;
  stroke-width: 3;
  stroke-dasharray: none;
}

.anatomy figcaption { margin-top: 10px; font-size: .88rem; color: var(--ink-2); line-height: 1.55; }

.anatomy .anatomy-key {
  list-style: none; margin: 14px 0 0; padding: 0;
  display: flex; flex-direction: row; flex-wrap: wrap; gap: 7px;
}
.anatomy .anatomy-key li { flex: 0 0 auto; margin: 0; }
.anatomy-key button {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 7px 13px; border-radius: 999px;
  border: 1.5px solid var(--line); background: var(--card);
  font-size: .84rem; transition: border-color .16s, background .16s;
}
.anatomy-key button:hover { border-color: var(--line-2); }
.anatomy-key button[aria-pressed="true"] { background: var(--seal); border-color: var(--seal); color: var(--seal-ink); }
.anatomy-key .kr { font-weight: 700; }
.anatomy-key button span:last-child { color: var(--ink-3); font-size: .95em; }
.anatomy-key button[aria-pressed="true"] span:last-child { color: color-mix(in srgb, var(--seal-ink) 75%, transparent); }
