:root {
  --bg: #f7f3ef;
  --surface: #ffffff;
  --text: #2b2420;
  --muted: #6f655e;
  --line: #e7ded6;
  --accent: #97492f;
  --accent-ink: #ffffff;
  --accent-soft: #f6e6df;
  --warn-bg: #fff4d6;
  --warn-ink: #7a5600;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(43, 36, 32, .06), 0 4px 16px rgba(43, 36, 32, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1b1715;
    --surface: #26201d;
    --text: #f1e9e3;
    --muted: #b3a79e;
    --line: #3a322d;
    --accent: #e08a6c;
    --accent-ink: #1b1715;
    --accent-soft: #3a2a24;
    --warn-bg: #3b3018;
    --warn-ink: #f2d28a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: clamp(1.5rem, 4.5vw, 2.2rem); line-height: 1.2; margin: .2em 0 .4em; }
h2 { font-size: 1.1rem; margin: 1.4em 0 .6em; }
h1 + .muted, .card > h2:first-child { margin-top: 0; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }

/* Layout */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.logo span { color: var(--accent); }
#nav { display: flex; align-items: center; gap: 14px; font-size: .95rem; }
#nav a { text-decoration: none; }
.hello { color: var(--muted); }
@media (max-width: 420px) { .hello { display: none; } }

main { max-width: 960px; margin: 0 auto; padding: 20px 16px 40px; min-height: 70vh; } /* reserves space so the footer does not jump while the first view renders */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
}
.narrow { max-width: 420px; margin: 4vh auto 0; }
main > .card { max-width: 680px; margin-left: auto; margin-right: auto; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--accent); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: .9rem; }
.btn.full { width: 100%; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }

/* Hero */
.hero { text-align: center; padding: 6vh 0 2vh; }
.hero h1 { max-width: 16em; margin: 0 auto .5em; }
.hero h1 em { color: var(--accent); font-style: normal; }
.hero > p { max-width: 34em; margin: 0 auto; color: var(--muted); }
.cta-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin: 24px 0 36px; }
.how {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px;
  list-style: none; padding: 0; text-align: left; counter-reset: how;
}
.how li {
  counter-increment: how; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 16px 16px 52px; position: relative; color: var(--muted);
}
.how li::before {
  content: counter(how); position: absolute; left: 16px; top: 16px;
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; font-weight: 700; font-size: .85rem;
}
.how b { color: var(--text); display: block; }

/* Forms */
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 14px; }
input {
  display: block; width: 100%; margin-top: 6px; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px; /* prevents iOS zoom */
}
input:focus-visible, .choice:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.error { color: #c0392b; min-height: 1.2em; font-size: .9rem; margin: 0 0 10px; }
.self-desc { margin-top: 10px; }

/* Quiz */
.progress { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.step { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 12px 0 0; }
.choices { display: grid; gap: 10px; }
.choices.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.choice {
  position: relative; text-align: left; min-height: 48px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text);
  font: inherit; cursor: pointer; display: flex; flex-direction: column; justify-content: center;
}
.choice:hover { border-color: var(--accent); }
.choice.on { border-color: var(--accent); background: var(--accent-soft); }
.choice .label { font-weight: 600; }
.choice .hint { color: var(--muted); font-size: .85rem; }
.choice .rank {
  position: absolute; top: -8px; right: -8px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink); font-size: .75rem; font-weight: 700;
  display: grid; place-items: center;
}
.quiz-nav { display: flex; justify-content: space-between; margin-top: 24px; gap: 12px; }

/* Results */
.results-head { margin-bottom: 8px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.stats div { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stats span { display: block; font-size: .8rem; color: var(--muted); }
.stats b { font-size: 1.1rem; }
@media (max-width: 480px) { .stats b { font-size: .95rem; } }
.warn { background: var(--warn-bg); color: var(--warn-ink); padding: 12px 14px; border-radius: 10px; }
.schedule { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 16px 0; }
.schedule ol { margin: 0; padding-left: 1.2em; }
.schedule li { margin-bottom: 4px; }
.section-title { margin-top: 28px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.product {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: flex; flex-direction: column; box-shadow: var(--shadow);
}
.product.alt { box-shadow: none; }
.product-head { display: flex; justify-content: space-between; align-items: center; font-size: .8rem; }
.tag { background: var(--accent-soft); color: var(--accent); padding: 2px 8px; border-radius: 99px; font-weight: 600; }
.when { color: var(--muted); }
.product h3 { font-size: 1rem; margin: 10px 0 6px; }
.product h3 span { font-weight: 400; display: block; }
.why { color: var(--muted); font-size: .9rem; margin: 0 0 12px; flex: 1; }
.product-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.price { font-weight: 700; }
.soon { font-size: .85rem; color: var(--muted); }
.alts { margin: 16px 0; }
.alts summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 8px 0; }
.notes { margin-top: 20px; }
.notes ul { margin: 0; padding-left: 1.2em; }
.notes li { margin-bottom: 6px; }

/* Multi-area results */
.area { scroll-margin-top: 70px; }
.area .schedule { margin-top: 0; }
.schedule h3 { font-size: 1rem; margin: 0 0 .6em; }
.howto { margin: 0; padding-left: 1.2em; }
.howto li { margin-bottom: 4px; }
.area > .card { margin-bottom: 12px; }
.area-tabs { display: flex; gap: 8px; overflow-x: auto; margin: 0 0 14px; padding-bottom: 4px; }
.area-tabs a {
  flex: none; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); text-decoration: none; font-size: .9rem;
}
.quiz-body h2 .small { font-weight: 400; }
.product.shared { box-shadow: none; border-style: dashed; }

/* Tier and natural badges */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.chip {
  display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: .75rem; font-weight: 600;
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
}
.chip.value, .chip.balanced { color: #2f6b3f; border-color: #bcd9c4; background: #eaf5ed; }
.chip.premium { color: #3b4f8a; border-color: #c3cdee; background: #eef1fb; }
.chip.luxury { color: #7a5a12; border-color: #e3d09a; background: #fbf3d9; }
.chip.natural { color: #3d6b2b; border-color: #c9dfb8; background: #f1f8e9; }
.chip.fallback { color: var(--muted); border-style: dashed; }
@media (prefers-color-scheme: dark) {
  .chip.value, .chip.balanced { color: #9ed2ab; border-color: #2f4d37; background: #1f2d24; }
  .chip.premium { color: #aebcf0; border-color: #36406b; background: #232842; }
  .chip.luxury { color: #e8cd7d; border-color: #5c4a1c; background: #3a2f14; }
  .chip.natural { color: #b3d89a; border-color: #3b5129; background: #26301f; }
}
.results-head .chips { margin: 0 0 4px; }
.product .chips { margin: 8px 0 0; }

/* Skip link: hidden until focused by keyboard. */
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: 10px; font-weight: 600; text-decoration: none; }
.skip-link:focus { left: 12px; }

/* Footer on every page: legal links, Cookie settings, affiliate and medical notices. */
.site-footer { max-width: 960px; margin: 32px auto 0; padding: 20px 16px 28px; border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; }
.site-footer p { margin: 0 0 8px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 12px; }
.footer-links a { color: var(--accent); }
.draft-tag { font-weight: 600; color: var(--text); }

/* Legal pages: readable column, draft banner, simple header. */
.legal-head { max-width: 820px; margin: 0 auto; padding: 16px 16px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: .92rem; }
.legal-head .brand-link { font-weight: 700; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.legal-page main.legal-main { max-width: 820px; margin: 0 auto; padding: 16px 16px 24px; }
.legal-article { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.legal-article h1 { font-size: 1.8rem; margin-top: 4px; }
.legal-article h2 { font-size: 1.15rem; margin-top: 26px; }
.legal-article p, .legal-article li { line-height: 1.65; }
.legal-article table { font-size: .9rem; }
.legal-article blockquote { margin: 12px 0; padding: 8px 14px; border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: 0 8px 8px 0; }
.legal-article blockquote p { margin: 0; }
.draft-banner { margin: 8px 0 16px; background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px 12px; font-size: .88rem; }
.table-wrap { overflow-x: auto; }

/* Sign-up consent: unticked by default, large tap targets, visible focus. */
.consent { margin: 4px 0 14px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); }
.consent legend { font-weight: 600; padding: 0 4px; font-size: .92rem; }
.check { display: flex !important; gap: 10px; align-items: flex-start; padding: 6px 0; font-weight: 400 !important; font-size: .9rem; cursor: pointer; margin-bottom: 4px !important; }
.check input[type=checkbox] { width: 20px; min-width: 20px; height: 20px; min-height: 20px; padding: 0; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--accent); }
.check.optional { color: var(--muted); }
.check input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Honeypot: present for bots, invisible to people and assistive technology. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

button:disabled { opacity: .55; cursor: not-allowed; }

/* Affiliate disclosure: visible, not hidden in the footer. */
.affiliate-notice { margin: 12px 0; background: var(--warn-bg); color: var(--warn-ink); border-radius: 10px; padding: 10px 12px; font-size: .9rem; line-height: 1.5; }
.aff-label { font-size: .75rem; color: var(--warn-ink); background: var(--warn-bg); border-radius: 999px; padding: 2px 8px; margin-right: 8px; font-weight: 600; }
.btn.danger { background: #9b1c1c; color: #ffffff; }
.btn.danger:disabled { background: #9b1c1c; }

/* Visible keyboard focus on every interactive element. */
a:focus-visible, button:focus-visible, summary:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

/* Reduced motion: no transitions or animations for people who ask for less motion. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* My data tabs: two equal tabs, 48px tap targets, visible focus from the global rule. */
.tablist { display: flex; gap: 8px; border-bottom: 1px solid var(--line); margin: 14px 0 18px; }
.tablist [role="tab"] {
  min-height: 48px; padding: 0 16px; background: transparent; color: var(--muted);
  border: 1px solid transparent; border-bottom: 0; border-radius: 10px 10px 0 0; font: inherit; font-weight: 600; cursor: pointer;
}
.tablist [role="tab"][aria-selected="true"] { color: var(--accent); border-color: var(--line); background: var(--surface); }
[role="tabpanel"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
