/* LongevityIQ — direction C · Editorial: ivory, olive, serif numerals, hairlines instead of cards. */
:root {
  --bg: #FAF9F6;
  --surface: #F3F1EC;
  --ink: #1C1B19;
  --muted: #5E5B55;
  --line: #E5E2DB;
  --olive: #5B6236;
  --olive-strong: #3F4424;
  --olive-tint: #E7E8DA;
  --alert: #A04A22;
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --tabbar-h: 68px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: var(--olive); }
a:hover { color: var(--olive-strong); }
:focus-visible { outline: 2px solid var(--olive); outline-offset: 3px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--alert); margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { display: none; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#view { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: 8px 20px 32px; outline: none; }
.footer { padding: 16px 20px calc(var(--tabbar-h) + 24px + env(safe-area-inset-bottom)); text-align: center; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(14px + env(safe-area-inset-top)) 20px 14px;
  border-bottom: 1px solid var(--ink);
  margin: 0 20px 0; padding-left: 0; padding-right: 0;
}
.brand {
  font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
}
.topbar-feedback {
  font: 500 13px var(--sans); color: var(--olive); background: none; border: 0;
  padding: 12px 0; min-height: 44px; cursor: pointer;
}

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: space-around;
  background: rgba(250, 249, 246, 0.96);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  min-height: 52px; justify-content: center;
  font-size: 11px; color: var(--muted); text-decoration: none;
}
.tabbar svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a[aria-current="page"] { color: var(--olive); font-weight: 600; }

@media (min-width: 900px) {
  .sidebar {
    display: flex; flex-direction: column; gap: 6px;
    position: sticky; top: 0; height: 100vh;
    width: 240px; flex: none; padding: 32px 24px;
    border-right: 1px solid var(--line);
  }
  .brand-tagline { margin: 0 0 28px; }
  .side-nav { display: flex; flex-direction: column; gap: 2px; }
  .side-nav a {
    padding: 10px 12px; border-radius: 10px; text-decoration: none;
    color: var(--muted); font-size: 15px;
  }
  .side-nav a:hover { color: var(--ink); background: var(--surface); }
  .side-nav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--surface); }
  .side-feedback { margin-top: auto; }
  .side-note { margin: 12px 0 0; }
  .topbar, .tabbar { display: none; }
  #view { padding: 48px 48px 32px; }
  .footer { padding: 16px 48px 32px; text-align: left; }
}

/* ---------- Type ---------- */
.eyebrow { margin: 0; font-size: 13px; color: var(--muted); }
.greeting { margin: 4px 0 0; font-size: 15px; color: var(--muted); }
.display {
  margin: 12px 0 0; font-family: var(--serif); font-weight: 400;
  font-size: clamp(36px, 7vw, 64px); line-height: 1.02; letter-spacing: -0.02em;
}
.lede { margin: 16px 0 0; font-family: var(--serif); font-size: clamp(19px, 2.4vw, 23px); line-height: 1.4; max-width: 34ch; }
.page-head { padding: 16px 0 28px; border-bottom: 1px solid var(--ink); }
.page-head .lede { max-width: 46ch; }

/* ---------- Hero ---------- */
.hero { display: flex; flex-direction: column-reverse; gap: 24px; padding: 16px 0 32px; border-bottom: 1px solid var(--ink); }
.hero-photo { margin: 0 -20px; }
.hero-photo img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 30%; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 28px; }
@media (min-width: 900px) {
  .hero { flex-direction: row; align-items: stretch; gap: 48px; padding-top: 0; }
  .hero-text { flex: 1 1 0; display: flex; flex-direction: column; justify-content: center; min-width: 0; }
  .hero-photo { flex: 0 1 44%; margin: 0; }
  .hero-photo img { height: 100%; aspect-ratio: auto; min-height: 420px; max-height: 560px; }
}

/* ---------- Rows (hairlines instead of cards) ---------- */
.rows { display: flex; flex-direction: column; margin: 0; padding: 0; }
.rows.plain { list-style: none; }
.row { padding: 22px 0; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.row p { margin: 0; max-width: 62ch; }
.row-inline { flex-direction: row; justify-content: space-between; align-items: baseline; gap: 16px; }
.row-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 24px; line-height: 1.2; }
@media (min-width: 900px) {
  .rows:not(.plain) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 40px; }
  .rows:not(.plain) > .row { border-bottom: 0; border-top: 1px solid var(--line); }
  .page-head + .rows:not(.plain) { grid-template-columns: minmax(0, 1fr); max-width: 760px; }
  .page-head + .rows:not(.plain) > .row:first-child { border-top: 0; }
}

.tag { font-size: 12px; font-weight: 500; color: var(--olive); background: var(--olive-tint); padding: 4px 10px; border-radius: 999px; white-space: nowrap; }

.points { list-style: none; margin: 28px 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.points li { display: flex; gap: 12px; align-items: flex-start; font-size: 17px; }
.points svg { color: var(--olive); flex: none; margin-top: 4px; }

/* ---------- Controls ---------- */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px;
  font: 500 15px var(--sans); color: var(--bg); background: var(--olive);
  border: 1px solid var(--olive); border-radius: 2px; text-decoration: none; cursor: pointer;
}
.button:hover { background: var(--olive-strong); border-color: var(--olive-strong); color: var(--bg); }
.button-quiet { background: transparent; color: var(--ink); border-color: var(--ink); }
.button-quiet:hover { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.button-danger { background: transparent; color: var(--alert); border-color: var(--alert); }
.button-danger:hover { background: var(--alert); color: var(--bg); border-color: var(--alert); }
.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 6px; }
.text-link { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; text-decoration: none; min-height: 44px; }

.select {
  min-height: 48px; max-width: 320px; padding: 0 14px;
  font: 400 16px var(--sans); color: var(--ink); background: var(--bg);
  border: 1px solid var(--ink); border-radius: 2px;
}

/* ---------- Dialog, toast ---------- */
.dialog { width: min(520px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--ink); border-radius: 2px; background: var(--bg); color: var(--ink); }
.dialog::backdrop { background: rgba(28, 27, 25, 0.35); }
.dialog-body { display: flex; flex-direction: column; gap: 12px; padding: 24px; }
.dialog textarea {
  width: 100%; min-height: 140px; padding: 12px; resize: vertical;
  font: 400 16px/1.5 var(--sans); color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 2px;
}
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--tabbar-h) + 20px + env(safe-area-inset-bottom)); z-index: 20;
  max-width: calc(100vw - 32px); padding: 12px 18px;
  background: var(--ink); color: var(--bg); font-size: 14px; border-radius: 2px;
}
@media (min-width: 900px) { .toast { bottom: 32px; } }
.noscript { padding: 24px; }

@media (prefers-reduced-motion: no-preference) {
  #view { animation: fade 240ms ease-out; }
  @keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
