/* ------------------------------------------------------------------
   AI Nutrition — shared design system
   Aesthetic: editorial botanical wellness
   Type: Fraunces (display) · Geist (body) · JetBrains Mono (labels)
   ------------------------------------------------------------------ */

:root {
    /* Warm-cream paper background, deep forest ink, honey accent */
    --paper:        #f3ede1;
    --paper-2:      #ede5d4;
    --card:         #fbf7ee;
    --ink:          #1c2a22;
    --ink-2:        #2f3d33;
    --muted:        #5a6a5e;
    --rule:         #d8cdb8;
    --leaf:         #2b5a3d;
    --leaf-deep:    #163826;
    --leaf-soft:    #cdddc7;
    --honey:        #c4863a;
    --honey-soft:   #e9c89a;
    --blush:        #e6c5b1;
    --danger:       #8a2a2a;
    --danger-soft:  #f3dad0;
    --ok:           #2b5a3d;
    --ok-soft:      #cfe1cf;

    --measure:      68ch;
    --shadow-card:  0 1px 0 rgba(28,42,34,.04), 0 18px 40px -28px rgba(28,42,34,.32);
    --shadow-soft:  0 1px 0 rgba(28,42,34,.04), 0 8px 22px -18px rgba(28,42,34,.28);

    color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
    font-family: 'Geist', 'Geist Variable', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 17px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--paper);
    background-image:
        radial-gradient(1100px 700px at 12% -10%, rgba(43,90,61,.10), transparent 60%),
        radial-gradient(900px 600px at 110% 10%, rgba(196,134,58,.10), transparent 55%),
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='280' height='280' viewBox='0 0 280 280'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .12  0 0 0 0 .18  0 0 0 0 .15  0 0 0 .035 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    background-attachment: fixed, fixed, fixed;
    background-size: auto, auto, 280px 280px;
    min-height: 100vh;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::selection { background: var(--leaf); color: #fff7e6; }

/* ---------- Typography ---------- */

h1, h2, h3, h4 {
    font-family: 'Fraunces', 'Newsreader', 'Cormorant Garamond', "Times New Roman", serif;
    font-weight: 460;
    font-variation-settings: "opsz" 144, "SOFT" 60, "WONK" 0;
    letter-spacing: -0.015em;
    color: var(--ink);
    margin: 0;
}

h1 { font-size: clamp(2.6rem, 6vw, 5.2rem); line-height: 0.98; font-weight: 380; }
h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); line-height: 1.08; font-weight: 420; }
h3 { font-size: 1.35rem; line-height: 1.2; font-weight: 500; }
h4 { font-size: 1.05rem; line-height: 1.25; font-weight: 600; }

p { margin: 0 0 1em; max-width: var(--measure); }
strong { font-weight: 600; color: var(--ink); }
em { font-style: italic; font-family: 'Fraunces', serif; font-variation-settings: "opsz" 96, "SOFT" 100; font-weight: 420; }

.serif        { font-family: 'Fraunces', serif; font-weight: 420; }
.serif-italic { font-family: 'Fraunces', serif; font-style: italic; font-variation-settings: "opsz" 96, "SOFT" 100; }
.mono         { font-family: 'JetBrains Mono', ui-monospace, "SF Mono", Menlo, monospace; }

.eyebrow {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.22em;
    color: var(--leaf);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.eyebrow::before {
    content: "";
    width: 28px;
    height: 1px;
    background: currentColor;
    display: inline-block;
}

a {
    color: var(--leaf);
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-size: 100% 1px;
    background-repeat: no-repeat;
    background-position: 0 100%;
    transition: color .2s ease, background-size .25s ease;
}
a:hover { color: var(--honey); background-size: 100% 2px; }

/* ---------- Layout ---------- */

.shell {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 32px;
}
.shell-narrow {
    max-width: 820px;
    margin: 0 auto;
    padding: 0 28px;
}

hr.rule {
    border: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--rule) 18%, var(--rule) 82%, transparent);
    margin: 56px 0;
}

/* ---------- Top bar ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 28px 0 18px;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: 14px;
    color: var(--ink);
}
.brand:hover { color: var(--ink); background: none; }
.brand-logo {
    width: 40px; height: 40px;
    border-radius: 11px;
    box-shadow: 0 6px 18px -8px rgba(22,56,38,.55), inset 0 0 0 1px rgba(255,255,255,.4);
}
.brand-text { line-height: 1.05; }
.brand-name {
    font-family: 'Fraunces', serif;
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.01em;
    font-variation-settings: "opsz" 144, "SOFT" 60;
}
.brand-mark {
    display: block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--muted);
    margin-top: 2px;
}

.topnav {
    display: flex;
    align-items: center;
    gap: 28px;
}
.topnav a {
    background: none;
    color: var(--ink-2);
    font-size: 14px;
}
.topnav a:hover { color: var(--leaf); background: none; }
.topnav .pill {
    border: 1px solid var(--ink);
    border-radius: 999px;
    padding: 8px 16px;
    color: var(--ink);
    font-weight: 500;
    transition: background .2s ease, color .2s ease;
}
.topnav .pill:hover { background: var(--ink); color: var(--paper); }

@media (max-width: 720px) {
    .topnav { gap: 16px; }
    .topnav a:not(.pill) { display: none; }
}

/* ---------- Buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 22px;
    border-radius: 999px;
    font-family: 'Geist', system-ui, sans-serif;
    font-weight: 500;
    font-size: 15px;
    cursor: pointer;
    border: 1px solid transparent;
    background: var(--ink);
    color: var(--paper);
    transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
    text-decoration: none;
}
.btn:hover { background: var(--leaf-deep); color: #fff; transform: translateY(-1px); }
.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--ink);
}
.btn-ghost:hover { background: var(--ink); color: var(--paper); }
.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover { background: #6b1f1f; color: #fff; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */

.card {
    background: var(--card);
    border-radius: 18px;
    padding: 40px;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(216,205,184,.5);
}
.card-tight { padding: 28px; border-radius: 14px; }

/* ---------- Footer ---------- */

.foot {
    margin-top: 96px;
    padding: 56px 0 48px;
    border-top: 1px solid var(--rule);
}
.foot-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 48px;
}
.foot-grid h4 {
    font-family: 'JetBrains Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 14px;
    font-weight: 500;
}
.foot-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.foot-grid a { background: none; color: var(--ink-2); font-size: 15px; }
.foot-grid a:hover { color: var(--leaf); }
.foot-bottom {
    margin-top: 48px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    color: var(--muted);
    font-size: 13px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.04em;
}
.foot-tag {
    font-family: 'Fraunces', serif;
    font-style: italic;
    font-size: 16px;
    color: var(--leaf);
    max-width: 36ch;
    margin-top: 8px;
    font-variation-settings: "opsz" 96, "SOFT" 100;
}

@media (max-width: 720px) {
    .foot-grid { grid-template-columns: 1fr 1fr; }
    .foot-bottom { flex-direction: column; gap: 10px; }
}

/* ---------- Editorial article styling ---------- */

.legal article {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 64px 0 32px;
}
.legal h1 {
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    margin-bottom: 12px;
}
.legal h2 {
    margin-top: 56px;
    margin-bottom: 12px;
    font-size: 1.55rem;
    font-weight: 460;
    display: flex;
    align-items: baseline;
    gap: 18px;
}
.legal h2 .num {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--honey);
    letter-spacing: 0.15em;
    transform: translateY(-4px);
    font-weight: 500;
}
.legal p, .legal li { color: var(--ink-2); font-size: 17px; }
.legal ul { padding-left: 22px; }
.legal ul li { margin-bottom: 8px; }
.legal .meta {
    display: flex;
    gap: 24px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--muted);
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--rule);
}
.legal .meta span strong { color: var(--ink); font-weight: 500; }
.legal .lede {
    font-family: 'Fraunces', serif;
    font-size: clamp(1.15rem, 1.6vw, 1.45rem);
    line-height: 1.45;
    color: var(--ink);
    font-weight: 420;
    margin-bottom: 36px;
    font-variation-settings: "opsz" 96, "SOFT" 80;
}
.legal .lede::first-letter {
    font-family: 'Fraunces', serif;
    font-size: 3.4em;
    line-height: 0.88;
    float: left;
    margin: 0.05em 0.12em -0.05em 0;
    color: var(--leaf);
    font-weight: 420;
    font-variation-settings: "opsz" 144, "SOFT" 40;
}

/* ---------- Skip link & accessibility ---------- */

.skip {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
.skip:focus {
    position: fixed;
    left: 12px; top: 12px;
    width: auto; height: auto;
    padding: 10px 14px;
    background: var(--ink);
    color: var(--paper);
    border-radius: 8px;
    z-index: 999;
}

/* ---------- Utilities ---------- */
.text-muted { color: var(--muted); }
.center { text-align: center; }
.stack-12 > * + * { margin-top: 12px; }
.stack-24 > * + * { margin-top: 24px; }
.stack-48 > * + * { margin-top: 48px; }
