/* Groundwork Stacks: shared styles.
   Concept: supplements as layers of soil. Each stack has its own earth colour (--stack),
   drawn as a "core sample" of layered bands. One stylesheet, no JavaScript needed. */

:root {
  --ground: #F4EFE6;      /* limestone page */
  --surface: #FFFCF6;     /* cards */
  --ink: #2F2620;         /* loam text */
  --muted: #6A5B4F;
  --moss: #3E5C3A;        /* buttons, links */
  --moss-strong: #2E4A2B;
  --moss-tint: #E3EADC;
  --clay: #B5562F;
  --line: #E2D7C6;
  --caution: #F8E8DA;
  --caution-ink: #6B3418;
  --note: #FFF4C9;
  --note-ink: #4A3B00;
  --on-moss: #FFFFFF;
  --band: #2F2620;
  --band-ink: #EFE5D6;
  --stack: #B5562F;       /* overridden per stack page */
  --display: "Young Serif", Georgia, "Times New Roman", serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 12px;
  --measure: 66ch;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #1E1A16; --surface: #28221D; --ink: #F1E9DD; --muted: #BBAD9D;
    --moss: #8FB585; --moss-strong: #A9CC9F; --moss-tint: #2F3B2B; --clay: #E08A62;
    --line: #3D342C; --caution: #3A2A20; --caution-ink: #F3C9AE; --note: #3A3315; --note-ink: #F2E3A6;
    --on-moss: #15200F; --band: #141110; --band-ink: #E6DACA; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #1E1A16; --surface: #28221D; --ink: #F1E9DD; --muted: #BBAD9D;
  --moss: #8FB585; --moss-strong: #A9CC9F; --moss-tint: #2F3B2B; --clay: #E08A62;
  --line: #3D342C; --caution: #3A2A20; --caution-ink: #F3C9AE; --note: #3A3315; --note-ink: #F2E3A6;
  --on-moss: #15200F; --band: #141110; --band-ink: #E6DACA; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 17px/1.65 var(--body); }
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.18; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(36px, 6vw, 56px); }
h2 { font-size: clamp(26px, 3.4vw, 32px); }
h3 { font-size: 21px; }
p { margin: 0; }
a { color: var(--moss); text-underline-offset: 3px; }
a:hover { color: var(--moss-strong); }
:focus-visible { outline: 3px solid var(--clay); outline-offset: 3px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 14px; z-index: 20; }
.skip:focus { left: 16px; }

.wrap { max-width: 1040px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.flow { display: flex; flex-direction: column; gap: 16px; }
.lede { color: var(--muted); max-width: var(--measure); font-size: 18px; }
.label { text-transform: uppercase; letter-spacing: .12em; font-size: 13px; font-weight: 700; color: var(--stack); }
.small { font-size: 15px; color: var(--muted); }

/* Draft bar (remove before launch) */
.draftbar { background: var(--note); color: var(--note-ink); font-size: 14px; text-align: center; padding: 8px 16px; }

/* Header */
.site-head { border-bottom: 1px solid var(--line); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px 28px; padding-block: 16px; }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-size: 22px; color: var(--ink); text-decoration: none; }
.logo:hover { color: var(--ink); }
.l1 { fill: var(--clay); } .l2 { fill: var(--moss); } .l3 { fill: var(--ink); }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 22px; }
.site-nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 15px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--moss); text-decoration: underline; }

.crumbs { font-size: 14px; color: var(--muted); padding-top: 18px; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--line); }
.crumbs a { color: var(--muted); }

section { padding-block: 44px; border-top: 1px solid var(--line); }
.first { border-top: 0; }

/* Buttons */
.btn { display: inline-block; background: var(--moss); color: var(--on-moss); text-decoration: none; font-weight: 600; padding: 14px 28px; border-radius: 999px; border: 0; font-size: 17px; }
.btn:hover { background: var(--moss-strong); color: var(--on-moss); }
.btn.soon { background: var(--line); color: var(--muted); cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; }
.price { color: var(--muted); font-size: 15px; }
.price b { color: var(--ink); font-size: 18px; font-variant-numeric: tabular-nums; }
.save { font-size: 15px; color: var(--ink); background: var(--moss-tint); border-radius: 10px; padding: 10px 14px; max-width: var(--measure); }
.save b { font-weight: 600; }
.fda { font-size: 14px; color: var(--muted); max-width: var(--measure); padding-left: 14px; border-left: 3px solid var(--line); }

/* Stack hero with core sample */
.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 40px; align-items: center; padding-block: 28px 44px; }
.hero > div { min-width: 0; }
.claim { font-size: 22px; max-width: 32ch; }
.core { display: flex; flex-direction: column; gap: 6px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.core figcaption { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: 4px; }
.layer { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; padding: 12px 16px; border-radius: 10px; font-size: 15px; }
.layer b { font-weight: 600; }
.layer span { font-size: 13px; opacity: .9; text-align: right; }
.layer:nth-of-type(1) { background: var(--stack); color: #fff; margin-inline: 0; }
.layer:nth-of-type(2) { background: color-mix(in srgb, var(--stack) 78%, var(--surface)); color: #fff; margin-inline: 6px; }
.layer:nth-of-type(3) { background: color-mix(in srgb, var(--stack) 52%, var(--surface)); color: var(--ink); margin-inline: 12px; }
.layer:nth-of-type(4) { background: color-mix(in srgb, var(--stack) 32%, var(--surface)); color: var(--ink); margin-inline: 18px; }
.layer:nth-of-type(5) { background: color-mix(in srgb, var(--stack) 18%, var(--surface)); color: var(--ink); margin-inline: 24px; }

/* Credentials card (About page) */
.cred { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 28px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; max-width: 860px; }
.cred-photo { aspect-ratio: 4 / 5; max-width: 100%; border-radius: 12px; background: repeating-linear-gradient(135deg, var(--moss-tint) 0 10px, var(--surface) 10px 20px); border: 1px dashed var(--line); display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.cred-img { display: block; width: 100%; max-width: 100%; height: auto; border-radius: 12px; }
.cred dl { margin: 0; display: grid; gap: 0; }
.cred dl > div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 4px 16px; padding-block: 10px; border-bottom: 1px solid var(--line); }
.cred dl > div:last-child { border-bottom: 0; }
.cred dt { font-weight: 700; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.cred dd { margin: 0; }
mark.fill { background: var(--note); color: var(--note-ink); padding: 0 4px; border-radius: 4px; }
@media (max-width: 640px) {
  .cred { grid-template-columns: 1fr; }
  .cred-photo, .cred-img { max-width: 200px; }
  .cred dl > div { grid-template-columns: 1fr; }
}

/* Starter Guide sign-up */
.signup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px 36px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.signup > div { min-width: 0; }
.gw-signup { display: flex; flex-direction: column; gap: 10px; }
.gw-signup .fields { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 12px; align-items: center; }
.gw-signup label { font-size: 15px; font-weight: 600; }
.gw-signup input[type="text"], .gw-signup input[type="email"] { font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--ground); color: var(--ink); width: 100%; }
.gw-signup .consent { font-weight: 400; font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.gw-signup .consent input { margin-top: 3px; flex: none; }
.gw-signup .btn { align-self: flex-start; }
.gw-signup .hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.form-msg { font-size: 14px; color: var(--caution-ink); min-height: 1em; }
.signup-done { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.gw-pop { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(400px, calc(100vw - 32px)); max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-top: 6px solid var(--clay); border-radius: 16px; padding: 20px; box-shadow: 0 12px 40px rgba(47, 38, 32, .22); z-index: 30; display: flex; flex-direction: column; gap: 8px; animation: gw-up .35s ease-out; }
.gw-pop h2 { font-size: 22px; padding-right: 28px; }
.gw-pop .label { color: var(--clay); }
.gw-pop .gw-signup .fields { grid-template-columns: 1fr; }
.gw-pop-close { position: absolute; top: 10px; right: 12px; border: 0; background: transparent; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }
@keyframes gw-up { from { transform: translateY(16px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .gw-pop { animation: none; } }
@media (max-width: 700px) {
  .signup { grid-template-columns: 1fr; }
  .gw-signup .fields { grid-template-columns: 1fr; }
}

/* Owner review note (remove before launch) */
.review { background: var(--note); color: var(--note-ink); border: 1px dashed currentColor; border-radius: var(--radius); padding: 14px 18px; font-size: 15px; max-width: var(--measure); }
.review b { display: block; }

/* Daily rhythm */
.rhythm { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.slot { padding: 16px; border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.slot:first-child { border-left: 0; }
.slot h3 { font-family: var(--body); font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.chip { display: block; font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--stack) 14%, var(--surface)); border-left: 4px solid var(--stack); }
.slot .none { font-size: 14px; color: var(--muted); }

/* Products */
.products { border-top: 1px solid var(--line); }
.product { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 10px 32px; padding-block: 26px; border-bottom: 1px solid var(--line); }
.product > div { min-width: 0; }
.brand { color: var(--muted); font-size: 15px; }
.cost { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px; }
.dose { display: inline-block; margin-top: 8px; background: var(--moss-tint); border-radius: 999px; padding: 3px 12px; font-size: 14px; font-weight: 500; }
.product .flow { gap: 10px; }
.evidence { color: var(--muted); font-size: 16px; }
.evidence b { color: var(--ink); font-weight: 600; }

/* Research depth meter: three layers, like the logo */
.depth { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); margin-top: 10px; }
.depth i { display: inline-flex; flex-direction: column; gap: 2px; }
.depth i::before, .depth i::after, .depth i span { content: ""; display: block; height: 4px; border-radius: 2px; background: var(--line); }
.depth i::before { width: 22px; } .depth i span { width: 17px; margin-left: 2.5px; } .depth i::after { width: 12px; margin-left: 5px; }
.depth[data-level="3"] i::before, .depth[data-level="3"] i span, .depth[data-level="3"] i::after,
.depth[data-level="2"] i span, .depth[data-level="2"] i::after,
.depth[data-level="1"] i::after { background: var(--stack); }

/* Cautions */
.cautions { background: var(--caution); color: var(--caution-ink); border-radius: var(--radius); padding: 24px 26px; }
.cautions h2 { color: var(--caution-ink); font-size: 26px; }
.cautions ul { margin: 0; padding-left: 20px; display: grid; gap: 8px; max-width: 72ch; }

/* FAQ */
.faq details { border-bottom: 1px solid var(--line); padding-block: 14px; max-width: 76ch; }
.faq summary { cursor: pointer; font-weight: 600; font-size: 18px; }
.faq details p { margin-top: 8px; color: var(--muted); }

/* Sources */
.sources ol { margin: 0; padding-left: 22px; display: grid; gap: 10px; font-size: 15px; color: var(--muted); max-width: 86ch; }
.reviewed { font-size: 14px; color: var(--muted); }

/* Stack cards and core tray */
.tray { display: grid; grid-template-columns: repeat(auto-fit, minmax(88px, 1fr)); gap: 14px; align-items: end; }
.tray a { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 10px; }
.tray a:hover .col { transform: translateY(-4px); }
.col { display: flex; flex-direction: column; gap: 4px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; transition: transform .2s ease; }
.col i { display: block; height: 22px; border-radius: 5px; background: var(--c); }
.col i:nth-child(2) { background: color-mix(in srgb, var(--c) 75%, var(--surface)); }
.col i:nth-child(3) { background: color-mix(in srgb, var(--c) 52%, var(--surface)); }
.col i:nth-child(4) { background: color-mix(in srgb, var(--c) 32%, var(--surface)); }
.col i:nth-child(5) { background: color-mix(in srgb, var(--c) 18%, var(--surface)); }
.tray span { font-size: 14px; font-weight: 600; line-height: 1.3; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; border-top: 6px solid var(--c); min-width: 0; }
.card h3 a { color: var(--ink); text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }
.card .meta { font-size: 14px; color: var(--muted); margin-top: auto; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.step { padding: 18px 20px; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }
.step b { display: block; font-family: var(--display); font-weight: 400; font-size: 19px; margin-bottom: 4px; }
.home-hero { padding-block: 48px 40px; display: grid; gap: 28px; }
.home-hero h1 { max-width: 16ch; }

/* Prose pages */
.prose { max-width: var(--measure); display: flex; flex-direction: column; gap: 16px; }
.prose h2 { margin-top: 18px; }
.prose ul, .prose ol { margin: 0; padding-left: 22px; display: grid; gap: 6px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 15px; background: var(--surface); }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; }
.ingredient { padding-block: 22px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; max-width: 80ch; scroll-margin-top: 16px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags a { font-size: 13px; text-decoration: none; padding: 2px 10px; border-radius: 999px; background: var(--moss-tint); color: var(--ink); }
.az { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 15px; }

/* Footer */
footer { background: var(--band); color: var(--band-ink); font-size: 14px; margin-top: 40px; }
footer .wrap { padding-block: 32px; display: grid; gap: 16px; }
footer a { color: var(--band-ink); }
footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 20px; }
footer .fdafoot { border-top: 1px solid #4A3E35; padding-top: 16px; max-width: 90ch; }

@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .rhythm { grid-auto-flow: row; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slot:nth-child(3) { border-left: 0; }
  .slot:nth-child(n+3) { border-top: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .product { grid-template-columns: 1fr; }
  .rhythm { grid-template-columns: 1fr; }
  .slot { border-left: 0; border-top: 1px solid var(--line); }
  .slot:first-child { border-top: 0; }
}
@media (prefers-reduced-motion: reduce) { .col { transition: none; } }
