/* The public recipe book — VeryUseful.AI brand.
   Tokens mirror veryuseful-site/src/styles/global.css: sage on warm paper,
   Playfair Display headings, Inter body, JetBrains Mono for the [[ ]] motif. */

:root {
  --sage-50: #f6f7f4; --sage-100: #e8ebe3; --sage-200: #d4d9cb; --sage-300: #b5bda8;
  --sage-400: #96a085; --sage-500: #7a866b; --sage-600: #606b53; --sage-700: #4c5543;
  --sage-800: #3f4638; --sage-900: #363b30; --sage-950: #1c1f18;
  --warm-50: #faf9f7; --warm-100: #f2f0ec; --warm-200: #e5e1d9; --warm-300: #d4cec2;
  --brand: #606b53; --brand-dark: #363b30;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
  --serif: 'Playfair Display', Georgia, serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --tap: 3rem; /* minimum touch target */
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font-family: var(--sans); color: var(--sage-950); background: var(--warm-50); }
main { flex: 1; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(2.1rem, 5.5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
p { line-height: 1.7; color: var(--sage-800); margin: 0; }
a { color: var(--brand); text-decoration: none; transition: color .2s ease; }
a:hover { color: var(--brand-dark); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 2px; }
.mono { font-family: var(--mono); }
.wrap { width: 100%; max-width: 72rem; margin: 0 auto; padding-left: 1.25rem; padding-right: 1.25rem; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 1rem; z-index: 100; background: var(--sage-950); color: #fff; padding: .5rem 1rem; border-radius: 2px; }

/* Header and footer */
.site-header { position: sticky; top: 0; z-index: 40; background: rgb(250 249 247 / .92); backdrop-filter: blur(12px); border-bottom: 1px solid rgb(212 217 203 / .5); }
.site-nav { height: 4rem; display: flex; align-items: center; justify-content: space-between; }
.logo { font-weight: 700; font-size: 1.2rem; color: var(--sage-950); white-space: nowrap; }
.logo:hover { color: var(--sage-950); }
.logo .br { font-family: var(--mono); font-weight: 800; }
.logo .br-a, .logo-ai { color: var(--brand); }
.nav-book { font-size: .875rem; font-weight: 500; color: var(--sage-700); }
.nav-book .mono { color: var(--brand); opacity: .6; }
.site-footer { background: var(--sage-950); margin-top: 4rem; }
.footer-inner { padding-top: 3rem; padding-bottom: 3rem; }
.made-with { color: #fff; font-weight: 600; font-size: 1.05rem; margin-bottom: .75rem; }
.made-with .mono { color: var(--sage-400); }
.footer-note { color: var(--sage-400); font-size: .875rem; max-width: 34rem; }
.footer-note a { color: var(--sage-200); text-decoration: underline; text-underline-offset: 2px; }
.footer-legal { color: var(--sage-500); font-size: .75rem; margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--sage-800); }
body.is-cooking .site-header, body.is-cooking .site-footer { display: none; }

/* Shared bits */
.kicker { color: var(--brand); font-weight: 500; font-size: .875rem; letter-spacing: .1em; margin-bottom: 1rem; }
.lede { font-size: 1.125rem; color: var(--sage-700); max-width: 40rem; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .25rem; min-height: var(--tap); padding: .75rem 1.5rem; border-radius: 2px; border: 1px solid transparent; font: 500 1rem var(--sans); cursor: pointer; transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
.btn .mono { opacity: .7; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--sage-300); color: var(--sage-700); }
.btn-ghost:hover { border-color: var(--sage-500); color: var(--sage-950); }
.btn-big { min-height: 3.75rem; font-size: 1.125rem; font-weight: 600; }
.btn:disabled { opacity: .35; cursor: default; }

/* Every picture hangs in the pencil frame. A photo fills the opening. A drawing
   is pencil on white, multiplied onto the wrapper's own paper so it reads as a
   sketch behind a mount. The wrapper carries the paper and isolates the blend:
   without that, a hovered card (transform = new stacking context) flashes white. */
.framed { position: relative; aspect-ratio: 1087 / 786; }
.framed-photo { position: absolute; left: 7.8%; top: 10.7%; width: 84.3%; height: 78.5%; object-fit: cover; }
.framed-frame { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.framed-sketch { background: var(--warm-50); isolation: isolate; }
.framed-sketch .framed-photo { object-fit: cover; mix-blend-mode: multiply; }
.no-image { aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; gap: .1em; font-size: 3rem; font-weight: 800; color: var(--sage-300); background: var(--warm-100); border-radius: 2px; }

/* The book */
.hero { padding-top: 3.5rem; padding-bottom: 2.5rem; display: grid; gap: 1.5rem; align-items: center; }
.hero-art img { width: 100%; height: auto; mix-blend-mode: multiply; }
.hero h1 { max-width: 20ch; margin-bottom: 1.25rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 2rem; }
.chip { min-height: 2.5rem; padding: .4rem 1rem; border-radius: 2px; border: 1px solid var(--sage-300); background: transparent; color: var(--sage-700); font: 500 .875rem var(--sans); cursor: pointer; }
.chip.is-on { background: var(--sage-950); border-color: var(--sage-950); color: #fff; }
.book-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 2rem 1.75rem; }
.card-link { display: block; color: inherit; transition: transform .2s ease; }
.card-link:hover { transform: translateY(-2px); color: inherit; }
/* One box for every card, so a framed photo and a free-standing drawing line their titles up. */
.card-image { margin-bottom: .9rem; aspect-ratio: 4 / 3; display: flex; align-items: center; }
.card-image > * { width: 100%; }
.card-title { font-size: 1.35rem; line-height: 1.2; margin-bottom: .4rem; }
.card-meta { font-size: .875rem; color: var(--sage-600); }
.empty { padding: 3rem 0; color: var(--sage-600); }

/* Recipe summary */
.recipe { padding-top: 1.5rem; }
.crumb { font-size: .875rem; margin-bottom: 1.5rem; }
.recipe-top { display: grid; gap: 2rem; align-items: center; }
.recipe-intro h1 { margin-bottom: 1.25rem; }
.recipe-intro .lede { margin-bottom: 1.5rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: 2rem; margin: 0 0 1.75rem; }
.meta-row dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--sage-500); margin-bottom: .2rem; }
.meta-row dd { margin: 0; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; }
.start-note { font-size: .875rem; color: var(--sage-600); margin-top: .75rem; }
.recipe-cols { display: grid; gap: 2.5rem; margin-top: 3rem; padding-top: 2.5rem; border-top: 1px solid var(--sage-200); }
.ing-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.serves { display: inline-flex; align-items: center; border: 1px solid var(--sage-300); border-radius: 2px; background: #fff; }
.serves-btn { width: var(--tap); height: var(--tap); border: 0; background: transparent; font-size: 1.5rem; line-height: 1; color: var(--brand); cursor: pointer; }
.serves-btn:disabled { color: var(--sage-300); cursor: default; }
.serves-val { min-width: 6.5rem; text-align: center; font-weight: 600; font-size: 1.05rem; }
.serves-unit { font-weight: 400; color: var(--sage-600); font-size: .9rem; }
.scaled-note { font-size: .85rem; color: var(--sage-600); background: var(--sage-100); padding: .6rem .8rem; border-left: 3px solid var(--sage-400); margin-bottom: 1rem; line-height: 1.5; }
.ing-list { list-style: none; margin: 0; padding: 0; }
.ing-list li { padding: .65rem 0; border-bottom: 1px solid var(--warm-200); line-height: 1.4; }
.ing-amt { font-weight: 600; white-space: nowrap; }
.ing-amt.is-scaled, .qty-scaled { color: var(--brand); text-decoration: underline; text-decoration-color: var(--sage-300); text-underline-offset: 3px; }
.outline h2 { margin-bottom: 1rem; }
.outline-list { list-style: none; margin: 0 0 1.75rem; padding: 0; counter-reset: phase; }
.outline-list li { padding: .8rem 0; border-bottom: 1px solid var(--warm-200); display: grid; gap: .2rem; }
.outline-phase { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--brand); font-weight: 600; }
.outline-steps { color: var(--sage-800); line-height: 1.5; }
.noscript { margin-top: 2rem; }
.noscript li { margin-bottom: 1rem; line-height: 1.6; }

/* Cook mode: big, calm, readable from across the bench */
.cook { min-height: 100vh; display: flex; flex-direction: column; padding-bottom: 7rem; }
.cook-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; background: rgb(250 249 247 / .95); backdrop-filter: blur(12px); }
.cook-exit { width: var(--tap); height: var(--tap); flex: none; border: 0; background: transparent; font-size: 1.5rem; color: var(--sage-700); cursor: pointer; }
.cook-title { flex: 1; min-width: 0; font-family: var(--serif); font-weight: 600; color: var(--sage-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cook-ing-btn { flex: none; min-height: var(--tap); padding: 0 .9rem; border: 1px solid var(--sage-300); border-radius: 2px; background: transparent; color: var(--sage-700); font: 500 .9rem var(--sans); cursor: pointer; }
.cook-ing-btn .mono { color: var(--brand); opacity: .6; }
.cook-timer-btn { flex: none; width: var(--tap); height: var(--tap); display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--sage-300); border-radius: 2px; background: transparent; color: var(--sage-700); cursor: pointer; }
.cook-timer-btn[aria-expanded="true"], .cook-ing-btn[aria-expanded="true"] { background: var(--sage-950); border-color: var(--sage-950); color: #fff; }
.cook-progress { height: 4px; background: var(--sage-100); }
.cook-progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .3s ease; }
.cook-main { display: grid; gap: 1.5rem; padding-top: 1.75rem; }
.step-card:focus { outline: none; }
.step-meta { font-size: .8rem; text-transform: uppercase; letter-spacing: .1em; color: var(--brand); font-weight: 600; margin-bottom: .75rem; }
.step-title { font-size: clamp(1.9rem, 5vw, 3rem); margin-bottom: 1.25rem; }
.pills { list-style: none; margin: 0 0 1.25rem; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.pill { padding: .45rem .8rem; background: var(--sage-100); border-radius: 2px; font-size: 1rem; font-weight: 500; color: var(--sage-900); }
.step-detail { font-size: clamp(1.15rem, 2.4vw, 1.4rem); line-height: 1.65; color: var(--sage-900); max-width: 44rem; }
.qty-asis small { color: var(--sage-500); font-size: .75em; }
.tips { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: .6rem; max-width: 44rem; }
.tips li { padding: .8rem 1rem; background: #fff; border-left: 3px solid var(--sage-400); line-height: 1.55; color: var(--sage-800); }
.tip-label { font-family: var(--mono); font-size: .75rem; font-weight: 700; color: var(--brand); text-transform: uppercase; letter-spacing: .08em; margin-right: .3rem; }
.step-timer { margin-top: 1.75rem; max-width: 30rem; }
.btn-timer { width: 100%; flex-direction: column; gap: .15rem; background: var(--sage-950); color: #fff; padding: 1rem 1.5rem; }
.btn-timer:hover { background: var(--sage-800); }
.timer-start { display: inline-flex; align-items: center; gap: .5rem; }
.clock-icon { flex: none; }
.timer-sub { font-size: .85rem; font-weight: 400; color: var(--sage-300); }
.timer-running { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1rem; padding: 1rem 1.25rem; border: 2px solid var(--brand); border-radius: 2px; background: #fff; }
.timer-count { font-family: var(--mono); font-size: 2.25rem; font-weight: 700; color: var(--sage-950); font-variant-numeric: tabular-nums; }
.timer-label { flex: 1; min-width: 8rem; color: var(--sage-700); }
.timer-stop { align-self: center; min-height: var(--tap); padding: 0 1rem; border: 1px solid var(--sage-300); border-radius: 2px; background: transparent; color: var(--sage-700); font: 500 .9rem var(--sans); cursor: pointer; }
.timer-stop[data-armed], .timer-row-btn[data-armed] { border-color: var(--sage-950); background: var(--sage-950); color: #fff; }
.timer-hint { font-size: .85rem; color: var(--sage-600); margin-top: .5rem; }
.next-up { padding: 1rem 1.25rem; background: var(--warm-100); border-radius: 2px; align-self: start; }
.next-up p { color: var(--sage-700); line-height: 1.5; }
.next-label { font-family: var(--mono); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); margin-right: .4rem; }
.next-timer { color: var(--sage-500); }
.cook-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; max-width: none; display: grid; grid-template-columns: 1fr 1.6fr; gap: .75rem; padding-top: .75rem; padding-bottom: calc(.75rem + env(safe-area-inset-bottom)); background: linear-gradient(rgb(250 249 247 / 0), var(--warm-50) 35%); }
.cook-nav .btn-ghost { background: var(--warm-50); }

/* Ingredient drawer */
.drawer { position: fixed; inset: 0 0 0 auto; z-index: 50; width: min(26rem, 100%); overflow-y: auto; background: var(--warm-50); border-left: 1px solid var(--sage-200); box-shadow: -12px 0 40px rgb(0 0 0 / .12); padding: 1rem 1.25rem 6rem; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.drawer-close { width: var(--tap); height: var(--tap); border: 0; background: transparent; font-size: 1.25rem; color: var(--sage-700); cursor: pointer; }
.drawer .serves { margin-bottom: 1rem; }

/* Timers panel: the recipe's timers from anywhere, and one of your own */
.drawer-sub { margin: 1.5rem 0 .6rem; font: 700 .75rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--brand); }
.drawer-head + .drawer-sub { margin-top: .25rem; }
.own-timer { display: grid; gap: .5rem; }
.own-row { display: flex; align-items: center; gap: .6rem; }
.own-mins { width: 5.5rem; min-height: var(--tap); padding: 0 .6rem; border: 1px solid var(--sage-300); border-radius: 2px; background: #fff; color: var(--sage-950); font: 700 1.35rem var(--mono); text-align: center; }
.own-unit { color: var(--sage-700); }
.own-row .btn { margin-left: auto; min-height: var(--tap); }
.own-what { min-height: var(--tap); padding: 0 .75rem; border: 1px solid var(--sage-200); border-radius: 2px; background: #fff; color: var(--sage-950); font: 400 1rem var(--sans); }
.own-problem { font-size: .875rem; color: #9a3412; }
.own-problem:empty { display: none; }
.timer-rows { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .5rem; }
.timer-row { display: flex; align-items: center; gap: .75rem; padding: .6rem .75rem; background: #fff; border-left: 3px solid var(--sage-200); }
.timer-row.is-here { border-left-color: var(--brand); }
.timer-row-text { flex: 1; min-width: 0; display: grid; gap: .1rem; }
.timer-row-step { font: 700 .7rem var(--mono); text-transform: uppercase; letter-spacing: .08em; color: var(--sage-500); }
.timer-row-label { color: var(--sage-900); line-height: 1.3; }
.timer-row-go { flex: none; display: flex; align-items: center; gap: .6rem; }
.timer-row-count { font: 700 1.1rem var(--mono); font-variant-numeric: tabular-nums; color: var(--sage-950); }
.timer-row-btn { flex: none; min-height: var(--tap); padding: 0 .9rem; font-size: .9rem; white-space: nowrap; }
.timer-note { margin-top: 1.5rem; font-size: .875rem; line-height: 1.5; color: var(--sage-600); }
.link-btn { padding: 0; border: 0; background: none; color: var(--brand); font: inherit; text-decoration: underline; cursor: pointer; }

/* Running timers, visible on every screen of the recipe */
.timer-chips { position: fixed; left: 0; right: 0; bottom: calc(5.25rem + env(safe-area-inset-bottom)); z-index: 35; display: flex; gap: .5rem; padding: 0 .75rem; overflow-x: auto; pointer-events: none; }
body:not(.is-cooking) .timer-chips { bottom: calc(1rem + env(safe-area-inset-bottom)); }
.timer-chip { pointer-events: auto; flex: none; display: flex; align-items: stretch; min-height: var(--tap); background: var(--sage-950); color: #fff; border-radius: 2px; box-shadow: 0 4px 12px rgb(0 0 0 / .2); }
.chip-main { display: flex; align-items: center; gap: .6rem; padding: 0 .3rem 0 .9rem; border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.chip-count { font-family: var(--mono); font-weight: 700; font-variant-numeric: tabular-nums; }
.chip-label { max-width: 11rem; font-size: .875rem; color: var(--sage-200); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip-cancel[data-armed] { background: #fff; color: var(--sage-950); font-weight: 600; border-radius: 0 2px 2px 0; }
.chip-cancel { min-width: var(--tap); padding: 0 .6rem; border: 0; background: transparent; color: var(--sage-300); font-size: .9rem; cursor: pointer; }

/* Alarm */
.alarm { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: rgb(28 31 24 / .82); }
.alarm-card { width: min(30rem, 100%); padding: 2rem 1.5rem; background: var(--warm-50); border-radius: 2px; text-align: center; animation: alarm-pulse 1.2s ease-in-out infinite; }
.alarm-card h2 { font-size: clamp(1.75rem, 5vw, 2.5rem); margin-bottom: .5rem; }
.alarm-late { margin-bottom: 1.5rem; color: var(--sage-700); }
.alarm-card .btn-primary { width: 100%; }
.alarm-snooze { margin-top: 1.5rem; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .5rem; }
.alarm-snooze p { width: 100%; font-size: .875rem; color: var(--sage-600); }
.alarm-more { margin-top: 1rem; font-size: .875rem; color: var(--sage-600); }
@keyframes alarm-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(150 160 133 / .7); } 50% { box-shadow: 0 0 0 18px rgb(150 160 133 / 0); } }

/* Finish */
.finish { padding-top: 4rem; padding-bottom: 4rem; }
.finish h2 { font-size: clamp(2rem, 5vw, 3rem); margin-bottom: 1rem; }
.finish-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 2rem; }

@media (min-width: 52rem) {
  .wrap { padding-left: 2rem; padding-right: 2rem; }
  .hero { padding-top: 5rem; grid-template-columns: 1.1fr 1fr; gap: 3rem; }
  .recipe-top { grid-template-columns: 1.1fr 1fr; gap: 3.5rem; }
  .recipe-cols { grid-template-columns: 1fr 1.15fr; gap: 4rem; }
  .cook-main { grid-template-columns: minmax(0, 1fr) 17rem; gap: 2.5rem; padding-top: 2.5rem; }
  .cook-nav { padding-left: 2rem; padding-right: 2rem; }
}
@media (max-width: 51.99rem) {
  .recipe-image { order: -1; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
