/* Recipe Keeper — one stylesheet for user, admin and print views.
   Type: Atkinson Hyperlegible (UI, readable at arm's length in a kitchen) + Literata (recipe titles). */

:root {
    --bg: #f1f4f0;
    --surface: #ffffff;
    --ink: #17211b;
    --muted: #56635b;
    --line: #d2dbd4;
    --herb: #2d6a49;
    --herb-ink: #ffffff;
    --herb-soft: #dceade;
    --tomato: #a8372a;
    --tomato-soft: #f6e1dd;
    --mustard: #e3b23c;
    --mustard-soft: #fbf0d3;
    --radius-s: 6px;
    --radius-l: 14px;
    --ui: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
    --serif: "Literata", Georgia, "Times New Roman", serif;
    --step: clamp(1.02rem, 0.98rem + 0.2vw, 1.12rem);
}

/* Dark colours: used when the device prefers dark (unless the person picked Light), or when they picked Dark. */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #121814;
        --surface: #1b231e;
        --ink: #e6ece7;
        --muted: #9fb0a5;
        --line: #2f3b33;
        --herb: #6fbf92;
        --herb-ink: #0e1a13;
        --herb-soft: #23382b;
        --tomato: #f08b7c;
        --tomato-soft: #3a2421;
        --mustard: #e9c063;
        --mustard-soft: #3a3220;
    }
}
:root[data-theme="dark"] {
    --bg: #121814;
    --surface: #1b231e;
    --ink: #e6ece7;
    --muted: #9fb0a5;
    --line: #2f3b33;
    --herb: #6fbf92;
    --herb-ink: #0e1a13;
    --herb-soft: #23382b;
    --tomato: #f08b7c;
    --tomato-soft: #3a2421;
    --mustard: #e9c063;
    --mustard-soft: #3a3220;
}
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font: 400 var(--step)/1.55 var(--ui);
}
img { max-width: 100%; display: block; }
a { color: var(--herb); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--mustard); outline-offset: 2px; border-radius: 3px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font: 600 clamp(1.7rem, 1.3rem + 1.6vw, 2.5rem)/1.15 var(--serif); letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Top bar ---------------------------------------------------------------- */
.topbar {
    display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
    padding: 0.8rem clamp(1rem, 4vw, 2.5rem);
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}
.brand { font: 600 1.3rem/1 var(--serif); color: var(--ink); text-decoration: none; margin-right: auto; }
.nav { display: flex; gap: 0.25rem; align-items: center; flex-wrap: wrap; }
.nav a, .nav button.linklike {
    padding: 0.45rem 0.75rem; border-radius: var(--radius-s); text-decoration: none; color: var(--ink);
}
.nav a[aria-current="page"] { background: var(--herb-soft); }
.nav a:hover { background: var(--herb-soft); }
.wrap { max-width: 1180px; margin: 0 auto; padding: clamp(1rem, 3vw, 2rem) clamp(1rem, 4vw, 2.5rem) 4rem; }
.narrow { max-width: 760px; }

/* ---- Buttons & forms ----------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    padding: 0.62rem 1.05rem; min-height: 44px;
    border-radius: var(--radius-s); border: 1px solid var(--herb);
    background: var(--herb); color: var(--herb-ink);
    font: 600 1rem/1 var(--ui); text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.07); }
.btn.secondary { background: transparent; color: var(--herb); }
.btn.danger { background: transparent; border-color: var(--tomato); color: var(--tomato); }
.btn.small { min-height: 34px; padding: 0.35rem 0.7rem; font-size: 0.9rem; }
.linklike { background: none; border: 0; padding: 0; color: var(--herb); font: inherit; cursor: pointer; text-decoration: underline; }
form.inline { display: inline; }

label { display: block; font-weight: 700; margin: 0 0 0.3rem; }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.9rem; }
input[type=text], input[type=url], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
    width: 100%; padding: 0.6rem 0.75rem; min-height: 44px;
    border: 1px solid var(--line); border-radius: var(--radius-s);
    background: var(--surface); color: var(--ink); font: inherit;
}
textarea { min-height: 9rem; line-height: 1.5; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--herb); outline: 2px solid var(--herb-soft); }
.field { margin-bottom: 1.1rem; }
.row { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.notice { padding: 0.75rem 1rem; border-radius: var(--radius-s); margin-bottom: 1.25rem; border-left: 4px solid var(--herb); background: var(--herb-soft); }
.notice.error { border-color: var(--tomato); background: var(--tomato-soft); }

/* ---- Library ------------------------------------------------------------------ */
.library-head { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; margin-bottom: 1.25rem; }
.library-head h1 { margin: 0 auto 0 0; }
.search { display: flex; gap: 0.5rem; flex: 1 1 320px; max-width: 520px; }
.filters { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1.5rem; }
.chip {
    padding: 0.3rem 0.75rem; border-radius: 999px; border: 1px solid var(--line);
    background: var(--surface); color: var(--ink); text-decoration: none; font-size: 0.92rem;
}
.chip[aria-current="true"] { background: var(--ink); border-color: var(--ink); color: var(--surface); }

.grid { display: grid; gap: 1.25rem 1rem; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tile { text-decoration: none; color: var(--ink); display: block; }
.tile .photo {
    aspect-ratio: 4 / 3; border-radius: var(--radius-l); overflow: hidden;
    background: var(--herb-soft); display: grid; place-items: center;
}
.tile .photo img { width: 100%; height: 100%; object-fit: cover; }
.tile .photo .initial { font: 600 2.6rem/1 var(--serif); color: var(--herb); }
.tile h2 { font: 600 1.06rem/1.3 var(--serif); margin: 0.6rem 0 0.15rem; }
.tile:hover h2 { text-decoration: underline; text-underline-offset: 0.18em; }
.tile .meta { font-size: 0.86rem; color: var(--muted); }
.badge { display: inline-block; font-size: 0.78rem; padding: 0.05rem 0.45rem; border-radius: 4px; background: var(--herb-soft); color: var(--ink); }
.badge.warn { background: var(--mustard-soft); }
.badge.bad { background: var(--tomato-soft); }

.empty { padding: 3rem 1rem; text-align: center; border: 2px dashed var(--line); border-radius: var(--radius-l); }

/* ---- Recipe page ------------------------------------------------------------------ */
.recipe-head { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; margin-bottom: 2rem; }
.recipe-head .hero { border-radius: var(--radius-l); overflow: hidden; aspect-ratio: 4 / 3; }
.recipe-head .hero img { width: 100%; height: 100%; object-fit: cover; }
.facts { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; margin: 1rem 0; padding: 0; list-style: none; }
.facts li strong { display: block; font-size: 0.82rem; color: var(--muted); font-weight: 400; }
.source { font-size: 0.92rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }

.cook { display: grid; gap: 2.5rem; grid-template-columns: minmax(240px, 0.8fr) minmax(0, 1.6fr); }
.cook h2 { font: 600 1.35rem/1.2 var(--serif); padding-bottom: 0.4rem; border-bottom: 2px solid var(--ink); }
.cook h3 { margin-top: 1.25rem; color: var(--muted); font-size: 0.98rem; }

/* Ingredients: tap to tick off while cooking. */
.ingredients { list-style: none; padding: 0; margin: 0; }
.ingredients li { border-bottom: 1px solid var(--line); }
.ingredients label { display: flex; gap: 0.7rem; align-items: baseline; font-weight: 400; margin: 0; padding: 0.55rem 0; cursor: pointer; }
.ingredients input { width: 1.15rem; height: 1.15rem; accent-color: var(--herb); flex: none; transform: translateY(0.15rem); }
.ingredients input:checked + span { text-decoration: line-through; color: var(--muted); }

/* Method: the steps are a real sequence, so they get big numbers. */
.cook section { counter-reset: step; }
.steps { list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 3rem 1fr; gap: 0.5rem; padding: 0.85rem 0; border-bottom: 1px solid var(--line); max-width: 68ch; }
.steps li::before { content: counter(step); font: 600 1.9rem/1 var(--serif); color: var(--herb); }
.steps .timer { display: inline-block; margin-top: 0.3rem; font-size: 0.85rem; color: var(--muted); }
.notes { margin-top: 2rem; padding: 1rem 1.25rem; background: var(--mustard-soft); border-radius: var(--radius-l); max-width: 68ch; white-space: pre-line; }

.panel { margin-top: 3rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.panel h2 { font-size: 1.1rem; }
.share-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.share-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.flagbar { padding: 0.75rem 1rem; background: var(--mustard-soft); border-radius: var(--radius-s); margin-bottom: 1rem; }

/* ---- Import ------------------------------------------------------------------------ */
.import-box { padding: clamp(1.25rem, 3vw, 2rem); background: var(--surface); border-radius: var(--radius-l); border: 1px solid var(--line); }
.or { display: flex; align-items: center; gap: 1rem; color: var(--muted); margin: 1.5rem 0; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---- Tables (admin) --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 0.94rem; }
th, td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 700; color: var(--muted); font-size: 0.85rem; background: var(--bg); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.thumb { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; background: var(--herb-soft); }

/* ---- Admin shell --------------------------------------------------------------------- */
.admin-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.admin-nav { background: var(--ink); color: var(--surface); padding: 1.25rem 0.75rem; }
.admin-nav .brand { color: var(--surface); display: block; margin: 0 0.5rem 1.5rem; }
.admin-nav a { display: block; color: var(--surface); text-decoration: none; padding: 0.5rem 0.75rem; border-radius: var(--radius-s); opacity: 0.85; }
.admin-nav a:hover, .admin-nav a[aria-current="page"] { background: rgba(255, 255, 255, 0.12); opacity: 1; }
.admin-nav hr { border: 0; border-top: 1px solid rgba(255, 255, 255, 0.18); margin: 1rem 0.5rem; }
.admin-main { padding: clamp(1rem, 3vw, 2rem); max-width: 1200px; }
.stats { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 2rem; }
.stat { padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.stat b { display: block; font: 600 1.8rem/1.1 var(--serif); }
.stat a { color: inherit; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { display: grid; grid-template-columns: 1.5rem 11rem 1fr; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.ok { color: var(--herb); }
.bad { color: var(--tomato); }
.log { font: 0.8rem/1.45 ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1rem; overflow-x: auto; white-space: pre; max-height: 320px; }
.two-col { display: grid; gap: 2rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.copybox { padding: 1rem; border: 2px solid var(--herb); border-radius: var(--radius-l); background: var(--herb-soft); margin-bottom: 1.5rem; word-break: break-all; }

/* ---- Sign-in page -------------------------------------------------------------------- */
.signin {
    min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
    background:
        radial-gradient(circle at 85% 12%, var(--herb-soft) 0 18%, transparent 18.2%),
        radial-gradient(circle at 10% 92%, var(--mustard-soft) 0 14%, transparent 14.2%),
        var(--bg);
}
.signin-card { width: min(100%, 400px); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 2.25rem 2rem; }
.signin-card h1 { font-size: 2.3rem; margin-bottom: 0.3rem; }
.signin-card .lede { color: var(--muted); margin-bottom: 1.75rem; }
.provider {
    display: flex; align-items: center; justify-content: center; gap: 0.65rem;
    width: 100%; min-height: 50px; margin-bottom: 0.75rem;
    border-radius: 10px; font: 600 1.02rem/1 var(--ui); text-decoration: none; cursor: pointer;
}
.provider svg { width: 20px; height: 20px; flex: none; }
.provider.apple { background: #000; color: #fff; border: 1px solid #000; }
.provider.google { background: #fff; color: #1f1f1f; border: 1px solid #747775; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .provider.apple { background: #fff; color: #000; border-color: #fff; } }
:root[data-theme="dark"] .provider.apple { background: #fff; color: #000; border-color: #fff; }
.signin details { margin-top: 1.5rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.signin summary { cursor: pointer; color: var(--muted); font-size: 0.92rem; }
.signin .fineprint { margin-top: 1.5rem; font-size: 0.85rem; color: var(--muted); }

/* ---- Small screens ------------------------------------------------------------------- */
@media (max-width: 820px) {
    .recipe-head, .cook { grid-template-columns: 1fr; }
    .admin-shell { grid-template-columns: 1fr; }
    .admin-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; padding: 0.75rem; }
    .admin-nav .brand { width: 100%; margin-bottom: 0.5rem; }
    .admin-nav hr { display: none; }
    .checks li { grid-template-columns: 1.5rem 1fr; }
    .checks li span:last-child { grid-column: 2; }
}

@media (prefers-reduced-motion: no-preference) {
    .ingredients input:checked + span { transition: color 0.2s; }
}

/* ---- Print / "Save as PDF" ------------------------------------------------------------ */
@media print {
    @page { margin: 16mm 14mm; }
    :root, :root[data-theme] { --ink: #000; --muted: #444; --line: #bbb; --herb: #000; --bg: #fff; --surface: #fff; --herb-soft: #eee; --mustard-soft: #f6f6f6; --tomato-soft: #f6f6f6; --herb-ink: #fff; color-scheme: light; }
    body { font-size: 10.5pt; background: #fff; }
    .topbar, .actions, .panel, .noprint, .flagbar { display: none !important; }
    .wrap { padding: 0; max-width: none; }
    .recipe-head { grid-template-columns: 1fr 0.7fr; gap: 8mm; margin-bottom: 6mm; }
    .recipe-head .hero { aspect-ratio: 4 / 3; border-radius: 3mm; }
    h1 { font-size: 22pt; }
    .cook { grid-template-columns: 0.75fr 1.5fr; gap: 8mm; }
    .cook h2 { font-size: 13pt; }
    .ingredients label { padding: 1.2mm 0; }
    .ingredients input { display: none; }
    .steps li { grid-template-columns: 8mm 1fr; padding: 2mm 0; break-inside: avoid; }
    .steps li::before { font-size: 14pt; }
    .notes { background: none; border: 1px solid #bbb; }
    a { color: #000; text-decoration: none; }
    .print-footer { display: block !important; margin-top: 8mm; font-size: 8.5pt; color: #444; border-top: 1px solid #bbb; padding-top: 2mm; }
}
.print-footer { display: none; }

/* ---- Utilities (no inline styles: the CSP blocks them) ---- */
.align-end { align-items: end; }
.gap-bottom { margin-bottom: 1.25rem; }
.gap-top-s { margin-top: 0.5rem; }
.gap-top { margin-top: 1rem; }
.gap-top-m { margin-top: 1.5rem; }
.gap-top-l { margin-top: 2rem; }
.pad-y { padding: 3rem 0; }
.btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
textarea.short { min-height: 4.5rem; }
.cell-wide { max-width: 340px; }
.linklike.navbutton { color: inherit; text-decoration: none; padding: 0.45rem 0.75rem; }
.admin-nav .linklike.navbutton { padding: 0.5rem 0.75rem; opacity: 0.85; }
.admin-nav .linklike.navbutton:hover { opacity: 1; }

/* ---- Welcome / public pages ---- */
.welcome { display: grid; gap: clamp(1.5rem, 4vw, 3.5rem); grid-template-columns: minmax(0, 1.25fr) minmax(300px, 400px); align-items: start; padding-top: clamp(0.5rem, 3vw, 2rem); }
.welcome-intro h1 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.3rem); max-width: 16ch; margin-bottom: 0.6rem; }
.welcome-intro .lede { font-size: 1.15rem; color: var(--muted); max-width: 46ch; margin-bottom: 2rem; }
.welcome .signin-card { width: 100%; }
.welcome .signin-card h2 { font: 600 1.4rem/1.2 var(--serif); margin-bottom: 1rem; }

/* The share code entry: the one bold element on the front page. */
.codecard { padding: 1.5rem; border-radius: var(--radius-l); background: var(--herb); color: var(--herb-ink); max-width: 560px; }
.codecard label { color: var(--herb-ink); font-size: 1.05rem; margin-bottom: 0.7rem; }
.codecard .muted { color: var(--herb-ink); opacity: 0.85; margin: 0.7rem 0 0; }
.codecard .btn { background: var(--herb-ink); color: var(--herb); border-color: var(--herb-ink); }
.codebox-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.codebox-row input {
    flex: 1 1 12rem; min-height: 52px; font: 700 1.45rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace;
    letter-spacing: 0.12em; text-transform: uppercase; text-align: center;
}
.codebox-row input::placeholder { color: var(--line); letter-spacing: 0.12em; }
.codebox-row .btn { min-height: 52px; }
.codebox-inline { margin: -0.5rem 0 1.25rem; }
.codebox-inline summary { cursor: pointer; color: var(--herb); font-weight: 700; }
.codebox-inline .codebox { margin-top: 0.75rem; max-width: 520px; }

.auth-narrow { max-width: 440px; margin: clamp(0.5rem, 4vw, 3rem) auto 0; }
.panel-plain { padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.btn.wide { width: 100%; }
.code-input { font: 700 1.6rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.35em; text-align: center; }

/* Owner's share code display */
.sharecode-block { padding: 1rem 0 0.5rem; }
.sharecode { font: 700 clamp(2rem, 1.5rem + 2vw, 2.8rem)/1 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.1em; margin: 0.25rem 0 0.5rem; color: var(--herb); }
.sharelink { word-break: break-all; }
.panel h3 { margin-top: 1.5rem; }
.panel details summary { cursor: pointer; color: var(--herb); font-weight: 700; }

/* Banner on a shared recipe */
.sharedbar { padding: 1rem 1.25rem; margin-bottom: 1.5rem; border-radius: var(--radius-l); background: var(--herb-soft); border-left: 5px solid var(--herb); }
.sharedbar p { margin: 0 0 0.6rem; }
.sharedbar .btn-row { margin-bottom: 0.4rem; }

@media (max-width: 820px) {
    .welcome { grid-template-columns: 1fr; }
}

/* ======================= Landing page ======================= */
body.landing { background: var(--surface); }
.landing-bar { position: sticky; top: 0; z-index: 5; }
.landing-bar .nav a:not(.btn) { color: var(--ink); }
.landing main { overflow-x: clip; }
.section, .landing .hero, .band-inner { max-width: 1180px; margin: 0 auto; padding: clamp(3rem, 7vw, 5.5rem) clamp(1rem, 4vw, 2.5rem); }
.section h2, .band h2 { font: 600 clamp(1.6rem, 1.2rem + 1.6vw, 2.4rem)/1.15 var(--serif); margin-bottom: 0.6rem; }
.section-lede { color: var(--muted); max-width: 60ch; font-size: 1.08rem; margin-bottom: 2rem; }
.band { background: var(--bg); }
.band-herb { background: var(--herb); color: var(--herb-ink); }
.band-herb h2, .band-herb p { color: var(--herb-ink); }

/* Hero */
.landing .hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; padding-top: clamp(2.5rem, 6vw, 4.5rem); }
.landing .hero h1 { font-size: clamp(2.4rem, 1.5rem + 3.6vw, 4.2rem); line-height: 1.04; letter-spacing: -0.02em; max-width: 15ch; margin-bottom: 1rem; }
.landing .hero .lede { font-size: clamp(1.08rem, 1rem + 0.3vw, 1.25rem); color: var(--muted); max-width: 46ch; margin-bottom: 1.75rem; }
.hero-note { font-size: 0.92rem; color: var(--muted); margin: 0.75rem 0 1.5rem; }
.hero-code summary { cursor: pointer; font-weight: 700; color: var(--herb); }
.hero-code .codebox { margin-top: 0.75rem; max-width: 520px; }

/* The big link box (landing hero and Create page) */
.linkbox label { font-weight: 700; display: block; margin-bottom: 0.5rem; }
.linkbox-row { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.linkbox-row input { flex: 1 1 16rem; min-height: 56px; font-size: 1.1rem; padding: 0 1rem; border: 2px solid var(--ink); border-radius: 12px; }
.linkbox-row input:focus { border-color: var(--herb); outline: 3px solid var(--herb-soft); }
.linkbox-row .btn { min-height: 56px; padding: 0 1.5rem; border-radius: 12px; font-size: 1.05rem; }
.hero-linkbox { max-width: 600px; }

/* Phone mock-up built from the real recipe styles */
.hero-visual { position: relative; justify-self: center; padding: 1rem 2.5rem; }
.phone { width: min(300px, 72vw); aspect-ratio: 9 / 18.5; border-radius: 42px; background: #111; padding: 11px; box-shadow: 0 30px 60px -20px rgba(23, 33, 27, 0.45); transform: rotate(2deg); }
.phone-screen { height: 100%; border-radius: 32px; overflow: hidden; background: #fff; color: #17211b; font-size: 12.5px; }
.demo-photo { height: 34%; }
.demo-photo-loaf {
    background:
        radial-gradient(circle at 26% 34%, #f6e27a 0 9%, #e9c63f 9.5% 11%, transparent 11.5%),
        radial-gradient(circle at 72% 62%, #f6e27a 0 8%, #e9c63f 8.5% 10%, transparent 10.5%),
        radial-gradient(ellipse 34% 20% at 50% 60%, #f3d79a 0 72%, #d9a85a 74% 100%, transparent 101%),
        radial-gradient(ellipse 44% 30% at 50% 66%, #ffffff 0 92%, transparent 94%),
        linear-gradient(160deg, #dceadf 0%, #cfe3d4 100%);
    background-color: #cfe3d4;
}
.demo-body { padding: 12px 16px; }
.demo-title { font: 600 19px/1.15 var(--serif); margin: 0 0 2px; }
.demo-meta { color: #56635b; margin: 0 0 10px; }
.demo-h { font-weight: 700; margin: 10px 0 4px; border-bottom: 1.5px solid #17211b; padding-bottom: 3px; }
.demo-ing { list-style: none; padding: 0; margin: 0; }
.demo-ing li { padding: 4px 0 4px 20px; border-bottom: 1px solid #e3e9e4; position: relative; }
.demo-ing li::before { content: ""; position: absolute; left: 0; top: 6px; width: 11px; height: 11px; border: 1.5px solid #8a978f; border-radius: 3px; }
.demo-ing li.done { color: #8a978f; text-decoration: line-through; }
.demo-ing li.done::before { background: #2d6a49; border-color: #2d6a49; }
.demo-steps { padding-left: 18px; margin: 0; }
.demo-steps li { padding: 3px 0; }
.demo-steps li::marker { color: #2d6a49; font-weight: 700; }
.float-card { position: absolute; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; padding: 0.55rem 0.85rem; font-size: 0.85rem; box-shadow: 0 12px 30px -12px rgba(23, 33, 27, 0.35); }
.float-card strong { display: block; font: 700 1.05rem/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--herb); }
.float-code { left: -1rem; bottom: 4%; transform: rotate(-3deg); }
.float-timer { right: -0.5rem; top: 16%; transform: rotate(3deg); }

/* Before / after */
.before-after { display: grid; grid-template-columns: 1fr auto 1fr; gap: 1.5rem; align-items: center; }
.before-after figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.25rem; min-height: 320px; position: relative; }
.before-after figcaption { margin-top: 1rem; font-weight: 700; font-size: 0.95rem; }
.before figcaption { color: var(--tomato); }
.after figcaption { color: var(--herb); }
.ba-arrow { font: 600 2rem/1 var(--serif); color: var(--herb); }
.mock-ad { background: repeating-linear-gradient(45deg, #f2e6c9, #f2e6c9 8px, #ecdcb5 8px, #ecdcb5 16px); color: #8a7440; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; display: grid; place-items: center; height: 44px; border-radius: 6px; margin: 0.6rem 0; }
.mock-ad.tall { height: 70px; }
.mock-lines span { display: block; height: 9px; background: #e2e7e3; border-radius: 4px; margin: 7px 0; }
.mock-lines span.short { width: 60%; }
.mock-popup { position: absolute; right: 1.25rem; top: 42%; background: var(--surface); border: 2px solid var(--ink); border-radius: 10px; padding: 0.6rem 2rem 0.6rem 0.8rem; font-weight: 700; font-size: 0.85rem; box-shadow: 0 10px 24px -10px rgba(0,0,0,0.4); }
.mock-popup span { position: absolute; right: 0.6rem; top: 0.35rem; color: var(--muted); }
.after .demo-title { font-size: 1.35rem; }
.after-cols { display: grid; grid-template-columns: 0.9fr 1.3fr; gap: 1.25rem; font-size: 0.92rem; }

/* How it works: a real sequence, so numbered */
.how { list-style: none; padding: 0; margin: 2rem 0 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; counter-reset: how; }
.how li { counter-increment: how; }
.how li::before { content: counter(how); display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%; background: var(--herb); color: var(--herb-ink); font: 600 1.25rem/1 var(--serif); margin-bottom: 0.9rem; }
.how h3 { font-size: 1.15rem; }
.how p { color: var(--muted); }

/* Ways to add */
.ways { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 2rem; }
.way { padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); }
.way h3 { font-size: 1.05rem; margin: 0.6rem 0 0.3rem; }
.way p { color: var(--muted); margin: 0; font-size: 0.95rem; }
.way-icon, .create-icon { display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; border-radius: 10px; background: var(--herb-soft); color: var(--herb); }
.way-icon svg, .create-icon svg { width: 1.3rem; height: 1.3rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Share band */
.share-band { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2.5rem; align-items: center; }
.share-band .codecard { background: var(--surface); color: var(--ink); }
.share-band .codecard label { color: var(--ink); }
.share-band .codecard .btn { background: var(--herb); color: var(--herb-ink); border-color: var(--herb); }

/* Features */
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.75rem 2rem; margin-top: 2rem; }
.features h3 { font-size: 1.05rem; padding-top: 0.9rem; border-top: 3px solid var(--herb); }
.features p { color: var(--muted); }

/* Sign up */
.signup-section { display: grid; grid-template-columns: 1fr minmax(300px, 420px); gap: 3rem; align-items: start; border-top: 1px solid var(--line); }
.signup-pitch p { color: var(--muted); font-size: 1.08rem; max-width: 42ch; }

/* FAQ */
.faq { max-width: 820px; }
.faq details { border-bottom: 1px solid var(--line); padding: 1rem 0; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 1.08rem; }
.faq details p { color: var(--muted); margin: 0.6rem 0 0; }

.landing-footer { background: var(--ink); color: var(--surface); padding: 2rem clamp(1rem, 4vw, 2.5rem); font-size: 0.92rem; }
.landing-footer p { max-width: 1180px; margin: 0 auto 0.4rem; opacity: 0.85; }
.landing-footer a { color: var(--surface); }

/* Sign-in card heading is always the small size, whatever section it sits in */
.section .signin-card h2, .signin-card h2 { font: 600 1.4rem/1.2 var(--serif); margin-bottom: 1rem; }

/* Sign-in page */
.login-page { max-width: 440px; margin: clamp(1rem, 5vw, 3rem) auto; }
.login-page .signin-card { width: 100%; }
.login-code { margin-top: 1.5rem; }

/* Create page */
.shortcut { margin-top: 1.25rem; padding: 0.9rem 1.1rem; background: var(--mustard-soft); border-radius: var(--radius-l); }
.shortcut code { font-size: 0.95em; background: var(--surface); padding: 0.05rem 0.3rem; border-radius: 4px; word-break: break-all; }
.shortcut .small { display: block; margin-top: 0.3rem; }
.create-options { display: grid; gap: 0.75rem; }
.create-option { display: block; padding: 1rem 1.15rem; border: 1px solid var(--line); border-radius: var(--radius-l); background: var(--surface); color: var(--ink); text-decoration: none; }
a.create-option:hover, .create-option summary:hover strong { color: var(--herb); }
.create-option summary { cursor: pointer; list-style: none; }
.create-option summary::-webkit-details-marker { display: none; }
.create-option > strong, .create-option summary strong { display: block; font-size: 1.05rem; margin-top: 0.5rem; }
.create-option > span:not(.create-icon), .create-option summary > span:not(.create-icon) { color: var(--muted); font-size: 0.95rem; }
.create-option form { margin-top: 1rem; }
.dictate.listening { background: var(--tomato); border-color: var(--tomato); color: #fff; }

@media (max-width: 900px) {
    .landing .hero, .share-band, .signup-section { grid-template-columns: 1fr; }
    .landing .hero { padding-top: 1.75rem; }
    .hero-visual { padding: 0.5rem 2.5rem 1rem; }
    .phone { width: min(230px, 60vw); }
    .float-code { bottom: -2%; }
    .before-after { grid-template-columns: 1fr; }
    .ba-arrow { transform: rotate(90deg); justify-self: center; }
    .how, .ways, .features { grid-template-columns: 1fr; }
    .after-cols { grid-template-columns: 1fr; }
    .landing-bar .nav a[href^="#"] { display: none; }
}

/* Two-step setup */
.setup-steps { padding-left: 1.25rem; }
.setup-steps li { margin-bottom: 0.75rem; }
.qr { margin: 0.75rem 0; }
.qr img { image-rendering: pixelated; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.setup-key { font-size: 1.05rem; letter-spacing: 0.06em; word-break: break-all; }

/* Portions and units */
.scaler { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; margin: 0 0 0.75rem; }
.scaler-portions { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.step-btn { width: 40px; height: 40px; border: 0; background: none; font: 700 1.2rem/1 var(--ui); color: var(--herb); cursor: pointer; border-radius: 999px; }
.step-btn:hover { background: var(--herb-soft); }
.scaler-value { min-width: 7.5rem; text-align: center; font-weight: 700; }
.unit-select { width: auto; min-height: 40px; border-radius: 999px; padding: 0 0.9rem; }
button.timer { background: var(--herb-soft); border: 0; border-radius: 999px; padding: 0.2rem 0.7rem; margin-top: 0.35rem; font: 600 0.85rem var(--ui); color: var(--ink); cursor: pointer; }
button.timer.running { background: var(--mustard); }
@media print { .scaler { display: none !important; } }

/* Collections */
.filters { align-items: center; margin-bottom: 0.6rem; }
.filters-label { font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-right: 0.25rem; }
.filters-label:not(:first-child) { margin-left: 0.75rem; }
.chip-folder::before { content: "▤ "; color: var(--herb); }
.chip-n { color: var(--muted); font-size: 0.8em; }
.chip[aria-current="true"] .chip-n { color: inherit; opacity: 0.75; }
.chip-add { border-style: dashed; color: var(--herb); }
.chip-tag { color: var(--muted); }
.collection-list { list-style: none; padding: 0; margin: 0; }
.collection-list li { padding: 0.85rem 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 0.25rem 1rem; align-items: baseline; }
.collection-list details { grid-column: 1 / -1; }
.collection-list summary { cursor: pointer; font-size: 0.9rem; color: var(--herb); }
.collection-name { font: 600 1.15rem/1.3 var(--serif); color: var(--ink); text-decoration: none; }
.check-list { list-style: none; padding: 0; margin: 0 0 0.75rem; columns: 2 14rem; }
.check-list label { font-weight: 400; display: flex; gap: 0.5rem; align-items: center; }

/* Shopping list */
.add-item { display: flex; gap: 0.5rem; margin: 0.5rem 0 0.4rem; }
.add-item input { flex: 1; min-height: 50px; font-size: 1.05rem; }
.aisle { margin-top: 1.5rem; }
.aisle h2 { font: 700 0.85rem/1 var(--ui); text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 0.4rem; }
.shop-items { list-style: none; padding: 0; margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.shop-items li { display: flex; align-items: center; gap: 0.5rem; border-bottom: 1px solid var(--line); padding: 0 0.75rem; }
.shop-items li:last-child { border-bottom: 0; }
.shop-toggle { flex: 1; display: flex; align-items: center; gap: 0.75rem; min-height: 52px; }
.tick { width: 26px; height: 26px; flex: none; border: 2px solid var(--muted); border-radius: 50%; background: var(--surface); cursor: pointer; padding: 0; }
.tick[aria-pressed="true"] { background: var(--herb) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12l5 5 9-10' fill='none' stroke='white' stroke-width='3'/%3E%3C/svg%3E") center/16px no-repeat; border-color: var(--herb); }
.shop-text { cursor: pointer; }
.shop-note { display: block; font-size: 0.8rem; color: var(--muted); }
.shop-items li.done .shop-text { text-decoration: line-through; color: var(--muted); }
.shop-del .linklike { font-size: 0.85rem; color: var(--muted); }
.aisle-done .shop-items { opacity: 0.8; }
.add-to-list { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; padding-bottom: 1.25rem; margin-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.add-to-list select { width: auto; }

/* Journal */
.journal-add > summary { list-style: none; display: inline-flex; }
.journal-add > summary::-webkit-details-marker { display: none; }
.journal-add[open] > summary { display: none; }
.stars { border: 0; padding: 0; margin: 0; display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 0.15rem; }
.stars legend { font-weight: 700; margin-bottom: 0.3rem; float: left; width: 100%; }
.stars input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.stars label { font-size: 1.9rem; line-height: 1; color: var(--line); cursor: pointer; margin: 0; }
.stars input:checked ~ label, .stars label:hover, .stars label:hover ~ label { color: var(--mustard); }
.stars input:focus-visible + label { outline: 3px solid var(--mustard); border-radius: 4px; }
.stars-shown { color: var(--mustard); letter-spacing: 0.05em; margin-left: 0.4rem; }
.stars-shown .muted { color: var(--line); }
.journal-list { list-style: none; padding: 0; margin: 1rem 0 0; }
.journal-list li { display: flex; gap: 1rem; padding: 0.9rem 0; border-top: 1px solid var(--line); }
.journal-photo { width: 96px; height: 72px; object-fit: cover; border-radius: 8px; flex: none; }
.journal-notes { margin: 0.35rem 0 0.25rem; white-space: pre-line; }
.cooked-badge { display: inline-block; font-size: 0.85rem; background: var(--mustard-soft); border-radius: 999px; padding: 0.15rem 0.7rem; margin-top: 0.4rem; }
.journal-del { margin-top: 0.15rem; }

/* Breakdown */
.breakdown h1 { margin-bottom: 0.25rem; }
.flow-wrap { overflow-x: auto; }
.flow { width: 100%; min-width: 620px; height: auto; font: 13px var(--ui); }
.flow text { fill: var(--ink); }
.flow-link { fill: none; stroke: var(--herb); stroke-opacity: 0.45; stroke-width: 1.6; }
.flow-ing circle { fill: var(--herb); }
.flow-unused text { fill: var(--muted); }
.flow-unused circle { fill: var(--line); }
.flow-step circle { fill: var(--herb); }
.flow .flow-num { fill: var(--herb-ink); font-weight: 700; font-size: 12px; }
.ready-list { padding-left: 1.4rem; margin: 0; }
.ready-list li { padding: 0.4rem 0; border-bottom: 1px solid var(--line); }
.ready-list label { display: inline-flex; gap: 0.5rem; font-weight: 400; margin: 0; }
.ready-list input:checked + span { text-decoration: line-through; color: var(--muted); }
.ready-list .small { display: block; margin-left: 1.6rem; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 0.75rem 0; border-bottom: 1px solid var(--line); }
.timeline p { margin: 0.35rem 0 0; }
.tl-head { display: flex; align-items: center; gap: 0.6rem; }
.tl-num { display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; background: var(--herb); color: var(--herb-ink); font-weight: 700; font-size: 0.85rem; flex: none; }
.tl-bar { flex: 1; height: 8px; max-width: 220px; }
.tl-bar rect { fill: var(--mustard); }
.tl-bar .tl-track { fill: var(--line); }
.tl-min { font-size: 0.85rem; font-weight: 700; }
.tl-uses .badge { margin-top: 0.3rem; }

/* Nutrition */
.nutrition { max-width: 560px; }
.nut-table { border-top: 3px solid var(--ink); }
.nut-table th { background: none; color: var(--ink); font-size: 0.98rem; }
.nut-table tr.sub th { padding-left: 1.6rem; font-weight: 400; }
.nut-table td.num { font-weight: 700; }
.nut-detail { font-size: 0.88rem; margin-top: 0.5rem; }
@media print {
    .nutrition { break-inside: avoid; border: 1px solid #bbb; margin-top: 6mm; padding: 3mm 4mm; max-width: 90mm; }
    .nutrition .muted { color: #444; }
}
@media print { .panel.nutrition { display: block !important; } }

.nut-table tr:last-child th, .nut-table tr:last-child td { border-bottom: 0; }

/* Colour theme switch (top bar) */
.theme-toggle { margin: 0 0 0 0.25rem; }
.theme-button {
    display: inline-flex; align-items: center; gap: 0.4rem; cursor: pointer;
    font: inherit; font-size: 0.9rem; color: var(--ink); background: transparent;
    border: 1px solid var(--line); border-radius: 999px; padding: 0.3rem 0.65rem; min-height: 2.25rem;
}
.theme-button:hover { background: var(--herb-soft); }
.theme-button:focus-visible { outline: 3px solid var(--herb); outline-offset: 2px; }
.theme-button .ti { width: 1.15rem; height: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; display: none; }
.theme-button .ti .fill { fill: currentColor; stroke: none; }
:root[data-theme="system"] .ti-system, :root:not([data-theme]) .ti-system,
:root[data-theme="light"] .ti-light, :root[data-theme="dark"] .ti-dark { display: block; }
.admin-nav .theme-toggle { margin: 0.25rem 0.5rem; }
.admin-nav .theme-button { color: var(--surface); border-color: var(--muted); }
.admin-nav .theme-button:hover { background: rgba(128, 128, 128, 0.2); }
@media (max-width: 560px) { .topbar .theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }
@media print { .theme-toggle { display: none; } }
