/* ==========================================================================
   THE LOCKSMITH'S ALMANAC — Stylesheet
   A 1940–1955 American hardware almanac, reissued for the web.
   --------------------------------------------------------------------------
   00. Tokens (palette, type scale, spacing)
   01. Reset & base
   02. Paper grain, selection, scrollbar
   03. Typography (headings, prose, drop cap, links)
   04. Layout helpers (wrap, grid, folio numbers)
   05. Utility strip & header (shop sign)
   06. Navigation & mobile file-drawer
   07. Hero (almanac cover)
   08. Buttons
   09. Ornaments: rules, stamps, badges
   10. Cards: ticket cards, index cards
   11. Ledger tables
   12. Shop-tag checklist
   13. Warning plate
   14. FAQ accordion
   15. Breadcrumbs, article meta, key takeaways, sources
   16. Interactive: pin-tumbler diagram
   17. Interactive: state tile grid
   18. Interactive: checklist + rekey calculator
   19. Glossary
   20. Forms
   21. Cookie notice card
   22. Footer
   23. 404
   24. Breakpoints (640 / 960 / 1280)
   25. Reduced motion
   26. Print
   ========================================================================== */

/* 00. TOKENS ------------------------------------------------------------- */
:root {
  /* Palette (brief) */
  --paper: #F3EAD7;
  --paper-dark: #E6D8BC;
  --ink: #1E1B16;
  --ink-soft: #4A4238;
  --brass: #B08D57;
  --brass-deep: #8A6A3B;
  --oxblood: #6E1F1B;
  --verdigris: #4F7C6E;
  --rule: rgba(30, 27, 22, .25);

  /* Derived text-safe tones (WCAG AA on --paper, measured):
     --brass-ink 5.16:1 · --verdigris-deep 5.63:1 (paper on it) */
  --brass-ink: #7A5C30;
  --verdigris-deep: #3D6357;
  --oxblood-wash: rgba(110, 31, 27, .08);
  --index-blue: rgba(70, 110, 160, .22);
  --index-red: #B3473F;

  /* Type */
  --font-display: "Playfair Display", "Georgia", "Times New Roman", serif;
  --font-engraved: "IM Fell English SC", "Georgia", serif;
  --font-body: "Source Serif 4", "Georgia", "Times New Roman", serif;
  --font-mono: "Courier Prime", "Courier New", Courier, monospace;

  /* Modular scale 1.25, base 18px */
  --step--2: .72rem;
  --step--1: .9rem;
  --step-0: 1.125rem;
  --step-1: 1.406rem;
  --step-2: 1.758rem;
  --step-3: 2.197rem;
  --step-4: 2.747rem;
  --step-5: 3.433rem;
  --step-6: 4.292rem;

  --measure: 68ch;
  --space-1: .25rem;
  --space-2: .5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
  --radius: 2px;
  --shadow-hard: 3px 3px 0 var(--ink);
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* 01. RESET & BASE -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.7;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  position: relative;
  counter-reset: folio var(--folio-start, 0);
}
img, svg { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; border-radius: 1px; }
.skip-link {
  position: absolute; left: var(--space-3); top: -100px; z-index: 10000;
  background: var(--ink); color: var(--paper); padding: var(--space-2) var(--space-3);
  font-family: var(--font-mono); text-decoration: none;
}
.skip-link:focus { top: var(--space-3); }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
[hidden] { display: none !important; }

/* 02. PAPER GRAIN, SELECTION, SCROLLBAR ----------------------------------- */
body::before {
  content: "";
  position: fixed; inset: 0; z-index: 9000; pointer-events: none;
  opacity: .06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.12 0 0 0 0 0.1 0 0 0 0 0.08 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
}
::selection { background: var(--brass); color: var(--ink); }
html { scrollbar-color: var(--brass) var(--paper-dark); scrollbar-width: thin; }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--paper-dark); }
::-webkit-scrollbar-thumb { background: var(--brass); border: 3px solid var(--paper-dark); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--brass-deep); }

/* 03. TYPOGRAPHY ---------------------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 var(--space-3);
  color: var(--ink);
  text-wrap: balance;
}
h1 { font-size: clamp(var(--step-4), 7vw, var(--step-6)); font-weight: 900; letter-spacing: -.02em; }
h2 { font-size: var(--step-3); margin-top: var(--space-5); }
h3 { font-size: var(--step-2); margin-top: var(--space-4); }
h4 { font-size: var(--step-1); }
.engraved, .kicker {
  font-family: var(--font-engraved);
  font-weight: 400;
  letter-spacing: .06em;
  color: var(--ink-soft);
}
.kicker { font-size: var(--step-1); display: block; margin-bottom: var(--space-2); }
p { margin: 0 0 var(--space-3); }
.prose { max-width: var(--measure); }
.prose p, .prose li { hyphens: auto; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 var(--space-3); }
.prose li { margin-bottom: var(--space-2); }
.prose li::marker { color: var(--brass-ink); }
.lede { font-style: italic; font-size: var(--step-1); line-height: 1.5; color: var(--ink-soft); max-width: 60ch; }
.mono, code, kbd { font-family: var(--font-mono); font-size: .92em; }
strong { font-weight: 600; }
blockquote {
  margin: var(--space-4) 0; padding: var(--space-3) var(--space-4);
  border-left: 4px double var(--brass); background: var(--paper-dark);
  font-style: italic;
}

/* Drop cap: oxblood, 3 lines */
.dropcap::first-letter {
  float: left;
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--oxblood);
  font-size: calc(1.7em * 3 * .86);
  line-height: .8;
  padding: .06em .08em 0 0;
  margin-top: .06em;
}

a { color: var(--ink); text-decoration-color: var(--brass); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--oxblood); text-decoration-color: var(--oxblood); }
a:visited { color: var(--brass-ink); text-decoration-color: var(--brass-deep); }
a.ext::after { content: " ↗"; font-family: var(--font-mono); font-size: .8em; text-decoration: none; display: inline-block; }

/* 04. LAYOUT -------------------------------------------------------------- */
.wrap { width: min(100% - 2.5rem, 1180px); margin-inline: auto; }
.wrap--narrow { width: min(100% - 2.5rem, 820px); margin-inline: auto; }
main { display: block; }
.section { padding: var(--space-6) 0 var(--space-4); position: relative; }
.section--band { background: var(--paper-dark); border-block: 1px solid var(--rule); }
.section-head { max-width: 62ch; margin-bottom: var(--space-5); }
.section-head h2 { margin-top: 0; }
.grid { display: grid; gap: var(--space-4); }

/* Folio (decorative page number) at the foot of each section */
.folio::after, .chapter::after {
  counter-increment: folio;
  content: "— " counter(folio) " —";
  display: block; text-align: center;
  font-family: var(--font-mono); font-size: var(--step--1);
  color: var(--ink-soft); letter-spacing: .1em;
  margin-top: var(--space-5);
}

/* Article two-column layout */
.article-layout { display: grid; gap: var(--space-5); padding-block: var(--space-4) var(--space-6); }
.article-layout .toc { display: none; }
.chapter { padding-top: var(--space-2); }
.chapter + .chapter { margin-top: var(--space-4); }

/* 05. UTILITY STRIP & HEADER --------------------------------------------- */
.strip {
  background: var(--brass);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--step--1);
  text-align: center;
  padding: .35rem 1rem;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--brass-deep);
}
.site-header {
  position: relative;
  border-bottom: 3px double var(--ink);
  background: var(--paper);
}
.site-header__inner { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding-block: var(--space-3); }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); }
.brand:visited { color: var(--ink); }
.brand svg { width: 52px; height: 52px; flex: none; }
.brand__name { font-family: var(--font-display); font-weight: 900; font-size: var(--step-1); line-height: 1; letter-spacing: -.01em; display: block; }
.brand__sub { font-family: var(--font-engraved); font-size: var(--step--1); color: var(--ink-soft); letter-spacing: .08em; display: block; margin-top: .2rem; }
.header-notice {
  font-family: var(--font-mono); font-size: var(--step--2); color: var(--ink-soft);
  border-top: 1px solid var(--rule); padding: .4rem 0; text-align: center;
}

/* 06. NAVIGATION & DRAWER ------------------------------------------------- */
.nav-toggle {
  display: inline-flex; align-items: center; gap: .5rem;
  background: var(--paper); border: 3px double var(--ink); border-radius: var(--radius);
  padding: .45rem .8rem; cursor: pointer; font-family: var(--font-engraved); font-size: var(--step-0);
}
.nav-toggle svg { width: 22px; height: 22px; }
.site-nav { display: none; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .2rem 1.3rem; }
.site-nav a, .drawer a {
  font-family: var(--font-engraved); font-size: var(--step-0); letter-spacing: .05em;
  text-decoration: none; color: var(--ink); position: relative; padding: .2rem 0;
}
.site-nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: var(--brass); transform: scaleX(0); transform-origin: left; transition: transform .3s var(--ease);
}
.site-nav a:hover::after, .site-nav a:focus-visible::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.site-nav a[aria-current="page"] { color: var(--oxblood); }

/* Mobile file drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(30, 27, 22, .45); z-index: 8000; opacity: 0; transition: opacity .3s; }
.drawer-backdrop.is-open { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(86vw, 360px); z-index: 8001;
  background: var(--paper-dark);
  border-left: 3px double var(--ink);
  box-shadow: -8px 0 0 var(--brass);
  transform: translateX(105%); transition: transform .35s var(--ease);
  display: flex; flex-direction: column; overflow-y: auto;
  visibility: hidden;
}
.drawer.is-open { transform: translateX(0); visibility: visible; }
.drawer__head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3); border-bottom: 1px solid var(--rule); }
.drawer__label { font-family: var(--font-mono); font-size: var(--step--1); text-transform: uppercase; letter-spacing: .12em; }
.drawer__close { white-space: nowrap; background: none; border: 3px double var(--ink); padding: .25rem .6rem; cursor: pointer; font-family: var(--font-mono); }
.drawer ul { list-style: none; margin: 0; padding: var(--space-3); display: grid; gap: .6rem; }
/* each link looks like a filing-cabinet folder tab */
.drawer li a {
  display: block; background: var(--paper); padding: .65rem .9rem .55rem;
  border: 1px solid var(--rule); border-top: 4px solid var(--brass);
  clip-path: polygon(0 6px, 6px 0, 42% 0, 46% 6px, 100% 6px, 100% 100%, 0 100%);
}
.drawer li a[aria-current="page"] { border-top-color: var(--oxblood); color: var(--oxblood); }
.drawer__foot { margin-top: auto; padding: var(--space-3); font-family: var(--font-mono); font-size: var(--step--2); color: var(--ink-soft); border-top: 1px solid var(--rule); }
body.drawer-open { overflow: hidden; }

/* 07. HERO ---------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden;
  padding: var(--space-5) 0 var(--space-6);
  border-bottom: 3px double var(--ink);
}
.hero::after { /* soft vignette */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(30, 27, 22, .16) 100%);
}
.hero__grid { display: grid; gap: var(--space-5); align-items: center; position: relative; z-index: 1; }
.hero__edition {
  display: flex; gap: .75rem; align-items: center; flex-wrap: wrap;
  font-family: var(--font-mono); font-size: var(--step--1); text-transform: uppercase; letter-spacing: .14em;
  border-block: 1px solid var(--ink); padding: .35rem 0; margin-bottom: var(--space-4);
}
.hero__edition span + span::before { content: "✦"; margin-right: .75rem; color: var(--brass-ink); }
.hero h1 { margin-bottom: var(--space-3); }
.hero__actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin-top: var(--space-4); }
.hero__figure { position: relative; max-width: 520px; justify-self: center; width: 100%; }
.hero__figure figcaption { font-family: var(--font-mono); font-size: var(--step--2); text-align: center; color: var(--ink-soft); margin-top: .5rem; }
.hero .stamp { position: absolute; right: -8px; top: -58px; z-index: 2; }

.page-hero { padding: var(--space-4) 0 var(--space-4); border-bottom: 1px solid var(--rule); }
.page-hero h1 { font-size: clamp(var(--step-3), 6vw, var(--step-5)); max-width: 20ch; }

/* 08. BUTTONS ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 48px; padding: .65rem 1.25rem;
  font-family: var(--font-engraved); font-size: var(--step-0); letter-spacing: .05em; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  border: 4px double currentColor; border-radius: var(--radius);
  background: transparent; color: var(--ink);
  transition: transform .12s var(--ease), box-shadow .12s var(--ease), background .2s;
}
.btn:visited { color: var(--ink); }
.btn:hover, .btn:focus-visible { transform: translateY(2px); box-shadow: var(--shadow-hard); color: var(--ink); }
.btn:active { transform: translateY(3px); box-shadow: 1px 1px 0 var(--ink); }
.btn--primary { background: var(--oxblood); color: var(--paper); border-color: var(--paper); outline: 2px solid var(--oxblood); outline-offset: 0; }
.btn--primary:visited, .btn--primary:hover, .btn--primary:focus-visible { color: var(--paper); }
.btn--primary:focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; }
.btn--small { min-height: 40px; padding: .4rem .9rem; font-size: var(--step--1); }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: none; }

/* 09. ORNAMENTS ----------------------------------------------------------- */
.rule-ornament {
  display: flex; align-items: center; gap: 1rem; margin: var(--space-5) auto; max-width: 560px;
  color: var(--brass-ink);
}
.rule-ornament::before, .rule-ornament::after {
  content: ""; flex: 1; height: 5px;
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); opacity: .55;
}
.rule-ornament svg { width: 46px; height: 18px; flex: none; }

.stamp {
  --stamp: var(--oxblood);
  width: 112px; height: 112px; border-radius: 50%;
  display: inline-grid; place-items: center; text-align: center;
  border: 3px solid var(--stamp); color: var(--stamp);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 6px var(--stamp);
  font-family: var(--font-mono); font-weight: 700; font-size: .7rem; line-height: 1.15;
  letter-spacing: .12em; text-transform: uppercase;
  transform: rotate(-8deg);
  filter: url(#ink-rough);
  opacity: .9; mix-blend-mode: multiply;
  padding: 14px; user-select: none;
}
.stamp strong { display: block; font-size: 1.05rem; letter-spacing: .06em; }
.stamp--green { --stamp: var(--verdigris-deep); }
.stamp--ink { --stamp: var(--ink); }

.badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-family: var(--font-mono); font-size: var(--step--2); text-transform: uppercase; letter-spacing: .1em;
  padding: .2rem .55rem; border: 1px solid currentColor; border-radius: var(--radius);
}
.badge--ok { background: var(--verdigris-deep); color: var(--paper); border-color: var(--verdigris-deep); }
.badge--warn { color: var(--oxblood); background: var(--oxblood-wash); }
.badge--plain { color: var(--ink-soft); }

/* 10. CARDS --------------------------------------------------------------- */
/* Ticket card: notched corners via mask + inner frame at 6px */
.ticket {
  --notch: 14px;
  position: relative; background: var(--paper-dark);
  padding: var(--space-4) var(--space-4) var(--space-4);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 0, transparent 98%, #000) top left,
    radial-gradient(circle var(--notch) at 100% 0, transparent 98%, #000) top right,
    radial-gradient(circle var(--notch) at 0 100%, transparent 98%, #000) bottom left,
    radial-gradient(circle var(--notch) at 100% 100%, transparent 98%, #000) bottom right;
  -webkit-mask-size: 51% 51%; -webkit-mask-repeat: no-repeat;
  mask:
    radial-gradient(circle var(--notch) at 0 0, transparent 98%, #000) top left,
    radial-gradient(circle var(--notch) at 100% 0, transparent 98%, #000) top right,
    radial-gradient(circle var(--notch) at 0 100%, transparent 98%, #000) bottom left,
    radial-gradient(circle var(--notch) at 100% 100%, transparent 98%, #000) bottom right;
  mask-size: 51% 51%; mask-repeat: no-repeat;
  transition: transform .2s var(--ease);
}
.ticket::before { /* inner double frame at 6px */
  content: ""; position: absolute; inset: 6px; pointer-events: none;
  border: 1px solid var(--brass-deep);
  outline: 1px solid var(--rule); outline-offset: 3px;
  border-radius: 10px;
}
.ticket h3 { margin-top: 0; font-size: var(--step-1); }
.ticket__num { font-family: var(--font-mono); font-size: var(--step--1); color: var(--ink-soft); letter-spacing: .1em; display: block; margin-bottom: .4rem; }
.ticket__icon { height: 56px; width: auto; max-width: 150px; margin-bottom: var(--space-3); object-fit: contain; object-position: left center; }
.ticket a.stretched { text-decoration: none; }
.ticket a.stretched::after { content: ""; position: absolute; inset: 0; }
.ticket:has(a.stretched:hover) { transform: translateY(-3px); }
.ticket:has(a.stretched:focus-visible) { outline: 3px solid var(--brass); }
.ticket p:last-child { margin-bottom: 0; }

/* Index card (library card) */
.index-card {
  background-color: #FBF6EA;
  background-image:
    linear-gradient(var(--index-red), var(--index-red)),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.7em - 1px), var(--index-blue) calc(1.7em - 1px), var(--index-blue) 1.7em);
  background-size: 100% 2px, 100% 100%;
  background-position: 0 2.6em, 0 2.6em;
  background-repeat: no-repeat, repeat;
  border: 1px solid var(--rule);
  box-shadow: 2px 2px 0 var(--paper-dark), 3px 3px 0 var(--rule);
  padding: .55em 1rem 1rem;
  line-height: 1.7em;
  font-size: 1rem;
}
.index-card h3 { font-size: 1.15rem; margin: 0 0 .9em; line-height: 1.5em; display: flex; justify-content: space-between; gap: .5rem; align-items: baseline; }
.index-card h3 .mono { font-size: .75rem; font-weight: 400; color: var(--ink-soft); }
.index-card p { margin: 0; }

/* 11. LEDGER TABLE -------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: var(--space-4) 0; border: 3px double var(--ink); background: var(--paper); }
.ledger { width: 100%; border-collapse: collapse; font-size: 1rem; min-width: 560px; }
.ledger caption { caption-side: top; text-align: left; font-family: var(--font-engraved); font-size: var(--step-1); padding: .6rem .9rem; border-bottom: 1px solid var(--ink); }
.ledger th {
  font-family: var(--font-mono); font-weight: 700; font-size: var(--step--1); text-transform: uppercase; letter-spacing: .08em;
  text-align: left; padding: .6rem .9rem; border-bottom: 2px solid var(--ink); background: var(--paper-dark); vertical-align: bottom;
}
.ledger td { padding: .6rem .9rem; border-bottom: 1px solid var(--rule); vertical-align: top; }
.ledger tbody tr:nth-child(even) { background: var(--paper-dark); }
.ledger .num { text-align: right; font-family: var(--font-mono); white-space: nowrap; }
.ledger td:first-child { font-weight: 600; }
.ledger tfoot td { font-family: var(--font-mono); font-size: var(--step--1); border-top: 2px solid var(--ink); border-bottom: 0; }

/* 12. SHOP-TAG CHECKLIST -------------------------------------------------- */
.shop-tag { position: relative; max-width: 560px; margin: var(--space-5) auto var(--space-4); padding-top: 48px; }
.shop-tag__string { position: absolute; top: 0; left: 50%; width: 120px; height: 70px; transform: translateX(-50%); z-index: 2; pointer-events: none; }
.shop-tag__body {
  background: #EAD9B5;
  border: 1px solid var(--brass-deep);
  padding: 3.4rem var(--space-4) var(--space-4);
  clip-path: polygon(18% 0, 82% 0, 100% 9%, 100% 100%, 0 100%, 0 9%);
  position: relative;
  box-shadow: inset 0 0 0 6px #EAD9B5, inset 0 0 0 7px var(--brass-deep);
}
.shop-tag__body::before { /* eyelet */
  content: ""; position: absolute; top: 16px; left: 50%; width: 22px; height: 22px; transform: translateX(-50%);
  border-radius: 50%; background: var(--paper); border: 4px solid var(--brass);
  box-shadow: inset 1px 1px 2px rgba(0, 0, 0, .3);
}
.shop-tag h3 { text-align: center; font-family: var(--font-engraved); font-weight: 400; font-size: var(--step-1); margin: 0 0 var(--space-3); }
.shop-tag ul { list-style: none; padding: 0; margin: 0; }
.shop-tag li { padding: .5rem 0 .5rem 2rem; border-bottom: 1px dashed var(--rule); position: relative; }
.shop-tag li::before { content: "☐"; position: absolute; left: 0; top: .45rem; font-family: var(--font-mono); }
.shop-tag li:last-child { border-bottom: 0; }

/* 13. WARNING PLATE ------------------------------------------------------- */
.plate {
  --screw: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8' fill='%23B08D57' stroke='%231E1B16' stroke-width='1.5'/%3E%3Cpath d='M5 10h10M10 5v10' stroke='%231E1B16' stroke-width='1.5' transform='rotate(25 10 10)'/%3E%3C/svg%3E");
  position: relative;
  background-color: var(--oxblood-wash);
  background-image: var(--screw), var(--screw), var(--screw), var(--screw);
  background-size: 18px 18px;
  background-position: 10px 10px, calc(100% - 10px) 10px, 10px calc(100% - 10px), calc(100% - 10px) calc(100% - 10px);
  background-repeat: no-repeat;
  border: 2px solid var(--oxblood);
  box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px var(--oxblood);
  padding: var(--space-4) calc(var(--space-4) + 14px);
  margin: var(--space-4) 0;
  border-radius: var(--radius);
}
.plate__title { font-family: var(--font-mono); font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--oxblood); font-size: var(--step--1); margin-bottom: .4rem; display: block; }
.plate p:last-child { margin-bottom: 0; }
.plate--note { --screw: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='10' cy='10' r='8' fill='%23B08D57' stroke='%231E1B16' stroke-width='1.5'/%3E%3Cpath d='M5 10h10' stroke='%231E1B16' stroke-width='1.5' transform='rotate(-30 10 10)'/%3E%3C/svg%3E"); background-color: rgba(79, 124, 110, .1); border-color: var(--verdigris-deep); box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 5px var(--verdigris-deep); }
.plate--note .plate__title { color: var(--verdigris-deep); }

/* 14. FAQ ACCORDION ------------------------------------------------------- */
.faq { border-top: 3px double var(--ink); max-width: var(--measure); }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; gap: .8rem; align-items: flex-start;
  padding: var(--space-3) 0; font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); line-height: 1.3;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary svg { width: 28px; height: 28px; flex: none; margin-top: .1rem; transition: transform .3s var(--ease); color: var(--brass-ink); }
.faq details[open] summary svg { transform: rotate(90deg); }
.faq .faq__a { padding: 0 0 var(--space-3) 2.6rem; }

/* 15. BREADCRUMBS, META, TAKEAWAYS, SOURCES ------------------------------- */
.breadcrumbs { font-family: var(--font-mono); font-size: var(--step--1); margin: var(--space-3) 0; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .3rem; }
.breadcrumbs li + li::before { content: "›"; margin-right: .3rem; color: var(--brass-ink); }
.breadcrumbs a { color: var(--ink-soft); }
.article-meta { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-family: var(--font-mono); font-size: var(--step--1); color: var(--ink-soft); margin: var(--space-3) 0 0; }
.takeaways {
  border: 3px double var(--ink); background: var(--paper-dark);
  padding: var(--space-4); margin: var(--space-4) 0 var(--space-5); position: relative; max-width: var(--measure);
}
.takeaways h2 { font-family: var(--font-engraved); font-weight: 400; font-size: var(--step-1); margin: 0 0 var(--space-3); letter-spacing: .06em; }
.takeaways ul { margin: 0; padding-left: 1.2em; }
.takeaways li { margin-bottom: .45rem; }
.takeaways li::marker { content: "✓  "; color: var(--verdigris-deep); font-family: var(--font-mono); }
.takeaways .stamp { position: absolute; right: -10px; top: -34px; width: 96px; height: 96px; font-size: .6rem; }
.sources { border-top: 3px double var(--ink); margin-top: var(--space-5); padding-top: var(--space-3); max-width: var(--measure); }
.sources h2 { font-family: var(--font-engraved); font-weight: 400; font-size: var(--step-2); margin-top: 0; }
.sources ol { font-size: 1rem; padding-left: 1.4em; }
.sources li { margin-bottom: .4rem; }
.sources li::marker { font-family: var(--font-mono); color: var(--ink-soft); }
.toc { font-family: var(--font-mono); font-size: var(--step--1); }
.toc h2 { font-family: var(--font-engraved); font-weight: 400; font-size: var(--step-0); letter-spacing: .1em; margin: 0 0 .5rem; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--brass); }
.toc a { display: block; padding: .3rem .8rem; text-decoration: none; color: var(--ink-soft); }
.toc a:hover { color: var(--oxblood); }
.toc a.is-active { color: var(--ink); background: var(--paper-dark); font-weight: 700; }
.figure { margin: var(--space-4) 0; max-width: var(--measure); }
.figure img, .figure svg { margin-inline: auto; }
.figure figcaption { font-family: var(--font-mono); font-size: var(--step--1); color: var(--ink-soft); text-align: center; margin-top: .5rem; }
.related { display: grid; gap: var(--space-3); margin-top: var(--space-4); max-width: var(--measure); }

/* 16. PIN-TUMBLER DIAGRAM ------------------------------------------------- */
.pin-lab { border: 3px double var(--ink); background: var(--paper); padding: var(--space-4); }
.pin-lab__svg { width: 100%; max-width: 760px; margin: 0 auto; }
.pin-lab__controls { display: grid; gap: var(--space-3); margin-top: var(--space-3); align-items: center; }
.pin-lab__controls label { font-family: var(--font-mono); font-size: var(--step--1); display: block; }
.pin-lab__row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.pin-lab output, .pin-lab__status { font-family: var(--font-mono); font-size: var(--step--1); }
.pin-lab__status { padding: .6rem .8rem; border-left: 4px solid var(--brass); background: var(--paper-dark); min-height: 3.2em; }
.pin-lab__status.is-open { border-color: var(--verdigris-deep); }
.pin-lab__status.is-bind { border-color: var(--oxblood); }
.pin-lab select { font-family: var(--font-mono); font-size: var(--step--1); padding: .4rem; background: var(--paper); border: 2px solid var(--ink); border-radius: var(--radius); }
input[type="range"] { width: 100%; accent-color: var(--oxblood); height: 32px; }
.pin-legend { display: grid; gap: .5rem 1.5rem; margin-top: var(--space-3); font-size: 1rem; }
.pin-legend dt { font-family: var(--font-mono); font-weight: 700; font-size: var(--step--1); text-transform: uppercase; letter-spacing: .08em; }
.pin-legend dd { margin: 0 0 .4rem; }
#pinSvg .pin-label { font-family: var(--font-mono); font-size: 13px; fill: var(--ink); }
#pinSvg .shear { stroke: var(--oxblood); stroke-width: 2; stroke-dasharray: 8 5; }
#pinSvg .bind { stroke: var(--oxblood) !important; stroke-width: 3 !important; }
#pinSvg .is-set { fill: var(--verdigris) !important; }

/* 17. STATE GRID ---------------------------------------------------------- */
.state-grid-wrap { display: grid; gap: var(--space-4); }
.state-grid {
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 3px;
  max-width: 720px; width: 100%; margin: 0 auto;
}
.state-tile {
  aspect-ratio: 1; display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 700; font-size: clamp(.55rem, 2.2vw, .95rem);
  border: 1px solid var(--ink); background: var(--paper); color: var(--ink);
  cursor: pointer; padding: 0; border-radius: 1px; transition: transform .15s var(--ease), box-shadow .15s;
}
.state-tile.is-licensed { background: var(--verdigris-deep); color: var(--paper); }
.state-tile.is-local { background: repeating-linear-gradient(45deg, var(--paper), var(--paper) 4px, var(--paper-dark) 4px, var(--paper-dark) 8px); }
.state-tile:hover { transform: translateY(-2px); box-shadow: 2px 2px 0 var(--ink); }
.state-tile[aria-pressed="true"] { outline: 3px solid var(--brass); outline-offset: 1px; z-index: 1; }
.state-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-family: var(--font-mono); font-size: var(--step--1); justify-content: center; margin-top: var(--space-3); }
.state-legend span { display: inline-flex; gap: .4rem; align-items: center; }
.state-legend i { width: 16px; height: 16px; border: 1px solid var(--ink); display: inline-block; }
.state-panel { border: 3px double var(--ink); background: var(--paper-dark); padding: var(--space-4); min-height: 220px; }
.state-panel h3 { margin-top: 0; }
.state-panel dl { display: grid; gap: .2rem; font-size: 1rem; }
.state-panel dd + dt { margin-top: .5rem; }
.state-panel dt { font-family: var(--font-mono); font-size: var(--step--1); text-transform: uppercase; letter-spacing: .06em; padding-top: .15rem; }
.state-panel dd { margin: 0; }

/* 18. CHECKLIST + CALCULATOR --------------------------------------------- */
.ink-checklist { list-style: none; padding: 0; margin: 0; }
.ink-checklist li { border-bottom: 1px dashed var(--rule); }
.ink-checklist label { display: grid; grid-template-columns: 28px 1fr; gap: .6rem; padding: .6rem 0; cursor: pointer; position: relative; }
.ink-checklist input { appearance: none; -webkit-appearance: none; width: 24px; height: 24px; margin: .2rem 0 0; border: 2px solid var(--ink); background: var(--paper); border-radius: 1px; cursor: pointer; display: grid; place-items: center; }
.ink-checklist input::after { content: "✕"; font-family: var(--font-mono); font-weight: 700; color: var(--oxblood); font-size: 18px; line-height: 1; transform: scale(0); transition: transform .15s var(--ease); }
.ink-checklist input:checked::after { transform: scale(1); }
.ink-checklist .item-text { position: relative; }
.ink-checklist .item-text::after { /* hand-drawn ink strike */
  content: ""; position: absolute; left: -2px; right: -2px; top: .85em; height: 3px;
  background: var(--ink); border-radius: 2px;
  transform: scaleX(0) rotate(-.6deg); transform-origin: left; transition: transform .35s var(--ease);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 4' preserveAspectRatio='none'%3E%3Cpath d='M0 2 Q 25 0.5 50 2.2 T 100 1.6' stroke='black' stroke-width='2.6' fill='none'/%3E%3C/svg%3E") center / 100% 100%;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 4' preserveAspectRatio='none'%3E%3Cpath d='M0 2 Q 25 0.5 50 2.2 T 100 1.6' stroke='black' stroke-width='2.6' fill='none'/%3E%3C/svg%3E") center / 100% 100%;
}
.ink-checklist input:checked + .item-text { color: var(--ink-soft); }
.ink-checklist input:checked + .item-text::after { transform: scaleX(1) rotate(-.6deg); }
.checklist-progress { font-family: var(--font-mono); font-size: var(--step--1); margin-top: var(--space-3); text-align: center; }

.calc { border: 3px double var(--ink); background: var(--paper); padding: var(--space-4); }
.calc fieldset { border: 0; padding: 0; margin: 0 0 var(--space-4); }
.calc legend { font-family: var(--font-display); font-weight: 700; font-size: var(--step-1); margin-bottom: .6rem; padding: 0; }
.calc .choices { display: grid; gap: .5rem; }
.calc .choice { display: flex; gap: .6rem; align-items: flex-start; padding: .55rem .8rem; border: 1px solid var(--rule); background: var(--paper-dark); cursor: pointer; border-radius: var(--radius); }
.calc .choice:has(input:checked) { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--oxblood); }
.calc .choice input { margin-top: .4rem; accent-color: var(--oxblood); width: 18px; height: 18px; flex: none; }
.calc-result { margin-top: var(--space-4); border-top: 3px double var(--ink); padding-top: var(--space-4); }
.calc-result__verdict { font-family: var(--font-display); font-weight: 900; font-size: var(--step-3); line-height: 1.1; margin: .2rem 0 var(--space-3); }
.calc-result ul { padding-left: 1.2em; }

/* 19. GLOSSARY ------------------------------------------------------------ */
.az-filter { display: flex; flex-wrap: wrap; gap: .3rem; margin: var(--space-4) 0; position: static; top: 0; background: var(--paper); padding: .6rem 0; z-index: 5; border-bottom: 1px solid var(--rule); }
.az-filter button {
  min-width: 40px; min-height: 40px; font-family: var(--font-mono); font-weight: 700; font-size: 1rem;
  background: var(--paper); border: 1px solid var(--ink); border-radius: var(--radius); cursor: pointer;
}
.az-filter button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.az-filter button:disabled { opacity: .35; cursor: default; }
.glossary-grid { display: grid; gap: var(--space-4); }
.glossary-count { font-family: var(--font-mono); font-size: var(--step--1); color: var(--ink-soft); }

/* 20. FORMS --------------------------------------------------------------- */
.form { display: grid; gap: var(--space-3); max-width: 620px; }
.form label { font-family: var(--font-mono); font-size: var(--step--1); text-transform: uppercase; letter-spacing: .08em; display: block; margin-bottom: .3rem; }
.form input, .form textarea, .form select {
  width: 100%; padding: .7rem .8rem; background: #FBF6EA; border: 2px solid var(--ink); border-radius: var(--radius);
  font-family: var(--font-body); font-size: 1rem;
}
.form textarea { min-height: 180px; resize: vertical; }
.form .hint { font-size: .9rem; color: var(--ink-soft); margin-top: .3rem; }
.form-status { font-family: var(--font-mono); font-size: var(--step--1); }

/* 21. COOKIE NOTICE CARD -------------------------------------------------- */
.cookie-card {
  position: fixed; left: 1rem; right: 1rem; bottom: 1rem; z-index: 8500;
  max-width: 520px; margin-left: auto;
  background: var(--paper); border: 4px double var(--ink);
  box-shadow: 6px 6px 0 var(--brass);
  padding: var(--space-4) var(--space-4) var(--space-3);
  transform: translateY(0); transition: transform .35s var(--ease), opacity .35s;
}
.cookie-card[hidden] { display: none; }
.cookie-card h2 { font-size: var(--step-1); margin: 0 0 .5rem; padding-right: 80px; }
.cookie-card p { font-size: .98rem; }
.cookie-card .stamp { position: absolute; top: -26px; right: 8px; width: 84px; height: 84px; font-size: .55rem; padding: 10px; background: var(--paper); }
.cookie-card__actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.cookie-prefs { border-top: 1px dashed var(--rule); margin-top: var(--space-3); padding-top: var(--space-3); }
.cookie-prefs label { display: flex; gap: .6rem; align-items: flex-start; margin-bottom: .6rem; font-size: .98rem; }
.cookie-prefs input { width: 18px; height: 18px; margin-top: .35rem; accent-color: var(--oxblood); flex: none; }

/* 22. FOOTER -------------------------------------------------------------- */
.site-footer { background: var(--ink); color: var(--paper); padding: var(--space-6) 0 var(--space-4); margin-top: var(--space-5); position: relative; z-index: 1; }
.site-footer a { color: var(--paper); text-decoration-color: var(--brass); }
.site-footer a:visited { color: var(--paper-dark); }
.site-footer a:hover { color: var(--brass); }
.footer-cols { display: grid; gap: var(--space-5); }
.footer-cols h2 { font-family: var(--font-engraved); font-weight: 400; color: var(--brass); font-size: var(--step-1); margin: 0 0 var(--space-3); letter-spacing: .06em; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; font-size: 1rem; }
.footer-brand p { font-size: 1rem; color: var(--paper-dark); }
.footer-brand .brand { color: var(--paper); }
.footer-brand .brand:visited { color: var(--paper); }
.footer-brand .brand__sub { color: var(--paper-dark); }
.footer-legal { border-top: 3px double var(--brass); margin-top: var(--space-5); padding-top: var(--space-4); font-size: .95rem; color: var(--paper-dark); }
.footer-legal p { max-width: 90ch; }
.footer-colophon { font-family: var(--font-mono); font-size: var(--step--1); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; margin-top: var(--space-3); color: var(--brass); }
.linklike { background: none; border: 0; padding: 0; color: var(--paper); text-decoration: underline; text-decoration-color: var(--brass); text-decoration-thickness: 2px; text-underline-offset: 3px; cursor: pointer; font-size: 1rem; font-family: var(--font-body); }

/* 23. 404 ----------------------------------------------------------------- */
.locked-door { text-align: center; padding: var(--space-6) 0; }
.locked-door svg { width: min(240px, 60vw); margin: 0 auto var(--space-4); }
.locked-door h1 { margin-inline: auto; }
.locked-door .hero__actions { justify-content: center; }

/* 24. BREAKPOINTS --------------------------------------------------------- */
@media (min-width: 640px) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .glossary-grid { grid-template-columns: repeat(2, 1fr); }
  .az-filter { position: sticky; }
  .pin-legend { grid-template-columns: repeat(2, 1fr); }
  .calc .choices--2 { grid-template-columns: repeat(2, 1fr); }
  .footer-cols { grid-template-columns: repeat(2, 1fr); }
  .related { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  .nav-toggle { display: none; }
  .site-nav { display: block; }
  .site-header__inner { flex-wrap: wrap; }
  .hero__grid { grid-template-columns: 1.15fr 1fr; }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
  .article-layout { grid-template-columns: minmax(0, 1fr) 240px; }
  .article-layout .toc { display: block; position: sticky; top: var(--space-4); align-self: start; order: 2; }
  .footer-cols { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
  .pin-lab__controls { grid-template-columns: 1.3fr 1fr; }
}
@media (min-width: 1280px) {
  :root { --step-0: 1.125rem; }
  .wrap { width: min(100% - 4rem, 1240px); }
  .glossary-grid { grid-template-columns: repeat(3, 1fr); }
  .site-header__inner { flex-wrap: nowrap; }
  .state-grid-wrap { grid-template-columns: 1.3fr 1fr; align-items: start; }
}

/* 25. REDUCED MOTION ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .btn:hover, .btn:focus-visible, .ticket:has(a.stretched:hover), .state-tile:hover { transform: none; }
}

/* 26. PRINT --------------------------------------------------------------- */
@media print {
  @page { margin: 18mm 16mm; }
  body { background: #fff; color: #000; font-size: 11pt; line-height: 1.5; }
  body::before, .strip, .site-nav, .nav-toggle, .drawer, .drawer-backdrop, .cookie-card, .toc,
  .hero__actions, .pin-lab__controls, .az-filter, .skip-link, .related, .site-footer .footer-cols { display: none !important; }
  .site-header { border-bottom: 2px solid #000; }
  .hero, .section--band { background: none; }
  .hero::after { display: none; }
  .stamp { filter: none; mix-blend-mode: normal; }
  a { color: #000; text-decoration: underline; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-family: var(--font-mono); font-size: 8pt; word-break: break-all; }
  a.ext::after { content: " (" attr(href) ")"; }
  .site-footer { background: none; color: #000; padding: 0; border-top: 2px solid #000; }
  .site-footer a, .footer-legal, .footer-colophon { color: #000; }
  h2, h3 { break-after: avoid; }
  .ticket, .index-card, .plate, .takeaways, .ledger tr, figure { break-inside: avoid; }
  .ticket { -webkit-mask: none; mask: none; border: 1px solid #000; }
  .faq details > *:not(summary) { display: block !important; }
  .table-wrap { overflow: visible; border: 1px solid #000; }
  .ledger { min-width: 0; }
}
