/* ==========================================================================
   Cross Stitch Calculator — global stylesheet.
   Warm craft / textile aesthetic: cream-linen base, warm ink text,
   embroidery-rose accent, ochre-gold highlights. Original design,
   built mobile-first. Light by default with a prefers-color-scheme
   dark variant. No frameworks. System font stack.
   ========================================================================== */

:root {
  /* ---- color tokens ---- */
  --bg: #faf5ea;              /* cream linen */
  --surface: #f2e9d6;         /* deeper linen */
  --card: #fffdf7;            /* raised paper */
  --text: #3a2f28;            /* warm ink */
  --muted: #77644f;           /* warm taupe */
  --border: #e2d2b8;          /* warm tan */
  --border-strong: #d3bd97;
  --accent: #a63d5a;          /* embroidery rose / deep crimson */
  --accent-deep: #86304a;     /* rose, pressed */
  --accent-ink: #7c2a43;     /* rose darkened for text on cream */
  --accent-contrast: #fdf8f0; /* cream white on rose */
  --accent-soft: #f7e3ea;     /* rose tint */
  --gold: #c08a3e;            /* warm ochre */
  --gold-deep: #9a6a2c;       /* ochre darkened for text on cream */
  --gold-soft: #f6ecd8;       /* gold tint */
  --success: #6d7c34;         /* olive */
  --danger: #b3261e;
  --shadow: 0 10px 30px rgba(84, 58, 38, 0.10);

  /* ---- type scale ---- */
  --fs-xs: 0.8125rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.25rem;
  --fs-2xl: 1.5rem;
  --fs-3xl: 2rem;
  --fs-4xl: 2.75rem;

  /* ---- type + layout tokens ---- */
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --max-width: 72rem;
  --measure: 72ch;
  --radius: 0.5rem;
  --radius-lg: 0.875rem;

  /* ---- spacing scale ---- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 1rem;
  --space-4: 1.5rem;
  --space-5: 2.5rem;
  --space-6: 4rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #211913;
    --surface: #2c221a;
    --card: #312619;
    --text: #f2e7d5;
    --muted: #b8a48c;
    --border: #463627;
    --border-strong: #5a4530;
    --accent: #d67f96;
    --accent-deep: #b8637c;
    --accent-ink: #e9a3b5;
    --accent-contrast: #2b1218;
    --accent-soft: #3d222c;
    --gold: #ddab63;
    --gold-deep: #e8bd7e;
    --gold-soft: #3a2c1a;
    --success: #a9c05c;
    --danger: #ef7d72;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
}

/* ---------- base ---------- */

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

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

body {
  margin: 0;
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

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

a { color: var(--accent-ink); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

h1, h2, h3, h4 {
  line-height: 1.25;
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}
h1 { font-size: var(--fs-3xl); letter-spacing: -0.01em; }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-lg); }

p { margin: 0 0 var(--space-3); }

/* ---------- layout ---------- */

/* Centered max-width container with inline padding. */
.wrap {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

/* Skip link: visually hidden until focused. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: var(--space-2) var(--space-3);
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* ---------- header + navigation ---------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  box-shadow: 0 1px 0 var(--gold-soft);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding-block: var(--space-2);
}
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.site-logo img { height: 2rem; width: 2rem; display: block; }

.site-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav__list a,
.site-nav__list button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.site-nav__list a:hover,
.site-nav__list button:hover { background: var(--surface); }
.site-nav__list a[aria-current="page"] { color: var(--accent-ink); }

/* Dropdown: chevron on the trigger, panel hidden until hover/focus/expanded. */
.has-dropdown { position: relative; }
.has-dropdown > button::after {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  margin-left: var(--space-2);
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}
.has-dropdown > ul {
  display: none;
  position: absolute;
  top: calc(100% + var(--space-1));
  right: 0;
  min-width: 15rem;
  margin: 0;
  padding: var(--space-2);
  list-style: none;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 50;
}
.has-dropdown > ul li { margin: 0; }
.has-dropdown > ul a { display: flex; width: 100%; }
.has-dropdown > ul a:hover { background: var(--accent-soft); }
.dropdown-all {
  border-top: 1px dashed var(--border-strong);
  margin-top: var(--space-1);
  padding-top: var(--space-1);
}
.dropdown-all a {
  color: var(--gold-deep);
  font-weight: 700;
}
.has-dropdown:hover > ul,
.has-dropdown:focus-within > ul,
.has-dropdown > button[aria-expanded="true"] + ul { display: block; }

/* Hamburger toggle: hidden on desktop, styled for touch on mobile. */
.nav-toggle { display: none; }

/* ---------- hero / page-top content ---------- */

.hero {
  padding-block: var(--space-6) var(--space-4);
  border-bottom: 2px dashed var(--border-strong);
  margin-bottom: var(--space-5);
}
.hero h1 { font-size: var(--fs-4xl); margin-bottom: var(--space-2); }

.lede {
  font-size: var(--fs-lg);
  color: var(--muted);
  max-width: var(--measure);
}

.breadcrumb { margin-bottom: var(--space-3); }
.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.breadcrumb li + li::before {
  content: "›";
  margin-right: var(--space-1);
  color: var(--muted);
}
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 600; }

/* Article body: comfortable line length. */
.prose { max-width: var(--measure); }
.prose li { margin-bottom: var(--space-2); }

.byline {
  color: var(--muted);
  font-size: var(--fs-sm);
  margin: calc(var(--space-3) * -1) 0 var(--space-3);
}
.byline a { color: inherit; }

/* ==========================================================================
   TOOL — the centerpiece. Premium card flow: numbered step cards, polished
   inputs, a designed results panel, and a "how it's calculated" callout.
   ========================================================================== */

.tool {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  position: relative;
  overflow: hidden;
}
/* Rose-gold top stitch: a thin two-tone bar across the tool card. */
.tool::before {
  content: "";
  display: block;
  height: 4px;
  margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-4);
  background: linear-gradient(90deg, var(--accent) 0 60%, var(--gold) 60% 100%);
}
.tool h2 { font-size: var(--fs-2xl); letter-spacing: -0.01em; }
.calc-desc { color: var(--muted); max-width: var(--measure); }

/* --- step cards --- */

.tool__step {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-4);
}
.tool__step:last-of-type { margin-bottom: var(--space-4); }
.tool__step-label {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-weight: 800;
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
  margin: 0 0 var(--space-3);
}
/* Premium step badge: rose gradient medallion with a soft halo. */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: var(--accent-contrast);
  font-size: var(--fs-base);
  font-weight: 800;
  flex: none;
  box-shadow: 0 0 0 5px var(--accent-soft), 0 4px 10px rgba(134, 48, 74, 0.35);
}

/* --- form fields --- */

/* One column on mobile; two to three columns from 640px. */
.field-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
}
.field { margin: 0; }
.field label {
  display: block;
  font-weight: 700;
  font-size: var(--fs-sm);
  margin-bottom: var(--space-2);
  color: var(--text);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  max-width: 24rem;
  padding: var(--space-2) var(--space-3);
  min-height: 3.25rem;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 1.0625rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--gold); }
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}
.field [aria-invalid="true"] { border-color: var(--danger); }
.field input::placeholder { color: var(--muted); opacity: 0.7; }

/* Custom select chevron in the accent color. */
.field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 2.75rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23a63d5a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  .field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1 1l6 6 6-6' fill='none' stroke='%23d67f96' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }
}

/* Small muted helper text under a field. */
.help {
  display: block;
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: var(--space-2);
  line-height: 1.5;
}
/* Unit indicator as a small gold pill chip. */
.unit-hint {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--gold-deep);
  background: var(--gold-soft);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  margin-left: var(--space-1);
  vertical-align: 0.1em;
}

/* Checkbox + label on one comfortable row. */
.field-check {
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3);
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.field-check:hover { border-color: var(--gold); }
.field-check input {
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.15rem;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}
.field-check label {
  font-weight: 600;
  font-size: var(--fs-base);
  cursor: pointer;
  margin: 0;
}

/* --- action buttons --- */

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

/* Primary button: embroidery-rose with a soft lift. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 3.25rem;
  min-width: 3.25rem;
  padding: var(--space-2) var(--space-5);
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: var(--accent-contrast);
  border: 1px solid var(--accent-deep);
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: 0.01em;
  cursor: pointer;
  text-decoration: none;
  box-shadow: 0 6px 16px rgba(134, 48, 74, 0.30);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(134, 48, 74, 0.38);
  filter: brightness(1.06);
}
.btn:active { transform: translateY(0); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.25rem;
  min-width: 3.25rem;
  padding: var(--space-2) var(--space-4);
  background: transparent;
  color: var(--accent-ink);
  border: 1.5px solid var(--accent);
  border-radius: var(--radius);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, transform 0.15s ease;
}
.btn-ghost:hover { background: var(--accent-soft); transform: translateY(-1px); }

/* The "Copy result" action is a primary action: rose fill, same weight. */
.btn-ghost[data-action="copy"] {
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent-deep) 100%);
  color: var(--accent-contrast);
  border-color: var(--accent-deep);
  box-shadow: 0 6px 16px rgba(134, 48, 74, 0.30);
}
.btn-ghost[data-action="copy"]:hover {
  transform: translateY(-2px);
  filter: brightness(1.06);
}

/* --- validation message --- */

.error-box {
  border: 1px solid var(--danger);
  border-left: 5px solid var(--danger);
  background: var(--bg);
  color: var(--danger);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  margin-top: var(--space-4);
  font-weight: 600;
}
.error-box[hidden] { display: none; }

/* ---------- results panel ---------- */

.results {
  margin-top: var(--space-5);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 0 0 1px var(--gold-soft);
  padding: var(--space-4);
  position: relative;
  overflow: hidden;
}
.results::before {
  content: "";
  display: block;
  height: 3px;
  margin: calc(var(--space-4) * -1) calc(var(--space-4) * -1) var(--space-4);
  background: linear-gradient(90deg, var(--gold) 0%, var(--accent) 100%);
}
.results[hidden] { display: none; }
/* Eyebrow heading replacing the plain "Result" dump. */
.results h3 {
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-deep);
  margin: 0 0 var(--space-2);
}
/* Key figure: first row is the hero — large rose figure, centered. */
.results .result-row:first-of-type {
  display: block;
  text-align: center;
  padding: var(--space-3) var(--space-2) var(--space-4);
  border-bottom: 2px dashed var(--border-strong);
  margin-bottom: var(--space-2);
}
.results .result-row:first-of-type .result-label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: var(--space-2);
}
.results .result-row:first-of-type .result-value {
  display: block;
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent-ink);
  line-height: 1.1;
  text-align: center;
}
/* Supporting rows: clean label/value lines. */
.result-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding-block: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.result-row:last-of-type { border-bottom: 0; }
.result-label { color: var(--muted); font-weight: 600; }
.result-value {
  font-weight: 800;
  font-size: var(--fs-xl);
  text-align: right;
  color: var(--text);
}
.result-note {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border);
}

/* ---------- "how it's calculated" callout ---------- */

.how-calculated {
  background: linear-gradient(180deg, var(--gold-soft), var(--surface));
  border: 1px solid var(--border-strong);
  border-left: 5px solid var(--gold);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  font-size: var(--fs-base);
  box-shadow: var(--shadow);
}
.how-calculated h2 {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-lg);
  margin-bottom: var(--space-2);
}
/* Stitched-diamond motif before the callout heading. */
.how-calculated h2::before {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  flex: none;
  background: var(--gold);
  transform: rotate(45deg);
  border-radius: 2px;
}
.how-calculated p:last-child { margin-bottom: 0; }
.how-calculated code {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  padding: 0.05rem 0.4rem;
  font-size: 0.9em;
}

/* ---------- card grid (tool listing) ---------- */

.tool-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: 1fr;
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
}
.tool-card {
  display: block;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  border-top: 3px solid var(--gold);
  padding: var(--space-4);
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}
.tool-card:hover {
  border-color: var(--accent);
  border-top-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 16px 34px rgba(84, 58, 38, 0.16);
}
.tool-card strong {
  display: block;
  font-size: var(--fs-lg);
  margin-bottom: var(--space-1);
  color: var(--accent-ink);
}
.tool-card span { color: var(--muted); font-size: var(--fs-sm); }

/* ---------- FAQ (native details/summary) ---------- */

.faq { margin-bottom: var(--space-5); }
.faq details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  margin-bottom: var(--space-2);
  box-shadow: var(--shadow);
}
.faq summary {
  cursor: pointer;
  padding: var(--space-3) var(--space-4);
  font-weight: 700;
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--accent-contrast);
  font-weight: 800;
  line-height: 1;
}
.faq details[open] summary::before { content: "–"; }
.faq details p { padding: 0 var(--space-4) var(--space-3); margin: 0; }

/* ---------- trust box ---------- */

.trust {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow);
}
.trust h2 { font-size: var(--fs-lg); margin-bottom: var(--space-2); }

.reviewed-line {
  font-size: var(--fs-sm);
  color: var(--muted);
  margin-top: var(--space-3);
}

/* ---------- tables ---------- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--space-4);
  font-size: var(--fs-sm);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
caption { caption-side: top; text-align: left; font-weight: 700; padding: var(--space-2); }
th, td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border);
}
thead th {
  background: var(--surface);
  color: var(--accent-ink);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
tbody tr:nth-child(even) { background: var(--surface); }
tbody tr:last-child th,
tbody tr:last-child td { border-bottom: 0; }

/* ---------- footer ---------- */

.site-footer {
  background: #2b2119;
  color: #e9dcc6;
  margin-top: var(--space-6);
  padding-block: var(--space-5) var(--space-3);
}
.site-footer a { color: #e9dcc6; }
.site-footer a:hover { color: var(--gold); }
.footer-grid {
  display: grid;
  gap: var(--space-5);
  grid-template-columns: 1fr;
  margin-bottom: var(--space-4);
}
.footer-brand__name {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--fs-lg);
  font-weight: 800;
  color: #f7efe0;
  margin: 0 0 var(--space-2);
}
.footer-brand__name img { height: 1.75rem; width: 1.75rem; }
.footer-brand p { color: #cbb894; }
.footer-grid p { color: #cbb894; font-size: var(--fs-sm); }
.footer-grid h2 {
  font-size: var(--fs-xs);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold);
  margin-bottom: var(--space-2);
}
.footer-grid ul { list-style: none; margin: 0; padding: 0; }
.footer-grid li { margin-bottom: var(--space-1); }
.footer-grid li a {
  text-decoration: none;
  display: inline-block;
  padding-block: 0.2rem;
  font-size: var(--fs-sm);
}
.footer-grid li a:hover { text-decoration: underline; }
/* Calculators column uses keyword-rich anchors: slightly smaller so the
   longer labels fit the column cleanly without awkward wrapping. */
.site-footer nav[aria-label="Calculators"] li a { font-size: var(--fs-xs); }
.footer-bottom {
  border-top: 1px solid rgba(233, 220, 198, 0.18);
  padding-top: var(--space-3);
  font-size: var(--fs-sm);
  color: #b7a582;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: space-between;
}
.footer-bottom p { margin: 0; }

@media (prefers-color-scheme: dark) {
  .site-footer { background: #171009; }
}

/* ---------- responsive ---------- */

@media (min-width: 640px) {
  .field-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: var(--fs-4xl); }
  .tool { padding: var(--space-5); }
  .tool::before {
    margin: calc(var(--space-5) * -1) calc(var(--space-5) * -1) var(--space-5);
  }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .tool-grid { grid-template-columns: repeat(3, 1fr); }
  .field-grid--wide { grid-template-columns: repeat(3, 1fr); }
  .footer-grid { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
}

/* Mobile nav: hamburger toggle + full-width panel under 768px. */
@media (max-width: 767px) {
  /* .site-nav must stay position:static so the open panel anchors to the
     full-width .site-header; desktop dropdowns anchor to .has-dropdown. */
  .site-header { position: relative; }
  .site-nav { position: static; }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
    min-height: 48px;
    background: none;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    cursor: pointer;
  }
  .site-nav__list {
    display: none;
    position: absolute;
    top: 100%;
    right: var(--space-3);
    left: var(--space-3);
    flex-direction: column;
    align-items: stretch;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-2);
    box-shadow: var(--shadow);
    z-index: 50;
    max-height: calc(100dvh - 5rem);
    overflow-y: auto;
  }
  .site-nav.open .site-nav__list { display: flex; }
  .has-dropdown > ul {
    position: static;
    box-shadow: none;
    border: 0;
    border-left: 3px solid var(--gold);
    border-radius: 0;
    margin-left: var(--space-3);
    background: transparent;
  }
  .has-dropdown > button[aria-expanded="true"]::after {
    transform: rotate(225deg) translateY(-2px);
  }

  /* Mobile tool polish: full-width inputs, generous buttons, stacked hero. */
  .tool { padding: var(--space-3); }
  .tool::before {
    margin: calc(var(--space-3) * -1) calc(var(--space-3) * -1) var(--space-3);
  }
  .tool__step { padding: var(--space-3); }
  .field input,
  .field select,
  .field textarea { max-width: 100%; }
  .btn-row { flex-direction: column; align-items: stretch; }
  .btn-row .btn,
  .btn-row .btn-ghost { width: 100%; }
}

/* Hamburger icon: CSS-drawn bars that become an X when the menu is open. */
.nav-toggle__icon {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
  position: relative;
  border-radius: 1px;
}
.nav-toggle__icon::before,
.nav-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
}
.nav-toggle__icon::before { top: -6px; }
.nav-toggle__icon::after { top: 6px; }
.site-nav.open .nav-toggle__icon { background: transparent; }
.site-nav.open .nav-toggle__icon::before { top: 0; transform: rotate(45deg); }
.site-nav.open .nav-toggle__icon::after { top: 0; transform: rotate(-45deg); }

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}
