:root {
  --paper: #f4f0e7;
  --paper-deep: #e9e1d2;
  --ink: #172129;
  --muted: #5f6b70;
  --navy: #123b55;
  --cyan: #237f7b;
  --cyan-soft: #d8eeea;
  --coral: #bd4f3f;
  --coral-soft: #f4ddd6;
  --brass: #8a672c;
  --line: #c8c1b5;
  --white: #fffdf8;
  --shadow: 0 14px 34px rgba(23, 33, 41, .09);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background:
    linear-gradient(rgba(18, 59, 85, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(18, 59, 85, .035) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.68;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
a { color: #12635f; text-decoration-thickness: .09em; text-underline-offset: .18em; }
a:hover { color: #8d3b30; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 3px solid #e89a32;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 12px;
  left: 12px;
  transform: translateY(-160%);
  padding: .7rem 1rem;
  color: white;
  background: var(--ink);
  border-radius: 8px;
}
.skip-link:focus { transform: none; }

.preview-ribbon {
  padding: .38rem 1rem;
  color: #fff;
  background: var(--coral);
  text-align: center;
  font-size: .78rem;
  font-weight: 750;
  letter-spacing: .04em;
}

.site-header {
  position: sticky;
  z-index: 70;
  top: 0;
  border-bottom: 1px solid rgba(23, 33, 41, .16);
  background: rgba(244, 240, 231, .95);
  backdrop-filter: blur(14px);
}
.header-inner {
  display: flex;
  width: min(1480px, calc(100% - 32px));
  min-height: 72px;
  margin: 0 auto;
  align-items: center;
  gap: 1.35rem;
}
.brand {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: .72rem;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: grid;
  width: 39px;
  height: 39px;
  place-items: center;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--cyan-soft);
  box-shadow: 4px 4px 0 var(--brass);
  font: 800 1rem/1 Georgia, serif;
}
.brand-copy { display: grid; line-height: 1.05; }
.brand-name { font: 700 1.08rem/1.1 Georgia, "Times New Roman", serif; }
.brand-kicker { margin-top: .18rem; color: var(--muted); font-size: .67rem; letter-spacing: .08em; text-transform: uppercase; }
.age-chip {
  flex: none;
  padding: .2rem .5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--white);
  font-size: .7rem;
  font-weight: 800;
}
.primary-nav { display: flex; margin-left: auto; align-items: stretch; gap: .15rem; }
.primary-nav a {
  display: grid;
  min-height: 72px;
  padding: 0 .78rem;
  place-items: center;
  border-bottom: 3px solid transparent;
  color: var(--ink);
  font-size: .86rem;
  font-weight: 700;
  text-decoration: none;
}
.primary-nav a:hover, .primary-nav a[aria-current="page"] { border-color: var(--cyan); color: var(--cyan); }
.menu-button {
  display: none;
  margin-left: auto;
  padding: .6rem .78rem;
  border: 1px solid var(--ink);
  border-radius: 10px;
  color: var(--ink);
  background: var(--white);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}
.mobile-nav { display: none; }

.site-shell {
  display: grid;
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 70px;
  grid-template-columns: minmax(180px, 220px) minmax(0, 840px) minmax(200px, 260px);
  justify-content: center;
  gap: clamp(22px, 3vw, 48px);
}
.index-rail, .proof-rail { min-width: 0; }
.rail-card, .proof-card {
  position: sticky;
  top: 112px;
  padding: 1.05rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 253, 248, .88);
  box-shadow: var(--shadow);
}
.rail-label, .proof-label, .eyebrow {
  margin: 0 0 .65rem;
  color: var(--coral);
  font-size: .72rem;
  font-weight: 850;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.outline { display: grid; gap: .15rem; }
.outline a {
  padding: .38rem .5rem;
  border-left: 2px solid var(--line);
  color: var(--ink);
  font-size: .79rem;
  line-height: 1.35;
  text-decoration: none;
}
.outline a:hover { border-color: var(--cyan); color: var(--cyan); background: var(--cyan-soft); }
.rail-help {
  display: block;
  margin-top: 1rem;
  padding: .72rem;
  border-radius: 10px;
  color: #fff;
  background: var(--coral);
  font-size: .78rem;
  font-weight: 750;
  text-decoration: none;
}

.article { min-width: 0; }
.breadcrumbs {
  margin-bottom: 1.25rem;
  color: var(--muted);
  font-size: .77rem;
}
.breadcrumbs ol { display: flex; margin: 0; padding: 0; list-style: none; flex-wrap: wrap; gap: .35rem; }
.breadcrumbs li:not(:last-child)::after { content: "›"; margin-left: .35rem; color: var(--brass); }
.breadcrumbs a { color: inherit; }
.article-hero {
  position: relative;
  padding: clamp(24px, 4.5vw, 56px);
  overflow: hidden;
  border: 1px solid rgba(18, 59, 85, .24);
  border-radius: 28px 28px 8px 28px;
  background: linear-gradient(135deg, var(--white), #e7f1ee);
  box-shadow: var(--shadow);
}
.article-hero::after {
  position: absolute;
  right: -45px;
  bottom: -65px;
  width: 170px;
  height: 170px;
  border: 28px solid rgba(35, 127, 123, .08);
  border-radius: 50%;
  content: "";
}
h1, h2, h3 { color: var(--ink); font-family: Georgia, "Times New Roman", serif; text-wrap: balance; }
h1 { max-width: 18ch; margin: 0; font-size: clamp(2.2rem, 5.4vw, 4.7rem); line-height: 1.02; letter-spacing: -.045em; }
.lede { position: relative; z-index: 1; max-width: 68ch; margin: 1.35rem 0 .9rem; color: #283840; font-size: clamp(1.05rem, 1.7vw, 1.28rem); line-height: 1.58; }
.scope-note {
  position: relative;
  z-index: 1;
  max-width: 70ch;
  margin: 0;
  padding: .78rem 1rem;
  border-left: 4px solid var(--coral);
  color: #3d484d;
  background: var(--coral-soft);
  font-size: .88rem;
}
.hero-figure { margin: 1.5rem 0 0; }
.hero-figure img, .proof-figure img {
  width: 100%;
  border: 1px solid rgba(18, 59, 85, .25);
  border-radius: 14px;
  box-shadow: 8px 8px 0 rgba(138, 103, 44, .18);
}
.hero-figure figcaption, .proof-figure figcaption { margin-top: .65rem; color: var(--muted); font-size: .75rem; }

.task-panel {
  margin: 1.8rem 0;
  padding: 1.35rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink);
  box-shadow: var(--shadow);
}
.task-panel h2 { margin: 0 0 .9rem; color: var(--white); font-size: 1.45rem; }
.task-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .65rem; }
.task-card {
  display: grid;
  min-height: 132px;
  padding: .9rem;
  align-content: space-between;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 13px;
  color: var(--white);
  background: rgba(255,255,255,.055);
  text-decoration: none;
}
.task-card:hover { color: var(--ink); background: var(--cyan-soft); }
.task-step { color: #9bd5ce; font: 800 .68rem/1 ui-sans-serif, system-ui; letter-spacing: .1em; text-transform: uppercase; }
.task-title { font: 700 .93rem/1.25 Georgia, serif; }

.prose {
  margin-top: 1.8rem;
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: 8px 28px 28px 28px;
  background: var(--white);
  box-shadow: var(--shadow);
}
.prose h2 { margin: 2.35rem 0 .8rem; padding-top: .25rem; font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.15; }
.prose h2:first-child { margin-top: 0; }
.prose h3 { margin: 1.45rem 0 .45rem; font-size: 1.2rem; }
.prose p { max-width: 72ch; }
.prose a { overflow-wrap: anywhere; word-break: break-word; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose li { margin: .4rem 0; }
.prose blockquote { margin: 1.2rem 0; padding: .8rem 1rem; border-left: 4px solid var(--cyan); background: var(--cyan-soft); }
.table-scroll { max-width: 100%; margin: 1.15rem 0 1.8rem; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { width: 100%; min-width: 610px; border-collapse: collapse; font-size: .88rem; }
caption { padding: .75rem; font-weight: 700; text-align: left; }
th, td { padding: .8rem .9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: white; background: var(--navy); }
tbody tr:nth-child(even) { background: #f4f3ee; }
tbody tr:last-child td { border-bottom: 0; }
.prose h2[id*="frequently"] ~ h3 { padding-left: .8rem; border-left: 3px solid var(--brass); }

.proof-card dl { display: grid; margin: 0; gap: .7rem; }
.proof-card div { padding-bottom: .65rem; border-bottom: 1px solid var(--line); }
.proof-card div:last-child { padding-bottom: 0; border: 0; }
.proof-card dt { color: var(--muted); font-size: .68rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.proof-card dd { margin: .15rem 0 0; font-size: .84rem; font-weight: 700; overflow-wrap: anywhere; }
.proof-figure { margin: 1rem 0; }
.proof-link { display: inline-block; margin-top: .85rem; font-size: .8rem; font-weight: 750; }

.site-footer { color: #dfe8e8; background: var(--ink); }
.footer-inner {
  display: grid;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
}
.footer-title { margin: 0 0 .65rem; color: white; font: 700 1.2rem/1.2 Georgia, serif; }
.footer-copy { max-width: 48ch; margin: 0; color: #b8c5c8; font-size: .84rem; }
.footer-links { display: grid; align-content: start; gap: .5rem; }
.footer-links a { color: #dfe8e8; font-size: .82rem; }
.footer-meta { grid-column: 1 / -1; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.15); color: #aebcc0; font-size: .74rem; }

.utility-notice { padding: 1rem; border: 1px dashed var(--coral); border-radius: 12px; background: var(--coral-soft); }
.not-found { min-height: 58vh; display: grid; place-content: center; text-align: center; }
.not-found .code { color: var(--cyan); font: 800 clamp(5rem, 14vw, 10rem)/.9 Georgia, serif; }

@media (max-width: 1180px) {
  .site-shell { grid-template-columns: minmax(180px, 220px) minmax(0, 760px); }
  .proof-rail { grid-column: 2; }
  .proof-card { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  .proof-figure { margin: 0; }
  .task-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .primary-nav, .age-chip { display: none; }
  .menu-button { display: inline-flex; }
  .mobile-nav {
    position: fixed;
    z-index: 60;
    inset: 0;
    display: none;
    padding: 94px 24px 28px;
    overflow-y: auto;
    background: var(--paper);
  }
  .mobile-nav[data-open="true"] { display: grid; align-content: start; gap: .55rem; }
  .mobile-nav a { padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--white); font-weight: 750; text-decoration: none; }
  .mobile-nav .help { margin-top: 1rem; color: #fff; background: var(--coral); }
  body.menu-open { overflow: hidden; }
  .site-shell { grid-template-columns: minmax(0, 1fr); }
  .index-rail { order: 2; }
  .article { order: 1; }
  .proof-rail { grid-column: 1; order: 3; }
  .rail-card { position: static; }
  .outline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .header-inner { width: min(100% - 22px, 1480px); min-height: 64px; }
  .brand-kicker { display: none; }
  .site-shell { width: min(100% - 20px, 1480px); padding-top: 20px; gap: 18px; }
  .article-hero { padding: 22px 18px; border-radius: 20px 20px 7px 20px; }
  h1 { font-size: clamp(2.05rem, 11vw, 3.2rem); }
  .prose { padding: 24px 18px; border-radius: 7px 20px 20px 20px; }
  .task-grid, .outline, .proof-card { grid-template-columns: 1fr; }
  .task-card { min-height: 104px; }
  .footer-inner { grid-template-columns: 1fr; }
  .footer-meta { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media print {
  .preview-ribbon, .site-header, .index-rail, .proof-rail, .site-footer { display: none; }
  .site-shell { display: block; width: 100%; padding: 0; }
  .article-hero, .prose { box-shadow: none; }
}
