/* ====================================================================
   HandyConvert — shared base stylesheet
   Mobile-first. Plain CSS, custom properties for theming. No preprocessor.
   Category accent colours live in /assets/<category>.css, loaded after
   this file by header.php. The :root values below are the Home & Build
   defaults and act as a fallback if no category file loads.
   ==================================================================== */

:root {
  --bg:            #FFFFFF;
  --surface:       #FFFFFF;
  --surface-alt:   #F4F4F5;
  --text:          #1A1A1A;
  --text-muted:    #5C5C62;
  --border:        #E6E6E9;
  --border-strong: #CDCDD2;

  --accent:        #D97706;   /* default = Home & Build amber */
  --accent-strong: #B45309;
  --accent-soft:   #FEF3E2;
  --on-accent:     #FFFFFF;

  --svg-fill:      #F4F4F5;
  --svg-stroke:    #9A9AA0;

  --ok:            #15803D;
  --shadow:        0 1px 3px rgba(0,0,0,.07), 0 6px 18px rgba(0,0,0,.05);

  --radius:        12px;
  --radius-sm:     8px;
  --gutter:        20px;   /* space framing the content; scales up on wider screens */

  --font: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg:            #16161A;
  --surface:       #1F1F25;
  --surface-alt:   #2A2A31;
  --text:          #F1F0EC;
  --text-muted:    #A6A39B;
  --border:        #34343D;
  --border-strong: #45454F;

  --accent:        #F59E0B;
  --accent-strong: #FBBF24;
  --accent-soft:   #2E2410;
  --on-accent:     #1A1A1A;

  --svg-fill:      #26262E;
  --svg-stroke:    #6E6E78;

  --ok:            #4ADE80;
  --shadow:        0 1px 3px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.35);
}

/* ---- Reset & base ------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0 auto;
  max-width: 1680px;        /* wide enough for a full row of tool cards */
  padding: var(--gutter);   /* the frame around the site content */
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* ---- Monotone icons ---------------------------------------------- */
.icon {
  width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.16em;
  filter: url(#hc-sketch);   /* gentle hand-drawn wobble on the line work */
}
/* Hand-drawn PNG icons replace the line icons — no SVG filter, fit cleanly. */
.icon--img { filter: none; object-fit: contain; }
[data-theme="dark"] .icon--img { filter: invert(1); }
.btn .icon, .hc-consent__btn .icon { width: 17px; height: 17px; }
.card-icon { display: block; color: var(--accent); margin-bottom: 4px; }
.card-icon .icon { width: 200px; height: auto; max-width: 100%; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: 25px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
p  { margin: 0 0 1em; }
a  { color: var(--accent-strong); text-decoration-thickness: 1px; text-underline-offset: 2px; }
img, svg { max-width: 100%; }
.tabular { font-variant-numeric: tabular-nums; }

/* Full-width content; the 50px frame is the body padding around it. */
.container { width: 100%; margin: 0 auto; padding: 0; }

.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--on-accent);
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; }

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

/* ---- Site header -------------------------------------------------- */
/* No box — the header is just content with a soft hairline rule beneath. */
.site-header {
  background: transparent;
  border-bottom: 1px solid var(--border-strong);
}
.site-header__inner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 14px;
  padding: 6px 0;   /* header hugs the logo — no tall empty band */
}
.site-logo { display: inline-flex; align-items: center; text-decoration: none; }
.site-logo__img { width: 300px; height: auto; max-width: 72vw; display: block; }
/* The logo is black line art — flip it to white in dark mode. */
[data-theme="dark"] .site-logo__img { filter: invert(1); }
.theme-toggle .icon { width: 20px; height: 20px; }
.site-nav { display: flex; gap: 4px; margin-left: auto; }
.site-nav a {
  color: var(--text-muted); text-decoration: none; font-weight: 500;
  padding: 8px 10px; border-radius: var(--radius-sm); font-size: 15px;
}
.site-nav a:hover { background: var(--surface-alt); color: var(--text); }
.site-nav a[aria-current="true"] { color: var(--accent-strong); }
.theme-toggle {
  width: 44px; height: 44px; flex: none;
  border: 1px solid var(--border); background: var(--surface);
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text);
  font-size: 18px; line-height: 1;
}
.theme-toggle:hover { background: var(--surface-alt); }

/* ---- Breadcrumb --------------------------------------------------- */
.breadcrumb { background: var(--bg); font-size: 13.5px; }
.breadcrumb ol {
  list-style: none; display: flex; flex-wrap: wrap; gap: 4px;
  margin: 0; padding: 12px 0 0;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb [aria-current="page"] { color: var(--text); font-weight: 500; }
.breadcrumb__sep { color: var(--border-strong); margin-left: 4px; }

/* ---- Page layout -------------------------------------------------- */
main { display: block; padding: 24px 0 40px; }
.page-head { margin: 16px 0 24px; }
.page-head .subhead { color: var(--text-muted); font-size: 17px; margin: 0; }
/* Homepage lede heading — a modest H1, not a hero banner. */
.home-h1 { font-size: 22px; margin-bottom: 6px; }

section { margin: 32px 0; }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ---- Homepage / category card grids ------------------------------ */
.category-grid, .tool-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}
.category-card, .tool-card {
  position: relative;
  text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 20px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 16px rgba(0,0,0,.07);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
/* Clickable cards lift toward the cursor — a clear "open me" cue. */
a.category-card:hover, a.tool-card:hover,
a.category-card:focus-visible, a.tool-card:focus-visible {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 4px 10px rgba(0,0,0,.08), 0 18px 38px rgba(0,0,0,.13);
}
a.category-card:hover .category-card__title,
a.tool-card:hover .tool-card__title { color: var(--accent-strong); }
/* Always-visible arrow affordance (also works on touch — no hover). */
a.category-card::after, a.tool-card::after {
  content: "→";
  position: absolute; top: 14px; right: 16px;
  font-size: 17px; font-weight: 700; line-height: 1;
  color: var(--accent-strong); opacity: .5;
  transition: transform .16s ease, opacity .16s ease;
}
a.category-card:hover::after, a.tool-card:hover::after {
  opacity: 1; transform: translateX(4px);
}
/* Tool card: graphic on the left, text on the right. */
.tool-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.tool-card__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tool-card__title { font-weight: 600; font-size: 16px; }
.tool-card__desc  { color: var(--text-muted); font-size: 14px; }
.tool-card .card-icon .icon { width: 200px; height: auto; max-width: 100%; }
.tool-card[aria-disabled] .card-icon { color: var(--text-muted); }

/* Category card: graphic on the left, text on the right. */
.category-card { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.category-card__body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.category-card__title { font-size: 20px; font-weight: 600; }
.category-card__desc  { color: var(--text-muted); font-size: 14.5px; }
/* Homepage tool finder — heading + opt-in toggle, then interest chips. */
.cat-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 16px; flex-wrap: wrap; margin-bottom: 16px;
}
.cat-head h2 { margin: 0; }
.finder-intro { color: var(--text-muted); margin: 0 0 10px; }
.finder-chips { margin-bottom: 18px; }

/* ---- Form controls ------------------------------------------------ */
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.field > label, .field-label {
  display: block; font-weight: 600; font-size: 15px; margin-bottom: 8px;
}
.field-label .tooltip { font-weight: 400; }

input[type="number"], input[type="text"], select {
  width: 100%; max-width: 480px; height: 48px;
  padding: 0 12px;
  font: inherit; font-size: 16px;
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}
input:focus-visible, select:focus-visible { border-color: var(--accent); }

/* Currency-prefixed input — a "$" sits inside the left of the field. */
.prefix-input { position: relative; max-width: 480px; }
.prefix-input__sym {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  font-size: 16px; color: var(--text-muted); pointer-events: none;
}
.prefix-input input[type="number"] { padding-left: 26px; }

/* Recipe Scaler — one editable row per ingredient. */
.ingredient-row {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap; margin-bottom: 8px;
}
.ingredient-row input { height: 44px; }
.ingredient-row .ing-amt  { width: 88px; }
.ingredient-row .ing-unit { width: 108px; }
.ingredient-row .ing-name { flex: 1 1 160px; min-width: 140px; }
.ingredient-row__scaled {
  min-width: 96px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--accent-strong);
}
.ingredient-row__rm {
  width: 38px; height: 38px; flex: none;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-muted); border-radius: var(--radius-sm);
  font-size: 18px; line-height: 1; cursor: pointer;
}
.ingredient-row__rm:hover { border-color: var(--accent); color: var(--text); }

/* Pan Substitution — a labelled dimension input. */
.pan-dim { display: flex; flex-direction: column; }
.pan-dim .field-label { margin-bottom: 6px; }
.pan-dim input[type="number"] { max-width: 170px; }

/* Collapsible "Advanced options" — progressive disclosure inside a form. */
.advanced { border-top: 1px solid var(--border-strong); margin: 0 0 20px; }
.advanced__summary {
  cursor: pointer; list-style: none;
  font-weight: 600; font-size: 15px; color: var(--accent-strong);
  padding: 14px 0 2px; display: flex; align-items: center; gap: 8px;
}
.advanced__summary::-webkit-details-marker { display: none; }
.advanced__summary::before {
  content: "+"; display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border: 1.5px solid currentColor; border-radius: 50%;
  font-size: 14px; line-height: 1;
}
.advanced[open] .advanced__summary::before { content: "\2212"; }
.advanced__body { padding-top: 14px; }
.advanced__body .field:last-child { margin-bottom: 0; }

.result__allin { margin-top: 8px; font-size: 15px; }
.result__allin strong { color: var(--accent-strong); font-size: 17px; margin-left: 4px; }

/* Mortgage comparison — three side-by-side scenario columns. */
.cmp-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 760px) { .cmp-grid { grid-template-columns: 1fr; } }
.cmp-col, .cmp-card {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 14px; background: var(--surface);
}
.cmp-col__field { margin-bottom: 10px; }
.cmp-col__field:last-child { margin-bottom: 0; }
.cmp-col__field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--text-muted); margin-bottom: 4px;
}
.cmp-card { position: relative; }
.cmp-card--best { border-color: var(--accent); border-width: 2px; background: var(--accent-soft); }
.cmp-card__name { font-weight: 700; font-size: 16px; }
.cmp-card__meta { font-size: 12.5px; color: var(--text-muted); margin: 2px 0 10px; }
.cmp-card__pay { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cmp-card__pay-sub { font-size: 12.5px; color: var(--text-muted); margin-bottom: 6px; }
.cmp-row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 5px 0; font-size: 14px; border-top: 1px solid var(--border);
}
.cmp-row__k { color: var(--text-muted); }
.cmp-row__v { font-variant-numeric: tabular-nums; font-weight: 600; }
.cmp-badge {
  display: inline-block; margin-bottom: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--on-accent); background: var(--accent);
  padding: 3px 9px; border-radius: 999px;
}
.cmp-legend {
  display: flex; flex-wrap: wrap; gap: 16px; justify-content: center;
  margin-top: 10px; font-size: 13px;
}
.cmp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cmp-legend svg { display: block; }

/* Step-by-step calculator mode — one field at a time, opt-in. */
.step-mode-toggle { margin-bottom: 18px; justify-content: center; }
.step-progress { margin-bottom: 18px; }
.step-progress__label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.step-bar {
  margin-top: 6px; height: 6px; border-radius: 999px;
  background: var(--accent-soft); overflow: hidden;
}
.step-bar__fill { height: 100%; background: var(--accent); transition: width .2s ease; }
.step-nav { display: flex; gap: 10px; margin-top: 18px; }
.step-nav .btn { min-width: 116px; justify-content: center; }
/* Advanced disclosure rendered as a <button> (step-mode-capable pages). */
button.advanced__summary {
  width: 100%; text-align: left;
  background: none; border: 0; font-family: inherit;
}
.advanced__summary[aria-expanded="true"]::before { content: "\2212"; }

/* Option-card grids flow to fit any width — no fixed column counts. */
.option-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.option-card {
  display: flex; flex-direction: column; gap: 2px;
  text-align: left; cursor: pointer;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 12px;
  font: inherit; color: var(--text);
}
.option-card:hover { border-color: var(--accent); }
.option-card[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.option-card__title { font-weight: 600; font-size: 15px; }
.option-card__note  { font-size: 12.5px; color: var(--text-muted); }
.option-card svg { margin-top: 6px; }

.stepper { display: flex; align-items: center; gap: 8px; }
.stepper button {
  width: 48px; height: 48px; flex: none;
  font-size: 24px; line-height: 1;
  border: 1.5px solid var(--border-strong); background: var(--surface);
  color: var(--text); border-radius: var(--radius-sm); cursor: pointer;
}
.stepper button:hover:not(:disabled) { border-color: var(--accent); }
.stepper button:disabled { opacity: .4; cursor: not-allowed; }
.stepper input { text-align: center; max-width: 90px; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font: inherit; font-size: 14px;
  padding: 6px 12px; min-height: 32px;
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); border-radius: 999px; cursor: pointer;
}
.chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.chip[aria-pressed="true"] {
  border-color: var(--accent); background: var(--accent); color: var(--on-accent);
}

.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.help-text { font-size: 13px; color: var(--text-muted); margin: 6px 0 0; }
.warn-text { font-size: 14px; color: var(--accent-strong); font-weight: 500; }

/* ---- Result display ---------------------------------------------- */
.result { margin-top: 8px; }
.result__layout + .result__layout {
  margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border);
}
.result__dir-label {
  font-size: 13px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); margin-bottom: 4px;
}
.result__hero {
  font-size: 44px; font-weight: 600; line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.result__hero .x { color: var(--text-muted); font-size: .7em; padding: 0 .12em; }
.result__mm { font-size: 17px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.result__decimal { font-size: 14px; color: var(--text-muted); }

.verify {
  margin-top: 14px; padding: 12px 14px;
  background: var(--surface-alt); border-radius: var(--radius-sm);
  font-size: 14px; font-variant-numeric: tabular-nums;
}
.verify .ok { color: var(--ok); font-weight: 700; }

/* ---- Stat grid (multi-output results) ---------------------------- */
.stat-grid {
  display: grid; gap: 10px; margin-top: 16px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.stat {
  background: var(--surface-alt); border-radius: var(--radius-sm); padding: 12px 14px;
}
.stat__label {
  font-size: 12px; color: var(--text-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: .03em;
}
.stat__value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat__sub { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ---- Code-check list --------------------------------------------- */
.checks { margin-top: 16px; }
.check {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 9px 0; font-size: 14px; border-bottom: 1px solid var(--border);
}
.check:last-child { border-bottom: none; }
.check__icon { font-weight: 700; flex: none; line-height: 1.5; }
.check--ok   .check__icon { color: var(--ok); }
.check--warn .check__icon { color: var(--accent-strong); }

/* ---- SVG cut diagram --------------------------------------------- */
.diagram { margin-top: 16px; }
.diagram svg { width: 100%; height: auto; display: block; }
.diagram figcaption { font-size: 13px; color: var(--text-muted); margin-top: 6px; }

/* ---- Result action buttons --------------------------------------- */
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  min-height: 44px; padding: 0 16px;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { border-color: var(--accent); }
.btn--primary {
  background: var(--accent); color: var(--on-accent);
  border-color: var(--accent); min-height: 48px;
}
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

/* ---- Toast -------------------------------------------------------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: var(--bg);
  padding: 10px 18px; border-radius: 999px;
  font-size: 14px; font-weight: 500; z-index: 80;
  box-shadow: var(--shadow);
}

/* ---- Tooltip ------------------------------------------------------ */
.tooltip { position: relative; display: inline-block; }
.tooltip-trigger {
  border: none; background: none; cursor: pointer; padding: 2px;
  color: var(--accent-strong); font-size: 15px; line-height: 1;
}
.tooltip-card {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 30;
  width: 250px; max-width: 78vw;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13.5px; line-height: 1.5;
  font-weight: 400; box-shadow: var(--shadow);
}

/* ---- Scenario & FAQ ---------------------------------------------- */
.scenario-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.scenario {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px 14px;
  text-decoration: none; color: var(--text);
}
.scenario:hover { border-color: var(--accent); }
.scenario__label { font-weight: 500; font-size: 14.5px; }
.scenario__value { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

.faq details {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); margin-bottom: 8px; padding: 0 14px;
}
.faq summary {
  cursor: pointer; font-weight: 600; padding: 14px 0; list-style: none;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--accent-strong); font-size: 20px; }
.faq details[open] summary::after { content: '\2212'; }
.faq details[open] summary { border-bottom: 1px solid var(--border); }
.faq details p { padding: 12px 0; margin: 0; }

dl.glossary dt { font-weight: 600; }
dl.glossary dd { margin: 4px 0 14px; color: var(--text-muted); }

/* ---- Related tools ----------------------------------------------- */
.related-grid {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.related-card {
  display: block; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px;
}
.related-card:hover { border-color: var(--accent); }
.related-card__title { font-weight: 600; }
.soon {
  display: inline-block;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  background: var(--surface-alt); color: var(--text-muted);
  padding: 2px 6px; border-radius: 4px; margin-left: 6px; letter-spacing: .03em;
  vertical-align: middle;
}
.related-card__desc { font-size: 13.5px; color: var(--text-muted); margin: 2px 0 0; }

/* ---- Ad slots (reserve space to avoid layout shift) -------------- */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  margin: 28px 0; background: var(--surface-alt);
  border: 1px dashed var(--border-strong); border-radius: var(--radius-sm);
  color: var(--text-muted); font-size: 12px;
}
.ad-slot-top, .ad-slot-mid, .ad-slot-bottom { min-height: 100px; }
/* Live AdSense banner — space reserved up front to avoid layout shift. */
.ad-leaderboard { min-height: 100px; margin: 0 0 18px; text-align: center; }
.ad-leaderboard ins { display: block; }

/* ---- Language switcher ------------------------------------------- */
.lang-switch { display: flex; gap: 2px; flex: none; }
.lang-switch a {
  font-size: 13px; font-weight: 600; text-decoration: none;
  color: var(--text-muted); padding: 6px 8px; border-radius: var(--radius-sm);
  text-transform: uppercase; letter-spacing: .03em;
}
.lang-switch a:hover { background: var(--surface-alt); color: var(--text); }
.lang-switch a[aria-current="true"] { color: var(--accent-strong); }

/* ---- Cookie consent banner (Law 25) ------------------------------ */
.hc-consent {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
  background: var(--surface); border-top: 2px solid var(--accent);
  box-shadow: 0 -4px 24px rgba(0,0,0,.18);
}
.hc-consent__inner {
  width: 100%; max-width: 880px; margin: 0 auto;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
}
.hc-consent__intro h2 { font-size: 18px; margin: 0 0 6px; }
.hc-consent__intro p  { font-size: 14px; margin: 0 0 14px; }
.hc-consent__panel { margin: 4px 0 14px; }
.hc-consent__cat {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 12px; margin-bottom: 8px;
}
.hc-consent__cat-head {
  display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px;
}
.hc-consent__cat-head input { width: auto; height: auto; }
.hc-consent__cat-head .always {
  margin-left: auto; font-size: 12px; font-weight: 600; color: var(--ok);
  text-transform: uppercase; letter-spacing: .03em;
}
.hc-consent__cat p { font-size: 13px; color: var(--text-muted); margin: 6px 0 0; }
.hc-consent__actions {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.hc-consent__btn {
  font: inherit; font-weight: 600; cursor: pointer; flex: 1 1 auto;
  min-height: 46px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--accent); background: var(--surface); color: var(--text);
}
.hc-consent__btn:hover { background: var(--accent-soft); }
/* Accept and Refuse get equal visual weight — Law 25 requires refusing
   to be as easy and prominent as accepting. */
.hc-consent__btn--solid {
  background: var(--accent); color: var(--on-accent); border-color: var(--accent);
}
.hc-consent__btn--solid:hover { background: var(--accent-strong); }
.hc-consent__btn--ghost {
  border-color: var(--border-strong); color: var(--text-muted); flex: 0 1 auto;
}
.hc-consent__btn--ghost:hover { background: var(--surface-alt); }
@media (min-width: 560px) {
  .hc-consent__btn { flex: 0 1 auto; }
}
@media print { .hc-consent { display: none !important; } }

/* ---- Homepage unit converter ------------------------------------- */
.uconv__title { font-size: 18px; margin-bottom: 14px; }
/* Sector switcher — a segmented control: a tray holding the 5 sectors,
   the active one a raised pill so it clearly reads as a control. */
.uconv__sectors {
  display: flex; flex-wrap: wrap; gap: 3px;
  margin-bottom: 16px; padding: 4px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.uconv__tab {
  flex: 1 1 auto; white-space: nowrap;
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer;
  background: transparent; border: none; color: var(--text-muted);
  padding: 9px 12px; border-radius: 7px;
  transition: background .14s ease, color .14s ease, box-shadow .14s ease;
}
.uconv__tab:hover { color: var(--text); }
.uconv__tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--accent-strong);
  box-shadow: 0 1px 3px rgba(0,0,0,.13);
}
.uconv__system { display: flex; gap: 6px; margin-bottom: 14px; }
.uconv__cats { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.uconv__input { display: flex; gap: 10px; margin-bottom: 16px; }
/* Selectors are specific enough to beat the base input[type=...] rule,
   so the value field and the unit dropdown are exactly the same height. */
.uconv__input .uconv__value {
  flex: 1; min-width: 0; max-width: none;
  height: 52px; font-size: 22px; font-weight: 600;
}
.uconv__input .uconv__from {
  flex: 0 0 auto; width: auto; min-width: 108px;
  height: 52px; font-size: 16px; font-weight: 600;
}
/* Results as a single vertical column — a clean conversion table. */
.uconv__list {
  list-style: none; margin: 0; padding: 0;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.uconv__row {
  width: 100%; display: flex; align-items: baseline;
  justify-content: space-between; gap: 14px;
  padding: 11px 14px; cursor: pointer;
  font: inherit; color: var(--text); background: none;
  border: none; border-top: 1px solid var(--border);
}
.uconv__list li:first-child .uconv__row { border-top: none; }
.uconv__row:hover { background: var(--accent-soft); }
.uconv__runit { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.uconv__rnum  {
  font-size: 19px; font-weight: 600;
  font-variant-numeric: tabular-nums; text-align: right;
}

/* ---- Site footer -------------------------------------------------- */
.site-footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 28px 0; margin-top: 40px;
}
.site-footer__brand { font-weight: 600; margin: 0 0 8px; }
.site-footer__nav { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 8px; }
.site-footer__nav a { color: var(--text-muted); text-decoration: none; font-size: 14px; }
.site-footer__nav a:hover { color: var(--accent-strong); }
.linklike {
  font: inherit; font-size: 14px; cursor: pointer;
  background: none; border: none; padding: 0;
  color: var(--text-muted); text-decoration: underline; text-underline-offset: 2px;
}
.linklike:hover { color: var(--accent-strong); }
.site-footer__legal { font-size: 13px; color: var(--text-muted); margin: 0; }

/* ---- Sticky mobile mini-bar -------------------------------------- */
.sticky-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  background: var(--surface); border-top: 1px solid var(--border-strong);
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; padding-bottom: calc(8px + env(safe-area-inset-bottom));
}
.sticky-bar__text { font-size: 14px; font-variant-numeric: tabular-nums; flex: 1; }
.sticky-bar__text strong { color: var(--accent-strong); }
.sticky-bar__close {
  border: none; background: none; cursor: pointer;
  font-size: 20px; color: var(--text-muted); width: 32px; height: 32px;
}

/* ---- Responsive -------------------------------------------------- */
/* Gutter grows with the viewport: 20px phones, 32px tablets, 50px desktop. */
@media (min-width: 600px) { :root { --gutter: 32px; } }
@media (min-width: 900px) { :root { --gutter: 50px; } }

@media (min-width: 640px) {
  .result__hero { font-size: 56px; }
  input[type="number"], input[type="text"], select { height: 44px; }
}

/* Phones: the category nav drops to its own row below the logo so the
   longer French labels never overflow the header. */
@media (max-width: 620px) {
  .site-nav {
    order: 5; flex-basis: 100%; margin-left: 0;
    overflow-x: auto; -webkit-overflow-scrolling: touch;
  }
  .lang-switch { margin-left: auto; }
}

/* ---- Print: tool, diagram and math only -------------------------- */
@media print {
  .site-header, .breadcrumb, .site-footer, .ad-slot,
  .faq, .related, .sticky-bar, .actions, .theme-toggle,
  .tooltip-trigger, .scenarios { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #999; }
  main { padding: 0; }
  a { color: #000; text-decoration: none; }
  .verify { background: #f0f0f0; }
}

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