/* Elevated Self — shared styles for index + the three product pages.
   Tokens mirror the apps' own palette (see DrHerb/android/.../ui/Theme.kt). */

/* Light is the baseline. Explicit token overrides make the theme switch work in
   browsers that do not resolve light-dark() reliably after color-scheme changes. */
:root {
  color-scheme: light dark;
  --bg:        #f7f9fa;
  --surface:   #ffffff;
  --surface-2: #eef3f5;
  --divider:   #dde5e8;
  --text:      #142a30;
  --muted:     rgba(20, 42, 48, 0.62);
  --accent:    #127c84;
  --cta:       #f08c2e;
  --on-cta:    #2a1b00;
  --green:     #2e9e6b;
  --herbalrx-brand: #3a6bb8;
  --shadow-near: rgba(20, 42, 48, 0.04);
  --shadow-far:  rgba(20, 42, 48, 0.06);
  --shadow: 0 1px 2px var(--shadow-near), 0 8px 24px var(--shadow-far);
  --radius: 16px;
}

/* assets/theme.js sets data-theme on <html>; absent = follow the system. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #10191c;
  --surface:   #18242a;
  --surface-2: #1e2c33;
  --divider:   #26343a;
  --text:      #e6eef0;
  --muted:     rgba(230, 238, 240, 0.62);
  --accent:    #35b6c0;
  --cta:       #ff9b45;
  --green:     #43c08a;
  --herbalrx-brand: #7aa5e8;
  --shadow-near: rgba(0, 0, 0, 0.30);
  --shadow-far:  rgba(0, 0, 0, 0.28);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:        #10191c;
    --surface:   #18242a;
    --surface-2: #1e2c33;
    --divider:   #26343a;
    --text:      #e6eef0;
    --muted:     rgba(230, 238, 240, 0.62);
    --accent:    #35b6c0;
    --cta:       #ff9b45;
    --green:     #43c08a;
    --herbalrx-brand: #7aa5e8;
    --shadow-near: rgba(0, 0, 0, 0.30);
    --shadow-far:  rgba(0, 0, 0, 0.28);
  }
}

/* Per-product accent. Dr.Herb leads with the green from its logo gradient,
   Dr.Peptide with the amber it uses for actions, Herbal RX with the steel blue
   from its mark — deliberately the coolest of the three, it's the clinical one. */
body.drherb { --brand: var(--green); }
body.drpeptide { --brand: var(--cta); }
body.herbalrx { --brand: var(--herbalrx-brand); }
body.moms { --brand: var(--accent); }
body.jtodo { --brand: var(--accent); }
body { --brand: var(--accent); }

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.6;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; width: min(1040px, 92%); margin: 0 auto; }
a { color: var(--accent); }
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

/* ── top bar ───────────────────────────────────────────────────────── */
.topbar {
  width: min(1040px, 92%);
  margin: 0 auto;
  padding: 1.5rem 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  /* Reserve the row height: theme.js injects the switch, and without this the
     page would jolt downward the moment it appears. */
  min-height: 3.1rem;
}
.topbar a {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
}
.topbar a:hover { color: var(--text); }
.topbar img { width: 26px; height: 26px; }

/* ── theme switch ──────────────────────────────────────────────────────
   Three-way, mirroring the System / Light / Dark control both apps have in
   their own Settings — a plain light/dark flip would leave no way back to
   following the system. Injected by assets/theme.js. */
.theme-switch {
  display: inline-flex;
  border: 1px solid var(--divider);
  border-radius: 999px;
  background: var(--surface);
  overflow: hidden;
  flex: none;
  margin-left: auto;   /* right-aligned whether or not a back link precedes it */
}
.theme-switch button {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: 0;
  padding: 0.35rem 0.8rem;
  cursor: pointer;
  line-height: 1.5;
}
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-pressed="true"] { background: var(--accent); color: var(--bg); }

/* ── home hero ─────────────────────────────────────────────────────── */
header.home { text-align: center; padding: 2.5rem 0 2.5rem; }
header.home img { width: 128px; max-width: 36vw; }
h1 {
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-top: 1rem;
  line-height: 1.15;
}
h1 span.grad {
  background: linear-gradient(100deg, #4a7bc8, var(--accent), var(--green));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline { font-size: 1.15rem; color: var(--muted); max-width: 34em; margin: 0.9rem auto 0; }

/* ── product cards on the home page ────────────────────────────────── */
.products {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 1.5rem;
  padding: 0 0 3rem;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); }
.card img.icon { width: 88px; height: 88px; object-fit: contain; margin: 0 auto; }
.card h2 { font-size: 1.45rem; font-weight: 800; margin: 1rem 0 0.2rem; }
.card .kind {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.card p { color: var(--muted); margin-top: 0.8rem; flex: 1; }
.card .more { margin-top: 1.25rem; font-weight: 700; color: var(--accent); }

/* ── product page hero ─────────────────────────────────────────────── */
header.product {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: center;
  padding: 2.5rem 0 2rem;
}
header.product img { width: 104px; height: 104px; object-fit: contain; }
header.product .kind {
  color: var(--brand);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
header.product h1 { font-size: clamp(2rem, 5.5vw, 2.9rem); margin-top: 0.3rem; }
header.product p { color: var(--muted); font-size: 1.1rem; margin-top: 0.6rem; max-width: 42em; }
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .theme-switch { width: 100%; margin-left: 0; }
  .theme-switch button { flex: 1; padding-inline: 0.65rem; }
  header.product { grid-template-columns: 1fr; text-align: center; justify-items: center; }
}

.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.pill {
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--divider);
}

/* ── sections ──────────────────────────────────────────────────────── */
section { padding: 2.5rem 0; border-top: 1px solid var(--divider); }
section > h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin-bottom: 0.4rem;
}
section > .lede { color: var(--muted); max-width: 46em; margin-bottom: 1.6rem; }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 1.1rem; }
.feature {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 1.35rem;
}
.feature h3 { font-size: 1.02rem; font-weight: 800; margin-bottom: 0.35rem; }
.feature h3::before {
  content: "";
  display: block;
  width: 30px;
  height: 3px;
  border-radius: 2px;
  background: var(--brand);
  margin-bottom: 0.7rem;
}
.feature p { color: var(--muted); font-size: 0.94rem; }

/* ── screenshot strip ──────────────────────────────────────────────── */
.shots {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  padding-bottom: 1rem;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.shots figure { flex: 0 0 auto; width: 240px; scroll-snap-align: start; }
.shots img {
  width: 100%;
  height: auto;
  border-radius: 20px;
  border: 1px solid var(--divider);
  box-shadow: var(--shadow);
  display: block;
}
.shots figcaption { color: var(--muted); font-size: 0.86rem; margin-top: 0.6rem; }

/* ── get the app ───────────────────────────────────────────────────── */
.get { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 1.1rem; }
.store {
  background: var(--surface);
  border: 1px solid var(--divider);
  border-radius: var(--radius);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}
.store h3 { font-size: 1.05rem; font-weight: 800; }

.qr {
  width: 148px;
  height: 148px;
  border-radius: 12px;
  background: #fff;
  padding: 8px;
  border: 1px solid var(--divider);
  display: grid;
  place-items: center;
}
.qr img { width: 100%; height: 100%; display: block; }
/* No QR generated yet → the <img> onerror swaps in this dashed placeholder.
   Drop the PNG into assets/qr/ (see tools/make_qr.py) and it appears by itself. */
.qr.empty { background: var(--surface-2); border-style: dashed; }
.qr.empty img { display: none; }
.qr.empty::after {
  content: "QR code once the listing is live";
  color: var(--muted);
  font-size: 0.76rem;
  padding: 0 0.8rem;
  text-align: center;
  line-height: 1.35;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.8rem 1.2rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  background: var(--brand);
  color: #fff;
  border: 1px solid transparent;
}
body.drpeptide .btn { color: var(--on-cta); }
.btn:hover { filter: brightness(1.06); }
.btn.disabled {
  background: transparent;
  color: var(--muted);
  border-color: var(--divider);
  cursor: default;
  pointer-events: none;
}

/* ── notes ─────────────────────────────────────────────────────────── */
.note {
  background: var(--surface-2);
  border: 1px solid var(--divider);
  border-left: 3px solid var(--brand);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
}
.note strong { color: var(--text); }
.note + .note { margin-top: 0.8rem; }

/* ── long-form pages (privacy, research) ───────────────────────────── */
.prose { max-width: 44em; padding-bottom: 1rem; overflow-wrap: anywhere; }
.prose h2 {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.015em;
  margin: 2.4rem 0 0.6rem;
}
.prose h3 { font-size: 1.02rem; font-weight: 800; margin: 1.6rem 0 0.4rem; }
.prose p, .prose ul, .prose ol { margin-bottom: 1rem; color: var(--muted); }
.prose li { margin-bottom: 0.45rem; }
.prose ul, .prose ol { padding-left: 1.3rem; }
.prose strong { color: var(--text); }
.prose > p:first-of-type { font-size: 1.1rem; }
.prose table { width: 100%; border-collapse: collapse; margin-bottom: 1.2rem; font-size: 0.94rem; }
.prose th, .prose td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--divider);
  vertical-align: top;
}
.prose th { color: var(--text); font-weight: 700; }
.prose td { color: var(--muted); }
.updated { color: var(--muted); font-size: 0.88rem; margin-top: 0.4rem; }

footer {
  text-align: center;
  padding: 2.5rem 0;
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--divider);
}
footer a { color: var(--accent); text-decoration: none; }
footer nav { margin-bottom: 0.6rem; display: flex; gap: 1.2rem; justify-content: center; flex-wrap: wrap; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
  .card:hover { transform: none; }
}
