:root {
  /* Navy and orange are sampled directly from the ShoeSizeIt logo/badge
     (navy #272c33 from the badge's outer ring, orange #f06d0d from the
     tape measure) rather than a generic UI blue, so the site's own colors
     match its brand mark. --brand (navy) drives buttons/links/focus --
     the structural, "ink" role. --accent (orange) is reserved for the
     logo's own spotlight color: the result box and the guide's numbered
     steps, not general UI chrome, so it keeps its impact. */
  --brand: #272c33;
  --brand-dark: #14171c;
  --accent: #f06d0d;
  --accent-soft: rgba(240,109,13,.12);
  --ink: #172033;
  --muted: #64748b;
  --surface: #ffffff;
  --page: #f6f8fc;
  --line: #e2e8f0;
  --radius: 1.25rem;
}

html { scroll-behavior: smooth; }
body { background: var(--page); color: var(--ink); }
/* Skip link: hidden until keyboard focus (Bootstrap's .visually-hidden-focusable
   handles the hiding). On focus it is pinned with position:fixed so revealing it
   does not shift the page layout. */
.skip-link:focus {
  position: fixed; top: .5rem; left: .5rem; z-index: 2000;
  padding: .6rem 1rem; background: var(--brand); color: #fff;
  border-radius: .5rem; text-decoration: none; font-weight: 600;
  box-shadow: 0 2px 12px rgba(0,0,0,.35);
}
/* The skip target takes programmatic focus via tabindex="-1" so keyboard focus
   actually moves past the nav. Without this rule the browser draws an outline
   around the entire <main>. */
#main-content:focus { outline: none; }
.site-nav { background: #0f172a; }
.navbar-brand img { flex: 0 0 auto; width: auto; height: 42px; max-width: none; object-fit: contain; }
.hero-section {
  background: radial-gradient(circle at 85% 20%, rgba(240,109,13,.16), transparent 32%), linear-gradient(135deg, #f8fafc 0%, #ffffff 58%, #f4f1ec 100%);
  overflow: hidden;
}
.eyebrow, .section-kicker { color: var(--brand); font-size: .78rem; letter-spacing: .12em; font-weight: 800; }
.hero-section h1 { color: #0f172a; letter-spacing: -.03em; }
.hero-section .lead { color: #475569; max-width: 680px; }
.hero-art { max-height: 330px; width: auto; object-fit: contain; }
.section-space { padding: 5rem 0; }
.section-muted { background: #eef1f5; }
.calculator-card { border-radius: var(--radius); overflow: hidden; }
.form-control, .form-select { border-color: #cbd5e1; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(39,44,51,.13); }
.btn-primary { background-color: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover, .btn-primary:focus, .btn-check:focus + .btn-primary { background-color: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-primary:focus, .btn-check:focus + .btn-primary { box-shadow: 0 0 0 .25rem rgba(39,44,51,.35); }
.btn-primary:active, .btn-primary.active, .btn-check:active + .btn-primary, .btn-check:checked + .btn-primary {
  background-color: var(--brand-dark) !important; border-color: var(--brand-dark) !important; color: #fff !important;
}
.btn-outline-primary { color: var(--brand); border-color: var(--brand); }
.btn-outline-primary:hover, .btn-outline-primary:active, .btn-outline-primary.active {
  background-color: var(--brand) !important; border-color: var(--brand) !important; color: #fff !important;
}
.btn-outline-primary:focus { box-shadow: 0 0 0 .25rem rgba(39,44,51,.3); }
.status-badge { background: #ecfdf5; color: #166534; border-radius: 999px; padding: .45rem .75rem; font-size: .82rem; font-weight: 700; }
.status-dot { display: inline-block; width: .5rem; height: .5rem; border-radius: 50%; background: #22c55e; margin-right: .4rem; }
.result-panel { background: #f8fafc; border: 1px solid var(--line); border-radius: 1rem; padding: 1rem; }
/* Orange background with navy text (not white) -- verified at 4.62:1 contrast,
   passing WCAG AA for normal text, not just the large hero number. Deliberately
   fixed rather than theme-dependent: this box is the site's one direct echo of
   the logo's own navy-frame/orange-focal-point relationship, so it stays
   constant whether the page is in light or dark mode, like the logo itself. */
.result-main { background: var(--accent); color: var(--brand); border-radius: .9rem; padding: 1.25rem; display: flex; flex-direction: column; justify-content: center; }
.result-main strong { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.05; margin: .25rem 0; }
.conversion-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; height: 100%; }
.conversion-grid > div { background: white; border: 1px solid var(--line); border-radius: .9rem; padding: 1rem; display: flex; flex-direction: column; justify-content: center; }
.conversion-grid span { color: var(--muted); font-size: .82rem; }
.conversion-grid strong { font-size: 1.35rem; margin-top: .15rem; }
/* .guide-art removed -- replaced by the icon step-grid below */
.about-copy { max-width: 760px; }
.site-footer { background: #0f172a; color: white; }

@media (max-width: 767.98px) {
  .section-space { padding: 3.5rem 0; }
  .hero-section { text-align: center; }
  .hero-section .lead { margin-left: auto; margin-right: auto; }
  .hero-art { max-height: 250px; }
  .conversion-grid { grid-template-columns: 1fr; }
}

.status-ready .status-dot { background: #16a34a; }
.status-badge:not(.status-ready) .status-dot { background: #dc2626; }

/* ---------- Theme toggle ---------- */
.theme-toggle { border-radius: 999px; font-weight: 600; }

/* ---------- History list ---------- */
.history-list { display: flex; flex-direction: column; gap: .5rem; margin: 0; }
.history-item {
  width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line);
  border-radius: .75rem; padding: .6rem .9rem; display: flex; justify-content: space-between;
  align-items: center; gap: .75rem; flex-wrap: wrap; color: var(--ink); transition: border-color .15s ease;
}
.history-item:hover, .history-item:focus-visible { border-color: var(--brand); }
.history-item .history-meta { font-size: .78rem; color: var(--muted); white-space: nowrap; }

/* ---------- Print ---------- */
.print-only { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  .no-print, .site-nav, .hero-section, #guide, #about, .site-footer, #historyPanel { display: none !important; }
  .print-only { display: block !important; }
  body { background: #ffffff !important; color: #000000 !important; }
  .section-space { padding: 0 !important; }
  .calculator-card { box-shadow: none !important; border: none !important; }
  .result-panel { border: none !important; background: #ffffff !important; padding: 0 !important; }
  .conversion-grid > div { border: 1px solid #ccc !important; background: #ffffff !important; }
  html { font-size: 60%; }
  .result-main strong { font-size: 1.75rem !important; }
  .table-responsive { overflow: visible !important; }
  #measurementResult, #measurementResult *, .print-only, .print-only * {
    color: #000000 !important;
  }
  #measurementResult .result-main {
    background: #ffffff !important; border: 2px solid #000000 !important;
  }
}

/* ---------- Dark mode ---------- */
[data-theme="dark"] {
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --surface: #1e293b;
  --page: #0b1220;
  --line: #334155;
  /* A light slate rather than a lightened navy: navy itself is too close in
     value to the dark-mode page background to read as an interactive color,
     so this stays in the same neutral family while being clearly visible
     (7.3:1 against the dark background). --accent (orange) is unchanged --
     it doesn't need a dark-mode variant, since a warm, saturated color
     already reads clearly against a dark page. */
  --brand: #94a3b8;
  --brand-dark: #cbd5e1;
}
[data-theme="dark"] body { background: var(--page); color: var(--ink); }
[data-theme="dark"] .hero-section {
  background: radial-gradient(circle at 85% 20%, rgba(240,109,13,.14), transparent 32%), linear-gradient(135deg, #0b1220 0%, #111827 58%, #0b1220 100%);
}
[data-theme="dark"] .hero-section h1 { color: #f1f5f9; }
[data-theme="dark"] .hero-section .lead { color: #cbd5e1; }
[data-theme="dark"] .section-muted { background: #0f172a; }
[data-theme="dark"] .card, [data-theme="dark"] .calculator-card { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .form-label { color: var(--ink); }
[data-theme="dark"] .form-control, [data-theme="dark"] .form-select {
  background-color: #0f172a; border-color: var(--line); color: var(--ink);
}
[data-theme="dark"] .form-control::placeholder { color: #64748b; }
[data-theme="dark"] .form-control:focus, [data-theme="dark"] .form-select:focus {
  background-color: #0f172a; color: var(--ink); border-color: var(--brand); box-shadow: 0 0 0 .25rem rgba(148,163,184,.2);
}
[data-theme="dark"] .bg-body-tertiary { background: #0f172a !important; }
[data-theme="dark"] .result-panel { background: #0f172a; border-color: var(--line); }
[data-theme="dark"] .conversion-grid > div { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .conversion-grid span { color: var(--muted); }
[data-theme="dark"] .table { color: var(--ink); }
[data-theme="dark"] .table > :not(caption) > * > * { background: transparent; color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .alert-info { background: #0c3a5c; color: #dbeafe; border-color: #155e8a; }
[data-theme="dark"] .alert-danger { background: #5c1a1a; color: #fee2e2; border-color: #7f2626; }
[data-theme="dark"] .btn-outline-secondary { color: #cbd5e1; border-color: #475569; }
[data-theme="dark"] .btn-outline-secondary:hover { background: #334155; color: #f8fafc; border-color: #475569; }
[data-theme="dark"] .btn-outline-primary { color: var(--brand-dark); border-color: var(--brand-dark); }
[data-theme="dark"] .btn-outline-primary:hover { background: var(--brand-dark); color: #0b1220; }
[data-theme="dark"] .about-copy { color: #cbd5e1; }

/* ---------- Measurement guide: numbered step cards ---------- */
.guide-intro { max-width: 640px; }
.guide-steps { margin-top: 2.25rem; }
.guide-step {
  height: 100%; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.75rem 1.5rem;
  transition: border-color .15s ease, transform .15s ease;
}
.guide-step:hover { border-color: var(--accent); transform: translateY(-2px); }
/* Illustration panel. Replaces a 26px glyph in a 56px circle: at that size the
   old icons read as indistinguishable blobs, which is no use in a section whose
   whole job is to explain a method. A wide panel gives the diagrams room to be
   legible, and the two-tone scheme (.ink = passive reference, currentColor =
   the thing this step is about) is consistent across all six. */
.guide-step-figure {
  position: relative; width: 100%; height: 96px; margin-bottom: 1.15rem;
  border-radius: .9rem; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.guide-step-figure svg { width: 148px; height: 94px; overflow: visible; }
.guide-step-figure .ink { stroke: var(--muted); opacity: .85; }
.guide-step-figure .ink-fill { fill: var(--muted); stroke: none; opacity: .85; }
.guide-step-figure .acc-fill { fill: var(--accent); stroke: none; }
.guide-step-num {
  position: absolute; top: -8px; right: -8px; width: 26px; height: 26px;
  border-radius: 999px; background: var(--accent); color: #fff;
  font-size: .78rem; font-weight: 800; display: flex; align-items: center;
  justify-content: center; box-shadow: 0 0 0 3px var(--surface);
}
.guide-step-title { font-size: 1.02rem; font-weight: 700; color: var(--ink); margin-bottom: .45rem; }
.guide-step p { color: var(--muted); font-size: .92rem; margin-bottom: 0; }

.guide-bonus {
  display: flex; align-items: flex-start; gap: 1rem; background: rgba(39,44,51,.06);
  border: 1px solid rgba(39,44,51,.16); border-radius: var(--radius); padding: 1.25rem 1.5rem;
}
.guide-bonus-icon {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 999px; background: var(--brand);
  color: #fff; display: flex; align-items: center; justify-content: center;
}
.guide-bonus-icon svg { width: 20px; height: 20px; }
.guide-bonus-label { color: var(--brand); font-weight: 800; text-transform: uppercase; font-size: .78rem; letter-spacing: .06em; }
.guide-bonus p { color: var(--ink); }

[data-theme="dark"] .guide-step-figure { background: rgba(240,109,13,.14); }
[data-theme="dark"] .guide-step-figure .ink { stroke: #94a3b8; opacity: .9; }
[data-theme="dark"] .guide-step-figure .ink-fill { fill: #94a3b8; opacity: .9; }
[data-theme="dark"] .guide-bonus { background: rgba(148,163,184,.1); border-color: rgba(148,163,184,.25); }
[data-theme="dark"] .guide-bonus-label { color: var(--brand-dark); }
[data-theme="dark"] .guide-bonus p { color: var(--ink); }
[data-theme="dark"] .text-secondary { color: #94a3b8 !important; }
[data-theme="dark"] .border-top { border-color: var(--line) !important; }
[data-theme="dark"] .status-badge { background: #052e1c; color: #86efac; }
[data-theme="dark"] .status-badge:not(.status-ready) { background: #4c1414; color: #fca5a5; }
[data-theme="dark"] .theme-toggle { border-color: #475569; }

body, .card, .form-control, .form-select, .result-panel, .conversion-grid > div, .history-item {
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

/* ---------- Footer links ---------- */
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: #ffffff !important; text-decoration: underline; }

/* ---------- Cookie / storage notice ---------- */
.cookie-notice { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500; background: #0f172a; color: #f1f5f9; box-shadow: 0 -4px 20px rgba(0,0,0,.15); }
.cookie-notice a { color: #fbb454; }

/* ---------- Brand converter table ---------- */
#compareResults .table td:first-child { font-weight: 600; }

/* ---------- FAQ accordion ---------- */
.accordion-button:not(.collapsed) { color: var(--brand); background-color: rgba(39,44,51,.05); }
.accordion-button:focus { box-shadow: 0 0 0 .2rem rgba(39,44,51,.15); }
[data-theme="dark"] .accordion-item { background: var(--surface); border-color: var(--line); }
[data-theme="dark"] .accordion-button { background: var(--surface); color: var(--ink); }
[data-theme="dark"] .accordion-button:not(.collapsed) { color: var(--brand-dark); background-color: rgba(148,163,184,.1); }
[data-theme="dark"] .accordion-button::after { filter: invert(1) grayscale(1) brightness(1.6); }
[data-theme="dark"] .accordion-body { color: var(--muted); }
[data-theme="dark"] .cookie-notice { background: #060a14; }

/* ---------- Growth chart ---------- */
#growthChartWrap canvas { max-height: 220px; }

@media print {
  #compare, #faq, .cookie-notice { display: none !important; }
}

/* ---------- Compare-all: make the user's own brand findable in a 36-row table ---------- */
.compare-selected > td { background: var(--accent-soft) !important; font-weight: 600; }
.badge-selected {
  display: inline-block; margin-left: .4rem; padding: .1rem .45rem; border-radius: 999px;
  background: var(--accent); color: #fff; font-size: .68rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; vertical-align: middle;
}
[data-theme="dark"] .compare-selected > td { background: rgba(240,109,13,.18) !important; }

/* ---------- Brand-page footer links: a readable grid, not a run-on paragraph ---------- */
.brand-links { column-count: 3; column-gap: 1.5rem; }
.brand-links a { display: block; padding: .18rem 0; }
@media (max-width: 767.98px) { .brand-links { column-count: 2; } }
@media (max-width: 400px)    { .brand-links { column-count: 1; } }

/* Inline variant used in the ordered list on the how-to landing page. */
.guide-step-figure-inline { width: 190px; height: 82px; margin: 0 0 .6rem; }
.guide-step-figure-inline svg { width: 130px; height: 80px; }

/* A <tr> with the hidden attribute must actually hide -- some table CSS sets an
   explicit display on rows, which would beat the UA stylesheet default. */
tr[hidden] { display: none !important; }
