/* ==========================================================================
   The Proof House — Design System (v2)
   --------------------------------------------------------------------------
   A premium, image-forward craft-distillery look: deep charcoal, glowing
   copper and amber, warm cream. One stylesheet, no build step, no external
   requests — fonts are self-hosted variable woff2 files in ../fonts/.

   Contents:
     1. Self-hosted fonts (@font-face)
     2. Design tokens (custom properties)
     3. Reset & base typography
     4. Layout primitives (.container, .section, .grid)
     5. Header & footer
     6. Hero (+ .hero-media), buttons, badges
     7. Cards & tool cards (+ .card-media, .tool-card-media)
     8. Callouts
     9. Prose (long-form article text), TOC, breadcrumbs
    10. Calculator components (used by tools/*.html)
    11. Guide extras (.guide-hero, .guide-list + .guide-thumb, .product-media)
        + recipe extras (.recipe-meta, .scaler, ul.ingredients)
    12. Utilities & accessibility
    13. Responsive adjustments
    14. Reduced motion
    15. Shop (checkout page: shipping options, status messages)

   Design tokens (palette):
     --charcoal      #171310  near-black warm charcoal (header, footer, hero)
     --charcoal-2    #262019  raised dark surface (hover tint, results gradient)
     --charcoal-3    #33291e  dark hover / active surface
     --cream         #faf5ec  page background
     --cream-2       #f3ead9  subtle panel background
     --paper         #fffdf7  card background
     --ink           #211b13  primary text on cream
     --ink-soft      #5d5342  secondary text on cream
     --copper        #a94e1b  primary accent; links + buttons on light
     --copper-deep   #86390e  accent hover / active
     --copper-bright #e8824a  copper for text/links on dark surfaces
     --amber         #e8a33d  highlight accent (dark surfaces, rules, em)
     --amber-bright  #f6bd5a  brightest amber (small highlights on dark)
     --amber-soft    #fdf3dd  warning callout background
     --amber-line    #c98a1f  warning callout border
     --info-bg       #eef4f8  info callout background
     --info-line     #5b8db0  info callout border
     --line          #e0d5bd  hairline borders on cream
     --field-line    #8a7d63  input borders (3.97:1 vs paper — WCAG 1.4.11)
     --line-dark     #3d3325  hairline borders on charcoal
     --focus         #a94e1b  keyboard focus ring on light (amber on dark)

   Type:
     Display — "Fraunces" (variable, wght 100–900), h1 / h2 / brand.
     Body/UI — "Inter" (variable, wght 100–900), everything else.
     Code    — system mono stack.

   Contrast (WCAG AA, verified 2026-11-20 with a luminance checker):
     ink on cream            15.71:1   ink-soft on cream     6.95:1
     copper link on cream     5.10:1   copper-deep on cream  7.42:1
     white on charcoal       18.47:1   hero body on charcoal 12.42:1
     amber on charcoal        8.56:1   copper-bright on dark  6.79:1
     white on copper button   5.54:1   white on copper-deep   8.06:1
     footer text on charcoal  6.67–13.42:1 (all footer tones pass)
     badge text on badge bg   6.58–7.01:1
   Every text/background pair on the site meets AA (4.5:1 for normal text).
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Self-hosted fonts
   --------------------------------------------------------------------------
   Variable woff2, latin subset only, served from ../fonts/ — the site's CSP
   is default-src 'self', so no external font URL may ever appear here.
   Both files are variable fonts (wght 100–900): one file per family covers
   every weight the design uses. See ../fonts/FONTS.md for sources + licence.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  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: "Inter";
  src: url("../fonts/inter-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  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;
}


/* --------------------------------------------------------------------------
   2. Design tokens
   -------------------------------------------------------------------------- */

:root {
  /* Palette — deep charcoal, glowing copper/amber, warm cream. */
  --charcoal:      #171310;
  --charcoal-2:    #262019;
  --charcoal-3:    #33291e;
  --cream:         #faf5ec;
  --cream-2:       #f3ead9;
  --paper:         #fffdf7;
  --ink:           #211b13;
  --ink-soft:      #5d5342;
  --copper:        #a94e1b;
  --copper-deep:   #86390e;
  --copper-bright: #e8824a;
  --amber:         #e8a33d;
  --amber-bright:  #f6bd5a;
  --amber-soft:    #fdf3dd;
  --amber-line:    #c98a1f;
  --info-bg:       #eef4f8;
  --info-line:     #5b8db0;
  --line:          #e0d5bd;
  --field-line:    #8a7d63;
  --line-dark:     #3d3325;
  --focus:         #a94e1b;

  /* Type. */
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas,
               "Liberation Mono", monospace;

  /* Rhythm. */
  --radius:       16px;
  --radius-sm:    10px;
  --radius-lg:    20px;
  --radius-pill:  999px;
  --space:        1rem;
  --max-width:    1120px;
  --measure:      68ch;
  --card-pad:     1.5rem;

  /* Shadows — warm-tinted, layered. */
  --shadow-sm: 0 1px 2px rgba(33, 27, 19, 0.06),
               0 2px 8px rgba(33, 27, 19, 0.05);
  --shadow-md: 0 2px 4px rgba(33, 27, 19, 0.06),
               0 12px 28px rgba(33, 27, 19, 0.10);
  --shadow-lg: 0 4px 8px rgba(33, 27, 19, 0.08),
               0 20px 44px rgba(33, 27, 19, 0.16);
  --shadow-glow: 0 10px 24px rgba(169, 78, 27, 0.35);
}


/* --------------------------------------------------------------------------
   3. Reset & base typography
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.0625rem;          /* 17px — comfortable reading size */
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;        /* lets the footer sit at the bottom */
}

main { flex: 1; }

/* Display serif for the big headings; Inter for everything else. */
h1, h2 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  color: var(--ink);
}

h1 {
  font-weight: 900;
  font-size: clamp(2.75rem, 7vw, 4.5rem);
  letter-spacing: -0.03em;
  line-height: 1.02;
}

h2 { font-size: clamp(1.9rem, 4vw, 2.75rem); }

h3, h4 {
  font-family: var(--font-sans);
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h3 { font-size: 1.25rem; font-weight: 700; }
h4 { font-size: 1.05rem; font-weight: 700; }

p { margin-bottom: 1em; }

a { color: var(--copper); }
a:hover, a:focus-visible { color: var(--copper-deep); }

img, svg { max-width: 100%; height: auto; }

::selection { background: var(--copper); color: #fff; }

/* Visible, consistent keyboard focus everywhere. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Amber ring on dark surfaces — copper is too dark against charcoal. */
.site-header :focus-visible,
.site-footer :focus-visible,
.hero :focus-visible,
.results :focus-visible {
  outline-color: var(--amber);
}


/* --------------------------------------------------------------------------
   4. Layout primitives
   -------------------------------------------------------------------------- */

/* Centered content column. Every page wraps its sections in this. */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* Vertical breathing room between page sections. */
.section {
  padding-block: clamp(3rem, 7vw, 4.5rem);
}

.section + .section { border-top: 1px solid var(--line); }

.section > .container > h2 { margin-bottom: 0.35em; }

/* Short copper rule under each section heading — the design's signature. */
.section > .container > h2::after {
  content: "";
  display: block;
  width: 3rem;
  height: 3px;
  margin-top: 0.6rem;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--copper), var(--amber));
}

.section-lead {
  color: var(--ink-soft);
  font-size: 1.1rem;
  max-width: var(--measure);
  margin-bottom: 2rem;
}

/* Responsive card grid: 1 column on phones, auto-fitting columns above. */
.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}

@media (min-width: 560px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

/* Two-column variant for wider cards (guides preview, products). */
.grid-2 { grid-template-columns: 1fr; }
@media (min-width: 760px) {
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}


/* --------------------------------------------------------------------------
   5. Header & footer
   -------------------------------------------------------------------------- */

/* Sticky dark header. Same markup on every page.
   Solid charcoal by default; translucent + blurred where backdrop-filter
   is supported, so the page glows through as you scroll. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--charcoal);
  color: #f5efe3;
  border-bottom: 2px solid var(--copper);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

@supports ((backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px))) {
  .site-header {
    background: rgba(23, 19, 16, 0.86);
    -webkit-backdrop-filter: blur(12px) saturate(1.2);
    backdrop-filter: blur(12px) saturate(1.2);
  }
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.5rem;
  padding-block: 0.8rem;
}

/* Brand lockup: display-serif wordmark + tagline. */
.site-header .brand {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  color: #f5efe3;
  text-decoration: none;
  margin-right: auto;
}

.site-header .brand strong {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.site-header .brand strong span { color: var(--amber); }

.site-header .brand small {
  font-size: 0.78rem;
  font-weight: 600;
  color: #c9bfa9;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Primary navigation. */
nav.site-nav ul {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

nav.site-nav a {
  display: block;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-pill);
  color: #ece4d2;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s ease, color 0.15s ease;
}

nav.site-nav a:hover,
nav.site-nav a:focus-visible {
  background: var(--charcoal-3);
  color: #fff;
}

/* Mark the current page's nav link with aria-current="page". */
nav.site-nav a[aria-current="page"] {
  background: var(--copper);
  color: #fff;
}

/* Dark footer: nav, disclaimer, copyright. Same markup on every page. */
.site-footer {
  background:
    radial-gradient(ellipse 70% 100% at 50% 0%, rgba(232, 163, 61, 0.10), transparent 60%),
    var(--charcoal);
  color: #cfc6b4;
  margin-top: 4rem;
  padding-block: 3.5rem 2.5rem;
  border-top: 3px solid var(--copper);
  font-size: 0.95rem;
}

.site-footer a { color: #f0d9b0; }
.site-footer a:hover { color: #fff; }

.site-footer .footer-nav {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  margin-bottom: 1.5rem;
}

.site-footer .footer-nav a {
  text-decoration: none;
  font-weight: 600;
}

.site-footer .footer-nav a:hover { text-decoration: underline; text-underline-offset: 4px; }

.site-footer .disclaimer {
  border-top: 1px solid var(--line-dark);
  padding-top: 1.5rem;
  color: #b3a78c;
  max-width: var(--measure);
}

.site-footer .copyright {
  margin-top: 1rem;
  color: #a89a7d;
  font-size: 0.875rem;
}

.site-footer .support-line {
  margin-top: 1rem;
  color: #a89a7d;
  font-size: 0.875rem;
  max-width: var(--measure);
}

.site-footer .support-line a {
  font-weight: 600;
}

/* Amount picker on the donate page: preset buttons that behave like
 * radio options, plus a custom-amount input in a normal .field. */
.field-group-label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.amount-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.amount-option {
  padding: 0.6rem 1.5rem;
  border-radius: var(--radius-pill);
  border: 2px solid var(--copper);
  background: transparent;
  color: var(--copper);
  font: inherit;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
}

.amount-option:hover {
  background: rgba(169, 78, 27, 0.1);
}

.amount-option.selected {
  background: linear-gradient(180deg, var(--copper), var(--copper-deep));
  border-color: var(--copper-deep);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.amount-option:focus-visible {
  outline: 3px solid rgba(169, 78, 27, 0.25);
  outline-offset: 2px;
}

/* Warranty form: textarea, range sliders, checkbox, honeypot. */
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--field-line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
  resize: vertical;
}

.field textarea:focus {
  border-color: var(--copper);
  outline: 3px solid rgba(169, 78, 27, 0.25);
  outline-offset: 0;
}

.field textarea[aria-invalid="true"] { border-color: #b3261e; }

.field input[type="range"] {
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.field input[type="checkbox"] {
  width: auto;
  margin-right: 0.5rem;
  vertical-align: middle;
}

.checkbox-label {
  font-weight: 400;
}

/* Honeypot: present in the DOM for bots, invisible to everyone else. */
.honeypot {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Mailing list signup overlay (injected by assets/js/subscribe.js). */
.subscribe-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(23, 19, 16, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.subscribe-backdrop[hidden] { display: none; }

body.subscribe-open { overflow: hidden; }

.subscribe-card {
  position: relative;
  background: var(--paper);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: 0 1.5rem 3rem rgba(0, 0, 0, 0.35);
  padding: 2rem;
  max-width: 26rem;
  width: 100%;
}

.subscribe-card h2 {
  margin-top: 0;
  font-size: 1.5rem;
}

.subscribe-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
}

.subscribe-close:hover { color: var(--ink); }

.subscribe-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.subscribe-form input[type="email"] {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--field-line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.subscribe-form input[type="email"]:focus {
  border-color: var(--copper);
  outline: 3px solid rgba(169, 78, 27, 0.25);
  outline-offset: 0;
}

.subscribe-form input[type="email"][aria-invalid="true"] {
  border-color: #b3261e;
}

.subscribe-dismiss {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-size: 0.875rem;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.subscribe-dismiss:hover { color: var(--ink); }

/* Footer "Subscribe" button, styled to match the footer links. */
.site-footer .footer-nav button {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: #f0d9b0;
  cursor: pointer;
}

.site-footer .footer-nav button:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
  color: #fff;
}


/* --------------------------------------------------------------------------
   6. Hero, buttons, badges
   -------------------------------------------------------------------------- */

/* Tall, dramatic hero. Without .hero-media it is charcoal with copper glows
   (pure CSS); with .hero-media the photo becomes a full-bleed cover
   background under a dark gradient, and the headline stays readable. */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 30rem;
  background: var(--charcoal);
  color: #f5efe3;
  padding-block: 4rem;
  overflow: hidden;
  /* Copper glow, pure CSS — the fallback when no hero photo is present. */
  background-image:
    radial-gradient(ellipse 60% 90% at 85% 0%, rgba(232, 163, 61, 0.20), transparent 60%),
    radial-gradient(ellipse 50% 80% at 10% 100%, rgba(180, 85, 31, 0.28), transparent 60%);
}

@media (min-width: 900px) {
  .hero { min-height: min(70vh, 42rem); }
}

/* Full-bleed hero photo. Markup: <div class="hero-media"><img …></div>
   as the first child of .hero. The ::after gradient keeps white text
   readable over any photo; the charcoal background shows if the image
   fails to load. */
.hero-media {
  position: absolute;
  inset: 0;
  background: var(--charcoal);
}

.hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, rgba(23, 19, 16, 0.78) 0%, rgba(23, 19, 16, 0.45) 55%, rgba(23, 19, 16, 0.25) 100%),
    linear-gradient(180deg, rgba(23, 19, 16, 0.35) 0%, rgba(23, 19, 16, 0.45) 50%, rgba(23, 19, 16, 0.88) 100%);
}

/* Hero content sits above the photo. */
.hero .container {
  position: relative;
  z-index: 1;
  width: 100%;
}

.hero h1 {
  color: #fff;
  max-width: 20ch;
  margin-bottom: 0.45em;
  text-wrap: balance;
}

.hero h1 em {
  font-style: normal;
  color: var(--amber);
}

.hero p {
  color: #ddd3bd;
  font-size: 1.2rem;
  line-height: 1.6;
  max-width: 56ch;
  margin-bottom: 1.75rem;
}

.hero .hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* Buttons. <a class="btn btn-primary"> or <button class="btn">. */
.btn {
  display: inline-block;
  padding: 0.75rem 1.6rem;
  border-radius: var(--radius-pill);
  border: 2px solid var(--copper);
  background: transparent;
  color: var(--copper);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease,
              box-shadow 0.2s ease, border-color 0.2s ease;
}

.btn:hover, .btn:focus-visible {
  background: var(--copper);
  color: #fff;
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(180deg, var(--copper), var(--copper-deep));
  border-color: var(--copper-deep);
  color: #fff;
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover, .btn-primary:focus-visible {
  background: linear-gradient(180deg, var(--copper-deep), var(--copper-deep));
  border-color: var(--copper-deep);
  color: #fff;
  box-shadow: 0 14px 30px rgba(169, 78, 27, 0.45);
}

/* Outline buttons on the dark hero need light text and border. */
.hero .btn {
  border-color: rgba(245, 239, 227, 0.55);
  background: rgba(23, 19, 16, 0.25);
  color: #f5efe3;
}

.hero .btn:hover, .hero .btn:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: #f5efe3;
  color: #fff;
}

.hero .btn-primary {
  background: linear-gradient(180deg, var(--copper), var(--copper-deep));
  border-color: var(--copper-deep);
  color: #fff;
}

/* Small pill label, e.g. "New", "Popular", "Coming soon". */
.badge {
  display: inline-block;
  padding: 0.2em 0.7em;
  border-radius: var(--radius-pill);
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  color: #7a4d08;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
}

.badge-dark {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: #f5efe3;
}

/* Difficulty badges used on the guides hub. Extend .badge. */
.badge-beginner {
  background: #e6f2e4;
  border-color: #7fb069;
  color: #2c5a24;
}

.badge-intermediate {
  background: var(--amber-soft);
  border-color: var(--amber-line);
  color: #7a4d08;
}

.badge-advanced {
  background: #f9e8dc;
  border-color: var(--copper);
  color: var(--copper-deep);
}


/* --------------------------------------------------------------------------
   7. Cards & tool cards
   -------------------------------------------------------------------------- */

/* Cards are elevated: soft warm shadow, generous radius, a hover lift.
   overflow:hidden lets a .card-media / .tool-card-media image band reach
   the card's edges (via negative margins) without breaking the radius. */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--card-pad);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.card h3 { margin-bottom: 0.4em; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { color: var(--copper); }

.card p { color: var(--ink-soft); }
.card p:last-child { margin-bottom: 0; }

.card .card-link {
  margin-top: auto;
  padding-top: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.card .card-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Tool cards: the whole card is a link target via its heading link.
   A copper top rule marks them as interactive tools. */
.tool-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 4px solid var(--copper);
  border-radius: var(--radius);
  padding: var(--card-pad);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.tool-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.tool-card h3 {
  margin-bottom: 0.4em;
  font-size: 1.15rem;
}

.tool-card h3 a {
  color: var(--ink);
  text-decoration: none;
}

.tool-card h3 a:hover { color: var(--copper); }

.tool-card p {
  color: var(--ink-soft);
  margin-bottom: 0;
}

.tool-card .card-link {
  margin-top: auto;
  padding-top: 1rem;
  font-weight: 700;
  text-decoration: none;
}

.tool-card .card-link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Image bands at the top of cards.
   Markup: <div class="card-media"><img …></div> (or .tool-card-media)
   as the FIRST child of .card / .tool-card. The negative margins pull the
   band out to the card edges; aspect-ratio prevents layout shift. */
.card-media,
.tool-card-media {
  margin: calc(-1 * var(--card-pad)) calc(-1 * var(--card-pad)) 1.25rem;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--cream-2);
}

.card-media img,
.tool-card-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

/* Subtle hover zoom on card images (disabled under reduced motion). */
.card:hover .card-media img,
.tool-card:hover .tool-card-media img {
  transform: scale(1.06);
}


/* Grouped index on the tools hub: pill quick-links to each group. */
.group-index {
  margin-block: 1.5rem 0;
}

.group-index ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.group-index a {
  display: inline-block;
  padding: 0.45rem 1.1rem;
  border-radius: var(--radius-pill);
  border: 2px solid var(--copper);
  background: var(--paper);
  color: var(--copper-deep);
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.group-index a:hover,
.group-index a:focus-visible {
  background: var(--copper);
  border-color: var(--copper);
  color: #fff;
}

.group-index .group-count {
  display: inline-block;
  min-width: 1.4em;
  margin-left: 0.35em;
  padding: 0.05em 0.45em;
  border-radius: var(--radius-pill);
  background: var(--amber-soft);
  border: 1px solid var(--amber-line);
  color: #7a4d08;
  font-size: 0.8em;
  text-align: center;
}

.group-index a:hover .group-count,
.group-index a:focus-visible .group-count {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

/* Space between tool groups; the copper rule comes from the section-h2 style. */
.grid + .tool-group-heading {
  margin-top: 3rem;
}

/* Keep group headings clear of the sticky header on anchor jumps. */
.tool-group-heading {
  scroll-margin-top: 6rem;
}

.back-to-top {
  margin-top: 2.5rem;
  text-align: right;
}

.back-to-top a {
  color: var(--copper);
  font-weight: 700;
  text-decoration: none;
}

.back-to-top a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}


/* --------------------------------------------------------------------------
   8. Callouts
   -------------------------------------------------------------------------- */

.callout {
  border: 1px solid var(--line);
  border-left: 5px solid var(--copper);
  border-radius: var(--radius-sm);
  background: var(--cream-2);
  padding: 1.1rem 1.4rem;
  margin-block: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.callout > :last-child { margin-bottom: 0; }
.callout strong:first-child { display: block; margin-bottom: 0.25em; }

/* Amber warning callout — for safety and legality notes. */
.callout-warn {
  background: var(--amber-soft);
  border-color: var(--amber-line);
  border-left-color: var(--amber-line);
}

/* Blue-grey informational callout. */
.callout-info {
  background: var(--info-bg);
  border-color: var(--info-line);
  border-left-color: var(--info-line);
}


/* --------------------------------------------------------------------------
   9. Prose, TOC, breadcrumbs
   -------------------------------------------------------------------------- */

/* Readable long-form article text. Constrains line length. */
.prose {
  max-width: var(--measure);
}

.prose h2, .prose h3, .prose h4 { margin: 1.6em 0 0.5em; }
.prose h2:first-child, .prose h3:first-child { margin-top: 0; }

.prose ul, .prose ol {
  margin: 0 0 1em 1.25rem;
  padding: 0;
}

.prose li { margin-bottom: 0.35em; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.95rem;
}

.prose th, .prose td {
  border: 1px solid var(--line);
  padding: 0.55rem 0.8rem;
  text-align: left;
}

.prose th { background: var(--cream-2); font-weight: 700; }
.prose tbody tr:nth-child(even) { background: var(--cream); }

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--cream-2);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.prose pre {
  background: var(--charcoal);
  color: #f5efe3;
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25em;
}

.prose pre code { background: none; padding: 0; }

.prose blockquote {
  border-left: 4px solid var(--amber);
  padding-left: 1rem;
  margin: 0 0 1em;
  color: var(--ink-soft);
  font-style: italic;
}

/* In-page table of contents, shown near the top of long guides. */
.toc {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}

.toc h2, .toc strong {
  font-size: 1rem;
  font-family: var(--font-sans);
  letter-spacing: 0;
  margin: 0 0 0.5rem;
}

.toc ol, .toc ul {
  margin: 0;
  padding-left: 1.25rem;
}

.toc li { margin-bottom: 0.3em; }
.toc a { text-decoration: none; }
.toc a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* Breadcrumb trail under the header on sub-pages. */
.breadcrumbs {
  font-size: 0.9rem;
  color: var(--ink-soft);
  padding-block: 1rem 0;
}

.breadcrumbs ol {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.breadcrumbs li + li::before {
  content: "›";
  margin-right: 0.4rem;
  color: #a89a7d;
}

.breadcrumbs a { text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }


/* --------------------------------------------------------------------------
   10. Calculator components (used by tools/*.html)
   -------------------------------------------------------------------------- */

/* .calc wraps a whole tool: form on one side, results on the other. */
.calc {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
  margin-block: 1.5rem 2rem;
}

@media (min-width: 820px) {
  .calc { grid-template-columns: 1.1fr 1fr; }
}

/* The input form panel. */
.calc-form {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.calc-form .btn { width: 100%; margin-top: 0.5rem; }

/* One labelled input. */
.field { margin-bottom: 1.1rem; }

.field label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.field input,
.field select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 2px solid var(--field-line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1rem;
}

.field input:focus,
.field select:focus {
  border-color: var(--copper);
  outline: 3px solid rgba(169, 78, 27, 0.25);
  outline-offset: 0;
}

.field input[aria-invalid="true"] { border-color: #b3261e; }

/* Small helper text under an input. */
.field .hint {
  display: block;
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: 0.3rem;
}

/* The results panel — dark, with a copper top rule. */
.results {
  background: linear-gradient(160deg, var(--charcoal-2), var(--charcoal));
  color: #f5efe3;
  border-radius: var(--radius);
  border-top: 4px solid var(--copper);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.results h2, .results h3 { color: #fff; margin-bottom: 1rem; }

.result-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding-block: 0.7rem;
  border-bottom: 1px solid var(--line-dark);
}

.result-row:last-child { border-bottom: none; }

.result-label { color: #cfc6b4; }

.result-value {
  font-weight: 800;
  font-size: 1.15rem;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.colour-swatch {
  display: inline-block;
  width: 2.2rem;
  height: 1.4rem;
  vertical-align: -0.25rem;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background-color: transparent;
}

/* Comparison tables inside a calculator (fermentable sugars). */
.table-scroll { overflow-x: auto; }

.calc table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.5rem 0 1rem;
  font-size: 0.95rem;
}

.calc th, .calc td {
  border: 1px solid var(--line);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: middle;
}

.calc th { background: var(--cream-2); font-weight: 700; }
.calc tbody tr:nth-child(even) { background: var(--cream); }
.calc tbody tr[data-cheapest="true"] { background: var(--amber-soft); }

.calc td input[type="number"] {
  width: 5.5rem;
  padding: 0.4rem 0.5rem;
  border: 2px solid var(--field-line);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  font-size: 0.95rem;
}

.calc .hint {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-top: -0.5rem;
}

.cheapest-badge {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--copper-deep);
  white-space: nowrap;
}

.flag-warn {
  color: var(--copper-deep);
  font-weight: 700;
  font-size: 0.9rem;
}

/* Small note under a calculator explaining the formula used. */
.formula-note {
  font-size: 0.9rem;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 1rem;
}

.formula-note code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--cream-2);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}


/* --------------------------------------------------------------------------
   11. Guide extras (guide hero, learning path, product media)
   -------------------------------------------------------------------------- */

/* Wide banner photo at the top of a guide page.
   Markup: <figure class="guide-hero"><img …></figure>. */
.guide-hero {
  margin: 0 0 2rem;
  aspect-ratio: 21 / 9;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--cream-2);
  box-shadow: var(--shadow-md);
}

.guide-hero img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 700px) {
  .guide-hero { aspect-ratio: 16 / 9; }
}

/* Lead paragraph on guide pages. */
.lede {
  font-size: 1.2rem;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: var(--measure);
}

/* Ordered learning-path list on the guides hub. */
.guide-list {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: grid;
  gap: 0.9rem;
}

.guide-list li {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.guide-list li:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.guide-list li h3 { margin: 0 0 0.25rem; }
.guide-list li p { margin: 0.25rem 0 0; color: var(--ink-soft); }

/* Thumbnail at the start of a guide-list item.
   Markup: <img class="guide-thumb" …> as the FIRST child of the li.
   The li becomes a horizontal row (thumbnail left, text right); the
   :has() guard keeps list items without a thumbnail in the plain
   stacked layout above. */
.guide-list li:has(> .guide-thumb) {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 0.25rem 1.25rem;
  align-items: start;
}

.guide-thumb {
  grid-row: 1 / -1;
  align-self: start;
  width: 120px;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

@media (max-width: 560px) {
  .guide-list li:has(> .guide-thumb) {
    grid-template-columns: 1fr;
  }

  .guide-thumb {
    grid-row: auto;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin-bottom: 0.75rem;
  }
}

/* Large product photo on the products page.
   Markup: <div class="product-media"><img …></div>. */
.product-media {
  width: 100%;
  max-width: 640px;
  margin-inline: auto;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--cream-2);
  box-shadow: var(--shadow-md);
}

.product-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Recipe extras (.recipe-meta, .scaler, ul.ingredients) — used by
   recipes/*.html. The batch scaler reuses .field / .hint for its input. */

/* Badge + batch-size line under the recipe lede. */
.recipe-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 1.5rem;
  color: var(--ink-soft);
}

.recipe-meta .badge { margin: 0; }

/* Batch-size scaler panel: a distinct cream panel around the input,
   so the resizable batch size reads as a control, not body text. */
.scaler {
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 0 0 1.5rem;
  box-shadow: var(--shadow-sm);
}

.scaler .field { margin-bottom: 0; max-width: 20rem; }

/* Ingredient list: roomy spacing so scaled quantities stay readable. */
ul.ingredients {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
}

ul.ingredients li { margin-bottom: 0.5rem; line-height: 1.55; }
ul.ingredients li:last-child { margin-bottom: 0; }


/* --------------------------------------------------------------------------
   12. Utilities & accessibility
   -------------------------------------------------------------------------- */

/* Skip link: first focusable element on every page, visible on focus. */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 200;
  background: var(--copper);
  color: #fff;
  font-weight: 700;
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
}

.skip-link:focus { top: 0; color: #fff; }

/* Visually hidden but available to screen readers. */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.lead {
  font-size: 1.2rem;
  color: var(--ink-soft);
  max-width: var(--measure);
}

.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }


/* --------------------------------------------------------------------------
   13. Responsive adjustments
   -------------------------------------------------------------------------- */

@media (max-width: 559px) {
  /* Stack the header brand above the nav on small phones. */
  .site-header .container { flex-direction: column; align-items: flex-start; }

  nav.site-nav ul { gap: 0; }

  :root { --card-pad: 1.25rem; }

  .hero { min-height: 26rem; padding-block: 3rem; }
  .card, .tool-card, .calc-form, .results { padding: var(--card-pad); }
}


/* --------------------------------------------------------------------------
   14. Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
  /* No hover zoom or lift for users who prefer reduced motion. */
  .card:hover, .tool-card:hover, .guide-list li:hover { transform: none; }
  .card:hover .card-media img,
  .tool-card:hover .tool-card-media img { transform: none; }
}


/* --------------------------------------------------------------------------
   15. Search page
   -------------------------------------------------------------------------- */

/* The search box: one large input, the same shape as the calculator
   fields but bigger, with a result count underneath. */
.search-box { margin: 1.5rem 0 1rem; max-width: var(--measure); }

.search-input {
  width: 100%;
  padding: 0.85rem 1rem;
  border: 2px solid var(--field-line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.15rem;
}

.search-input:focus {
  border-color: var(--copper);
  outline: 3px solid rgba(169, 78, 27, 0.25);
  outline-offset: 0;
}

.search-count {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin-top: 0.5rem;
  min-height: 1.3em;
}

/* Results are a stacked list of paper cards, like the tool cards. */
.search-results { max-width: var(--measure); }

.search-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.search-result {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.search-result:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.search-result a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  text-decoration: none;
}

.search-result-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
}

.search-result a:hover .search-result-title { color: var(--copper); }

.search-result p { color: var(--ink-soft); margin: 0.45rem 0 0; }
.search-result p:last-child { margin-bottom: 0; }

/* Type badges follow the .badge pill pattern, one colour per type. */
.type-badge {
  display: inline-block;
  padding: 0.15em 0.7em;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line);
  background: var(--cream-2);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  vertical-align: middle;
  white-space: nowrap;
}

.type-badge-tool {
  background: #f9e8dc;
  border-color: var(--copper);
  color: var(--copper-deep);
}

.type-badge-guide {
  background: var(--amber-soft);
  border-color: var(--amber-line);
  color: #7a4d08;
}

.type-badge-recipe {
  background: #e6f2e4;
  border-color: #7fb069;
  color: #2c5a24;
}

.type-badge-hub {
  background: var(--charcoal);
  border-color: var(--charcoal);
  color: #f5efe3;
}

/* Empty states: the pre-search hint and the no-results message. */
.search-empty {
  color: var(--ink-soft);
  background: var(--cream-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}


/* --------------------------------------------------------------------------
   15. Shop (checkout page: shipping options, status messages)
   -------------------------------------------------------------------------- */

/* One column of the checkout's two-column .calc layout: stacks its panels
 * (form + shipping list on the left, summary + PayPal on the right). */
.shop-column {
  display: grid;
  gap: 1.5rem;
  align-content: start;
}

/* Inline status / error message under a checkout step. The error variant
 * uses a dark-red text/border on a pale-red background (7.5:1). */
.shop-status {
  background: var(--info-bg);
  border: 1px solid var(--info-line);
  border-left: 4px solid var(--info-line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
  font-size: 0.95rem;
  margin: 0;
}

.shop-status-error {
  background: #fdf0ef;
  border-color: #d9a49e;
  border-left-color: #b3261e;
  color: #7a1f1a;
}

/* Shipping service options: a radio list where each option is a card. */
#shipping-list {
  display: grid;
  gap: 0.75rem;
}

.shipping-option {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: #fff;
  border: 2px solid var(--field-line);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  cursor: pointer;
}

.shipping-option input[type="radio"] {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  margin-top: 0.15rem;
  accent-color: var(--copper);
}

.shipping-option:focus-within {
  border-color: var(--copper);
  outline: 3px solid rgba(169, 78, 27, 0.25);
  outline-offset: 0;
}

.shipping-option:has(input[type="radio"]:checked) {
  border-color: var(--copper);
  background: var(--amber-soft);
}

.shipping-option-body {
  display: grid;
  gap: 0.15rem;
  flex: 1;
  min-width: 0;
}

.shipping-option-name {
  font-weight: 700;
  color: var(--ink);
}

.shipping-option-name .badge { margin-left: 0.25rem; }

.shipping-option-meta {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.shipping-option-price {
  flex: none;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* The total row in the order summary: a copper rule above it and a
 * larger figure. Extends .result-row (dark results panel). */
.result-row-total {
  border-top: 2px solid var(--amber);
  margin-top: 0.5rem;
  padding-top: 1rem;
}

.result-row-total .result-value { font-size: 1.35rem; }

/* Product images (products page) and the checkout thumbnail. */
.card-media { margin-bottom: 1rem; }

.card-media img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
}

.product-feature {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: center;
  margin-top: 2rem;
}

.product-feature img {
  display: block;
  width: 100%;
  max-width: 280px;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}

.product-feature-body { flex: 1; min-width: 16rem; }

.product-feature-body h2 { margin-top: 0; }

.shop-thumb {
  display: block;
  width: 120px;
  height: auto;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
}
