/* Tiny Forest Cooking School — art direction from bible/series_bible.md */
@font-face { font-family: "Alegreya"; font-weight: 900; font-display: swap; src: url(/fonts/Alegreya-Black.woff) format("woff"); }
@font-face { font-family: "Literata"; font-weight: 400; font-display: swap; src: url(/fonts/Literata-Regular.woff) format("woff"); }
@font-face { font-family: "Literata"; font-weight: 400; font-style: italic; font-display: swap; src: url(/fonts/Literata-Italic.woff) format("woff"); }
@font-face { font-family: "Literata"; font-weight: 600; font-display: swap; src: url(/fonts/Literata-SemiBold.woff) format("woff"); }
@font-face { font-family: "Caveat"; font-weight: 700; font-display: swap; src: url(/fonts/Caveat-Bold.woff) format("woff"); }

:root {
  --paper: #F7EFDD;
  --paper-deep: #EFE3C8;
  --cream: #E9DCC0;
  --ink: #3B2A1E;
  --choc: #4A2E1C;
  --sage: #7E8F5A;
  --sage-dk: #5E6E40;
  --sage-grey: #A3AE97;
  --mustard: #D9B04C;
  --terracotta: #C66B4A;
  --terracotta-dk: #A9553A;
  --slate: #5F7489;
  --radius: 18px;
  --shadow: 0 10px 30px -12px rgba(74, 46, 28, .35);
  --gutter: clamp(16px, 4vw, 48px);
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .29  0 0 0 0 .18  0 0 0 0 .11  0 0 0 .07 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; color: var(--ink); background: var(--paper) var(--grain);
  font: 400 clamp(16px, 1.05vw + 12px, 19px)/1.6 "Literata", Georgia, serif;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--terracotta-dk); text-underline-offset: .18em; }
a:hover { color: var(--choc); }
h1, h2, h3 { font-family: "Alegreya", Georgia, serif; font-weight: 900; color: var(--choc); line-height: 1.08; margin: 0 0 .4em; letter-spacing: -.005em; }
h1 { font-size: clamp(2.4rem, 5.6vw, 4.6rem); }
h2 { font-size: clamp(1.9rem, 3.6vw, 3rem); }
h3 { font-size: clamp(1.25rem, 1.6vw, 1.6rem); }
h3 a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--choc); color: var(--paper); padding: 8px 14px; border-radius: 8px; }
.skip:focus { left: 8px; }
.label { font: 700 1.25rem/1.1 "Caveat", cursive; color: var(--terracotta); margin: 0 0 .35em; letter-spacing: .01em; }
.lede { font-size: 1.12em; max-width: 46em; }
.center { text-align: center; }
.section { padding: clamp(56px, 8vw, 120px) var(--gutter); max-width: 1280px; margin: 0 auto; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: .5em; padding: .85em 1.45em; border-radius: 999px;
  background: var(--terracotta); color: #FFF8EC; font-weight: 600; text-decoration: none; line-height: 1.1;
  box-shadow: 0 6px 0 -1px var(--terracotta-dk); transition: transform .15s, box-shadow .15s, background .15s;
}
.btn:hover { color: #FFF8EC; background: var(--terracotta-dk); transform: translateY(1px); box-shadow: 0 4px 0 -1px #8c4430; }
.btn-ghost { background: transparent; color: var(--choc); box-shadow: inset 0 0 0 2px var(--choc); }
.btn-ghost:hover { background: var(--choc); color: var(--paper); box-shadow: inset 0 0 0 2px var(--choc); }
.btn-small { padding: .6em 1.1em; font-size: .9em; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.2em; }

/* header */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px var(--gutter);
  background: rgba(247, 239, 221, .9);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 1px 0 rgba(74, 46, 28, .08);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--choc); font: 900 1.15rem/1 "Alegreya", serif; }
.brand em { font-style: normal; color: var(--sage-dk); }
.brand-leaf { width: 28px; height: 28px; fill: var(--sage); }
.topbar nav { display: flex; gap: clamp(12px, 2vw, 28px); }
.topbar nav a { color: var(--choc); text-decoration: none; font-weight: 600; font-size: .95rem; }
.topbar nav a[aria-current], .topbar nav a:hover { color: var(--terracotta); }
@media (max-width: 640px) {
  .brand span { font-size: 1rem; }
  .topbar nav { gap: 12px; }
  .topbar nav a { font-size: .85rem; }
  .topbar nav a[href="/about/"] { display: none; }
}

/* floating buy button: bottom-right pill on desktop, full-width bar on phones */
.buy-float {
  position: fixed; z-index: 60; right: clamp(14px, 2vw, 28px); bottom: clamp(14px, 2vw, 28px);
  display: flex; align-items: center; gap: 12px; padding: 10px 22px 10px 12px; border-radius: 999px;
  background: var(--choc); color: var(--paper); text-decoration: none; box-shadow: var(--shadow);
  transition: transform .2s, background .2s;
}
.buy-float:hover { color: var(--paper); background: #5a3a24; transform: translateY(-2px); }
.buy-float-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--mustard); color: var(--choc); display: grid; place-items: center; }
.buy-float-icon svg { width: 22px; height: 22px; }
.buy-float-text { display: flex; flex-direction: column; line-height: 1.15; }
.buy-float-text strong { font-size: 1rem; }
.buy-float-text small { font-size: .78rem; opacity: .8; transition: opacity .25s; }
.buy-float.is-swapping small { opacity: 0; }
@media (max-width: 640px) {
  .buy-float { left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); justify-content: center; border-radius: 16px; }
}

/* ---------- hero: forest ---------- */
.forest { position: relative; min-height: 100svh; overflow: hidden; background: var(--paper); }
.forest-stage { position: relative; height: 100svh; overflow: hidden; }
.layer { position: absolute; inset: 0; }
.layer img { width: 100%; height: 100%; object-fit: cover; }
.l-clearing img { object-position: 50% 60%; }
.l-far, .l-mid-l, .l-mid-r, .l-near-l, .l-near-r { display: none; } /* only the animated version shows the trees */
.forest-veil { position: absolute; inset: 0; background: var(--paper) var(--grain); opacity: 0; pointer-events: none; }

.critters { position: absolute; inset: auto 0 3svh 0; height: min(40svh, 24vw); display: flex; justify-content: center; align-items: flex-end; }
.critter + .critter { margin-left: -1.2vw; }
.critter { margin: 0; position: relative; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.critter-img { height: 100%; width: auto; max-width: none; filter: drop-shadow(0 8px 10px rgba(74, 46, 28, .18)); }
.critter-benny  { height: 100%; }
.critter-lily   { height: 82%; }
.critter-finley { height: 90%; }
.critter-nico   { height: 90%; }
.critter-hazel  { height: 76%; }
.critter figcaption {
  position: absolute; bottom: 100%; margin-bottom: 6px; white-space: nowrap; text-align: center;
  background: var(--paper); padding: 4px 12px 6px; border-radius: 12px; box-shadow: var(--shadow); font-size: .82rem;
}
.critter figcaption strong { display: block; font: 900 1.05rem/1 "Alegreya", serif; color: var(--choc); }
.critter figcaption span { font: 700 1rem/1 "Caveat", cursive; color: var(--terracotta); }

.forest-copy { position: relative; z-index: 5; }
.beat { max-width: 760px; margin: 0 auto; padding: 40px var(--gutter); text-align: center; }
.beat-title { max-width: none; padding-top: 32px; }
.beat-title h1 span { display: block; }
.beat-title h1 span + span { color: var(--sage-dk); }
.kicker { font: 700 clamp(1.3rem, 2vw, 1.7rem)/1.2 "Caveat", cursive; color: var(--terracotta); }
.scroll-hint { display: none; }

/* animated version (site.js adds .anim when motion is OK) */
.anim .forest { height: 100svh; }
.anim .forest-stage { position: absolute; inset: 0; }
.anim .l-far, .anim .l-mid-l, .anim .l-mid-r, .anim .l-near-l, .anim .l-near-r { display: block; }
.anim .layer { will-change: transform; }
/* portrait screens crop the wide layers: pin each side layer to its own edge */
.anim .l-near-l img, .anim .l-mid-l img { object-position: 0% 100%; }
.anim .l-near-r img, .anim .l-mid-r img { object-position: 100% 100%; }
.anim .critter { opacity: 0; }
.anim .forest-copy { position: absolute; inset: 0; pointer-events: none; }
.anim .beat { position: absolute; left: 0; right: 0; top: calc(70px + 3svh); opacity: 0; }
.anim .beat-title { opacity: 1; top: 50%; padding-top: 0; translate: 0 -55%; }
.anim .beat-title h1 { color: #FFF8EC; text-shadow: 0 2px 24px rgba(40, 30, 15, .55), 0 1px 2px rgba(40, 30, 15, .4); font-size: clamp(3rem, 8vw, 7rem); }
.anim .beat-title h1 span + span { color: var(--mustard); }
.anim .beat-title .kicker { color: #FFF3D8; text-shadow: 0 1px 12px rgba(40, 30, 15, .7); }
/* the painted forest is bright and busy: titles sit on a soft shadow, story beats on a paper card */
.anim .beat-title::before {
  content: ""; position: absolute; inset: -12% 8%; z-index: -1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(45, 32, 14, .5), rgba(45, 32, 14, 0));
}
.anim .beat:not(.beat-title) {
  left: 50%; right: auto; width: min(680px, calc(100% - 32px)); translate: -50% 0; padding: 22px 28px 10px;
  background: rgba(247, 239, 221, .9) var(--grain); border-radius: var(--radius); box-shadow: var(--shadow);
}
.anim .beat p { font-size: 1.05em; }
.anim .scroll-hint {
  display: block; position: absolute; z-index: 6; left: 0; right: 0; bottom: 96px; text-align: center; margin: 0;
  font: 700 1.3rem "Caveat", cursive; color: #FFF8EC; text-shadow: 0 1px 10px rgba(40, 30, 15, .7);
}
.anim .scroll-hint span::after { content: ""; display: block; width: 2px; height: 34px; margin: 8px auto 0; background: currentColor; animation: hint 1.6s ease-in-out infinite; transform-origin: top; }
@keyframes hint { 0%, 100% { transform: scaleY(.3); opacity: .4; } 50% { transform: scaleY(1); opacity: 1; } }

@media (max-width: 760px) {
  .critters { height: 27vw; bottom: 14svh; }
  .critter + .critter { margin-left: -3vw; }
  /* phone, animated: the side trees are gone, so the friends stand in two rows like a class photo */
  .anim .critters { display: block; height: min(50svh, 118vw); bottom: 11svh; }
  .anim .critter { position: absolute; bottom: 0; transform-origin: 50% 100%; }
  .anim .critter + .critter { margin-left: 0; }
  .anim .critter-benny  { left: 19%; bottom: 30%; height: 52%; translate: -50% 0; }
  .anim .critter-finley { left: 50%; bottom: 32%; height: 47%; translate: -50% 0; }
  .anim .critter-nico   { left: 81%; bottom: 30%; height: 47%; translate: -50% 0; }
  .anim .critter-lily   { left: 33%; bottom: 0;   height: 44%; translate: -50% 0; }
  .anim .critter-hazel  { left: 67%; bottom: 0;   height: 41%; translate: -50% 0; }
  .critter figcaption { font-size: .7rem; padding: 3px 8px 4px; }
  .critter figcaption strong { font-size: .9rem; }
  .critter figcaption span { display: none; }
}

/* non-animated fallback: copy flows under the picture */
html:not(.anim) .forest-stage { height: 78svh; }

/* ---------- journey: the four books ---------- */
.journey { position: relative; }
.journey-stage { display: none; }
.chapter { padding: 0 0 72px; }
.chapter-art { margin: 0; }
.chapter-art img { width: 100%; max-height: 70svh; object-fit: cover; }
.chapter-card {
  position: relative; display: flex; gap: clamp(16px, 2.5vw, 32px); align-items: flex-start;
  max-width: 980px; margin: -80px auto 0; padding: clamp(20px, 3vw, 40px);
  background: var(--paper) var(--grain); border-radius: var(--radius); box-shadow: var(--shadow);
}
.chapter-cover { flex: 0 0 clamp(110px, 16vw, 180px); }
.chapter-cover img { border-radius: 6px; box-shadow: 0 8px 18px -8px rgba(74, 46, 28, .5); transform: rotate(-2deg); }
.chapter-text h3 { font-size: clamp(1.8rem, 3.2vw, 2.8rem); }
.headline { font: 700 clamp(1.35rem, 2vw, 1.75rem)/1.15 "Caveat", cursive; color: var(--sage-dk); }
.ticks { list-style: none; padding: 0; margin: 0 0 .5em; }
.ticks li { position: relative; padding-left: 1.6em; margin: .25em 0; }
.ticks li::before { content: ""; position: absolute; left: 0; top: .45em; width: .9em; height: .9em; border-radius: 50% 50% 50% 0; background: var(--sage); transform: rotate(-45deg); }

.anim .journey { height: 100svh; overflow: hidden; }
.anim .journey-stage { display: block; position: absolute; inset: 0; overflow: hidden; background: var(--paper); }
.anim .scene { position: absolute; inset: 0; will-change: transform; --r: 0%; }
.anim .scene img { width: 100%; height: 100%; object-fit: cover; }
.anim .scene + .scene {
  -webkit-mask-image: radial-gradient(circle at var(--mx, 50%) var(--my, 60%), #000 calc(var(--r) - 12%), transparent var(--r));
  mask-image: radial-gradient(circle at var(--mx, 50%) var(--my, 60%), #000 calc(var(--r) - 12%), transparent var(--r));
}
.anim .journey-copy { position: absolute; inset: 0; pointer-events: none; }
.anim .chapter { position: absolute; inset: auto 0 0 0; padding: 0 var(--gutter) clamp(90px, 12svh, 130px); opacity: 0; }
.anim .chapter-art { display: none; }
.anim .chapter-card { margin: 0; max-width: 680px; pointer-events: auto; background: rgba(247, 239, 221, .94) var(--grain); }
.anim .chapter:nth-child(even) .chapter-card { margin-left: auto; }
.anim .chapter .ticks { display: none; }
@media (max-width: 760px) {
  .chapter-card { flex-direction: column; }
  .chapter-cover { flex-basis: auto; width: 110px; }
  .anim .chapter-card { padding: 18px; gap: 10px; flex-direction: row; }
  .anim .chapter-cover { width: 84px; flex: 0 0 84px; }
  .anim .chapter .blurb, .anim .chapter .ticks { display: none; }
  .anim .chapter .actions { margin-top: .5em; }
  .anim .chapter .btn { padding: .65em 1.1em; font-size: .9em; }
}

/* ---------- grids ---------- */
.book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(16px, 2.5vw, 32px); margin: 40px 0; }
.book-card { display: flex; flex-direction: column; align-items: flex-start; }
.book-card-cover { border-radius: 6px; box-shadow: 0 12px 22px -10px rgba(74, 46, 28, .55); margin-bottom: 14px; transition: transform .25s; }
.book-card a:hover .book-card-cover { transform: translateY(-4px) rotate(-1deg); }
.book-card p:not(.label) { font-size: .95em; }
.book-card .btn { margin-top: auto; }
@media (max-width: 900px) { .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.recipe-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(16px, 2vw, 28px); margin-top: 32px; }
.recipe-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); }
.recipe-card img { border-radius: var(--radius); aspect-ratio: 4 / 3; object-fit: cover; margin-bottom: 10px; transition: transform .25s; }
.recipe-card:hover img { transform: scale(1.02); }
.recipe-card strong { font: 900 1.3rem/1.1 "Alegreya", serif; color: var(--choc); }
.recipe-card .meta { font-size: .85em; opacity: .75; }
@media (max-width: 900px) { .recipe-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.meet-grid { list-style: none; padding: 0; margin: 32px 0 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: clamp(12px, 2vw, 28px); }
.meet-grid img { height: clamp(160px, 22vw, 300px); width: auto; margin: 0 auto 12px; }
.meet-grid h3, .meet-grid h2 { font-size: 1.45rem; margin-bottom: .2em; }
.meet-grid h3 span, .meet-grid h2 span { display: block; font: 700 1.1rem "Caveat", cursive; color: var(--terracotta); }
.meet-grid p { font-size: .92em; }
@media (max-width: 900px) { .meet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- inner pages ---------- */
.page main { padding-top: 64px; }
.crumbs { padding-top: 24px; padding-bottom: 0; font-size: .9em; }
.crumbs a { color: var(--choc); }
.page-head { padding-bottom: 0; }
.book-hero { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: clamp(24px, 5vw, 72px); align-items: center; padding-top: 32px; }
.book-hero-cover img { border-radius: 8px; box-shadow: 0 24px 40px -18px rgba(74, 46, 28, .6); transform: rotate(-2deg); }
.facts { font-size: .9em; opacity: .8; }
@media (max-width: 800px) { .book-hero { grid-template-columns: 1fr; } .book-hero-cover { max-width: 300px; } }
.gallery-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.gallery-grid figure { margin: 0; }
.gallery-grid img { border-radius: var(--radius); }
.gallery-grid figcaption { font: 700 1.25rem "Caveat", cursive; color: var(--sage-dk); margin-top: 6px; }
@media (max-width: 700px) { .gallery-grid { grid-template-columns: 1fr; } }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.four-col { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
@media (max-width: 800px) { .two-col, .four-col { grid-template-columns: 1fr; } }
.contents li { margin: .2em 0; }

.recipe-head { max-width: 880px; }
.recipe-facts { display: flex; flex-wrap: wrap; gap: 12px; margin: 24px 0; }
.recipe-facts div { background: var(--cream); border-radius: 14px; padding: 10px 16px; }
.recipe-facts dt { font: 700 1.05rem "Caveat", cursive; color: var(--terracotta); }
.recipe-facts dd { margin: 0; font-weight: 600; }
.spoons { display: inline-flex; gap: 4px; }
.spoons i { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--choc); }
.spoons i.on { background: var(--choc); }
.recipe-hero { margin: 0 0 40px; }
.recipe-hero img { border-radius: var(--radius); width: 100%; }
.recipe-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: clamp(24px, 5vw, 64px); }
@media (max-width: 800px) { .recipe-body { grid-template-columns: 1fr; } }
.ingredients { background: var(--cream); border-radius: var(--radius); padding: 24px 28px; align-self: start; }
.ingredients ul { padding-left: 1.1em; }
.steps ol { padding-left: 1.3em; }
.steps li { margin: 0 0 1em; padding-left: .3em; }
.grownup { display: inline-block; font: 700 .95rem/1 "Caveat", cursive; background: var(--mustard); color: var(--choc); padding: 3px 8px 4px; border-radius: 8px; transform: rotate(-2deg); }
.tip { background: #FFF8EC; border-left: 5px solid var(--sage); border-radius: 0 var(--radius) var(--radius) 0; padding: 16px 20px; font-family: "Caveat", cursive; font-weight: 700; font-size: 1.45rem; line-height: 1.2; }
.tip p { margin: 0; }
.tip-who { color: var(--sage-dk); font-size: 1.05rem; }
.from-book-inner { display: flex; gap: 28px; align-items: center; background: var(--cream); border-radius: var(--radius); padding: 28px; }
.from-book-inner img { width: 140px; border-radius: 6px; flex: 0 0 140px; }
@media (max-width: 600px) { .from-book-inner { flex-direction: column; align-items: flex-start; } }
.prose { max-width: 820px; }
.prose figure { margin: 32px 0 0; }
.prose img { border-radius: var(--radius); }

/* footer */
.footer { background: var(--choc); color: var(--cream); padding: 56px var(--gutter) calc(110px + env(safe-area-inset-bottom)); }
.footer-inner { max-width: 1280px; margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer a { color: var(--paper); display: block; margin: .25em 0; text-decoration: none; }
.footer a:hover { color: var(--mustard); }
.footer h2 { color: var(--mustard); font-size: 1.2rem; }
.footer-brand { font: 900 1.5rem "Alegreya", serif; color: var(--paper); }
.footer-brand em { font-style: normal; color: var(--mustard); }
.fine { max-width: 1280px; margin: 32px auto 0; font-size: .8rem; opacity: .7; }
@media (max-width: 800px) { .footer-inner { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
