/* Public website. The page runs from day (top) to night (footer). */
:root {
  --daylight: #eef2f7;
  --paper: #f8fafc;
  --ink: #18233a;
  --ink-soft: #4a5672;
  --espresso: #5b3a24;
  --crema: #e3b778;
  --night: #1e2347;
  --night-deep: #151935;
  --moon: #c9ccf2;
  --line: #d5dce7;
  --danger: #a3271f;
  --focus: #3d5bd9;

  --font-display: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --measure: 68ch;
  --page: 1080px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --daylight: #151935;
    --paper: #1b2044;
    --ink: #e8eaf8;
    --ink-soft: #a9aed6;
    --espresso: #e3b778;
    --crema: #8a6236;
    --night: #0e1128;
    --night-deep: #090b1d;
    --line: #2f356a;
    --danger: #ff8a80;
    --focus: #9fb0ff;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--daylight);
  color: var(--ink);
  font: 17px/1.6 var(--font-body);
}
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 12px; background: var(--paper); padding: 8px 12px; z-index: 10; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; letter-spacing: -0.015em; margin: 0 0 .5em; }
h1 { font-size: clamp(2.3rem, 6.2vw, 4.25rem); font-weight: 750; letter-spacing: -0.03em; max-width: 16ch; }
h2 { font-size: clamp(1.55rem, 3vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.2rem; font-weight: 700; }
p, ul, ol, dl { margin: 0 0 1em; }

/* Header: logo, navigation, install buttons */
.site-header {
  max-width: var(--page); margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap;
}
.wordmark { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font: 750 1.35rem var(--font-display); min-height: 44px; }
.wordmark-icon { width: 36px; height: 36px; border-radius: 9px; }
.site-nav { display: flex; gap: 4px 20px; flex-wrap: wrap; margin-left: auto; }
.site-nav a { text-decoration: none; color: var(--ink-soft); padding: 10px 2px; }
.site-nav a:hover { color: var(--ink); text-decoration: underline; }

/* Install buttons with store logos */
.store-links { display: flex; flex-wrap: wrap; gap: 10px; }
.store-link { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; border-radius: 12px; font-weight: 650; }
.store-link:hover { text-decoration: none; }
.store-glyph { flex: none; fill: currentColor; }
.store-text { display: flex; flex-direction: column; line-height: 1.15; }
.store-text small { font-weight: 450; font-size: .74rem; opacity: .85; }
.store-links-large .store-link { min-height: 56px; padding: 9px 20px 9px 16px; background: var(--ink); color: var(--daylight); font-size: 1.1rem; }
.store-links-large .store-glyph { width: 26px; height: 26px; }
.store-links-compact .store-link { min-height: 44px; padding: 8px 14px; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--line); font-size: .92rem; }
.store-links-compact .store-link:hover { box-shadow: inset 0 0 0 1.5px var(--ink-soft); }
.store-links-compact .store-glyph { width: 18px; height: 18px; }
.site-footer .store-links-large .store-link { background: #fff; color: var(--night); }
.site-footer .store-links { margin-bottom: 32px; }

@media (max-width: 720px) {
  .site-header { justify-content: space-between; }
  .site-nav { order: 3; width: 100%; margin-left: 0; justify-content: space-between; border-top: 1px solid var(--line); }
  .store-links-compact .store-link { width: 44px; padding: 0; justify-content: center; }
  .store-links-compact .store-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .store-links-compact .store-glyph { width: 20px; height: 20px; }
}

main { max-width: var(--page); margin: 0 auto; padding: 8px max(16px, env(safe-area-inset-right)) 72px max(16px, env(safe-area-inset-left)); }
main, .site-footer { overflow-wrap: anywhere; }
img, svg { max-width: 100%; }
.notice { max-width: var(--measure); padding: 12px 16px; border-left: 4px solid var(--focus); background: var(--paper); }
.notice-alert { border-left-color: var(--danger); }

/* Hero */
.hero { padding: 32px 0 24px; }
.hero .lead { font-size: 1.2rem; color: var(--ink-soft); max-width: 46ch; }
.store-note { color: var(--ink-soft); font-size: .92rem; margin-top: 12px; max-width: 52ch; }

.day-chart { margin: 40px 0 8px; }
.day-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.day-chart figcaption { color: var(--ink-soft); font-size: .95rem; max-width: var(--measure); margin-top: 12px; }
.chart-night { fill: var(--night); }
.chart-area { fill: var(--crema); opacity: .55; }
.chart-line { fill: none; stroke: var(--espresso); stroke-width: 3; stroke-linejoin: round; }
.chart-area-night { fill: var(--moon); opacity: .18; }
.chart-line-night { fill: none; stroke: var(--crema); stroke-width: 3; stroke-linejoin: round; }
.chart-threshold { stroke: var(--ink-soft); stroke-width: 1.5; stroke-dasharray: 6 6; }
.chart-baseline { stroke: var(--line); stroke-width: 1.5; }
.chart-label { font: 15px var(--font-body); fill: var(--ink-soft); }
.chart-label-night { fill: var(--moon); }
.chart-dose { fill: var(--espresso); }
.chart-safe { stroke: var(--moon); stroke-width: 2; }
.chart-safe-label { font: 700 17px var(--font-display); fill: var(--moon); }
@media (prefers-color-scheme: dark) { .chart-night { fill: var(--night-deep); } }
@media (max-width: 560px) {
  .day-chart { margin-inline: -16px; }
  .day-chart figcaption { padding-inline: 16px; }
  .chart-label { font-size: 24px; }
  .chart-safe-label { font-size: 26px; }
  .chart-label-dose { display: none; }
}

/* Sections */
.section { padding: 56px 0 0; }
.section > p, .section > h2 { max-width: var(--measure); }
.features { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 56px; margin-top: 24px; max-width: 900px; }
@media (max-width: 640px) { .features { grid-template-columns: 1fr; } }
.features ul { padding-left: 1.1em; color: var(--ink-soft); }
.features li { margin-bottom: .35em; }
.features h3 { padding-top: 12px; border-top: 3px solid var(--crema); }

/* Stats as a running log */
.stats-log { max-width: 560px; margin: 24px 0 8px; border-top: 1px solid var(--line); }
.stats-log div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.stats-log dt { color: var(--ink-soft); }
.stats-log dd { margin: 0; font: 700 1.5rem var(--font-display); font-variant-numeric: tabular-nums; }
.stats-note { color: var(--ink-soft); font-size: .9rem; max-width: var(--measure); }

.steps { padding-left: 1.4em; max-width: var(--measure); }
.steps li { margin-bottom: .6em; padding-left: .3em; }
.steps li::marker { font: 700 1rem var(--font-display); color: var(--espresso); }

/* FAQ */
.faq-list { max-width: var(--measure); border-top: 1px solid var(--line); }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary { cursor: pointer; padding: 14px 0; min-height: 44px; font-weight: 650; list-style-position: outside; }
.faq-list details[open] summary { color: var(--espresso); }
.faq-list details > div { padding: 0 0 12px; color: var(--ink-soft); }

/* Long-form pages */
.prose { max-width: var(--measure); padding-top: 24px; }
.prose h2 { font-size: 1.4rem; margin-top: 2em; }
.prose h3 { margin-top: 1.5em; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose li { margin-bottom: .35em; }
.prose .updated { color: var(--ink-soft); font-size: .95rem; }
.prose address { font-style: normal; }

/* Forms */
.form-card { max-width: 520px; padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; margin: 24px 0; }
.form-card label { display: block; font-weight: 650; margin: 0 0 6px; }
.form-card input[type=email], .form-card input[type=text] {
  width: 100%; padding: 12px; font: inherit; color: var(--ink); background: var(--daylight);
  border: 1px solid var(--line); border-radius: 10px;
}
.form-card input.code { font: 700 1.6rem var(--font-display); letter-spacing: .3em; max-width: 9em; }
.form-card .check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; margin: 18px 0; }
.form-card .check input { margin-top: 5px; width: 18px; height: 18px; }
.form-card .hint { color: var(--ink-soft); font-size: .92rem; margin: 8px 0 0; }
.button { display: inline-block; margin-top: 16px; padding: 12px 22px; border: 0; border-radius: 999px; font: 650 1rem var(--font-body); cursor: pointer; background: var(--ink); color: var(--daylight); text-decoration: none; }
.button-danger { background: var(--danger); color: #fff; }
@media (prefers-color-scheme: dark) { .button-danger { color: var(--night-deep); } }

/* Footer: night */
.site-footer { background: var(--night); color: var(--moon); }
.footer-inner { max-width: var(--page); margin: 0 auto; padding: 56px 16px max(40px, env(safe-area-inset-bottom)); }
.footer-lead { font: 750 clamp(1.8rem, 4vw, 2.6rem) var(--font-display); color: #fff; margin-bottom: 8px; }
.footer-install { margin-bottom: 14px; }
.site-footer nav a { display: inline-block; padding: 6px 0; }
.site-footer ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 28px; }
.site-footer a { color: var(--moon); }
.footer-legal { font-size: .88rem; opacity: .8; max-width: var(--measure); margin-top: 24px; }

@media (prefers-reduced-motion: no-preference) {
  .chart-line, .chart-line-night { stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw-curve 1.8s ease-out .2s forwards; }
  @keyframes draw-curve { to { stroke-dashoffset: 0; } }
}
