/* Cẩm nang sức khỏe — style.css v2.1.0 */

/* ===== Tokens ===== */
:root {
  --bg: #f7f4ec;
  --bg-soft: #efeadd;
  --surface: #ffffff;
  --surface-2: #f3f7f4;
  --ink: #1f2a25;
  --ink-soft: #4a5751;
  --ink-faint: #6b7670;
  --line: #e1ddd0;
  --brand: #2f6b55;
  --brand-strong: #1d4a3a;
  --brand-tint: #dcebe2;
  --accent: #b5562f;
  --accent-tint: #f6e3d6;
  --warn-bg: #fff4d6;
  --warn-line: #ecd08a;
  --warn-ink: #6a4b00;
  --ok: #2f6b55;
  --ok-bg: #e2f0e8;
  --mid: #8a5a00;
  --mid-bg: #fbefd2;
  --bad: #a3392a;
  --bad-bg: #f8e1dc;
  --focus: #1f6fd1;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(31, 42, 37, .05), 0 6px 18px rgba(31, 42, 37, .06);
  --header-h: 64px;
  --font-body: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Lora', Georgia, 'Times New Roman', serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101513;
    --bg-soft: #141b18;
    --surface: #18201c;
    --surface-2: #1c2622;
    --ink: #e8ece9;
    --ink-soft: #b8c2bc;
    --ink-faint: #93a09a;
    --line: #2a3530;
    --brand: #7cc4a4;
    --brand-strong: #a6dcc3;
    --brand-tint: #1f3a2f;
    --accent: #e89a72;
    --accent-tint: #3a2419;
    --warn-bg: #2b2412;
    --warn-line: #5a4a1c;
    --warn-ink: #f0d79a;
    --ok: #8fd3b3;
    --ok-bg: #19362a;
    --mid: #f0c674;
    --mid-bg: #3a2e14;
    --bad: #f29a8a;
    --bad-bg: #3d1f1a;
    --focus: #7fb4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #101513;
  --bg-soft: #141b18;
  --surface: #18201c;
  --surface-2: #1c2622;
  --ink: #e8ece9;
  --ink-soft: #b8c2bc;
  --ink-faint: #93a09a;
  --line: #2a3530;
  --brand: #7cc4a4;
  --brand-strong: #a6dcc3;
  --brand-tint: #1f3a2f;
  --accent: #e89a72;
  --accent-tint: #3a2419;
  --warn-bg: #2b2412;
  --warn-line: #5a4a1c;
  --warn-ink: #f0d79a;
  --ok: #8fd3b3;
  --ok-bg: #19362a;
  --mid: #f0c674;
  --mid-bg: #3a2e14;
  --bad: #f29a8a;
  --bad-bg: #3d1f1a;
  --focus: #7fb4ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 1rem;
  overflow-x: hidden;
  transition: opacity .2s ease;
}

.i18n-pending body { opacity: 0; }

img, svg { max-width: 100%; display: block; }

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--brand-strong); }

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

h1, h2, h3 { font-family: var(--font-display); line-height: 1.25; color: var(--ink); }
h4 { line-height: 1.35; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 200;
  background: var(--brand-strong);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
}
.skip-link:focus { top: 12px; color: #fff; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .25s ease;
}
.header.scrolled { box-shadow: 0 6px 18px rgba(0, 0, 0, .07); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--header-h);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.brand:hover { color: var(--ink); }

.brand-mark { width: 36px; height: 36px; flex: none; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.12rem;
  white-space: nowrap;
}

.nav { display: flex; gap: 4px; }

.nav-link {
  font-size: .93rem;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 999px;
  transition: background-color .2s ease, color .2s ease;
}
.nav-link:hover { color: var(--brand-strong); background: var(--brand-tint); }
.nav-link.active { color: var(--brand-strong); background: var(--brand-tint); font-weight: 600; }

.header-actions { display: flex; align-items: center; gap: 8px; flex: none; }

.lang-switcher {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  background: var(--surface);
}

.lang-btn {
  min-width: 40px;
  min-height: 34px;
  padding: 4px 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font: 600 .82rem/1 var(--font-body);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.lang-btn[aria-pressed="true"] { background: var(--brand); color: var(--bg); }

.icon-btn {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }

.theme-btn .i-sun { display: none; }
:root[data-theme="dark"] .theme-btn .i-sun { display: block; }
:root[data-theme="dark"] .theme-btn .i-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-btn .i-sun { display: block; }
  :root:not([data-theme="light"]) .theme-btn .i-moon { display: none; }
}

.menu-toggle { display: none; }
.menu-toggle .bar {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.menu-toggle .bars { display: grid; gap: 4px; }
.menu-toggle[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
.menu-toggle[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ===== Hero ===== */
.hero {
  padding: 56px 0 48px;
  background:
    radial-gradient(900px 400px at 85% 0%, var(--brand-tint), transparent 60%),
    var(--bg);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 40px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  background: currentColor;
  border-radius: 2px;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -.01em;
  margin-bottom: 16px;
}
.hero-title em { font-style: italic; color: var(--brand); }

.hero-desc {
  font-size: 1.08rem;
  color: var(--ink-soft);
  max-width: 560px;
  margin-bottom: 24px;
}

.hero-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 28px; }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  list-style: none;
}
.facts li {
  font-size: .85rem;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.facts strong { color: var(--ink); font-weight: 600; }

.hero-art {
  border-radius: 28px;
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 6 / 5;
  background: #f3efe3;
}
.hero-art { position: relative; isolation: isolate; }
.hero-art .layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}
.hero-art .layer-bg { position: relative; }

:root[data-theme="dark"] .art { filter: brightness(.88) saturate(.9); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .art { filter: brightness(.88) saturate(.9); }
}
/* dim the layered hero in dark mode with a composited overlay (no filter on animated layers) */
.hero-art::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  background: #000;
  opacity: 0;
}
:root[data-theme="dark"] .hero-art::after { opacity: .12; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .hero-art::after { opacity: .12; }
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 10px 22px;
  border-radius: 999px;
  font: 600 .95rem/1.2 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: background-color .2s ease, color .2s ease, border-color .2s ease;
}
.btn-primary { background: var(--brand-strong); color: var(--bg); }
.btn-primary:hover { background: var(--brand); color: var(--bg); }
.btn-outline { border-color: var(--brand); color: var(--brand-strong); background: transparent; }
.btn-outline:hover { background: var(--brand-tint); color: var(--brand-strong); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-strong); }
.btn svg { width: 18px; height: 18px; }

/* ===== Notices ===== */
.disclaimer {
  background: var(--warn-bg);
  border-top: 1px solid var(--warn-line);
  border-bottom: 1px solid var(--warn-line);
  padding: 14px 0;
}
.disclaimer .container { display: flex; gap: 12px; align-items: flex-start; }
.disclaimer svg { width: 22px; height: 22px; flex: none; color: var(--warn-ink); margin-top: 2px; }
.disclaimer p { font-size: .92rem; color: var(--warn-ink); }

.note-box {
  display: flex;
  gap: 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  color: var(--warn-ink);
  font-size: .92rem;
}
.note-box svg { width: 20px; height: 20px; flex: none; margin-top: 2px; }

/* ===== Sections ===== */
.section { padding: 72px 0; scroll-margin-top: var(--header-h); }
.section-alt { background: var(--bg-soft); }

.section-head { max-width: 720px; margin: 0 auto 36px; text-align: center; }
.section-head .eyebrow { justify-content: center; }
.section-title { font-size: clamp(1.6rem, 3.6vw, 2.25rem); margin-bottom: 12px; }
.section-intro { color: var(--ink-soft); }

.split-head {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 32px;
  align-items: center;
  margin-bottom: 36px;
}
.split-head .section-head { text-align: left; margin: 0; }
.split-head .eyebrow { justify-content: flex-start; }
.split-head img { width: 240px; height: auto; border-radius: 24px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ===== Timeline ===== */
.timeline {
  list-style: none;
  padding: 0;
  max-width: 820px;
  margin: 0 auto;
  position: relative;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 23px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--line);
}

.tl-item {
  position: relative;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 16px;
  padding-bottom: 20px;
}
.tl-dot {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 2px solid var(--brand);
  color: var(--brand);
}
.tl-dot svg { width: 22px; height: 22px; }
.tl-item.is-key .tl-dot { background: var(--brand); color: var(--bg); }

.tl-body { padding: 16px 18px; }
.tl-year {
  display: inline-block;
  font-weight: 700;
  font-size: .82rem;
  color: var(--accent);
  letter-spacing: .04em;
  margin-bottom: 2px;
}
.tl-body h3 { font-size: 1.1rem; margin-bottom: 6px; }
.tl-body p { color: var(--ink-soft); font-size: .95rem; }
.tl-src { display: block; margin-top: 8px; font-size: .8rem; color: var(--ink-faint); }

/* ===== Compare (views vs evidence) ===== */
.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 16px;
  list-style: none;
  padding: 0;
  margin: -12px 0 28px;
  font-size: .85rem;
  color: var(--ink-soft);
}
.legend li { display: inline-flex; align-items: center; gap: 6px; }

.compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.compare { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.compare-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}
.compare-top h3 { font-size: 1.12rem; }
.compare-icon {
  width: 44px; height: 44px; flex: none;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--brand-tint);
  color: var(--brand-strong);
}
.compare-icon svg { width: 24px; height: 24px; }
.compare-title { display: flex; align-items: center; gap: 12px; }

.compare-body { display: grid; gap: 12px; padding: 16px 20px 20px; flex: 1; align-content: start; }
.pane { border-radius: var(--radius-sm); padding: 12px 14px; }
.pane-label {
  display: block;
  font-size: .74rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.pane p { font-size: .93rem; }
.pane-view { background: var(--accent-tint); }
.pane-view .pane-label { color: var(--accent); }
.pane-view p { color: var(--ink); }
.pane-evidence { background: var(--surface-2); border: 1px solid var(--line); }
.pane-evidence .pane-label { color: var(--brand); }
.pane-evidence p { color: var(--ink-soft); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-mid { background: var(--mid-bg); color: var(--mid); }
.badge-bad { background: var(--bad-bg); color: var(--bad); }

.compare-top .badge { flex: none; }

/* ===== Caution ===== */
.caution-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.caution { padding: 20px; }
.caution .num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 10px;
}
.caution h3 { font-size: 1.02rem; margin-bottom: 6px; }
.caution p { font-size: .9rem; color: var(--ink-soft); }

/* ===== Habits ===== */
.habit-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.habit { padding: 20px; }
.habit-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 14px;
  background: var(--brand-tint);
  color: var(--brand-strong);
  margin-bottom: 12px;
}
.habit-icon svg { width: 24px; height: 24px; }
.habit h3 { font-size: 1.05rem; margin-bottom: 6px; }
.habit p { font-size: .92rem; color: var(--ink-soft); }
.habit .src { display: block; margin-top: 10px; font-size: .8rem; color: var(--ink-faint); }

.duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.panel { padding: 22px; }
.panel h3 { font-size: 1.1rem; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; }
.panel h3 svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.panel ul, .panel ol { padding-left: 1.2em; display: grid; gap: 6px; color: var(--ink-soft); font-size: .93rem; }
.panel .emergency {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bad-bg);
  color: var(--bad);
  font-weight: 600;
  font-size: .9rem;
}

/* ===== Checker ===== */
.checker {
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 20px;
  align-items: start;
}
.check-list { padding: 8px; list-style: none; margin: 0; }
.check-item label {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-size: .95rem;
  transition: background-color .15s ease;
}
.check-item label:hover { background: var(--surface-2); }
.check-item input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  border: 2px solid var(--ink-faint);
  border-radius: 7px;
  background: var(--surface);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.check-item input::after {
  content: "";
  width: 11px;
  height: 6px;
  border-left: 2.5px solid var(--bg);
  border-bottom: 2.5px solid var(--bg);
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}
.check-item input:checked { background: var(--accent); border-color: var(--accent); }
.check-item input:checked::after { opacity: 1; }
.check-item input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.result { padding: 22px; position: sticky; top: calc(var(--header-h) + 16px); }
.result-meter {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 10px;
}
.result-count { font-family: var(--font-display); font-size: 2.6rem; font-weight: 700; line-height: 1; }
.result-total { color: var(--ink-faint); font-weight: 600; }
.meter {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-bottom: 16px;
}
.meter span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: inherit;
  background: var(--ok);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform .3s ease, background-color .3s ease;
}
.result[data-level="1"] .meter span { background: var(--mid); }
.result[data-level="2"] .meter span { background: var(--bad); }
.result[data-level="1"] .result-count { color: var(--mid); }
.result[data-level="2"] .result-count { color: var(--bad); }
.result[data-level="0"] .result-count { color: var(--ok); }

.result-msg h3 { font-size: 1.1rem; margin-bottom: 6px; }
.result-msg p { color: var(--ink-soft); font-size: .93rem; }
.result-msg[hidden] { display: none; }
.result .btn { margin-top: 16px; width: 100%; }
.result-hint { margin-top: 12px; font-size: .8rem; color: var(--ink-faint); }

/* ===== Library ===== */
.lib-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.lib { padding: 22px; }
.lib h3 { font-size: 1.12rem; margin-bottom: 14px; }
.works { list-style: none; padding: 0; display: grid; gap: 12px; }
.works li { padding-bottom: 12px; border-bottom: 1px dashed var(--line); }
.works li:last-child { border-bottom: 0; padding-bottom: 0; }
.works h4 { font-size: .98rem; font-style: italic; font-family: var(--font-display); }
.works .meta { font-size: .78rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.works p { font-size: .9rem; color: var(--ink-soft); }

.sources { list-style: none; padding: 0; display: grid; gap: 4px; }
.sources a {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 8px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--ink);
}
.sources a:hover { background: var(--surface-2); color: var(--ink); }
.sources svg { width: 18px; height: 18px; flex: none; margin-top: 3px; color: var(--brand); }
.sources strong { display: block; font-size: .93rem; font-weight: 600; }
.sources small { display: block; font-size: .82rem; color: var(--ink-faint); }

.official {
  margin-top: 20px;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--line);
  font-size: .9rem;
  color: var(--ink-soft);
}

/* ===== FAQ ===== */
.faq-list { max-width: 780px; margin: 0 auto; display: grid; gap: 10px; }
.faq-item { overflow: hidden; }
.faq-q { margin: 0; font-family: var(--font-body); font-size: 1rem; }
.faq-question {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 56px;
  padding: 14px 18px;
  background: none;
  border: 0;
  font: 600 1rem/1.4 var(--font-body);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.faq-icon {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--brand-tint);
  color: var(--brand-strong);
  transition: transform .25s ease;
}
.faq-icon svg { width: 14px; height: 14px; }
.faq-question[aria-expanded="true"] .faq-icon { transform: rotate(45deg); }

.faq-answer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .28s ease;
}
.faq-answer > div {
  overflow: hidden;
  visibility: hidden;
  transition: visibility 0s linear .28s;
}
.faq-item.open .faq-answer { grid-template-rows: 1fr; }
.faq-item.open .faq-answer > div { visibility: visible; transition-delay: 0s; }
.faq-answer p { padding: 0 18px 18px; color: var(--ink-soft); font-size: .95rem; }

@media (prefers-reduced-motion: reduce) {
  .faq-answer, .faq-answer > div, .faq-icon, .meter span, body { transition: none; }
}

/* ===== Footer ===== */
.footer {
  background: #16241e;
  color: #c9d8d0;
  padding: 44px 0 28px;
}
.footer a { color: #e6efe9; }
.footer a:hover { color: #fff; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 28px;
  margin-bottom: 24px;
}
.footer .brand { color: #fff; margin-bottom: 12px; }
.footer .brand:hover { color: #fff; }
.footer p { font-size: .9rem; }
.footer-links { list-style: none; padding: 0; display: grid; gap: 8px; font-size: .92rem; }
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding-top: 18px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: .82rem;
  color: #9fb3a8;
}

/* ===== Back to top ===== */
.to-top {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 90;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top svg { width: 20px; height: 20px; }

/* ===== Article pages (terms, 404) ===== */
.page-hero { padding: 48px 0 24px; }
.page-hero .hero-title { font-size: clamp(1.8rem, 4.5vw, 2.6rem); }
.prose { max-width: 760px; margin: 0 auto; padding: 0 0 64px; }
.prose section { padding: 22px 24px; margin-bottom: 14px; }
.prose h2 { font-size: 1.2rem; margin-bottom: 8px; }
.prose p, .prose li { color: var(--ink-soft); font-size: .96rem; }
.prose ul { padding-left: 1.2em; display: grid; gap: 6px; margin-top: 6px; }
.prose .updated { font-size: .88rem; color: var(--ink-faint); margin-bottom: 18px; }

.nf {
  min-height: calc(100vh - var(--header-h) - 160px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 48px 16px;
}
.nf img { width: min(320px, 80vw); margin: 0 auto 24px; border-radius: 28px; }
.nf .hero-buttons { justify-content: center; }
.nf .hero-desc { margin-left: auto; margin-right: auto; }

/* ===== Stats ===== */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat { padding: 18px 20px; }
.stat-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--brand-strong);
  line-height: 1;
  margin-bottom: 8px;
}
.stat-num { font-size: 2.3rem; font-variant-numeric: tabular-nums; }
.stat-unit { font-size: 1.15rem; color: var(--accent); }
.stat.is-risk .stat-value { color: var(--bad); }
.stat p { font-size: .88rem; color: var(--ink-soft); }
.stat small { display: block; margin-top: 6px; font-size: .76rem; color: var(--ink-faint); }

/* ===== Power-saving control ===== */
.power { display: grid; gap: 8px; margin-top: 18px; font-size: .85rem; }
.power-label { font-weight: 600; color: #e6efe9; }
.power .seg {
  display: inline-flex;
  width: max-content;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  padding: 3px;
}
.power .seg button {
  min-height: 36px;
  padding: 4px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #c9d8d0;
  font: 600 .82rem/1 var(--font-body);
  cursor: pointer;
}
.power .seg button[aria-pressed="true"] { background: #7cc4a4; color: #12211b; }
.power-status { color: #9fb3a8; font-size: .8rem; }
.power-status [hidden] { display: none; }

/* ===== Motion (only when data-motion="full") =====
   transform/opacity only; hero loops run a few cycles then stop, pause off-screen, in hidden tabs,
   in power-saving mode and with reduced motion. */
@keyframes fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.85); } to { opacity: 1; transform: none; } }
@keyframes grow-in { from { opacity: 0; transform: translateY(24px) scale(.88); } to { opacity: 1; transform: none; } }
@keyframes draw-x { from { transform: scaleX(0); } to { transform: none; } }
@keyframes lens-in { from { opacity: 0; transform: translate(30px, -24px) rotate(8deg); } to { opacity: 1; transform: none; } }
@keyframes sway { from { transform: rotate(-1.6deg); } to { transform: rotate(1.6deg); } }
@keyframes float-y { from { transform: translateY(0); } to { transform: translateY(-8px); } }
@keyframes float-lens { from { transform: translate(0, 0) rotate(0); } to { transform: translate(-6px, -8px) rotate(-3deg); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.18); } 100% { transform: scale(1); } }

:root[data-motion="full"] .hero-content > * { animation: fade-up .7s cubic-bezier(.2, .7, .2, 1) both; }
:root[data-motion="full"] .hero-content > :nth-child(2) { animation-delay: .08s; }
:root[data-motion="full"] .hero-content > :nth-child(3) { animation-delay: .16s; }
:root[data-motion="full"] .hero-content > :nth-child(4) { animation-delay: .24s; }
:root[data-motion="full"] .hero-content > :nth-child(5) { animation-delay: .32s; }
:root[data-motion="full"] .page-hero .prose > * { animation: fade-up .6s ease both; }

:root[data-motion="full"] .hero-art .layer-plant,
:root[data-motion="full"] .hero-art .layer-lens,
:root[data-motion="full"] .hero-art .layer-chip-a,
:root[data-motion="full"] .hero-art .layer-chip-b { will-change: transform; }

:root[data-motion="full"] .hero-art .layer-plant {
  transform-origin: 50% 54.8%;
  animation: grow-in .9s cubic-bezier(.2, .8, .2, 1) .2s both, sway 4s ease-in-out 1.1s 2 alternate;
}
:root[data-motion="full"] .hero-art .layer-lens {
  transform-origin: 73% 33.6%;
  animation: lens-in .9s cubic-bezier(.2, .8, .2, 1) .45s both, float-lens 3.6s ease-in-out 1.35s 2 alternate;
}
:root[data-motion="full"] .hero-art .layer-chip-a {
  transform-origin: 21% 17%;
  animation: pop-in .6s cubic-bezier(.3, 1.4, .5, 1) .7s both, float-y 3.2s ease-in-out 1.3s 2 alternate;
}
:root[data-motion="full"] .hero-art .layer-chip-b {
  transform-origin: 86% 14%;
  animation: pop-in .6s cubic-bezier(.3, 1.4, .5, 1) .85s both, float-y 3.6s ease-in-out 1.45s 2 alternate;
}
:root[data-motion="full"] .hero-art .layer-pulse {
  transform-origin: 5% 33.6%;
  animation: draw-x 1.1s ease-out .35s both;
}
:root[data-motion="full"] .hero.is-off .hero-art .layer,
:root[data-motion="full"].is-hidden .hero-art .layer { animation-play-state: paused; }

/* Scroll reveal: .motion-ready is added by script.js, so content stays visible without JS */
:root[data-motion="full"].motion-ready .rv {
  transition: opacity .6s ease, transform .6s cubic-bezier(.2, .7, .2, 1);
  transition-delay: var(--d, 0ms);
}
:root[data-motion="full"].motion-ready .rv:not(.in) { opacity: 0; transform: translateY(20px); }
:root[data-motion="full"].motion-ready .tl-item.rv:not(.in) { transform: translateX(-16px); }
:root[data-motion="full"].motion-ready .tl-item .tl-dot { transition: transform .5s cubic-bezier(.3, 1.4, .5, 1) .15s; }
:root[data-motion="full"].motion-ready .tl-item.rv:not(.in) .tl-dot { transform: scale(.4); }
:root[data-motion="full"].motion-ready .timeline::before { transform-origin: top; transition: transform 1.4s ease .1s; }
:root[data-motion="full"].motion-ready .timeline.rv-line:not(.in)::before { transform: scaleY(0); }

:root[data-motion="full"] .result-count { display: inline-block; }
:root[data-motion="full"] .result-count.bump { animation: bump .32s ease; }
:root[data-motion="full"] .result-msg:not([hidden]) { animation: fade-up .35s ease both; }

@media (hover: hover) {
  :root[data-motion="full"] .btn { transition: background-color .2s ease, color .2s ease, border-color .2s ease, transform .2s ease; }
  :root[data-motion="full"] .btn:hover { transform: translateY(-2px); }
  :root[data-motion="full"] .compare.in:hover,
  :root[data-motion="full"] .habit.in:hover,
  :root[data-motion="full"] .caution.in:hover,
  :root[data-motion="full"] .stat.in:hover { transform: translateY(-4px); }
  :root[data-motion="full"] .sources a svg { transition: transform .2s ease; }
  :root[data-motion="full"] .sources a:hover svg { transform: translate(2px, -2px); }
}

:root[data-motion="reduced"] .faq-answer,
:root[data-motion="reduced"] .faq-answer > div,
:root[data-motion="reduced"] .faq-icon,
:root[data-motion="reduced"] .meter span,
:root[data-motion="reduced"] .to-top { transition: none; }

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .caution-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .habit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 2px;
    padding: 10px 16px 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(0, 0, 0, .08);
  }
  .nav.open { display: flex; }
  .nav-link { padding: 12px 14px; border-radius: 12px; font-size: 1rem; }
  .menu-toggle { display: inline-grid; }

  .hero-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero-art { max-width: 380px; width: 100%; margin: 0 auto; }
  .compare-grid, .duo, .lib-grid, .checker, .footer-grid { grid-template-columns: 1fr; }
  .result { position: static; }
  .split-head { grid-template-columns: 1fr; }
  .split-head img { display: none; }
  .split-head .section-head { text-align: center; }
  .split-head .eyebrow { justify-content: center; }
}

@media (max-width: 560px) {
  .section { padding: 52px 0; }
  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat-num { font-size: 1.9rem; }
  .hero { padding: 24px 0 40px; }
  .caution-grid, .habit-grid { grid-template-columns: 1fr; }
  .brand-name { font-size: 1rem; }
  .brand-mark { width: 32px; height: 32px; }
  .header-actions { gap: 6px; }
  .icon-btn { width: 40px; height: 40px; }
  .lang-btn { min-width: 36px; padding: 4px 8px; }
  .compare-top { flex-direction: column; align-items: flex-start; }
  .compare-body { padding: 14px 16px 18px; }
  .compare-top { padding: 16px 16px 0; }
  .hero-buttons .btn { flex: 1 1 auto; }
  .prose section { padding: 18px 16px; }
  .timeline::before { left: 19px; }
  .tl-item { grid-template-columns: 40px 1fr; gap: 12px; }
  .tl-dot { width: 40px; height: 40px; }
  .tl-dot svg { width: 18px; height: 18px; }
}

@media (max-width: 440px) {
  .header .brand-name {
    white-space: normal;
    font-size: .92rem;
    line-height: 1.1;
    max-width: 5.6em;
  }
}

@media (max-width: 330px) {
  .header .brand-name { display: none; }
}

@media print {
  .header, .to-top, .hero-art, .checker .btn { display: none !important; }
  body { background: #fff; color: #000; }
  .faq-answer { grid-template-rows: 1fr; }
  .faq-answer > div { visibility: visible; }
}
