/* ===== Base, layout, shared components, content pages ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
img, svg { max-width: 100%; }
a { color: var(--accent-strong); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; letter-spacing: 0.005em; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.75rem, 6vw, 2.6rem); }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.tnum { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip-link:focus { left: 8px; }

/* ---- Site header ---- */
.site-header {
  position: relative;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.site-header::after { /* original hex band */
  content: '';
  position: absolute; inset: auto 0 -1px 0; height: 4px;
  background: linear-gradient(90deg, var(--land-sea) 0 16%, var(--land-forest) 16% 32%, var(--land-pasture) 32% 48%, var(--land-wheat) 48% 64%, var(--land-clay) 64% 80%, var(--land-stone) 80% 100%);
}
.header-inner {
  max-width: 960px; margin: 0 auto; padding: 10px var(--gutter);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-height: var(--tap); }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand-name { font-family: var(--font-display); font-size: 1.3rem; }
.site-nav { margin-left: auto; display: flex; gap: 2px; flex-wrap: wrap; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 999px;
  color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 0.95rem;
}
.site-nav a:hover, .site-nav a[aria-current='page'] { color: var(--ink); background: var(--surface-2); }
@media (max-width: 560px) {
  .site-nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; margin-top: -4px; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { padding: 0 9px; font-size: 0.9rem; white-space: nowrap; }
}

/* ---- Main column ---- */
.page { max-width: 640px; margin: 0 auto; padding: 20px var(--gutter) 40px; }
@media (min-width: 900px) { .page { max-width: 720px; padding-top: 32px; } body { font-size: 1.0625rem; } }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: 0.875rem; }
.footer-inner { max-width: 960px; margin: 0 auto; padding: 20px var(--gutter) 28px; }
.footer-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; }
.footer-links a { color: var(--ink-soft); min-height: 32px; display: inline-flex; align-items: center; }
.disclaimer { margin: 0; max-width: 70ch; }

/* ---- Cards ---- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.card h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-sub { color: var(--ink-soft); font-size: 0.9rem; margin: -6px 0 12px; }
.hexdot { width: 14px; height: 16px; flex: none; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); background: var(--accent); }

/* ---- Buttons ---- */
.btn {
  appearance: none; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink); text-decoration: none;
  transition: transform 0.08s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px -8px var(--accent); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-lg { min-height: 60px; font-size: 1.15rem; }
.btn-sm { min-height: 44px; padding: 0 14px; font-size: 0.92rem; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none; }
.linkish { background: none; border: 0; color: var(--accent-strong); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; min-height: 44px; padding: 0 6px; }

/* ---- Form controls ---- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > label, .label { font-weight: 700; font-size: 0.95rem; }
.hint { color: var(--ink-soft); font-size: 0.88rem; }
input[type='text'], select {
  font: inherit; color: var(--ink); background: var(--surface); width: 100%;
  min-height: var(--tap); border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 0 12px;
}
select { padding-right: 8px; }
input[type='text']:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.seg button {
  appearance: none; border: 0; background: transparent; color: var(--ink-soft); font: inherit; font-weight: 700;
  min-height: 40px; padding: 0 14px; border-radius: 999px; cursor: pointer;
}
.seg button[aria-pressed='true'] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

.stepper { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 52px; }
.stepper + .stepper { border-top: 1px dashed var(--line); }
.stepper-label { display: grid; }
.stepper-label b { font-size: 0.97rem; }
.stepper-label small { color: var(--ink-soft); font-size: 0.82rem; }
.stepper-ctl { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.stepper-ctl output { min-width: 64px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; font-size: 1.05rem; }
.icon-btn {
  appearance: none; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink);
  width: 44px; height: 44px; border-radius: 50%; font-size: 1.3rem; font-weight: 700; line-height: 1;
  display: inline-grid; place-items: center; cursor: pointer; touch-action: manipulation;
}
.icon-btn:active { transform: scale(0.94); }
.icon-btn[disabled] { opacity: 0.35; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; cursor: pointer; }
.switch input { appearance: none; width: 52px; height: 30px; border-radius: 999px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background 0.15s; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: transform 0.15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(22px); }

/* ---- Toast ---- */
.toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(150%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600;
  z-index: 100; transition: transform 0.25s ease; max-width: calc(100vw - 32px); text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }

/* ---- Ad slots (reserve space only when ads are on) ---- */
.ad-slot { display: none; }
html[data-ads='on'] .ad-slot {
  display: grid; place-items: center; margin: 18px auto; width: 100%; max-width: 336px;
  height: 280px; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-soft);
  font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; overflow: hidden;
}
html[data-ads='on'] .ad-slot[data-slot='content'] { max-width: 728px; height: 250px; }

/* ---- Content pages ---- */
.prose h1 { margin-bottom: 0.3em; }
.prose .lede { font-size: 1.12rem; color: var(--ink-soft); }
.prose h2 { margin-top: 1.6em; }
.prose li { margin-bottom: 0.45em; }
.prose ol, .prose ul { padding-left: 1.3em; }
.prose .callout { background: var(--accent-soft); border-radius: var(--r-md); padding: 14px 16px; margin: 1.2em 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 0.95rem; margin: 1em 0; }
.prose th, .prose td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose details { border: 1px solid var(--line); border-radius: var(--r-md); padding: 0 14px; margin-bottom: 10px; background: var(--surface); }
.prose summary { cursor: pointer; font-weight: 700; min-height: 48px; display: flex; align-items: center; }
.prose details[open] summary { border-bottom: 1px dashed var(--line); margin-bottom: 10px; }
.placeholder { background: #fff3b0; color: #4a3b00; padding: 0 4px; border-radius: 4px; font-weight: 700; }
.legal-note { border: 2px dashed var(--warn); border-radius: var(--r-md); padding: 12px 14px; margin-bottom: 1.4em; font-size: 0.95rem; }
.cta { display: flex; flex-wrap: wrap; gap: 10px; margin: 1.4em 0; }

/* ---- Hex decoration (pure CSS, original) ---- */
.hex-row { display: flex; gap: 6px; margin: 4px 0 18px; }
.hex-row span { width: 22px; height: 25px; clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }

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