/* ============================================================================
   My Quilt Math — design system (Slant 8, quilting calculators)
   Craft-editorial: Newsreader (self-hosted variable serif) for display, refined
   system sans for body + numbers. Warm cream ground, dusty-rose + soft-teal
   patchwork palette, running-stitch detailing, fabric-swatch cards. Light
   default (warm, for the 45–70 demographic) with a soft dark mode.
   No external/runtime font request — woff2 is self-hosted.
   ========================================================================== */

/* ---------- Self-hosted Newsreader (opsz 6–72, wght 400–700 + italic) ---------- */
@font-face {
  font-family: "Newsreader"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/newsreader-normal-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Newsreader"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(/assets/fonts/newsreader-normal-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader"; font-style: italic; font-weight: 400 600; font-display: swap;
  src: url(/assets/fonts/newsreader-italic-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Newsreader"; font-style: italic; font-weight: 400 600; font-display: swap;
  src: url(/assets/fonts/newsreader-italic-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}

/* ---------- Theme tokens ---------- */
:root {
  --paper:    #FFF8F0;   /* warm cream */
  --paper-2:  #FBEEE0;   /* cards */
  --paper-3:  #F4E2CF;   /* wells / inputs ground */
  --ink:      #2B2230;   /* deep plum-ink */
  --ink-soft: #5A4D5A;
  --ink-faint:#6E5F68;   /* darkened for WCAG AA (>=4.5:1) on cream + card/well surfaces */
  --line:     #ECDCC9;
  --line-2:   #E1CBB3;
  --rose:     #C4727F;   /* dusty rose — decorative fills */
  --rose-ink: #A8455A;   /* AA-safe rose for links/text on cream */
  --rose-2:   #934056;   /* pressed rose */
  --rose-soft:#F6E3E3;   /* rose tint wells */
  --teal:     #5B8A8A;   /* soft teal — secondary */
  --teal-ink: #3C6E6E;   /* AA-safe teal text */
  --teal-soft:#E2EEEC;
  --gold:     #D9A05B;   /* thread gold highlight */
  --plum:     #34283A;   /* dark brand block */
  --plum-2:   #2A1F30;
  --cream:    #FFF8F0;   /* text on dark blocks */

  --shadow-sm: 0 1px 2px rgba(43,34,48,.05), 0 4px 12px rgba(43,34,48,.05);
  --shadow:    0 2px 6px rgba(43,34,48,.06), 0 16px 40px rgba(43,34,48,.10);
  --shadow-lg: 0 6px 18px rgba(43,34,48,.10), 0 30px 70px rgba(43,34,48,.16);

  --radius: 16px;
  --radius-lg: 26px;
  --wrap: 75rem;
  --measure: 41rem;

  --font-display: "Newsreader", "Iowan Old Style", "Palatino", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-num: "SF Mono", ui-monospace, "Segoe UI Mono", "Roboto Mono", Menlo, monospace;

  /* faint woven-linen texture (inline, no request) */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] {
  --paper:    #1C1820;
  --paper-2:  #262029;
  --paper-3:  #2F2733;
  --ink:      #F1E8EC;
  --ink-soft: #CBB9C2;
  --ink-faint:#9B8893;
  --line:     #372F3C;
  --line-2:   #463B4B;
  --rose:     #D98A95;
  --rose-ink: #E79DA8;
  --rose-2:   #E79DA8;
  --rose-soft:#3a2730;
  --teal:     #7FB3B0;
  --teal-ink: #93C2BE;
  --teal-soft:#243733;
  --gold:     #E0B377;
  --plum:     #140F18;
  --plum-2:   #0E0A12;
  --cream:    #F1E8EC;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow:    0 2px 8px rgba(0,0,0,.4), 0 18px 44px rgba(0,0,0,.5);
  --shadow-lg: 0 10px 50px rgba(0,0,0,.6);
}

/* ---------- Reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 1.085rem/1.72 var(--font-sans);   /* larger body for the demographic */
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color .3s ease, color .3s ease;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
::selection { background: var(--rose); color: #fff; }

a { color: var(--rose-ink); text-underline-offset: .18em; text-decoration-thickness: .08em; transition: color .15s ease; }
a:hover { color: var(--ink); }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-optical-sizing: auto;
  font-weight: 560;
  line-height: 1.1;
  letter-spacing: -0.012em;
  color: var(--ink);
}
h1 { font-size: clamp(2.5rem, 1.6rem + 4vw, 4.2rem); font-weight: 600; margin: 0 0 .35em; }
h2 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.45rem); margin: 0 0 .5em; }
h3 { font-size: 1.4rem; margin: 1.7em 0 .4em; }
h4 { font-size: 1.05rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
p { margin: 1.05em 0; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: 1.5rem; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* Eyebrow / overline — the editorial tells */
.eyebrow {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: 1.2rem; color: var(--rose-ink); margin: 0 0 .9rem; letter-spacing: 0;
}
.overline {
  text-transform: uppercase; letter-spacing: .2em; font-size: .72rem; font-weight: 700;
  color: var(--teal-ink); font-family: var(--font-sans);
}

/* Skip link */
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--plum); color: var(--cream); padding: .6rem 1rem; border-radius: 0 0 8px 0; }
.skip:focus { left: 0; }

/* Visually-hidden, but exposed to assistive tech and search engines. Used for
   section headings that keep the heading order sequential without adding a
   second visible title beneath a page-hero h1. */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Keyboard focus: a clearly visible indicator on every interactive element.
   Mouse clicks don't trigger :focus-visible, so the rings only show for keyboard
   users. Inputs keep their own box-shadow ring (see .field input:focus). */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.chip:focus-visible,
.reset-btn:focus-visible,
.icon-btn:focus-visible,
.theme-toggle:focus-visible,
.nav-toggle:focus-visible {
  outline: 3px solid var(--rose-ink);
  outline-offset: 2px;
  border-radius: 6px;
}
.field input:focus-visible, .field select:focus-visible { outline: none; }

/* ---------- Running-stitch divider (the sewing tell) ---------- */
.stitch {
  height: 0; border: 0; border-top: 2px dashed var(--line-2);
  max-width: 180px; margin: 0 auto; opacity: .9;
}
.divider { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 0 auto; color: var(--line-2); max-width: 320px; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 2px dashed currentColor; }
.divider svg { width: 26px; height: 26px; flex: 0 0 auto; color: var(--rose); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5em;
  font-family: var(--font-sans); font-weight: 600; font-size: 1rem; line-height: 1;
  padding: .92em 1.5em; border-radius: 999px;
  border: 1.5px solid var(--rose-ink); color: var(--rose-ink);
  background: transparent; cursor: pointer; text-decoration: none;
  transition: background-color .2s, color .2s, border-color .2s, transform .2s, box-shadow .2s;
}
.btn:hover { background: var(--rose-soft); color: var(--rose-ink); transform: translateY(-2px); }
.btn-primary {
  background: var(--rose-ink); color: #fff; border-color: var(--rose-ink);
  box-shadow: 0 3px 0 var(--rose-2), 0 10px 24px rgba(168,69,90,.26);
}
.btn-primary:hover { background: var(--rose-2); border-color: var(--rose-2); color: #fff; transform: translateY(-2px); box-shadow: 0 5px 0 var(--rose-2), 0 16px 30px rgba(168,69,90,.30); }
.btn-primary:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--rose-2); }
.btn-teal { background: var(--teal-ink); border-color: var(--teal-ink); color: #fff; box-shadow: 0 3px 0 #2c5454, 0 10px 24px rgba(60,110,110,.24); }
.btn-teal:hover { background: #335f5f; border-color: #335f5f; color:#fff; box-shadow: 0 5px 0 #2c5454, 0 16px 30px rgba(60,110,110,.28); }
.btn-sm { padding: .6em 1.1em; font-size: .92rem; }
.btn-ghost { border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover { background: var(--paper-2); color: var(--ink); border-color: var(--ink-faint); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 1rem; min-height: 70px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.brand-mark { width: 34px; height: 34px; flex: 0 0 auto; border-radius: 7px; filter: drop-shadow(0 2px 3px rgba(43,34,48,.12)); }
.brand-word { display: flex; flex-direction: column; line-height: 1; }
.brand-word b { font-family: var(--font-display); font-weight: 600; font-size: 1.3rem; letter-spacing: -0.01em; }
.brand-word span { font-size: .64rem; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-faint); margin-top: .18rem; }
.nav { display: flex; gap: .15rem; margin-left: auto; }
.nav a { color: var(--ink-soft); text-decoration: none; font-weight: 500; font-size: 1rem; padding: .55rem .85rem; border-radius: 9px; transition: color .15s, background .15s; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--ink); background: var(--paper-2); }
.header-actions { display: flex; align-items: center; gap: .55rem; margin-left: .3rem; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border: 1.5px solid var(--line-2); background: var(--paper-2); color: var(--ink); border-radius: 12px; cursor: pointer; padding: 0; transition: border-color .15s, color .15s, transform .15s; }
.icon-btn:hover { border-color: var(--rose-ink); color: var(--rose-ink); transform: translateY(-1px); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-toggle .moon { display: none; } .theme-toggle .sun { display: block; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
.nav-toggle { display: none; }

/* ---------- Section rhythm ---------- */
section { position: relative; }
.section { padding-block: clamp(3rem, 6vw, 5.25rem); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.section-head h2 { margin: 0; }
.section-head .overline { margin-bottom: .35rem; }
.section-head a { font-size: 1rem; white-space: nowrap; font-weight: 600; }
.section-title-block { max-width: 40rem; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; margin-top: clamp(.9rem, 2vw, 1.5rem); }
.hero-panel {
  position: relative; overflow: hidden;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(120% 130% at 88% 0%, var(--rose-soft) 0%, transparent 52%),
    radial-gradient(120% 120% at 0% 100%, var(--teal-soft) 0%, transparent 46%),
    linear-gradient(165deg, var(--paper-2) 0%, var(--paper) 62%);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: clamp(1.8rem, 3.5vw, 3.2rem);
}
.hero-panel::after { content: ""; position: absolute; inset: 0; background-image: var(--grain); opacity: .045; mix-blend-mode: multiply; pointer-events: none; }
:root[data-theme="dark"] .hero-panel::after { mix-blend-mode: screen; opacity: .05; }
.hero-grid { position: relative; z-index: 1; display: grid; grid-template-columns: 1.08fr .92fr; gap: clamp(1.4rem, 4vw, 3rem); align-items: center; }
.hero-copy { max-width: 37rem; }
.hero-copy h1 { letter-spacing: -0.028em; margin-bottom: .28em; }
.hero-copy h1 em { font-style: italic; font-weight: 500; color: var(--rose-ink); }
.hero-copy .lede { font-size: clamp(1.08rem, 1rem + .4vw, 1.24rem); line-height: 1.55; color: var(--ink-soft); margin: 0 0 1.5rem; max-width: 34rem; }
.hero-cta { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.hero-art { position: relative; display: grid; place-items: center; }
.hero-art .quilt-illo { width: min(100%, 380px); height: auto; filter: drop-shadow(0 26px 44px rgba(43,34,48,.20)); }

/* Trust row */
.trust { display: flex; flex-wrap: wrap; gap: .4rem 1.5rem; margin-top: 1.4rem; padding: 0; list-style: none; color: var(--ink-soft); font-size: .94rem; }
.trust li { display: inline-flex; align-items: center; gap: .45rem; }
.trust svg { width: 18px; height: 18px; color: var(--teal-ink); flex: 0 0 auto; }

/* Rotating tape-measure badge */
.badge { position: absolute; width: clamp(94px, 11vw, 124px); height: clamp(94px, 11vw, 124px); z-index: 2; }
.hero-art .badge { right: -4px; bottom: -8px; }
.badge-svg { width: 100%; height: 100%; overflow: visible; }
.badge-ring { transform-origin: 100px 100px; animation: badge-spin 30s linear infinite; }
@keyframes badge-spin { to { transform: rotate(360deg); } }
.badge-disc { fill: var(--teal-ink); }
.badge-text { fill: var(--cream); font-family: var(--font-sans); font-size: 13px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; }
.badge-core { fill: var(--gold); }
.badge-core-text { fill: var(--plum); font-family: var(--font-display); font-weight: 600; }

/* ---------- Calculator hub grid (fabric-swatch cards) ---------- */
.calc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1.4rem; }
.calc-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  padding: 1.6rem 1.5rem 1.4rem; border-radius: var(--radius);
  background: var(--paper); border: 1px solid var(--line);
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s, border-color .2s;
}
.calc-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px;
  background: repeating-linear-gradient(90deg, var(--rose) 0 14px, var(--teal) 14px 28px, var(--gold) 28px 42px); opacity: .9; }
.calc-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-2); }
.calc-icon { width: 46px; height: 46px; flex: 0 0 auto; }
.calc-card .calc-icon { margin-bottom: .9rem; }
/* calculator-page hero: the icon as a deliberate feature tile */
.calc-feature-icon { display: inline-grid; place-items: center; width: 74px; height: 74px; border-radius: 18px; background: var(--paper-2); border: 1px solid var(--line); box-shadow: var(--shadow-sm); margin-bottom: 1.1rem; }
.calc-feature-icon .calc-icon { width: 40px; height: 40px; }
.calc-card .tag { font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--teal-ink); }
.calc-card h3 { margin: .35rem 0 .45rem; font-size: 1.34rem; line-height: 1.15; }
.calc-card p { margin: 0; color: var(--ink-soft); font-size: .97rem; line-height: 1.55; }
.calc-card .open { margin-top: 1.1rem; font-weight: 600; font-size: .95rem; color: var(--rose-ink); }
.calc-card:hover .open { text-decoration: underline; }

/* ---------- The calculator tool itself ---------- */
.calc-shell { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(1.4rem, 3vw, 2.4rem); align-items: start; margin-top: 2rem; }
.calc-form, .calc-result { border-radius: var(--radius-lg); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.calc-form { background: var(--paper); padding: clamp(1.4rem, 3vw, 2rem); }
.calc-form h2 { font-size: 1.45rem; margin: 0 0 .3rem; }
.calc-form .form-intro { color: var(--ink-soft); font-size: .98rem; margin: 0 0 1.4rem; }
.field { margin-bottom: 1.15rem; }
.field > label { display: block; font-weight: 600; font-size: .98rem; margin-bottom: .4rem; color: var(--ink); }
.field .input-wrap { position: relative; display: flex; align-items: center; }
.field input, .field select {
  width: 100%; font-family: var(--font-sans); font-size: 1.08rem; color: var(--ink);
  background: var(--paper-3); border: 1.5px solid var(--line-2); border-radius: 12px;
  padding: .8em 1em; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.field input { font-family: var(--font-num); letter-spacing: -0.01em; }
.field .input-wrap.has-unit input { padding-right: 3.2em; }
.field .unit { position: absolute; right: 1em; color: var(--ink-faint); font-size: .95rem; pointer-events: none; font-family: var(--font-sans); }
.field select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238B7B85' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1em center; padding-right: 2.8em; }
.field input:focus, .field select:focus { outline: none; border-color: var(--rose-ink); box-shadow: 0 0 0 4px var(--rose-soft); }
.field .note { font-size: .85rem; color: var(--ink-faint); margin-top: .4rem; line-height: 1.45; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.calc-actions { display: flex; gap: .7rem; margin-top: 1.5rem; }
.calc-actions .btn { flex: 0 0 auto; }
.reset-btn { background: none; border: 0; color: var(--ink-faint); font: inherit; font-size: .92rem; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; }
.reset-btn:hover { color: var(--rose-ink); }

/* Result panel — the "answer" */
.calc-result { background: linear-gradient(170deg, var(--paper-2), var(--paper)); padding: clamp(1.4rem, 3vw, 2rem); position: sticky; top: 88px; overflow: hidden; }
.calc-result::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: repeating-linear-gradient(90deg, var(--rose) 0 14px, var(--teal) 14px 28px, var(--gold) 28px 42px); }
.result-label { font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-ink); margin: .3rem 0 0; }
.result-headline { font-family: var(--font-display); font-weight: 600; line-height: 1.05; letter-spacing: -0.02em; margin: .3rem 0 .1rem; font-size: clamp(2.2rem, 1.4rem + 3vw, 3.1rem); color: var(--rose-ink); }
.result-headline .frac { font-size: .58em; vertical-align: .12em; }
.result-sub { color: var(--ink-soft); font-size: 1.02rem; margin: 0 0 1.3rem; }
.result-rows { list-style: none; margin: 0; padding: 0; border-top: 1px dashed var(--line-2); }
.result-rows li { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .72rem 0; border-bottom: 1px dashed var(--line-2); }
.result-rows .k { color: var(--ink-soft); font-size: .98rem; }
.result-rows .v { font-family: var(--font-num); font-weight: 600; font-size: 1.06rem; color: var(--ink); text-align: right; white-space: nowrap; }
.result-rows .v small { font-family: var(--font-sans); font-weight: 400; color: var(--ink-faint); display: block; font-size: .8rem; }
.result-note { margin: 1.1rem 0 0; padding: .9rem 1.05rem; background: var(--teal-soft); border-radius: 12px; font-size: .92rem; color: var(--ink-soft); line-height: 1.5; }
.result-note strong { color: var(--ink); }
.result-empty { color: var(--ink-faint); font-style: italic; font-family: var(--font-display); font-size: 1.15rem; padding: 1.5rem 0; }
.cut-pill { display: inline-flex; align-items: center; gap: .4rem; background: var(--rose-soft); color: var(--rose-2); border-radius: 999px; padding: .3em .85em; font-family: var(--font-num); font-weight: 600; font-size: .95rem; margin: .2rem .35rem .2rem 0; }
:root[data-theme="dark"] .cut-pill { color: var(--rose-ink); }

/* "How it works" explainer + formula block */
.explainer { margin-top: clamp(2.5rem, 5vw, 3.5rem); }
.formula { font-family: var(--font-num); background: var(--paper-3); border: 1px solid var(--line-2); border-left: 4px solid var(--teal); border-radius: 12px; padding: 1rem 1.2rem; margin: 1.2rem 0; font-size: .98rem; color: var(--ink); overflow-x: auto; }
.formula b { color: var(--rose-ink); font-weight: 700; }

/* ---------- Article / blog cards ---------- */
.post-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(17.5rem, 1fr)); gap: 1.4rem; }
.post-card {
  display: flex; flex-direction: column; position: relative; overflow: hidden;
  padding: 1.5rem 1.5rem 1.4rem; border-radius: var(--radius); background: var(--paper);
  border: 1px solid var(--line); text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .2s, box-shadow .2s, border-color .2s;
}
.post-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-2); }
.post-card .cat { color: var(--teal-ink); font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.post-card h3 { margin: .5rem 0 .45rem; font-size: 1.24rem; line-height: 1.2; }
.post-card p { margin: 0; color: var(--ink-soft); font-size: .96rem; line-height: 1.55; }
.post-card .read { margin-top: 1rem; font-weight: 600; font-size: .92rem; color: var(--rose-ink); }
.post-card:hover .read { text-decoration: underline; }

/* ---------- Closing band ---------- */
.closing-band { position: relative; overflow: hidden; margin-top: clamp(3rem, 6vw, 5rem); border-radius: var(--radius-lg); background: var(--plum); color: var(--cream); padding: clamp(2.4rem, 5vw, 3.6rem); text-align: center; box-shadow: var(--shadow); }
.closing-band::after { content: ""; position: absolute; inset: 0; background-image: var(--grain); opacity: .07; mix-blend-mode: overlay; pointer-events: none; }
.closing-band > * { position: relative; z-index: 1; }
.closing-band h2 { color: var(--cream); }
.closing-band .lede { color: color-mix(in srgb, var(--cream) 80%, transparent); max-width: 36rem; margin: 0 auto 1.6rem; font-size: 1.15rem; }
.closing-band .btn-primary { background: var(--gold); border-color: var(--gold); color: var(--plum-2); box-shadow: 0 3px 0 #b9863f, 0 12px 28px rgba(0,0,0,.3); }
.closing-band .btn-primary:hover { background: #e8b675; border-color: #e8b675; color: var(--plum-2); box-shadow: 0 5px 0 #b9863f, 0 16px 34px rgba(0,0,0,.34); }

/* ---------- Article body ---------- */
.article { padding-top: 2rem; padding-bottom: 1rem; }
.breadcrumbs { font-size: .88rem; color: var(--ink-faint); margin-bottom: 1.2rem; }
.breadcrumbs a { color: var(--ink-soft); text-decoration: none; }
.breadcrumbs a:hover { color: var(--rose-ink); }
.article-header { max-width: var(--measure); }
.article-header h1 { margin-top: .4rem; letter-spacing: -0.022em; }
.cat-tag { display: inline-block; font-family: var(--font-sans); font-size: .74rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--teal-ink); }
.article-meta { color: var(--ink-faint); font-size: .92rem; margin-top: .7rem; }
.article-lede { font-family: var(--font-display); font-style: italic; font-weight: 400; font-size: 1.32rem; line-height: 1.5; color: var(--ink-soft); max-width: var(--measure); margin: 1.1rem 0 0; }
.article-body { max-width: var(--measure); margin-top: 1.9rem; font-size: 1.13rem; }
.article-body > * { max-width: var(--measure); }
.article-body p { margin: 1.15em 0; }
.article-body > h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.95rem); margin: 1.9em 0 .5em; }
.article-body > h3 { font-size: 1.3rem; }
.article-body a { color: var(--rose-ink); text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--rose-ink) 38%, transparent); }
.article-body a:hover { color: var(--ink); text-decoration-color: currentColor; }
.article-body strong { color: var(--ink); font-weight: 650; }
.article-body ul { list-style: none; margin: 1.5em 0; padding: 1.3rem 1.5rem; background: var(--paper-2); border: 1px solid var(--line); border-left: 4px solid var(--rose); border-radius: 12px; }
.article-body ul li { position: relative; padding-left: 1.6rem; margin: .55em 0; }
.article-body ul li::before { content: ""; position: absolute; left: 0; top: .58em; width: 9px; height: 9px; border-radius: 2px; background: var(--gold); box-shadow: 0 0 0 3px var(--rose-soft); transform: rotate(45deg); }
.article-body ol { margin: 1.3em 0; padding-left: 1.4em; }
.article-body ol li { margin: .5em 0; padding-left: .3em; }
.article-body ol li::marker { color: var(--rose-ink); font-family: var(--font-display); font-weight: 600; }
.article-body blockquote { margin: 1.8em 0; padding: .4em 1.4em; border-left: 3px solid var(--teal); color: var(--ink-soft); font-family: var(--font-display); font-style: italic; font-size: 1.18rem; }
.article-body hr { border-top: 2px dashed var(--line-2); margin: 2.4em 0; }
.edition-body > p:first-of-type::first-letter { font-family: var(--font-display); font-weight: 600; float: left; font-size: 4rem; line-height: .82; padding: .06em .12em 0 0; color: var(--rose-ink); }

/* "Try the calculator" inline callout inside articles */
.calc-callout { max-width: var(--measure); margin: 2.4rem auto; padding: 1.5rem 1.6rem; border-radius: var(--radius); background: radial-gradient(130% 160% at 0% 0%, var(--teal-soft) 0%, var(--paper-2) 55%); border: 1px solid var(--line-2); display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.3rem; justify-content: space-between; }
.calc-callout .cc-text { max-width: 26rem; }
.calc-callout strong { font-family: var(--font-display); font-size: 1.2rem; display: block; margin-bottom: .15rem; }
.calc-callout p { margin: 0; color: var(--ink-soft); font-size: .96rem; }
.calc-callout .btn { white-space: nowrap; }

/* related links row */
.related { max-width: var(--measure); margin: 2.6rem auto 0; padding-top: 1.5rem; border-top: 1px dashed var(--line-2); }
.related h3 { font-family: var(--font-sans); text-transform: uppercase; letter-spacing: .14em; font-size: .72rem; color: var(--ink-faint); margin: 0 0 .8rem; }
.related ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.related a { color: var(--rose-ink); text-decoration: none; font-weight: 500; }
.related a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Page hero (archive, about) ---------- */
.page-hero { padding: clamp(2.5rem, 5vw, 4rem) 0 1rem; max-width: 46rem; }
.page-hero h1 { letter-spacing: -0.028em; }
.page-hero .lede { font-size: 1.2rem; color: var(--ink-soft); }

/* ---------- Category filter chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1.6rem 0 .5rem; }
.chip { font: 600 .9rem/1 var(--font-sans); padding: .55em 1em; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--paper); color: var(--ink-soft); cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--rose-ink); color: var(--rose-ink); }
.chip[aria-pressed="true"] { background: var(--rose-ink); border-color: var(--rose-ink); color: #fff; }

/* ---------- Ads ---------- */
.ad { margin: 2.4rem auto; text-align: center; max-width: var(--measure); }
.ad::before { content: "Advertisement"; display: block; font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: .35rem; }
.ad ins { display: block; }
/* Reserve slot height so the ad iframe loading in doesn't shift content (CLS). */
.ad-inline { min-height: 250px; }
.ad-sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; margin: 0; padding: .25rem; background: var(--paper-2); border-top: 1px solid var(--line); display: none; min-height: 60px; }
.ad-sticky::before { display: none; }
@media (max-width: 720px) { .ad-sticky.on { display: block; } body.has-sticky { padding-bottom: 70px; } }

/* ---------- Footer ---------- */
.site-footer { position: relative; overflow: hidden; margin-top: 4rem; background: var(--plum); color: var(--cream); }
.site-footer::after { content: ""; position: absolute; inset: 0; background-image: var(--grain); opacity: .06; mix-blend-mode: overlay; pointer-events: none; }
.footer-inner { position: relative; z-index: 1; padding-block: 3.2rem 2.2rem; display: grid; gap: 1.8rem; }
.footer-top { display: flex; flex-wrap: wrap; gap: 2.5rem; justify-content: space-between; align-items: flex-start; }
.footer-brand { max-width: 23rem; }
.footer-wordmark { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--font-display); font-weight: 600; font-size: 1.6rem; color: var(--cream); text-decoration: none; letter-spacing: -0.01em; }
.footer-wordmark .brand-mark { width: 30px; height: 30px; }
.footer-tag { color: color-mix(in srgb, var(--cream) 72%, transparent); margin: .7rem 0 0; font-size: 1.02rem; line-height: 1.55; }
.footer-cols { display: flex; flex-wrap: wrap; gap: 2rem 3.5rem; }
.footer-cols nav { display: grid; gap: .55rem; align-content: start; }
.footer-cols h3 { margin: 0 0 .2rem; font-family: var(--font-sans); font-size: .72rem; text-transform: uppercase; letter-spacing: .16em; color: color-mix(in srgb, var(--cream) 55%, transparent); }
.footer-cols a { color: color-mix(in srgb, var(--cream) 82%, transparent); text-decoration: none; font-size: 1rem; }
.footer-cols a:hover { color: var(--cream); }
.foot-brandline { color: color-mix(in srgb, var(--cream) 78%, transparent); font-size: .98rem; max-width: var(--measure); border-top: 1px solid rgba(255,255,255,.12); padding-top: 1.6rem; }
.foot-brandline strong { color: var(--gold); font-weight: 600; }
.foot-brandline a { color: var(--gold); }
.disclosure { color: color-mix(in srgb, var(--cream) 58%, transparent); font-size: .85rem; max-width: var(--measure); }
.foot-legal { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; color: color-mix(in srgb, var(--cream) 55%, transparent); font-size: .86rem; border-top: 1px solid rgba(255,255,255,.12); padding-top: 1.4rem; }
.foot-legal a { color: color-mix(in srgb, var(--cream) 70%, transparent); }
.foot-legal a:hover { color: var(--cream); }
.xref { color: var(--gold); font-weight: 500; font-style: italic; font-family: var(--font-display); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .calc-shell { grid-template-columns: 1fr; }
  .calc-result { position: static; order: -1; }
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .hero-copy { max-width: none; margin-inline: auto; }
  .hero-copy .lede { margin-inline: auto; }
  .hero-cta, .trust { justify-content: center; }
  .hero-art { order: -1; }
  .hero-art .quilt-illo { width: min(74%, 300px); }
  .hero-art .badge { right: 6%; }
}
@media (max-width: 760px) {
  .nav, .header-actions .btn { display: none; }
  .nav-toggle { display: inline-grid; }
  .nav.open { display: grid; position: absolute; left: 0; right: 0; top: 70px; background: var(--paper); border-bottom: 1px solid var(--line); padding: .75rem 1.5rem 1rem; gap: .1rem; box-shadow: var(--shadow); }
  .nav.open a { padding: .8rem .5rem; font-size: 1.05rem; }
  .section-head { flex-direction: column; align-items: flex-start; gap: .3rem; }
  .field-row { grid-template-columns: 1fr; }
}
@media print {
  .site-header, .site-footer, .ad, .ad-sticky, .calc-callout, .closing-band, .badge { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; }
  .calc-shell { grid-template-columns: 1fr; }
}
