/* =========================================================================
   linedpaperpdf.com — visual system

   Ported from the cursivewritingsheets.com "bound handwriting manual"
   direction. Visual layer only: no markup, copy, keywords, structure or
   tool behaviour are touched here. Every selector maps to existing
   generated HTML.

   Direction: a bound writing manual. Source Serif 4 for headings and prose,
   Inter for tool chrome. Real material throughout — paper grain, ruled
   stock, a leather desk under the preview, engraved frames, gold hairlines,
   and a dark cloth-bound footer.
   ========================================================================= */

:root {
  color-scheme: light;

  --serif: "Source Serif 4", "Iowan Old Style", "Palatino Linotype", Georgia, "Times New Roman", serif;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Paper & ink */
  --paper: #f4f0e6;
  --sheet: #fffdf8;
  --sheet-2: #f7f2e6;
  --sheet-3: #ebe4d3;
  --ink: #1b1813;
  --ink-2: #4b463c;
  --ink-3: #7a7367;
  --rule: #e0d8c6;
  --rule-2: #c9c0a9;

  /* Claret — links, marks, active states, primary action */
  --claret: #8c2f26;
  --claret-2: #74251e;
  --claret-3: #a8443a;
  --claret-tint: rgba(140, 47, 38, 0.07);
  --claret-ring: rgba(140, 47, 38, 0.22);

  --gold: #9a7b3f;
  --gold-2: #c8a765;
  --gold-line: rgba(154, 123, 63, 0.32);
  --success: #3f6b54;

  /* Cloth binding (footer + desk) */
  --cloth: #221d17;
  --cloth-2: #16120e;
  --cloth-text: #d9d0be;
  --cloth-text-2: #a49a86;

  /* Aliases kept so any older rule referencing the previous token names
     still resolves to the new system rather than to nothing. */
  --bg: var(--paper);
  --surface: var(--sheet);
  --surface-soft: var(--sheet-2);
  --surface-strong: var(--sheet-3);
  --text: var(--ink);
  --text-soft: var(--ink-2);
  --text-muted: var(--ink-3);
  --border: var(--rule-2);
  --primary: var(--claret);
  --primary-hover: var(--claret-2);
  --accent: var(--claret);
  --accent-hover: var(--claret-2);
  --accent-soft: var(--claret-tint);
  --radius: 7px;
  --radius-sm: 5px;
  --shadow-sm: var(--sh-1);
  --shadow-md: var(--sh-2);
  --shadow-lg: var(--sh-3);

  /* Paper grain — greyscale fractal noise, laid under every surface fill */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23g)' opacity='0.055'/%3E%3C/svg%3E");
  --grain-strong: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='h'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23h)' opacity='0.11'/%3E%3C/svg%3E");

  --sh-1: 0 1px 2px rgba(35, 28, 16, 0.06);
  --sh-2: 0 1px 3px rgba(35, 28, 16, 0.07), 0 8px 20px -8px rgba(35, 28, 16, 0.14);
  --sh-3: 0 2px 8px rgba(35, 28, 16, 0.09), 0 22px 48px -16px rgba(35, 28, 16, 0.24);
  --sh-plate:
    0 1px 1px rgba(0, 0, 0, 0.22),
    0 14px 30px -8px rgba(0, 0, 0, 0.45),
    0 44px 80px -30px rgba(0, 0, 0, 0.5);

  --r-xs: 3px;
  --r-sm: 5px;
  --r: 7px;
  --r-lg: 10px;

  /* Layout column. The masthead and colophon run edge to edge; every other
     block sits on this centred column, and the bands pad themselves to match. */
  --col: 1460px;
  --gutter: 28px;

  --measure: 68ch;
  --ease: cubic-bezier(0.2, 0.6, 0.3, 1);
  --focus: 0 0 0 3px var(--claret-ring);
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--cloth-2);
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background:
    var(--grain),
    radial-gradient(140% 60% at 50% 0%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 62%),
    radial-gradient(120% 80% at 100% 100%, rgba(154, 123, 63, 0.07), transparent 60%),
    var(--paper);
  background-attachment: fixed, scroll, scroll, scroll;
}

/* Headband — the coloured band at the top of a bound book */
body::before {
  content: "";
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px; z-index: 300;
  background: linear-gradient(90deg, var(--claret-2), var(--claret) 22%, var(--gold-2) 50%, var(--claret) 78%, var(--claret-2));
}

::selection { background: rgba(140, 47, 38, 0.16); }

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

a:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--claret);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
input[type="color"]:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-color: var(--claret);
}

.skip-link {
  position: fixed; top: -100%; left: 8px; z-index: 10000;
  padding: 12px 20px;
  border-radius: 0 0 var(--r) var(--r);
  background: var(--ink); color: #fff;
  font-size: 14px; font-weight: 700; text-decoration: none;
  transition: top 160ms ease;
}
.skip-link:focus { top: 3px; }

.page-shell { width: 100%; margin: 0; padding: 0; }

/* Distance from the viewport edge to the body column, used by the full-bleed
   bands so their contents line up with everything else. */
.topbar, .site-footer {
  padding-inline: max(var(--gutter), calc(50% - var(--col) / 2 + var(--gutter)));
}

/* -------------------------------------------------------------------------
   Masthead
   ------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 3px; z-index: 100;
  display: flex; align-items: center; justify-content: space-between;
  gap: 18px; min-height: 62px;
  margin: 0 0 30px;
  padding-block: 10px;
  flex-wrap: wrap;
  background:
    var(--grain),
    linear-gradient(180deg, rgba(252, 250, 244, 0.94), rgba(246, 241, 231, 0.92));
  backdrop-filter: saturate(150%) blur(14px);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
  border-bottom: 1px solid var(--rule-2);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 3px 0 -2px var(--gold-line), 0 14px 24px -22px rgba(35, 28, 16, 0.7);
}

@media (prefers-reduced-motion: reduce) {
  .topbar { backdrop-filter: none; -webkit-backdrop-filter: none; }
}

.topbar .brand { min-width: 0; flex-shrink: 1; }
.topbar .brand-name { overflow-wrap: anywhere; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.brand { display: inline-flex; align-items: center; gap: 13px; color: var(--ink); text-decoration: none; }
.brand-name {
  font-family: var(--serif);
  font-size: 17.5px; font-weight: 600; letter-spacing: -0.005em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
.brand-tagline {
  display: none; color: var(--ink-3);
  font-size: 11.5px; font-weight: 500; letter-spacing: 0.02em;
}
@media (min-width: 640px) {
  .brand-tagline { display: inline; }
  .brand-tagline::before {
    content: ""; display: inline-block;
    width: 1px; height: 14px; margin: 0 13px -3px;
    background: linear-gradient(180deg, transparent, var(--rule-2), transparent);
  }
}

/* Wax-seal monogram — claret seal stamped with a ruled-paper motif */
.brand-mark {
  position: relative;
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 50%;
  background:
    var(--grain-strong),
    repeating-linear-gradient(0deg, transparent 0 6px, rgba(253, 240, 228, 0.26) 6px 6.5px),
    radial-gradient(120% 120% at 32% 24%, #b04d42 0%, var(--claret) 42%, #5f1c17 100%);
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.4),
    inset 0 -2px 4px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(95, 28, 23, 0.5),
    0 1px 3px rgba(35, 28, 16, 0.4);
}

.topbar-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; }
.topbar-nav a {
  padding: 7px 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none;
  transition: color 140ms var(--ease), background-color 140ms var(--ease);
}
.topbar-nav a:hover { color: var(--claret); background: rgba(255, 255, 255, 0.7); }
.topbar-nav a[aria-current="page"] { color: var(--claret); }

/* -------------------------------------------------------------------------
   Running head — breadcrumbs
   ------------------------------------------------------------------------- */
#breadcrumbs, .breadcrumbs { margin-bottom: 20px; }
.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  padding: 0;
  color: var(--ink-3);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.13em;
}
#breadcrumbs nav ol {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  margin: 0; padding: 0; list-style: none;
  color: var(--ink-3);
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.13em;
}
#breadcrumbs li + li::before { content: "/"; margin-right: 7px; color: var(--rule-2); }
#breadcrumbs a, .breadcrumbs a { color: var(--ink-3); text-decoration: none; }
#breadcrumbs a:hover, .breadcrumbs a:hover { color: var(--claret); }
#breadcrumbs [aria-current="page"], #breadcrumbs .current,
.breadcrumbs [aria-current="page"] { color: var(--ink-2); }
.breadcrumbs .sep { color: var(--rule-2); }

/* -------------------------------------------------------------------------
   Headings
   ------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  margin: 0; font-family: var(--serif); color: var(--ink);
  font-variant-numeric: lining-nums;
}
h1 { font-size: clamp(34px, 3.9vw, 52px); line-height: 1.05; font-weight: 700; letter-spacing: -0.018em; }
h2 { font-size: 23px; line-height: 1.24; font-weight: 600; letter-spacing: -0.011em; }
h3 { font-size: 20px; line-height: 1.3; font-weight: 600; letter-spacing: -0.008em; }
h4 { font-size: 17px; line-height: 1.38; font-weight: 600; }
h2, h3, h4 { scroll-margin-top: 96px; }
p { margin: 0; }

.eyebrow {
  margin: 0 0 8px; color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
}

/* -------------------------------------------------------------------------
   Hero — set on a sheet of ruled exercise stock, stacked over two more
   ------------------------------------------------------------------------- */
.hero {
  position: relative;
  margin: 0 0 42px;
  padding: 46px 46px 48px 62px;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  background:
    var(--grain),
    repeating-linear-gradient(180deg, transparent 0 33px, rgba(35, 28, 16, 0.05) 33px 34px),
    linear-gradient(168deg, #fffefb 0%, #fdfaf1 52%, #f8f2e4 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 0 -1px var(--sheet-2), 0 3px 0 -1px var(--rule),
    0 7px 0 -2px #f4eedf, 0 8px 0 -2px var(--rule),
    0 26px 50px -26px rgba(35, 28, 16, 0.42);
}
/* the red margin rule of a school exercise book */
.hero::before {
  content: "";
  position: absolute; top: 0; bottom: 0; left: 36px; width: 1px;
  background: linear-gradient(180deg, transparent, rgba(140, 47, 38, 0.55) 8%, rgba(140, 47, 38, 0.55) 92%, transparent);
  box-shadow: 3px 0 0 -2px rgba(140, 47, 38, 0.22);
}

.hero-eyebrow {
  display: flex; align-items: center; gap: 12px;
  margin: 0 0 16px; color: var(--claret);
  font-family: var(--sans);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
}
.hero-eyebrow::after {
  content: ""; flex: 1 1 auto; max-width: 190px; height: 1px;
  background: linear-gradient(90deg, var(--gold-line), transparent);
}

.hero-title {
  max-width: 22ch; margin: 0 0 18px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.75);
}

.hero-desc {
  margin: 0; max-width: 58ch;
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 18.5px; line-height: 1.62;
}

.intent-strip { margin-top: 10px; color: var(--ink-3); font-size: 13px; line-height: 1.5; }

/* -------------------------------------------------------------------------
   Answer-first block — an engraved plate with a gold inner frame
   ------------------------------------------------------------------------- */
.answer-block {
  position: relative;
  margin: 0 0 42px;
  padding: 32px 36px 34px;
  border: 1px solid var(--rule-2);
  border-left: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  background:
    var(--grain),
    linear-gradient(170deg, #fffefb 0%, #fcf8ee 60%, #f8f3e6 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-2);
}
.answer-block::before {
  content: "";
  position: absolute; inset: 9px;
  border: 1px solid var(--gold-line);
  border-radius: var(--r-sm);
  pointer-events: none;
}
.answer-block > * { position: relative; }
.answer-block .eyebrow {
  display: flex; align-items: center; gap: 14px;
  margin: 0 0 12px; color: var(--claret);
  font-size: 10.5px; letter-spacing: 0.18em;
}
.answer-block .eyebrow::after {
  content: ""; flex: 1 1 auto; max-width: 220px; height: 1px;
  background: linear-gradient(90deg, var(--gold-line), transparent);
}
.answer-question {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 24px; line-height: 1.24; font-weight: 600; letter-spacing: -0.011em;
  color: var(--ink);
}
.answer-summary {
  margin: 0; max-width: var(--measure);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px; line-height: 1.68;
}
.key-facts {
  margin: 24px 0 0; padding: 22px 0 0;
  border-top: 1px solid var(--gold-line);
  display: grid; gap: 10px;
  max-width: var(--measure);
}
.key-facts .fact-row {
  display: grid; grid-template-columns: minmax(140px, 210px) 1fr;
  gap: 12px; align-items: baseline;
}
.key-facts dt {
  color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.11em; text-transform: uppercase;
}
.key-facts dd {
  margin: 0; color: var(--ink-2);
  font-family: var(--serif); font-size: 16px; line-height: 1.55;
}

/* -------------------------------------------------------------------------
   Workspace
   ------------------------------------------------------------------------- */
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) 386px; gap: 28px; align-items: stretch; }
#page-main { display: block; }
.preview-pane, .control-pane { min-width: 0; }
.preview-pane { display: flex; flex-direction: column; gap: 14px; }
.preview-header { display: flex; align-items: end; justify-content: space-between; gap: 16px; }

/* The preview on a leather desk blotter */
.paper-stage {
  position: relative; display: grid; place-items: center;
  min-height: 690px; padding: 44px;
  border: 1px solid #12100c;
  border-radius: var(--r-lg);
  background:
    var(--grain-strong),
    radial-gradient(120% 90% at 50% -10%, rgba(255, 240, 210, 0.1), transparent 62%),
    linear-gradient(168deg, #3a332a 0%, #2a241d 48%, #1c1813 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 245, 225, 0.1),
    inset 0 0 90px rgba(0, 0, 0, 0.55),
    var(--sh-3);
  overflow: hidden;
}
.paper-stage::after {
  content: "";
  position: absolute; inset: 13px;
  border: 1px solid rgba(200, 167, 101, 0.22);
  border-radius: var(--r-sm);
  pointer-events: none;
}

.preview-stage-label {
  position: absolute; top: 20px; left: 24px; z-index: 2;
  margin: 0; padding: 0; border: 0; background: none;
  color: rgba(240, 230, 210, 0.5);
  font-family: var(--sans);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.2em; text-transform: uppercase;
}
.preview-size {
  position: absolute; top: 20px; right: 24px; z-index: 2;
  padding: 0; border: 0; background: none;
  color: rgba(240, 230, 210, 0.5);
  font-family: var(--sans);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  font-variant-numeric: tabular-nums lining-nums;
  white-space: nowrap;
}

#paperCanvas {
  display: block; width: auto; max-width: 100%;
  max-height: min(74vh, 780px);
  background: #fff;
  border: 0; border-radius: 1px;
  box-shadow: var(--sh-plate);
}

.preview-actions {
  position: absolute; bottom: 22px; right: 24px; z-index: 2;
  display: flex; align-items: center; gap: 8px;
}
.preview-download-btn { min-height: 38px; padding: 0 16px; font-size: 13px; }

.status-row {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 22px; padding: 0 2px;
  color: var(--ink-3); font-size: 12px; font-weight: 500; letter-spacing: 0.02em;
}
.status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(63, 107, 84, 0.16);
}

/* -------------------------------------------------------------------------
   Control panel
   ------------------------------------------------------------------------- */
.control-pane {
  align-self: start; position: sticky; top: 92px;
  display: flex; flex-direction: column; gap: 0;
  max-height: calc(100vh - 116px); overflow-y: auto; overflow-x: hidden;
  padding: 0;
  border: 1px solid var(--rule-2);
  border-radius: var(--r-lg);
  background: var(--grain), linear-gradient(180deg, #fffefb, #fbf7ed);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-2);
  scrollbar-width: thin;
  scrollbar-color: var(--rule-2) transparent;
}
.control-pane::-webkit-scrollbar { width: 10px; }
.control-pane::-webkit-scrollbar-thumb {
  background: var(--rule-2); border: 3px solid transparent;
  border-radius: 999px; background-clip: content-box;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .control-pane { backdrop-filter: none; -webkit-backdrop-filter: none; }
  .sticky-cta { transition: none; }
}

.control-pane-header {
  padding: 19px 20px 16px;
  border-bottom: 1px solid var(--rule-2);
  background: var(--grain), linear-gradient(180deg, #f6efe0, #f1e9d7);
  box-shadow: inset 0 -3px 0 -2px var(--gold-line);
  display: grid; gap: 10px;
}
.control-pane-header .eyebrow { margin-bottom: 0; }
.control-pane-header h2 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 600; }
.control-pane-desc { margin-top: 2px; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }

.quick-settings { padding: 18px 20px; border-bottom: 1px solid var(--rule); }
.quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.quick-field { display: grid; gap: 7px; }

.quick-label, .field > span, .colour-field > span,
.segmented-field legend, .range-select > span {
  color: var(--ink-3);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.13em; text-transform: uppercase;
}

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.field, .range-field, .colour-field { display: grid; gap: 8px; }

/* -------------------------------------------------------------------------
   Form controls
   ------------------------------------------------------------------------- */
select {
  width: 100%; min-height: 42px; padding: 0 36px 0 12px;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  color: var(--ink); font-size: 13.5px; font-weight: 500;
  background-color: #fffefb;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2.75 4.75L6 8l3.25-3.25' stroke='%237a7367' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
  box-shadow: inset 0 1px 2px rgba(35, 28, 16, 0.07);
  appearance: none;
  transition: border-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
select:hover { border-color: var(--ink-3); }

textarea {
  width: 100%; min-height: 84px; padding: 10px 12px;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: #fffefb; color: var(--ink);
  font-size: 13.5px; line-height: 1.5;
  box-shadow: inset 0 1px 2px rgba(35, 28, 16, 0.07);
  resize: vertical;
}

.segmented-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.segmented-control {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px; min-height: 40px; margin-top: 9px; padding: 3px;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: linear-gradient(180deg, #ece4d2, #f2ebdb);
  box-shadow: inset 0 1px 3px rgba(35, 28, 16, 0.12);
}
.segmented-control.cols-2, .segmented-control.segmented-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.segmented-control.cols-3, .segmented-control.segmented-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.segmented-control.cols-4, .segmented-control.segmented-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.segmented-control.cols-5 { grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); }
.segmented-control label { min-width: 0; }
.segmented-control input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.segmented-control span {
  display: grid; place-items: center; min-height: 32px;
  border-radius: var(--r-xs);
  color: var(--ink-3); font-size: 12.5px; font-weight: 600;
  transition: color 140ms var(--ease), background-color 140ms var(--ease), box-shadow 140ms var(--ease);
}
.segmented-control label:hover span { color: var(--ink-2); }
.segmented-control input:checked + span {
  color: var(--ink);
  background: linear-gradient(180deg, #fffefb, #fdf9f0);
  box-shadow: 0 1px 2px rgba(35, 28, 16, 0.2), inset 0 1px 0 #fff, inset 0 0 0 1px rgba(35, 28, 16, 0.07);
}
.segmented-control input:focus-visible + span { box-shadow: var(--focus); }

.range-field > span { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.range-field strong {
  color: var(--ink-2); font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.13em; text-transform: uppercase;
}
output {
  flex: 0 0 auto; color: var(--claret);
  font-size: 12.5px; font-weight: 600;
  font-variant-numeric: tabular-nums lining-nums;
}

input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px; margin: 0; background: transparent; cursor: pointer;
}
input[type="range"]:focus { outline: none; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(180deg, #e2d9c5, #ece5d5);
  box-shadow: inset 0 1px 3px rgba(35, 28, 16, 0.2);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: radial-gradient(120% 120% at 35% 28%, #fff, #f4ecdd);
  border: 1px solid var(--rule-2);
  box-shadow: 0 1px 3px rgba(35, 28, 16, 0.3), inset 0 1px 0 #fff;
  transition: transform 140ms var(--ease), box-shadow 140ms var(--ease), border-color 140ms var(--ease);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.08); border-color: var(--ink-3); }
input[type="range"]:focus-visible::-webkit-slider-thumb { border-color: var(--claret); box-shadow: var(--focus); }
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 999px; background: #e2d9c5;
  box-shadow: inset 0 1px 3px rgba(35, 28, 16, 0.2);
}
input[type="range"]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fffdf8; border: 1px solid var(--rule-2);
  box-shadow: 0 1px 3px rgba(35, 28, 16, 0.3);
}
input[type="range"]:focus-visible::-moz-range-thumb { border-color: var(--claret); box-shadow: var(--focus); }

.range-selects { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 9px; }
.range-select { display: grid; gap: 6px; }
.range-select select { min-height: 38px; padding: 0 30px 0 10px; font-size: 13px; }

.colour-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.colour-field {
  min-width: 0; padding: 11px;
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: linear-gradient(180deg, #faf5e9, #f4eddd);
  box-shadow: inset 0 1px 2px rgba(35, 28, 16, 0.05);
}
input[type="color"] {
  width: 100%; min-width: 0; height: 34px; padding: 0;
  border: 1px solid var(--rule-2); border-radius: var(--r-xs);
  background: #fffdf8; cursor: pointer;
  box-shadow: inset 0 1px 2px rgba(35, 28, 16, 0.12);
}
input[type="color"]::-webkit-color-swatch-wrapper { padding: 3px; }
input[type="color"]::-webkit-color-swatch { border: 1px solid rgba(35, 28, 16, 0.18); border-radius: 2px; }
input[type="color"]::-moz-color-swatch { border: 1px solid rgba(35, 28, 16, 0.18); border-radius: 2px; }

/* Toggle switch (vertical writing) */
.toggle-field {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: linear-gradient(180deg, #faf5e9, #f4eddd);
  box-shadow: inset 0 1px 2px rgba(35, 28, 16, 0.05);
  color: var(--ink-3);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.13em; text-transform: uppercase;
}
.toggle-field input[type="checkbox"] {
  width: 42px; height: 22px; flex: 0 0 42px; margin: 0;
  accent-color: var(--claret);
}

/* -------------------------------------------------------------------------
   Buttons
   ------------------------------------------------------------------------- */
.primary-button, .ghost-button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 42px; border-radius: var(--r-sm);
  font-family: var(--sans);
  font-size: 13.5px; font-weight: 600; letter-spacing: 0.005em;
  transition: transform 160ms var(--ease), background-color 150ms var(--ease),
    border-color 150ms var(--ease), box-shadow 160ms var(--ease), color 150ms var(--ease);
}

.primary-button {
  border: 1px solid #5f1c17;
  color: #fdf3ec;
  background: linear-gradient(180deg, #a8443a 0%, var(--claret) 45%, #6d211b 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    inset 0 -2px 4px rgba(0, 0, 0, 0.25),
    0 1px 2px rgba(35, 28, 16, 0.3);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.28);
}
.primary-button:hover {
  transform: translateY(-1px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.3),
    inset 0 -2px 4px rgba(0, 0, 0, 0.22),
    0 4px 12px -3px rgba(35, 28, 16, 0.45);
}
.primary-button:active, .ghost-button:active { transform: translateY(1px); }

.ghost-button {
  padding: 0 15px;
  border: 1px solid var(--rule-2);
  color: var(--ink-2);
  background: linear-gradient(180deg, #fffefb, #f8f3e7);
  box-shadow: inset 0 1px 0 #fff, var(--sh-1);
}
.ghost-button:hover { border-color: var(--ink-3); color: var(--ink); }

@keyframes download-pulse { 0% { transform: scale(1); } 50% { transform: scale(1.03); } 100% { transform: scale(1); } }
.primary-button.downloading { animation: download-pulse 0.3s ease; }

.small-primary { display: inline-flex; padding: 0 15px; }
.download-button { width: 100%; }

.download-panel {
  display: grid; gap: 11px;
  padding: 20px;
  border: 0; border-top: 1px solid var(--rule-2); border-radius: 0;
  background: var(--grain), linear-gradient(180deg, #f5eddc, #efe5d0);
  box-shadow: inset 0 3px 0 -2px var(--gold-line);
}
.download-panel .primary-button { min-height: 52px; font-size: 15px; font-weight: 700; }
.download-panel .primary-button:hover {
  transform: translateY(-1px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), inset 0 -2px 4px rgba(0, 0, 0, 0.22), 0 8px 22px -6px rgba(35, 28, 16, 0.5);
}
.secondary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.secondary-actions .ghost-button { width: 100%; min-height: 40px; font-size: 12.5px; }

.trust-line {
  margin: 4px 0 0; text-align: center;
  color: var(--ink-3);
  font-family: var(--serif);
  font-size: 12.5px; font-style: italic; letter-spacing: 0.01em;
}

/* Ad slots — hidden by default, styled to the paper tone if ever shown */
.ad-slot {
  display: none; place-items: center;
  min-height: 86px;
  border: 1px dashed var(--rule-2); border-radius: var(--r-sm);
  color: var(--ink-3);
  background: var(--grain), repeating-linear-gradient(-45deg, #fbf7ec 0 10px, #f3ecda 10px 20px);
  font-family: var(--sans);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.ad-slot-side, .guide-ad { min-height: 248px; }

/* -------------------------------------------------------------------------
   Long-form content
   ------------------------------------------------------------------------- */
.content-band {
  position: relative;
  display: grid; gap: 44px;
  margin-top: 86px; padding-top: 58px;
  border-top: 3px double var(--rule-2);
}
.content-band::before {
  content: "\2766";
  position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  padding: 0 18px;
  background: var(--paper);
  color: var(--gold);
  font-family: var(--serif); font-size: 19px; line-height: 1;
}

.content-intro { max-width: 760px; }
.content-intro h2 {
  margin-bottom: 16px;
  font-size: clamp(29px, 3.4vw, 40px);
  line-height: 1.14; font-weight: 700; letter-spacing: -0.015em;
}

.content-intro p, .copy-section p, .size-panel p, .size-panel li,
.text-stack p, .text-stack li, .glossary dd, .faq-entry p, .use-grid p {
  color: var(--ink-2);
  font-family: var(--serif);
  font-size: 17px; line-height: 1.72;
  font-variant-numeric: oldstyle-nums;
}

.content-intro h2 + p:not(.blog-byline):not(.content-meta) {
  font-size: 19px; line-height: 1.62; color: var(--ink);
}
.content-intro h2 + p:not(.blog-byline):not(.content-meta)::first-line {
  font-variant-caps: small-caps;
  letter-spacing: 0.02em;
}
.content-intro p + p { margin-top: 14px; }

.guide-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 46px; align-items: start; }
.guide-main { display: grid; gap: 54px; min-width: 0; }
.guide-layout--single { grid-template-columns: minmax(0, 1fr); max-width: 1000px; }

.copy-section { display: grid; gap: 22px; }
.copy-heading {
  display: grid; gap: 7px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.copy-heading .eyebrow { margin: 0; }
.copy-heading h3 { font-size: 26px; line-height: 1.22; font-weight: 700; letter-spacing: -0.014em; }

.text-stack { display: grid; gap: 16px; max-width: 1000px; }
.text-stack > * { min-width: 0; }
.text-stack h3 { margin-top: 12px; font-size: 22px; }
.text-stack h4 { margin-top: 6px; font-size: 17.5px; }
.text-stack ol, .text-stack ul { margin: 0; padding-left: 24px; display: grid; gap: 10px; }
.text-stack li::marker { color: var(--claret); }

.text-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 46px; max-width: 1000px; }
.use-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 46px; }
.use-grid article { display: grid; gap: 8px; }

.blog-byline, .content-meta {
  margin: 6px 0 0; color: var(--ink-3);
  font-family: var(--sans);
  font-size: 12px; font-weight: 500; letter-spacing: 0.03em;
}
.content-meta { margin-bottom: 12px; }

.text-stack a:not(.primary-button):not(.ghost-button):not(.handoff-button):not(.pdf-dl),
.copy-section a:not(.primary-button):not(.ghost-button):not(.handoff-button),
.content-intro a, .answer-summary a, .key-facts a, .glossary dd a,
.faq-entry p a, .faq-list p a, .table-note a, .page-toc a, .muted a {
  color: var(--claret);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(140, 47, 38, 0.32);
  text-underline-offset: 3px;
  transition: text-decoration-color 140ms var(--ease), color 140ms var(--ease);
}
.text-stack a:hover, .copy-section a:hover, .content-intro a:hover,
.answer-summary a:hover, .glossary dd a:hover, .faq-entry p a:hover,
.faq-list p a:hover, .page-toc a:hover {
  color: var(--claret-2); text-decoration-color: currentColor;
}
.text-stack a { display: inline-block; padding: 4px 0; min-height: 40px; align-content: center; }

.feature-list {
  display: grid; gap: 11px; margin: 0; padding: 0; list-style: none;
  color: var(--ink-2); font-family: var(--serif);
  font-size: 17px; line-height: 1.62;
}
.feature-list li { position: relative; padding-left: 26px; }
.feature-list li::before {
  content: ""; position: absolute; left: 2px; top: 0.5em;
  width: 8px; height: 4px;
  border-left: 1.5px solid var(--claret);
  border-bottom: 1.5px solid var(--claret);
  transform: rotate(-45deg);
}

/* Booktabs tables on tinted stock */
.text-stack table, table {
  width: 100%; border-collapse: collapse; margin: 6px 0;
  font-family: var(--serif);
  font-size: 16px; line-height: 1.55;
  font-variant-numeric: lining-nums tabular-nums;
  background: var(--grain), linear-gradient(180deg, #fffefb, #faf5e9);
}
.text-stack thead th, thead th {
  text-align: left; padding: 13px 16px 11px;
  border-top: 1.5px solid var(--ink);
  border-bottom: 1px solid var(--rule-2);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.11em; text-transform: uppercase;
}
.text-stack tbody td, tbody td {
  padding: 12px 16px; border-bottom: 1px solid var(--rule);
  color: var(--ink-2); vertical-align: top;
}
tbody th[scope="row"] {
  text-align: left; padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink); font-weight: 600;
  font-family: var(--serif); font-size: 16px;
}
.text-stack tbody tr:last-child td,
tbody tr:last-child td,
tbody tr:last-child th[scope="row"] { border-bottom: 1.5px solid var(--ink); }
table caption {
  caption-side: top; text-align: left;
  padding: 0 0 12px;
  color: var(--ink-3);
  font-family: var(--sans); font-size: 11px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
}

.spec-table {
  display: block;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  padding: 6px 18px 10px;
  background: var(--grain), linear-gradient(180deg, #fffefb, #f7f1e3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-1);
}
.spec-table caption { padding: 12px 0 8px; }
.spec-table-wide { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
.table-note { margin-top: 10px; color: var(--ink-3); font-family: var(--serif); font-size: 14px; font-style: italic; }
.table-scroll { min-width: 0; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { margin: 0; min-width: 520px; }

.muted { color: var(--ink-3); font-family: var(--serif); font-size: 14px; }

.glossary { margin: 6px 0; display: grid; gap: 0; }
.glossary-entry { scroll-margin-top: 96px; }
.glossary-entry + .glossary-entry { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--rule); }
.glossary dt {
  font-family: var(--serif); font-size: 18px; font-weight: 600;
  color: var(--ink); margin: 0 0 6px; scroll-margin-top: 96px;
}
.glossary dt a { color: var(--ink); text-decoration: none; }
.glossary dt a:hover { color: var(--claret); }
.glossary dd { margin: 0; max-width: var(--measure); }

/* Open-format FAQ (h3 + p per entry) */
.faq-open { display: grid; gap: 0; }
.faq-entry { scroll-margin-top: 96px; }
.faq-entry + .faq-entry { margin-top: 22px; padding-top: 22px; border-top: 1px solid var(--rule); }
.faq-entry h3 { font-size: 19px; font-weight: 600; margin: 0 0 8px; line-height: 1.3; }
.faq-entry h3 a { color: var(--ink); text-decoration: none; }
.faq-entry h3 a:hover { color: var(--claret); }
.faq-entry p { margin: 0; max-width: var(--measure); }

/* Marginalia panel */
.guide-side { display: grid; gap: 16px; position: sticky; top: 104px; align-self: start; }
.size-panel {
  position: relative;
  display: grid; gap: 12px;
  padding: 22px 22px 24px;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: var(--grain), linear-gradient(170deg, #fffefb, #f7f1e3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-1);
}
.size-panel::before {
  content: ""; position: absolute; inset: 7px;
  border: 1px solid var(--gold-line); border-radius: var(--r-xs);
  pointer-events: none;
}
.size-panel > * { position: relative; }
.size-panel .eyebrow { margin: 0; }
.size-panel h3 { font-size: 17px; }
.size-panel p, .size-panel li { font-size: 14.5px; line-height: 1.6; }
.size-panel ul { display: grid; gap: 6px; margin: 0; padding-left: 18px; }
.size-panel li::marker { color: var(--gold); }

/* Print-at-actual-size caution — aged paper note */
.print-warning {
  margin: 0;
  padding: 18px 22px;
  border: 1px solid #ddc186; border-left: 3px solid var(--gold);
  border-radius: var(--r-sm);
  background: var(--grain), linear-gradient(180deg, #fdf5e0, #f8ecd2);
  color: #5c4a1c;
}
.print-warning-title {
  margin: 0 0 6px;
  font-family: var(--serif); font-size: 16px; font-weight: 700;
  color: #6b4f13;
}
.print-warning p {
  margin: 0; color: #5c4a1c;
  font-family: var(--serif); font-size: 15px; line-height: 1.6;
}
.print-warning p + p { margin-top: 6px; }

/* Direct PDF downloads — engraved plate + ruled index of files */
.pdf-downloads {
  position: relative;
  margin: 0;
  padding: 28px 30px 30px;
  border: 1px solid var(--rule-2); border-radius: var(--r-lg);
  background: var(--grain), linear-gradient(170deg, #fffefb 0%, #fcf8ee 60%, #f8f3e6 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-2);
  scroll-margin-top: 96px;
}
.pdf-downloads .eyebrow { color: var(--claret); letter-spacing: 0.18em; }
.pdf-downloads h2 { margin: 0 0 8px; font-family: var(--serif); font-size: 22px; font-weight: 600; }
.pdf-downloads > p { margin: 0 0 16px; color: var(--ink-2); font-family: var(--serif); font-size: 16px; line-height: 1.62; }
.pdf-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px;
}
a.pdf-dl {
  display: flex; flex-direction: column; gap: 2px;
  padding: 13px 15px;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: linear-gradient(180deg, #fffefb, #f6efdf);
  box-shadow: inset 0 1px 0 #fff, var(--sh-1);
  text-decoration: none; color: var(--ink);
  transition: border-color 140ms var(--ease), transform 140ms var(--ease), box-shadow 140ms var(--ease);
}
a.pdf-dl:hover, a.pdf-dl:focus-visible {
  border-color: var(--claret); transform: translateY(-1px); box-shadow: var(--sh-2);
}
a.pdf-dl strong { font-family: var(--serif); font-size: 15px; font-weight: 600; }
a.pdf-dl span { color: var(--ink-3); font-size: 12px; }

/* On-this-page jump list — ruled marginal index */
.page-toc {
  margin: 0;
  padding: 18px 22px;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: var(--grain), linear-gradient(170deg, #fffefb, #f7f1e3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-1);
}
.page-toc .toc-title {
  margin: 0 0 10px; color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.page-toc ol {
  margin: 0; padding: 0; list-style: none;
  display: flex; flex-wrap: wrap; gap: 6px 22px;
}
.page-toc li { font-family: var(--serif); font-size: 15px; }

/* Spacing index — ruled ledger */
.spacing-index {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0 46px;
}
.spacing-index li {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
  font-family: var(--serif); font-size: 15.5px;
}
.spacing-index .muted { white-space: nowrap; font-style: italic; }

/* -------------------------------------------------------------------------
   Index cards
   ------------------------------------------------------------------------- */
.hub-card-grid { margin: 50px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(244px, 1fr)); gap: 14px; }
.hub-cards, .silo-group .hub-cards-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(244px, 1fr));
  gap: 14px;
}
.silo-group {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(244px, 1fr));
  gap: 14px;
  align-items: start;
}
.silo-group > .silo-label,
.silo-group > .hub-cards-inner { grid-column: 1 / -1; }
.silo-group + .silo-group { margin-top: 30px; }
.silo-label {
  display: flex; align-items: center; gap: 14px;
  margin: 0; color: var(--ink-3);
  font-family: var(--sans);
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.16em; text-transform: uppercase;
}
.silo-label::after {
  content: ""; flex: 1 1 auto; height: 1px;
  background: linear-gradient(90deg, var(--rule-2), transparent);
}

.hub-card {
  position: relative;
  display: grid; align-content: start; gap: 6px;
  padding: 20px;
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: var(--grain), linear-gradient(170deg, #fffefb, #f8f3e6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-1);
  overflow: hidden;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}
.hub-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--claret), var(--gold));
  transform: scaleX(0); transform-origin: left;
  transition: transform 260ms var(--ease);
}
.hub-card:hover { transform: translateY(-3px); border-color: var(--rule-2); box-shadow: var(--sh-2); }
.hub-card:hover::before { transform: scaleX(1); }
.hub-card h3, .hub-card h4 { margin: 0; font-family: var(--serif); font-size: 17px; font-weight: 600; letter-spacing: -0.005em; }
.hub-card h3 a, .hub-card h4 a, .hub-card > a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 0; min-height: 40px; align-content: center;
  color: var(--ink); text-decoration: none;
  transition: color 140ms var(--ease);
}
.hub-card:hover h3 a, .hub-card:hover h4 a, .hub-card:hover > a { color: var(--claret); }
.hub-card p { margin: 0; color: var(--ink-3); font-family: var(--serif); font-size: 14.5px; line-height: 1.5; }

/* Use-case clusters — ruled index grouped under card headings */
.use-case-clusters {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px;
}
.cluster-card {
  display: grid; align-content: start; gap: 12px;
  padding: 20px;
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: var(--grain), linear-gradient(170deg, #fffefb, #f8f3e6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-1);
}
.cluster-card h4 { margin: 0; font-family: var(--serif); font-size: 16px; font-weight: 600; }
.cluster-card ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; border-top: 1px solid var(--rule); }
.cluster-card li { border-bottom: 1px solid var(--rule); }
.cluster-card a {
  display: flex; align-items: center;
  padding: 9px 2px; min-height: 40px;
  color: var(--ink);
  font-family: var(--serif); font-size: 14.5px; font-weight: 500;
  text-decoration: none;
  transition: color 140ms var(--ease), padding-left 160ms var(--ease);
}
.cluster-card a:hover { color: var(--claret); padding-left: 6px; }

/* Type grid (homepage) */
.type-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.type-grid article {
  display: grid; align-content: start; gap: 9px;
  min-height: 170px; padding: 20px;
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  background: var(--grain), linear-gradient(170deg, #fffefb, #f8f3e6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-1);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), border-color 180ms var(--ease);
}
.type-grid article:hover { transform: translateY(-2px); border-color: var(--rule-2); box-shadow: var(--sh-2); }
.type-grid article h3, .type-grid article h4 { font-size: 17px; }
.type-grid p { color: var(--ink-3); font-family: var(--serif); font-size: 14px; line-height: 1.5; }

.template-meta { font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.template-meta a { display: inline-block; padding: 4px 0; min-height: 40px; align-content: center; color: var(--claret); text-decoration: none; }
.template-meta a:hover { text-decoration: underline; }
.featured-badge {
  display: inline-block; padding: 3px 9px;
  border: 1px solid var(--claret); border-radius: 999px;
  background: var(--claret-tint);
  color: var(--claret);
  font-family: var(--sans);
  font-size: 9.5px; font-weight: 700;
  letter-spacing: 0.12em; text-transform: uppercase;
  vertical-align: middle;
}

/* Related links — a ruled index */
.related-links {
  list-style: none; margin: 6px 0 0; padding: 0;
  display: grid; gap: 0; max-width: 720px;
  border-top: 1px solid var(--rule);
}
.related-links li { margin: 0; border-bottom: 1px solid var(--rule); }
.related-links a {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 10px;
  color: var(--ink);
  font-family: var(--serif); font-size: 17px; font-weight: 500;
  text-decoration: none;
  transition: color 140ms var(--ease), background-color 140ms var(--ease), padding-left 160ms var(--ease);
}
.related-links a::after {
  content: "\2192"; margin-left: auto;
  color: var(--rule-2); font-family: var(--sans);
  transition: color 140ms var(--ease), transform 160ms var(--ease);
}
.related-links a:hover { color: var(--claret); background: rgba(154, 123, 63, 0.06); padding-left: 16px; }
.related-links a:hover::after { color: var(--claret); transform: translateX(3px); }

/* CTA / decision zones + handoff */
.cta-zone-top, .decision-zone {
  padding: 24px 26px;
  border: 1px solid var(--rule-2); border-radius: var(--r-lg);
  background: var(--grain), linear-gradient(170deg, #fffefb, #f7f1e3);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-1);
}
.decision-zone { margin-top: 8px; }
.handoff-section { margin-top: 10px; }
.handoff-primary { text-align: center; }
.cta-global { margin: 0 0 4px; font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--ink); }
.cta-contextual { margin: 0 0 16px; color: var(--ink-2); font-family: var(--serif); font-size: 15px; }
.handoff-button { display: inline-flex; min-height: 52px; padding: 0 36px; font-size: 15px; font-weight: 700; text-decoration: none; }

.stage-progression { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.stage-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 16px;
  border: 1px solid var(--rule-2); border-radius: var(--r-sm);
  background: linear-gradient(180deg, #fffefb, #f8f3e7);
  color: var(--ink-2);
  font-family: var(--sans); font-size: 12.5px; font-weight: 600;
  text-decoration: none;
  box-shadow: var(--sh-1);
  transition: border-color 140ms var(--ease), color 140ms var(--ease), transform 140ms var(--ease);
}
.stage-link:hover { border-color: var(--claret); color: var(--claret); transform: translateY(-1px); }
.stage-link.prev { margin-right: auto; }
.stage-link.next { margin-left: auto; }

/* Freshness line */
.page-updated {
  margin: 24px 0 0; padding-top: 20px;
  border-top: 1px solid var(--gold-line);
  color: var(--ink-3);
  font-family: var(--serif); font-size: 13px; font-style: italic;
}
.page-updated time { font-weight: 600; font-style: normal; color: var(--ink-2); }

/* -------------------------------------------------------------------------
   Disclosure widgets
   ------------------------------------------------------------------------- */
details {
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 18px 20px;
  background: var(--grain), linear-gradient(170deg, #fffefb, #f8f3e6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-1);
}
details summary { cursor: pointer; font-family: var(--serif); font-weight: 600; font-size: 17px; color: var(--ink); }
details p { margin-top: 12px; color: var(--ink-2); font-family: var(--serif); font-size: 16px; line-height: 1.66; }
details a { display: inline-block; margin-top: 8px; font-weight: 600; font-size: 14px; }

.faq-list { display: grid; gap: 0; border-top: 1px solid var(--rule); }
.faq-list details {
  border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
  padding: 0; background: none; box-shadow: none;
  transition: background-color 160ms var(--ease);
}
.faq-list details[open] { background: rgba(154, 123, 63, 0.05); }
.faq-list details summary { position: relative; padding: 18px 44px 18px 14px; list-style: none; }
.faq-list details summary::-webkit-details-marker { display: none; }
.faq-list details summary::after {
  content: ""; position: absolute; top: 50%; right: 16px;
  width: 8px; height: 8px; margin-top: -6px;
  border-right: 1.5px solid var(--claret); border-bottom: 1.5px solid var(--claret);
  transform: rotate(45deg);
  transition: transform 200ms var(--ease), margin-top 200ms var(--ease);
}
.faq-list details[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-list details summary:hover { color: var(--claret); }
.faq-list details p { margin: 0 14px 20px; max-width: var(--measure); }

/* FAQ item (homepage-style bordered card) */
.faq-item {
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 0;
  background: var(--grain), linear-gradient(170deg, #fffefb, #f8f3e6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), var(--sh-1);
  overflow: hidden;
}
.faq-item + .faq-item { margin-top: 10px; }
.faq-item summary {
  position: relative; padding: 16px 44px 16px 20px; list-style: none;
  cursor: pointer; font-family: var(--serif); font-weight: 600; font-size: 16px; color: var(--ink);
  transition: background-color 120ms var(--ease);
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: ""; position: absolute; top: 50%; right: 18px;
  width: 8px; height: 8px; margin-top: -6px;
  border-right: 1.5px solid var(--claret); border-bottom: 1.5px solid var(--claret);
  transform: rotate(45deg);
  transition: transform 200ms var(--ease), margin-top 200ms var(--ease);
}
.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
.faq-item summary:hover { background: rgba(154, 123, 63, 0.07); }
.faq-item[open] summary { border-bottom: 1px solid var(--rule); }
.faq-item p { margin: 0; padding: 14px 20px 18px; color: var(--ink-2); font-family: var(--serif); font-size: 16px; line-height: 1.66; }

details.control-section {
  display: block; padding: 0;
  border: 0; border-bottom: 1px solid var(--rule); border-radius: 0;
  background: none; box-shadow: none;
}
details.control-section summary {
  position: relative; padding: 15px 42px 15px 20px; cursor: pointer;
  font-family: var(--sans); font-size: 13.5px; font-weight: 600;
  color: var(--ink); list-style: none;
  transition: background-color 120ms var(--ease);
}
details.control-section summary::-webkit-details-marker { display: none; }
details.control-section summary::after {
  content: ""; position: absolute; top: 50%; right: 20px;
  width: 7px; height: 7px; margin-top: -5px;
  border-right: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3);
  transform: rotate(45deg);
  transition: transform 200ms var(--ease), margin-top 200ms var(--ease);
}
details.control-section[open] summary::after { transform: rotate(-135deg); margin-top: -2px; }
details.control-section summary:hover { background: rgba(154, 123, 63, 0.07); }
details.control-section[open] summary { border-bottom: 1px solid var(--rule); }

.control-section-summary { display: flex; flex-direction: column; gap: 3px; }
.control-section-summary .eyebrow { margin: 0; font-size: 9.5px; letter-spacing: 0.16em; }
.control-section-body { padding: 18px 20px 22px; display: grid; gap: 18px; }
.control-section { display: grid; gap: 16px; padding: 20px; border: 0; border-radius: 0; background: none; }

/* -------------------------------------------------------------------------
   Sticky CTA bar — cloth strip
   ------------------------------------------------------------------------- */
.sticky-cta {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 999;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 12px 24px;
  background: var(--grain-strong), linear-gradient(180deg, #2a241d, #17130f);
  border-top: 1px solid #3d352a;
  box-shadow: 0 -8px 30px -10px rgba(0, 0, 0, 0.5);
  transition: transform 0.35s var(--ease);
  transform: translateY(0);
}
.sticky-cta-text {
  margin: 0; color: var(--cloth-text);
  font-family: var(--serif); font-size: 14px; white-space: nowrap;
}
.sticky-cta--hidden { transform: translateY(100%); }
#stickyGenerateBtn { min-width: 240px; }

/* -------------------------------------------------------------------------
   Colophon — cloth-bound endpaper
   ------------------------------------------------------------------------- */
.site-footer {
  position: relative;
  margin: 90px 0 0;
  padding-block: 56px 44px;
  border-top: 0;
  background:
    var(--grain-strong),
    radial-gradient(120% 70% at 50% 0%, rgba(255, 240, 210, 0.06), transparent 65%),
    linear-gradient(180deg, var(--cloth) 0%, var(--cloth-2) 100%);
  color: var(--cloth-text);
}
.site-footer::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--claret-2), var(--claret) 22%, var(--gold-2) 50%, var(--claret) 78%, var(--claret-2));
}

.footer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); gap: 24px; }
.footer-column h3, .footer-col h4 {
  margin: 0 0 12px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(200, 167, 101, 0.22);
  color: var(--gold-2);
  font-family: var(--sans);
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.16em;
}
.footer-column ul, .footer-col ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 1px; }
.footer-column a, .footer-col a {
  display: inline-block; padding: 5px 0; min-height: 40px;
  align-content: center; line-height: 1.35;
  color: var(--cloth-text-2);
  font-family: var(--serif); font-size: 14.5px;
  text-decoration: none;
  transition: color 140ms var(--ease);
}
.footer-column a:hover, .footer-col a:hover { color: #fff; }
.footer-column a em, .footer-col a em { font-style: normal; color: var(--cloth-text); font-weight: 600; }

.footer-bottom, .footer-copy {
  margin-top: 38px; padding-top: 24px;
  border-top: 1px solid rgba(200, 167, 101, 0.18);
  text-align: center;
  color: var(--cloth-text-2);
  font-family: var(--serif);
  font-size: 13.5px; font-style: italic; font-weight: 400;
}

/* -------------------------------------------------------------------------
   noscript notice — fixed strip, aged-paper tone
   ------------------------------------------------------------------------- */
.noscript-notice {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  padding: 16px 24px;
  background: var(--grain), linear-gradient(180deg, #fdf5e0, #f8ecd2);
  border-top: 2px solid #ddc186;
  text-align: center;
  font-family: var(--serif); font-size: 15px; line-height: 1.6;
  color: #5c4a1c;
}
.noscript-notice p { margin: 0 0 8px; }
.noscript-notice p:last-child { margin-bottom: 0; }

/* -------------------------------------------------------------------------
   Cookie consent — dark cloth, toggled by [hidden]
   ------------------------------------------------------------------------- */
.cookie-consent{position:fixed;left:16px;right:16px;bottom:16px;z-index:9999;background:var(--grain-strong),linear-gradient(180deg,#2a241d,#17130f);color:#faf6ee;border:1px solid #3d352a;border-radius:10px;box-shadow:0 24px 60px -12px rgba(0,0,0,.6);padding:20px 22px;font-family:var(--sans);max-width:740px;margin:0 auto}
.cookie-consent[hidden]{display:none}
.cookie-consent-title{font-family:var(--serif);font-size:18px;font-weight:600;margin:0 0 7px;color:#faf6ee}
.cookie-consent-text{font-size:13.5px;line-height:1.55;margin:0 0 14px;color:#ded6c7}
.cookie-consent-text a{color:var(--gold-2);text-decoration:underline}
.cookie-consent-actions{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.cookie-consent-actions .primary-button{padding:9px 18px;border-radius:6px;font-weight:600;font-size:13.5px;min-height:0}
.cookie-consent-actions .ghost-button{background:transparent;color:#faf6ee;border:1px solid #4c463c;padding:9px 18px;border-radius:6px;font-weight:600;font-size:13.5px;min-height:0;box-shadow:none}
.cookie-consent-actions .ghost-button:hover{background:#2a251d;color:#fff;border-color:#635c4f}
.cookie-consent-link{color:var(--gold-2);font-size:12.5px;margin-left:auto;text-decoration:underline}
@media (max-width:480px){.cookie-consent{left:8px;right:8px;bottom:8px;padding:16px}.cookie-consent-link{margin-left:0}}

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .control-pane { position: static; max-height: none; overflow: visible; }
  .paper-stage { min-height: 560px; }
  .guide-layout { grid-template-columns: 1fr; gap: 34px; }
  .guide-side { position: static; }
  .type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .use-case-clusters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .text-columns, .use-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  :root { --gutter: 18px; }
  .topbar { position: static; margin: 0 0 22px; padding-block: 12px; min-height: 0; }
  html { scroll-padding-top: 16px; }
  h2, h3, h4, .glossary dt, .glossary-entry, .faq-entry,
  .pdf-downloads, .copy-section[id], .answer-block[id] { scroll-margin-top: 20px; }
  .brand-tagline { display: none; }
  .brand-name { font-size: 16px; }
  .hero { margin: 0 0 30px; padding: 28px 22px 30px 38px; }
  .hero::before { left: 20px; }
  .hero-title { max-width: none; }
  .hero-desc { font-size: 17px; }
  h1 { font-size: 34px; }
  .answer-block { padding: 24px 20px 26px; margin-bottom: 30px; }
  .answer-block::before { inset: 6px; }
  .answer-summary { font-size: 16.5px; }
  .answer-question { font-size: 21px; }
  .key-facts .fact-row { grid-template-columns: 1fr; gap: 2px; }
  .preview-header { align-items: flex-start; flex-direction: column; }
  .paper-stage { min-height: 420px; padding: 22px; }
  .paper-stage::after { inset: 8px; }
  .preview-stage-label, .preview-size { top: 8px; }
  .preview-stage-label { left: 12px; }
  .preview-size { right: 12px; }
  .preview-actions { position: static; margin-top: 16px; }
  #paperCanvas { max-height: 56vh; }
  .control-pane-header { padding: 16px 16px 14px; }
  .quick-settings { padding: 16px; }
  .quick-row { grid-template-columns: 1fr; }
  details.control-section summary { padding: 14px 40px 14px 16px; }
  details.control-section summary::after { right: 16px; }
  .control-section-body { padding: 16px 16px 20px; }
  .download-panel { padding: 16px; }
  .download-panel .primary-button { min-height: 48px; font-size: 14.5px; }
  .secondary-actions { gap: 6px; }
  .secondary-actions .ghost-button { min-height: 42px; font-size: 12px; }
  .colour-grid { grid-template-columns: 1fr; }
  .content-band { margin-top: 58px; padding-top: 40px; gap: 34px; }
  .guide-main { gap: 42px; }
  .content-intro h2 { font-size: 28px; }
  .content-intro p, .copy-section p, .text-stack p, .text-stack li,
  .feature-list, .glossary dd, .faq-entry p { font-size: 16.5px; }
  .content-intro h2 + p:not(.blog-byline):not(.content-meta) { font-size: 17.5px; }
  .copy-heading h3 { font-size: 23px; }
  .type-grid, .use-case-clusters { grid-template-columns: 1fr; gap: 14px; }
  .type-grid article { min-height: 0; }
  .hub-card-grid { margin: 36px 0; }
  .pdf-downloads, .cta-zone-top, .decision-zone { padding: 22px 20px; }
  .site-footer { margin: 60px 0 0; padding-block: 40px 32px; }
  .sticky-cta { flex-direction: column; gap: 8px; padding: 10px 16px; }
  .sticky-cta-text { white-space: normal; text-align: center; }
  #stickyGenerateBtn { min-width: 0; width: 100%; }
}

@media (max-width: 460px) {
  .topbar-actions { flex-shrink: 1; }
  .ghost-button, .small-primary { min-height: 38px; padding: 0 11px; font-size: 12.5px; }
}

/* -------------------------------------------------------------------------
   Motion
   ------------------------------------------------------------------------- */
@keyframes reveal-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .hub-cards > .hub-card,
    .hub-cards-inner > .hub-card,
    .hub-card-grid > .hub-card,
    .type-grid > article,
    .use-case-clusters > .cluster-card {
      animation: reveal-in linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 90%;
    }
  }
}

/* -------------------------------------------------------------------------
   Body column — last so margin-inline beats the component margin shorthands
   above without disturbing their block margins.
   ------------------------------------------------------------------------- */
.page-shell > * {
  width: min(100% - var(--gutter) * 2, calc(var(--col) - var(--gutter) * 2));
  margin-inline: auto;
}
.page-shell > .topbar,
.page-shell > .site-footer { width: 100%; }
