/* Four Leaf: one stylesheet for every page.
   System fonts and no external requests on purpose: a site that tells people
   their data stays on their phone shouldn't load third-party fonts or scripts.
   Palette mirrors BrandColors in the app. Everything here works without
   JavaScript; site.js only adds the playful layer. */

/* ---- tokens ---------------------------------------------------------- */
:root {
  color-scheme: light dark;
  --bg: #fff8ec;
  --surface: #fbf3df;
  --raised: #ffffff;
  --text: #3f3d56;
  --muted: #5f6573;
  --rule: #eadfc6;
  --ghost: #cdbf9d;
  --edge: #948768; /* outlines of controls: 3:1 on the page */
  --green: #059669;
  --green-deep: #047857;
  --on-green: #ffffff;
  --tint: #e2f3e4;
  --go: #059669;
  --ask: #d97706;
  --stop: #dc2626;
  --go-ink: #047857;
  --ask-ink: #92400e;
  --stop-ink: #b91c1c;
  --link: #047857;
  --sel: rgba(5, 150, 105, .25);
  --glow: rgba(5, 150, 105, .14);
  --shadow: 0 1px 2px rgba(63, 61, 86, .06), 0 16px 36px -20px rgba(63, 61, 86, .35);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  /* SF Rounded where the browser exposes it (Safari); plain system font elsewhere */
  --font-display: ui-rounded, "SF Pro Rounded", var(--font);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, 1, .36, 1);

  /* stacking scale */
  --z-above: 3; --z-totop: 20; --z-skip: 30; --z-spark: 50;

  /* the single heart-shaped leaf the whole site is built from, as a mask */
  --leaf: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-15 -34 30 35'%3E%3Cpath d='M0 0C-2-4-14-12-14-22C-14-29-9-33-5-33C-2-33 0-31 0-28C0-31 2-33 5-33C9-33 14-29 14-22C14-12 2-4 0 0Z'/%3E%3C/svg%3E");
  /* four of them, as a mask: tiny decorative marker (a lone leaf at this size reads as a heart) */
  --clover: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-35 -35 70 70'%3E%3Cpath d='M0 0C-2-4-14-12-14-22C-14-29-9-33-5-33C-2-33 0-31 0-28C0-31 2-33 5-33C9-33 14-29 14-22C14-12 2-4 0 0Z' transform='rotate(0)'/%3E%3Cpath d='M0 0C-2-4-14-12-14-22C-14-29-9-33-5-33C-2-33 0-31 0-28C0-31 2-33 5-33C9-33 14-29 14-22C14-12 2-4 0 0Z' transform='rotate(90)'/%3E%3Cpath d='M0 0C-2-4-14-12-14-22C-14-29-9-33-5-33C-2-33 0-31 0-28C0-31 2-33 5-33C9-33 14-29 14-22C14-12 2-4 0 0Z' transform='rotate(180)'/%3E%3Cpath d='M0 0C-2-4-14-12-14-22C-14-29-9-33-5-33C-2-33 0-31 0-28C0-31 2-33 5-33C9-33 14-29 14-22C14-12 2-4 0 0Z' transform='rotate(270)'/%3E%3C/svg%3E");
  --arrow-out: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 11.5l7-7M6 4.5h5.5V10' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.6l3 3L12.8 5' fill='none' stroke='black' stroke-width='2.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* Dark follows the system unless the visitor picked light; a picked dark wins either way.
   The two dark blocks are the same tokens: keep them in sync. */
:root[data-theme="light"] { color-scheme: light; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1814;
    --surface: #24211c;
    --raised: #2c2924;
    --text: #f5f1e8;
    --muted: #aaa59b;
    --rule: #3a362f;
    --ghost: #5d574a;
    --edge: #7f796c;
    --green: #10b981;
    --green-deep: #10b981;
    --on-green: #052e22;
    --tint: rgba(16, 185, 129, .15);
    --go: #10b981;
    --ask: #fbbf24;
    --stop: #ef4444;
    --go-ink: #34d399;
    --ask-ink: #fbbf24;
    --stop-ink: #f87171;
    --link: #34d399;
    --sel: rgba(52, 211, 153, .3);
    --glow: rgba(16, 185, 129, .17);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 36px -20px rgba(0, 0, 0, .7);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a1814;
  --surface: #24211c;
  --raised: #2c2924;
  --text: #f5f1e8;
  --muted: #aaa59b;
  --rule: #3a362f;
  --ghost: #5d574a;
  --edge: #7f796c;
  --green: #10b981;
  --green-deep: #10b981;
  --on-green: #052e22;
  --tint: rgba(16, 185, 129, .15);
  --go: #10b981;
  --ask: #fbbf24;
  --stop: #ef4444;
  --go-ink: #34d399;
  --ask-ink: #fbbf24;
  --stop-ink: #f87171;
  --link: #34d399;
  --sel: rgba(52, 211, 153, .3);
  --glow: rgba(16, 185, 129, .17);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 36px -20px rgba(0, 0, 0, .7);
}

/* People who ask their device for more contrast get stronger lines and body-coloured secondary text. */
@media (prefers-contrast: more) {
  :root:root { --rule: var(--edge); --ghost: var(--edge); --muted: var(--text); }
}

/* ---- base ------------------------------------------------------------ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 1.5rem; scroll-padding-bottom: 5rem; } /* a focused control scrolls clear of the back-to-top button */
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.6 var(--font);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; width: 100%; padding-top: clamp(1rem, 4vw, 2.5rem); }
main:focus { outline: none; }
a { color: var(--link); text-underline-offset: 3px; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 6px; }
::selection { background: var(--sel); }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1.25rem; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: var(--z-skip); padding: .65rem 1rem; border-radius: 10px; background: var(--raised); color: var(--text); }
.skip:focus { top: 1rem; box-shadow: var(--shadow); } /* no shadow while hidden, or it bleeds into view */

/* ---- header / footer ------------------------------------------------- */
.site-header { padding: .9rem 0; }
.site-header .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 1rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; color: var(--text); text-decoration: none; font: 800 1.1rem/1 var(--font-display); letter-spacing: -.01em; }
.brand img { width: 30px; height: 30px; transition: transform .6s var(--spring); }
.site-header nav { display: flex; flex-wrap: wrap; gap: .15rem; }
.site-header nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .9rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: .95rem; font-weight: 600; transition: background-color .2s, color .2s; }
.site-header nav a[aria-current="page"] { color: var(--green-deep); background: var(--tint); }

.site-footer { margin-top: clamp(3rem, 9vw, 5.5rem); padding: 1.5rem 0 2.5rem; color: var(--muted); font-size: .9rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem 1.5rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0 .25rem; margin-left: -.6rem; }
.site-footer nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 .6rem; color: var(--muted); text-decoration: none; }
.site-footer p { margin: 0; }

/* the Auto / Light / Dark switch (site.js adds it to the footer) */
.theme { display: inline-flex; gap: 2px; padding: 2px; border-radius: 999px; background: var(--surface); }
.theme:empty { visibility: hidden; }
.js .theme { min-width: 142px; min-height: 48px; }
@media (max-width: 20rem) { .js .theme { min-width: 0; } }
.theme button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; transition: background-color .2s, color .2s, transform .3s var(--spring); }
.theme button[aria-pressed="true"] { background: var(--raised); color: var(--green-deep); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.theme svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme .fill { fill: currentColor; stroke: none; }

/* ---- type ------------------------------------------------------------ */
h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; overflow-wrap: break-word; }
h1 { font-size: clamp(2.4rem, 8.5vw, 4.25rem); font-weight: 800; line-height: 1.04; letter-spacing: -.035em; margin: 0; }
h2 { font-size: 1.25rem; font-weight: 750; letter-spacing: -.015em; line-height: 1.25; margin: 3rem 0 .6rem; }
h3 { font-size: 1.02rem; font-weight: 700; margin: 1.75rem 0 .3rem; }
p, li { margin: .6rem 0; text-wrap: pretty; }
ul, ol { padding-left: 1.25rem; }
.lede { color: var(--muted); font-size: 1.2rem; line-height: 1.5; max-width: 32rem; margin: 1rem 0 0; text-wrap: balance; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 .9rem; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--green-deep); }
.eyebrow::before { content: ""; width: 1rem; height: 1rem; background: currentColor; -webkit-mask: var(--clover) center / contain no-repeat; mask: var(--clover) center / contain no-repeat; }
.updated { color: var(--muted); font-size: .9rem; margin: 1rem 0 0; }
.muted { color: var(--muted); }
code { font-size: .9em; background: var(--surface); padding: .1em .35em; border-radius: 6px; border: 1px solid var(--rule); }

/* ---- pieces ---------------------------------------------------------- */
.pill { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .75rem; border-radius: 999px; background: var(--tint); color: var(--green-deep); font-size: .8rem; font-weight: 700; }

.card { background: var(--raised); border: 1px solid var(--rule); border-radius: 20px; padding: 1.25rem 1.4rem; box-shadow: var(--shadow); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

.callout { background: var(--surface); border-radius: 16px; padding: 1rem 1.25rem; margin: 2rem 0; }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; max-width: 100%; text-align: center; overflow-wrap: anywhere; padding: 0 1.4rem; border-radius: 999px; background: var(--green-deep); color: var(--on-green); font-weight: 700; text-decoration: none; transition: transform .3s var(--spring), box-shadow .2s; }

.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.button.ghost { background: transparent; color: var(--text); border: 1.5px solid var(--edge); cursor: pointer; font: inherit; font-weight: 700; }
.button.ghost.done { border-color: var(--green); color: var(--green-deep); }

.arrow { display: inline-block; transition: transform .3s var(--spring); }

.app-icon { display: block; border-radius: 22.37%; box-shadow: 0 1px 2px rgba(0, 0, 0, .12), 0 14px 26px -12px rgba(4, 120, 87, .55); }
.hero > .app-icon { margin: 0 auto 1.25rem; }
.cap-1 .app-icon { flex: none; width: 56px; height: 56px; margin-top: .15rem; }

/* ---- home: the clover ------------------------------------------------ */
.hero { text-align: center; }
.hero .lede { margin-inline: auto; }

.clover { display: grid; justify-items: center; gap: 1.25rem; margin-top: clamp(1.5rem, 5vw, 2.5rem); container: clover / inline-size; overflow-x: clip; }
@container clover (max-width: 17rem) { .cap-1 { grid-template-columns: 1fr; } }
.clover-box { position: relative; width: clamp(210px, 56vw, 280px); aspect-ratio: 120 / 128; isolation: isolate; }
.clover-box::before { content: ""; position: absolute; inset: -18%; z-index: -1; pointer-events: none; background: radial-gradient(closest-side, var(--glow), transparent); }
.clover-box > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.clover .defs { width: 0; height: 0; }
.clover .stem { fill: none; stroke: var(--green); stroke-width: 3.2; stroke-linecap: round; opacity: .9; pointer-events: none; }
.clover label { pointer-events: none; }
.clover label svg { width: 100%; height: 100%; overflow: visible; }
.clover input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }

.lg { --y: -2px; --s: 1.5; transform: rotate(calc(var(--r) + var(--spin, 0deg))) translateY(calc(var(--y) + var(--lean, 0px))) scale(var(--s)); transition: transform .45s var(--spring); }
.clover input:checked + svg .lg { --y: -6px; --s: 1.58; }
.clover-box.spinning .lg { transition: none; }
.clover-box { touch-action: pan-y; }
.leaf { fill: var(--surface); stroke: var(--edge); stroke-width: 1.5; stroke-dasharray: 3 3; pointer-events: visiblePainted; cursor: pointer; transition: fill .25s, stroke .25s; }
.clover input:checked + svg .leaf { fill: var(--tint); fill: color-mix(in srgb, var(--green) 20%, var(--bg)); stroke: var(--green); stroke-width: 2; stroke-dasharray: none; }
.clover input.live + svg .leaf { fill: var(--green); stroke: none; }
.vein { fill: none; stroke: #fff; stroke-width: 1; stroke-linecap: round; opacity: 0; pointer-events: none; transition: opacity .25s; }
.clover input.live + svg .vein { opacity: .4; }
.clover input:focus-visible + svg .leaf { stroke: var(--text); stroke-width: 2.4; stroke-dasharray: none; }

.slot { width: 100%; max-width: 27rem; min-height: 8.25rem; display: grid; align-content: center; text-align: left; position: relative; }
.slot .cap { display: none; }
.slot .cap-1 { display: grid; }
@supports selector(:has(*)) {
  .slot .cap { display: none; }
  .clover:has(#lf1:checked) .cap-1,
  .clover:has(#lf2:checked) .cap-2,
  .clover:has(#lf3:checked) .cap-3,
  .clover:has(#lf4:checked) .cap-4 { display: block; }
  .clover:has(#lf1:checked) .cap-1 { display: grid; }
}
.cap-1 { grid-template-columns: 56px 1fr; gap: 1rem; align-items: start; }
.cap h2 { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .75rem; margin: 0 0 .35rem; font-size: 1.3rem; }
.cap p { margin: .25rem 0; }
.cap-soft { text-align: center; color: var(--muted); }
.cap-soft strong { display: block; color: var(--text); font: 750 1.2rem/1.3 var(--font-display); }
.cap-link { display: inline-block; margin-top: .4rem; font-weight: 700; }
.cap-link::after { content: ""; position: absolute; inset: 0; border-radius: 20px; } /* whole card is the link */
.slot:focus-within { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 20px; }
.slot { transition: transform .35s var(--spring), box-shadow .25s; }
.slot :focus-visible { outline: none; }

.hello { text-align: center; margin: clamp(2rem, 6vw, 3rem) 0 0; color: var(--muted); }

/* ---- greenlit: three dots, the demo, the steps ------------------------ */

.demo { max-width: 38rem; margin: clamp(2rem, 6vw, 3rem) auto 0; padding: 1rem 1rem .9rem; text-align: left; }
.demo-label { margin: 0 0 .6rem; font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.js-only { display: none; }
.js .js-only { display: inline; }
.js .nojs-only { display: none; }
.own { display: none; margin: .75rem 0 .25rem; }
.js .own { display: block; }
.own label { display: block; margin: 0 0 .35rem; color: var(--muted); font-size: .86rem; font-weight: 600; }
.own-row { display: flex; gap: .5rem; }
.own input { flex: 1; min-width: 0; min-height: 44px; padding: 0 1rem; border: 1.5px solid var(--edge); border-radius: 999px; background: var(--bg); color: var(--text); font: inherit; font-size: 1rem; }
.own input::placeholder { color: var(--muted); opacity: 1; }
.own input:focus-visible { outline-offset: 2px; border-color: var(--green); }
.chip.add { justify-content: center; padding: 0 1.1rem; background: var(--green-deep); border-color: var(--green-deep); color: var(--on-green); font-weight: 700; }
.chip.add::before, .chip.add::after { display: none; }
.own-note { margin: .5rem 0 0; color: var(--muted); font-size: .88rem; text-wrap: balance; }
.chip-own { display: inline-flex; align-items: center; }
.chip-own .chip { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right-width: 0; }
.chip-x { display: grid; place-items: center; width: 44px; min-height: 44px; padding: 0; border: 1.5px solid var(--green); border-left-width: 0; border-radius: 0 999px 999px 0; background: var(--tint); color: var(--muted); cursor: pointer; }
.chip-x svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.chip-own .chip[aria-pressed="false"] + .chip-x { background: var(--bg); border-color: var(--rule); }
.chips { display: none; flex-wrap: wrap; gap: .45rem; margin: 0 0 .4rem; }
.js .chips { display: flex; }
.chip { position: relative; display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .85rem 0 .7rem; border: 1.5px solid var(--rule); border-radius: 999px; background: var(--bg); color: var(--text); font: 600 .95rem/1 var(--font); cursor: pointer; transition: background-color .2s, border-color .2s, transform .3s var(--spring); }
.chip::before { content: ""; flex: none; width: 1.15rem; height: 1.15rem; border-radius: 50%; border: 1.5px solid var(--edge); transition: background-color .2s, border-color .2s; }
.chip::after { content: ""; position: absolute; left: calc(.7rem + 1.5px); top: 50%; width: 1.15rem; height: 1.15rem; margin: -.575rem 0 0 -1.5px; background: var(--on-green); -webkit-mask: var(--check) center / 78% no-repeat; mask: var(--check) center / 78% no-repeat; transform: scale(0); transition: transform .35s var(--spring); }
.chip[aria-pressed="true"] { background: var(--tint); border-color: var(--green); }
.chip[aria-pressed="true"]::before { background: var(--green); border-color: var(--green); }
.chip[aria-pressed="true"]::after { transform: scale(1); }

@media (max-width: 26rem) {
  .chips { gap: .4rem; }
  .chip { gap: .4rem; padding: 0 .65rem 0 .55rem; font-size: .875rem; }
  .chip::before, .chip::after { width: 1.05rem; height: 1.05rem; }
  .chip::after { left: calc(.55rem + 1.5px); margin-top: -.525rem; }
}

.demo { container: demo / inline-size; }
@container demo (max-width: 23rem) {
  .dishes li { grid-template-columns: 1.1rem 1fr; row-gap: .35rem; }
  .dishes .tag { grid-column: 2; justify-self: start; margin-top: 0; }
}
.dishes { position: relative; list-style: none; margin: .4rem 0 0; padding: 0; }
/* the scan-and-sort reveal (site.js adds .waiting / .pending / .scanning) */
.dishes .tag { transition: opacity .3s, transform .45s var(--spring); }
.dishes li.pending .lf { background: var(--rule); }
.dishes li.pending .tag { opacity: 0; transform: scale(.7); }
.dishes li.pending .ings .hit { text-decoration-color: transparent; }
.dishes.scanning::after { content: ""; position: absolute; left: -.4rem; right: -.4rem; top: 0; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, var(--green) 20%, var(--green) 80%, transparent); box-shadow: 0 0 14px 1px var(--green); pointer-events: none; animation: scan 1.3s linear forwards; }
@keyframes scan { from { top: 0; opacity: 1; } 90% { opacity: 1; } to { top: 100%; opacity: 0; } }
.dishes li > div { min-width: 0; }
.dishes li { position: relative; display: grid; grid-template-columns: 1.1rem 1fr auto; column-gap: .7rem; align-items: start; margin: 0; padding: .8rem 0; border-top: 1px solid var(--rule); background: var(--raised); transition: color .25s; }
.dishes .lf { width: .8rem; height: .8rem; margin: .4rem 0 0 .15rem; border-radius: 50%; background: var(--go); transition: background-color .25s; }
.dishes b { display: block; font-weight: 700; line-height: 1.3; }
.dishes .ings { display: block; margin-top: .15rem; color: var(--muted); font-size: .88rem; line-height: 1.4; }
.dishes .ings .hit { font-weight: 700; text-decoration: underline wavy; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.dishes .ings .inf { font-style: italic; }
.dishes .tag { align-self: start; margin-top: .1rem; padding: .15rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 800; white-space: nowrap; }
.dishes [data-state="go"] .tag { background: var(--tint); color: var(--go-ink); }
.dishes [data-state="ask"] .lf { background: var(--ask); }
.dishes [data-state="ask"] .tag { background: color-mix(in srgb, var(--ask) 18%, transparent); color: var(--ask-ink); }
.dishes [data-state="ask"] .hit { text-decoration-color: var(--ask); }
.dishes [data-state="stop"] .lf { background: var(--stop); }
.dishes [data-state="stop"] .tag { background: color-mix(in srgb, var(--stop) 14%, transparent); color: var(--stop-ink); }
.dishes [data-state="stop"] .hit { text-decoration-color: var(--stop); }
.dishes [data-state="stop"] b { color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: .85rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: .86rem; }
.legend li { display: flex; align-items: center; gap: .4rem; margin: 0; }
.legend b { color: var(--text); }
.legend .d { flex: none; width: .6rem; height: .6rem; border-radius: 50%; }
.legend .go { background: var(--go); }
.legend .ask { background: var(--ask); }
.legend .stop { background: var(--stop); }
.demo-note { margin: .7rem 0 0; padding-top: .7rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .84rem; }

.steps { list-style: none; padding: 0; margin: clamp(2.5rem, 7vw, 3.5rem) 0 0; display: grid; gap: 1.75rem; }
.steps li { margin: 0; }
.steps .ico { width: 48px; height: 48px; padding: 11px; margin-bottom: .75rem; border-radius: 50%; background: var(--tint); color: var(--green-deep); transition: transform .5s var(--spring); }
.steps b { display: block; font-family: var(--font-display); font-size: 1.05rem; }
.steps span { display: block; color: var(--muted); font-size: .95rem; line-height: 1.5; margin-top: .15rem; }
@media (min-width: 40rem) { .steps { grid-template-columns: repeat(3, 1fr); gap: 2rem; } }

.promise { margin-top: clamp(2.5rem, 7vw, 3.5rem); }
.promise h2 { margin-top: 0; }
.where { display: grid; gap: .75rem; margin: 1rem 0 .75rem; }
.where-col { padding: 1rem 1.15rem; border-radius: 16px; background: var(--surface); }
.where h3 { display: flex; align-items: center; gap: .55rem; margin: 0 0 .4rem; font-size: 1rem; }
.where h3 svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--green-deep); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.where ul { list-style: none; margin: 0; padding: 0; }
.where li { position: relative; margin: .35rem 0; padding-left: 1.5rem; color: var(--muted); font-size: .95rem; line-height: 1.45; }
.where li::before { content: ""; position: absolute; left: 0; top: .2rem; width: 1rem; height: 1rem; background: var(--green-deep); -webkit-mask: var(--check) center / contain no-repeat; mask: var(--check) center / contain no-repeat; }
.where .leaves li::before { background: var(--edge); -webkit-mask-image: var(--arrow-out); mask-image: var(--arrow-out); }
@media (min-width: 40rem) { .where { grid-template-columns: 1fr 1fr; } }

/* ---- support: the FAQ ------------------------------------------------ */
.faq { margin-top: 2.5rem; border-top: 1px solid var(--rule); }
.faq-tools { display: flex; justify-content: flex-end; margin-top: 2rem; margin-bottom: -2.25rem; }
.faq-tools + .faq { margin-top: 2.5rem; }
.faq-all { color: var(--muted); font-size: .9rem; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary { display: flex; align-items: center; gap: .85rem; min-height: 56px; padding: .6rem 0; cursor: pointer; font-weight: 650; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before { content: ""; flex: none; width: 1.1rem; height: 1.1rem; background: var(--edge); -webkit-mask: var(--clover) center / contain no-repeat; mask: var(--clover) center / contain no-repeat; transform: scale(.85); transition: transform .45s var(--spring), background-color .2s; }
.faq details[open] summary::before { background: var(--green); transform: rotate(45deg) scale(1.05); }
.faq details > :not(summary) { margin: 0 0 1.1rem 1.95rem; color: var(--muted); }
.faq details[open] > :not(summary) { animation: rise .35s var(--ease); }

/* ---- legal pages ------------------------------------------------------ */
.prose h2 { margin-top: 2.75rem; scroll-margin-top: 1rem; }
.prose h2 + p { margin-top: .4rem; }
.toc { margin: 1.5rem 0 0; border-radius: 16px; background: var(--surface); padding: 0 1.1rem; }
.toc summary { display: flex; align-items: center; min-height: 48px; cursor: pointer; font-weight: 700; font-size: .95rem; }
.toc ol { margin: 0 0 .5rem; padding: 0; list-style: none; columns: 2 14rem; column-gap: 1.5rem; }
.toc li { margin: 0; break-inside: avoid; }
.toc a { display: flex; align-items: center; min-height: 44px; color: var(--text); text-decoration: none; font-size: .95rem; }
/* section links and the wide-screen index */
.prose { position: relative; }
.prose h2:focus { outline: none; }
.anchor { margin-left: .2rem; padding: .2rem .5rem; color: var(--edge); font-weight: 600; text-decoration: none; opacity: 0; transition: opacity .2s, color .2s; }
@media (hover: none) { .anchor { display: none; } }
.anchor:focus-visible { opacity: 1; color: var(--green-deep); }
.toc-side { display: none; }
@media (min-width: 80rem) {
  .js .prose .toc { display: none; }
  .js .toc-side { display: block; position: absolute; top: 0; bottom: 0; left: -14.5rem; width: 12.5rem; }
  .toc-side-inner { position: sticky; top: 1.5rem; max-height: calc(100vh - 3rem); max-height: calc(100dvh - 3rem); overflow-y: auto; padding-right: .5rem; }
  .toc-title { margin: 0 0 .5rem; color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
  .toc-side ol { margin: 0; padding: 0; list-style: none; border-left: 2px solid var(--rule); }
  .toc-side li { margin: 0; }
  .toc-side a { display: block; margin-left: -2px; padding: .35rem 0 .35rem .8rem; border-left: 2px solid transparent; color: var(--muted); font-size: .85rem; line-height: 1.35; text-decoration: none; transition: color .2s, border-color .2s; }
  .toc-side a[aria-current="location"] { border-left-color: var(--green); color: var(--text); font-weight: 700; }
}
.table-scroll { overflow-x: auto; margin: 1rem 0; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .7rem .8rem .7rem 0; border-bottom: 1px solid var(--rule); vertical-align: top; }
th { font-weight: 700; font-size: .82rem; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }

/* ---- the lucky patch: find the four-leaf one ---------------------------- */
.patch { display: none; margin-top: clamp(3rem, 8vw, 4.5rem); text-align: center; }
.js .patch { display: block; }
.patch-grid { display: grid; grid-template-columns: repeat(6, 1fr); max-width: 19rem; margin: 1rem auto 0; }
.patch-grid button { aspect-ratio: 1; min-height: 44px; padding: 0; border: 0; border-radius: 14px; background: none; color: var(--edge); color: color-mix(in srgb, var(--green-deep) 70%, var(--bg)); cursor: pointer; transition: color .2s, transform .35s var(--spring), opacity .4s; }
.patch-grid svg { width: 76%; height: 76%; margin: auto; fill: currentColor; overflow: visible; }
.patch-grid button.miss { color: var(--rule); transform: scale(.85); pointer-events: none; }
.patch-grid button.found { color: var(--green); transform: scale(1.5); z-index: 1; }
.patch-grid.done button:not(.found) { pointer-events: none; opacity: 0; transform: translate(var(--gx, 120px), var(--gy, -40px)) rotate(var(--gr, 240deg)); transition: transform .9s cubic-bezier(.5, 0, .9, .5) var(--d, 0ms), opacity .7s ease-in var(--d, 0ms); }
.patch-more { margin: .75rem 0 0; }
.patch-more a { display: inline-block; padding: .6rem 0; font-weight: 600; }
.patch-more a:hover .arrow { transform: translateX(4px); }
.patch-msg { min-height: 1.6rem; margin: .9rem 0 0; color: var(--muted); }
.patch-msg strong { color: var(--text); }
.patch-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1rem; margin-top: .4rem; }
.linklike { min-height: 44px; padding: 0 .5rem; border: 0; background: none; color: var(--link); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---- back to top: a clover that turns as you read ----------------------- */
.totop { position: fixed; right: max(1rem, env(safe-area-inset-right)); bottom: max(1rem, env(safe-area-inset-bottom)); z-index: var(--z-totop); display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: 50%; background: var(--raised); box-shadow: var(--shadow); cursor: pointer; opacity: 0; visibility: hidden; transform: translateY(10px) scale(.9); transition: opacity .25s, transform .4s var(--spring), visibility 0s .4s; }
.totop.on { opacity: 1; visibility: visible; transform: none; transition: opacity .25s, transform .4s var(--spring), visibility 0s; }
.totop svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.totop circle { fill: none; stroke-width: 3; }
.totop .track { stroke: var(--rule); }
.totop .ring { stroke: var(--green); stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: calc(100 - var(--p, 0) * 100); }
.totop .glyph { width: 20px; height: 20px; background: var(--green); -webkit-mask: var(--clover) center / contain no-repeat; mask: var(--clover) center / contain no-repeat; transform: rotate(calc(var(--p, 0) * 360deg)); }

/* a ladybug that wanders the clover (site.js adds it after a few seconds) */
.clover-box > .bug { position: absolute; inset: auto; left: 0; top: 0; z-index: var(--z-above); width: 21px; height: 26px; margin: -13px 0 0 -10px; translate: var(--x, 0) var(--y, 0); rotate: var(--a, 0deg); opacity: 0; cursor: pointer; transition: translate 2.6s ease-in-out, rotate .6s ease-in-out, opacity .8s; }
.clover-box > .bug.on { opacity: 1; }
.clover-box > .bug svg { width: 100%; height: 100%; }
.clover-box > .bug.walking { animation: crawl .32s ease-in-out infinite; }
.clover-box > .bug.fly { translate: var(--x) calc(var(--y) - 170px); scale: 2.2; opacity: 0; cursor: default; transition: translate 1.1s cubic-bezier(.5, 0, .9, .5), scale 1.1s, opacity 1s; }
@keyframes crawl { 50% { scale: 1.1; } }

/* ---- the lucky meadow (a game, on /lucky/) ----------------------------------- */
.center-text { text-align: center; }
.game { display: none; margin-top: clamp(1.5rem, 5vw, 2.5rem); }
.js .game { display: block; }
.modes { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; width: fit-content; max-width: 100%; margin: 0 auto .9rem; padding: 2px; border-radius: 999px; background: var(--surface); }
.mode { min-height: 44px; padding: 0 1.3rem; border: 0; border-radius: 999px; background: none; color: var(--muted); font: 700 .95rem var(--font); cursor: pointer; transition: background-color .2s, color .2s; }
.mode[aria-pressed="true"] { background: var(--raised); color: var(--green-deep); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.game { container: game / inline-size; }
.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-bottom: .75rem; }
@container game (max-width: 28rem) { .hud { grid-template-columns: repeat(2, 1fr); } }
@container game (max-width: 12rem) { .hud { grid-template-columns: 1fr; } }
.stat { display: grid; align-content: space-between; gap: .15rem; padding: .55rem .75rem; border-radius: 14px; background: var(--surface); }
.stat .k { font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .v { font: 800 1.15rem/1.25rem var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.luck { display: inline-flex; gap: .3rem; align-items: center; height: 1.25rem; }
.luck i { width: 1.2rem; height: 1.2rem; background: var(--green); -webkit-mask: var(--clover) center / contain no-repeat; mask: var(--clover) center / contain no-repeat; transition: transform .45s var(--spring), background-color .3s, opacity .3s; }
.luck i.lost { background: var(--edge); opacity: .5; transform: scale(.7) rotate(25deg); }

.meadow { position: relative; min-height: 10.5rem; display: flex; flex-wrap: wrap; justify-content: center; padding: .5rem; border-radius: 24px; background: var(--surface); overflow: hidden; touch-action: manipulation; }
.meadow button { position: relative; flex: 0 0 calc(100% / var(--cols, 6)); aspect-ratio: 1; min-height: 44px; padding: 0; border: 0; border-radius: 14px; background: none; color: var(--green); color: color-mix(in srgb, var(--green-deep) var(--mix, 82%), var(--surface)); cursor: pointer; animation: pop .45s var(--spring) calc(var(--i, 0) * 4ms) backwards; }
.meadow svg { width: 100%; height: 100%; fill: currentColor; overflow: visible; transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg)) scale(calc(var(--s, .85) * var(--hv, 1))); transition: transform .35s var(--spring), filter .3s; }
.meadow button.miss { pointer-events: none; color: var(--edge); opacity: .45; animation: wiggle .4s; }
.meadow button.miss svg { --hv: .75; }
.meadow button.found { z-index: 2; color: var(--green); }
.meadow button.found svg { --hv: 2; filter: drop-shadow(0 0 10px var(--green)); }
.meadow button.reveal { z-index: 2; color: var(--ask); animation: throb 1.4s ease-in-out infinite; }
.meadow button.reveal svg { --hv: 1.9; filter: drop-shadow(0 0 10px var(--ask)); }
.meadow.over button:not(.reveal) { opacity: .3; pointer-events: none; transition: opacity .5s; }
/* the wind takes everything that wasn't lucky, nearest first */
.meadow.cleared button:not(.found) { pointer-events: none; opacity: 0; transform: translate(var(--gx, 120px), var(--gy, -40px)) rotate(var(--gr, 240deg)); transition: transform .9s cubic-bezier(.5, 0, .9, .5) var(--d, 0ms), opacity .7s ease-in var(--d, 0ms); }
.hint-ring { position: absolute; z-index: 1; width: var(--d); height: var(--d); margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2); border: 2px dashed var(--green); border-radius: 50%; background: radial-gradient(closest-side, var(--glow), transparent); pointer-events: none; animation: ring 3.2s ease-out forwards; }
.check { display: flex; align-items: flex-start; gap: .65rem; min-height: 44px; padding: .5rem 0; cursor: pointer; }
.check input { flex: none; width: 1.25rem; height: 1.25rem; margin: .15rem 0 0; accent-color: var(--green); }
.game-msg { min-height: 3.2rem; margin: .9rem 0 0; text-align: center; color: var(--muted); text-wrap: balance; }
.game-actions { justify-content: center; margin-top: .5rem; }
/* press feedback */
.meadow button:not(.miss):not(.found):not(.reveal):active svg { --hv: .85; }
@keyframes pop { from { opacity: 0; transform: scale(.2); } }
@keyframes throb { 50% { transform: scale(1.12); } }
@keyframes ring { 0% { opacity: 0; transform: scale(.6); } 15% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) {
  .meadow.cleared button:not(.found), .patch-grid.done button:not(.found) { transform: none; opacity: .15; }
  .meadow button.reveal { animation: none; }
}

/* confetti leaves thrown by the patch */
.spark { position: fixed; z-index: var(--z-spark); width: 16px; height: 17px; margin: -8px 0 0 -8px; pointer-events: none; background: var(--green); -webkit-mask: var(--leaf) center / contain no-repeat; mask: var(--leaf) center / contain no-repeat; }

/* ---- 404 --------------------------------------------------------------- */
.lost { text-align: center; }
.lost-path code { overflow-wrap: anywhere; }
.lost .lede { margin-inline: auto; }
.lost .patch { display: block; }

/* hover effects only where a pointer can really hover (no sticky hover after a tap) */
@media (hover: hover) {
  .mode[aria-pressed="false"]:hover { color: var(--text); }
  .prose h2:hover .anchor { opacity: 1; }
  .toc-side a:hover { color: var(--text); }
  .chip-x:hover { color: var(--stop-ink); }
  .meadow button:not(.miss):not(.found):not(.reveal):hover { color: var(--green); }
  .meadow button:not(.miss):not(.found):not(.reveal):hover svg { --hv: 1.2; }
  .theme button:not([aria-pressed="true"]):hover { color: var(--text); transform: scale(1.08); }
  .brand:hover img { transform: rotate(90deg); }
  .site-header nav a:hover { color: var(--text); background: var(--surface); }
  .site-footer nav a:hover { color: var(--text); text-decoration: underline; }
  .button:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -10px var(--green); text-decoration: none; }
  .button.ghost:hover { border-color: var(--green); box-shadow: none; }
  a:hover > .arrow, .card:hover .arrow { transform: translateX(4px); }
  .lg:hover { --y: -5px; }
  .lg:hover .leaf { stroke: var(--green); }
  .slot:has(.cap-link:hover) { transform: translateY(-3px); }
  .chip:hover { border-color: var(--green); }
  .steps li:hover .ico { transform: rotate(-8deg) scale(1.08); }
  .faq summary:hover { color: var(--green-deep); }
  .toc a:hover { color: var(--green-deep); text-decoration: underline; }
  .patch-grid button:hover { color: var(--green); transform: scale(1.12); }
  .totop:hover { transform: scale(1.08); }
}
.button:active { transform: scale(.97); }
.chip:active { transform: scale(.96); }
.totop:active { transform: scale(.95); }

/* a deep-linked section or answer flashes once so you can see where you landed */
.prose h2:target, .faq details:target { animation: land 2s ease-out; }
@keyframes land { 0%, 35% { background: var(--tint); box-shadow: 0 0 0 .5rem var(--tint); border-radius: 8px; } 100% { background: transparent; box-shadow: 0 0 0 .5rem transparent; } }

/* ---- motion ---------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes bloom { from { opacity: 0; transform: rotate(var(--r)) translateY(0) scale(.1); } }
@keyframes sway { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(2.5deg); } 75% { transform: rotate(-2.5deg); } }
@keyframes nudge { 45% { transform: rotate(var(--r)) translateY(-9px) scale(1.58); } }
@keyframes wiggle { 25% { transform: rotate(-12deg) scale(.9); } 75% { transform: rotate(12deg) scale(.9); } }
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .hero > *, .lost > * { animation: rise .7s var(--ease) backwards; }
  .hero > :nth-child(2), .lost > :nth-child(2) { animation-delay: .06s; }
  .hero > :nth-child(3), .lost > :nth-child(3) { animation-delay: .12s; }
  .lg { animation: bloom .8s var(--spring) calc(var(--i, 0) * 110ms + 150ms) backwards; }
  /* once the clover has bloomed, the empty leaves wave hello so touch users know they can be tapped */
  .clover-box label:nth-of-type(n+2) .lg { animation: bloom .8s var(--spring) calc(var(--i, 0) * 110ms + 150ms) backwards, nudge .8s ease-in-out calc(2.4s + var(--i, 0) * 160ms) 1; }

  .clover-box { animation: sway 6s ease-in-out 1.4s 3; transform-origin: 50% 42%; }
  .patch-grid button.miss { animation: wiggle .4s; }
  .slot .cap { animation: rise .4s var(--ease); }
  @view-transition { navigation: auto; }
  .site-header { view-transition-name: site-header; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* Windows High Contrast: keep the states that colour alone would carry */
@media (forced-colors: active) {
  .chip[aria-pressed="true"] { border-width: 3px; }
  .chip[aria-pressed="true"]::before { background: Highlight; border-color: Highlight; }
  .chip[aria-pressed="true"]::after { background: HighlightText; }
  .dishes .lf, .dishes .tag { forced-color-adjust: none; }
  .leaf { stroke: CanvasText; }
  .clover input:checked + svg .leaf, .clover input.live + svg .leaf { fill: Highlight; }
}

@media print {
  .site-header nav, .site-footer nav, .patch, .skip, .totop, .toc, .toc-side, .anchor, .theme, .faq-tools, .button.ghost, .game { display: none; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  body { background: #fff; color: #000; }
  .button { min-height: 0; padding: 0; background: none; color: #000; text-decoration: underline; }
  h2, h3 { break-after: avoid; }
  details, tr, .callout, .card { break-inside: avoid; }
}
