/* Cookie Christmas from The Dentons
   Watercolor storybook look: cream paper, dusty winter blues, soft berry red, sage, gold stars.
   Layout: one column, phone first. Full-screen watercolor splash shrinks into a sticky header. */
:root {
  --paper: #fbf8f2;
  --paper-2: #ffffff;
  --ink: #5b4636;          /* warm brown text */
  --ink-2: #8d7a6a;        /* muted */
  --blue: #6f8aa6;         /* dusty winter blue */
  --blue-2: #46607c;
  --blue-wash: #e6edf4;
  --berry: #c4574c;        /* soft red */
  --berry-2: #a8463c;
  --sage: #7f9b7a; --forest: #2f5e3e;
  --gold: #d4a94a;
  --line: #e3dbcf;
  --display: "Caveat", "Bradley Hand", "Segoe Print", cursive;
  --body: "Nunito", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --header-h: 118px;
  --radius: 16px;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 15% 25%, rgba(111,138,166,.10) 0 90px, transparent 160px),
    radial-gradient(circle at 85% 70%, rgba(111,138,166,.08) 0 120px, transparent 220px),
    radial-gradient(circle at 60% 10%, rgba(212,169,74,.07) 0 60px, transparent 140px);
  background-attachment: fixed;
  line-height: 1.5;
  min-height: 100%;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; text-wrap: balance; margin: 0; }
p { margin: 0; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- splash → header ---------- */
#splash {
  position: fixed; inset: 0 0 auto 0; height: 100dvh; z-index: 50;
  background: #dfe6ee url("img/hero-meadow.jpg") center top / cover no-repeat;
  color: var(--ink);
  isolation: isolate;
  display: grid; align-content: start; justify-items: center; text-align: center;
  padding: calc(env(safe-area-inset-top, 0px) + 7vh) max(16px, env(safe-area-inset-right, 0px)) 0 max(16px, env(safe-area-inset-left, 0px));
  overflow: hidden; cursor: pointer;
  transition: height .9s cubic-bezier(.65,0,.25,1), padding .9s cubic-bezier(.65,0,.25,1), background-position .9s cubic-bezier(.65,0,.25,1), box-shadow .9s;
}
#splash.shrunk {
  height: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding-top: calc(env(safe-area-inset-top, 0px) + 10px);
  background-position: center 74%;
  box-shadow: 0 4px 18px rgba(70,96,124,.18);
  cursor: default;
}
/* Wide screens: show the whole painting (contain) over a blurred copy of itself instead of cropping it. */
@media (min-aspect-ratio: 3/4) {
  /* the element's own background stays the cover crop; ::before blurs it (backdrop-filter) and paints the full painting on top */
  #splash:not(.shrunk)::before { content: ""; position: absolute; inset: 0; z-index: 0; -webkit-backdrop-filter: blur(26px) saturate(.9); backdrop-filter: blur(26px) saturate(.9); background: url("img/hero-meadow.jpg") center bottom / contain no-repeat; }
}
#splash::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(251,248,242,.35), rgba(251,248,242,0) 40%); pointer-events: none; }
#snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; opacity: .9; }
.splash-inner { position: relative; z-index: 1; display: grid; gap: 2px; justify-items: center; }
.title {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(3.4rem, 15vw, 6.5rem);
  color: var(--forest);
  text-shadow: 0 0 18px rgba(255,255,255,.95), 0 0 6px rgba(255,255,255,.95), 0 2px 0 rgba(255,255,255,.8);
  display: flex; flex-wrap: wrap; justify-content: center; column-gap: .22em; line-height: .95;
  transition: font-size .9s cubic-bezier(.65,0,.25,1);
}
.title .word { display: inline-flex; }
.title .ch { display: inline-block; opacity: 0; transform: translateY(26px) rotate(-6deg) scale(.7); animation: pop .7s cubic-bezier(.2,1.3,.4,1) forwards; animation-delay: calc(2.2s + var(--i) * 65ms); }
.title .ch.red { color: var(--forest); }
@keyframes pop { to { opacity: 1; transform: none; } }
.from {
  font-family: var(--display); font-size: clamp(1.6rem, 7vw, 2.4rem); color: var(--berry); font-weight: 700; letter-spacing: .02em;
  text-shadow: 0 0 14px #fff, 0 0 5px #fff;
  opacity: 0; animation: fadeUp .9s ease forwards; animation-delay: 1.1s;
  transition: font-size .9s cubic-bezier(.65,0,.25,1);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px);} to { opacity: 1; transform: none; } }
.tap { font-size: .85rem; color: var(--blue-2); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin-top: 10px; text-shadow: 0 0 10px #fff, 0 0 4px #fff; opacity: 0; animation: fadeUp .8s ease forwards, pulse 1.8s ease-in-out 4.8s infinite; animation-delay: 3.9s, 4.8s; }
@keyframes pulse { 50% { opacity: .45; } }
#splash.shrunk .title { font-size: clamp(2.3rem, 9.5vw, 3rem); }
#splash.shrunk .from { font-size: 1.3rem; }
#splash.shrunk .tap { display: none; }
#splash.shrunk .title .ch, #splash.shrunk .from { animation-delay: 0s; }

/* ---------- page ---------- */
main { max-width: 560px; margin: 0 auto; padding-block: calc(var(--header-h) + env(safe-area-inset-top, 0px) + 22px) 40px; display: grid; gap: 18px; opacity: 0; transition: opacity .6s ease .5s; }
body.ready main { opacity: 1; }

.welcome { min-height: calc(100dvh - var(--header-h) - env(safe-area-inset-top, 0px) - 24px); display: flex; flex-direction: column; justify-content: space-evenly; gap: 14px; }
.scroll-hint { text-align: center; font-family: var(--display); font-size: 1.25rem; color: var(--blue-2); line-height: 1.1; margin: 0; animation: bobHint 1.6s ease-in-out infinite; }
@keyframes bobHint { 50% { transform: translateY(5px); } }
.how { font-family: var(--display); font-size: 2rem; color: var(--blue-2); text-align: center; margin: 18px 0 6px; }
.directions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; text-align: center; margin: 0; padding: 0; }
.directions li { list-style: none; display: grid; justify-items: center; gap: 2px; font-size: .84rem; font-weight: 700; color: var(--ink-2); line-height: 1.25; }
.directions .pic { width: 86px; height: 86px; border-radius: 50%; overflow: hidden; background: #fff; box-shadow: 0 2px 10px rgba(70,96,124,.15); margin-bottom: 6px; }
.directions .pic img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.6); }
.intro {
  text-align: center; color: var(--ink); font-size: 1.2rem; line-height: 1.5; font-weight: 700;
  margin: 4px 0 0; padding: 0 4px;
}
.parade { display: block; width: 92%; max-width: 440px; margin: 0 auto; }
.directions .step { font-family: var(--display); font-size: 1.6rem; color: var(--berry); line-height: 1; }

section.card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px 20px; display: grid; gap: 14px; position: relative;
  box-shadow: 0 6px 22px rgba(70,96,124,.08);
}
section.card > h2 { font-size: 2.4rem; color: var(--blue-2); display: flex; align-items: center; gap: 10px; }
section.card > h2 .pic { width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex: none; background: #fff; }
section.card > h2 .pic img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.5); }
.hint { color: var(--ink-2); font-size: .95rem; }

/* cookie cards: one per row, picture + name on top, details below */
.cookies { display: grid; grid-template-columns: 1fr; gap: 30px; padding-top: 86px; }
.cookie {
  position: relative; isolation: isolate; border: 1.5px solid var(--line); border-radius: 16px; background: #fff;
  display: grid; cursor: pointer; transition: border-color .2s, box-shadow .2s; min-width: 0;
}
.cookie:hover { box-shadow: 0 6px 16px rgba(70,96,124,.12); }
.cookie.on { border-color: var(--berry); box-shadow: 0 0 0 3px rgba(196,87,76,.14); }
.cookie .top { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 14px; background: var(--blue-wash); border-radius: 15px 15px 0 0; border-bottom: 1.5px dashed var(--line); padding-right: 40px; }
.cookie .art { width: 112px; aspect-ratio: 1; overflow: hidden; border-radius: 15px 0 0 0; }
.cookie .art img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.5); }
.cookie .name { font-family: var(--display); font-weight: 700; font-size: 1.7rem; line-height: 1; color: var(--ink); }
.cookie .bottom { display: grid; gap: 8px; padding: 12px 14px 64px; justify-items: start; text-align: left; }
.cookie .desc { font-size: .9rem; color: var(--ink); line-height: 1.4; }
.cookie .story { font-family: var(--display); font-size: 1.15rem; line-height: 1.2; color: var(--blue-2); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: .68rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; border-radius: 999px; padding: 3px 8px; background: var(--blue-wash); color: var(--blue-2); }
.tag.warn { background: #fbe9d7; color: #9a5a1c; }
.tag.good { background: #e3efe0; color: #3f6b3a; }
.tag.new { background: #fde3df; color: var(--berry-2); }
.cookie .check { position: absolute; top: 10px; right: 10px; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line); background: #fff; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 900; transition: .2s; z-index: 1; }
.cookie.on .check { background: var(--berry); border-color: var(--berry); }
.qty { display: none; align-items: center; gap: 8px; margin-top: 2px; }
.cookie.on .qty { display: flex; }
.qty .qlabel { width: 6.4em; flex: none; font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--blue-2); }
.qty.zero output { color: var(--ink-2); font-weight: 700; }
.qty button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--blue-2); color: #fff; font-size: 1.2rem; font-weight: 800; cursor: pointer; line-height: 1; flex: none; }
.qty button:disabled { opacity: .35; cursor: default; }
.qty output { min-width: 4.6em; text-align: center; font-weight: 800; font-size: .95rem; font-variant-numeric: tabular-nums; }

/* peeking critters: sit behind the card, head poking above its top edge */
.peek { position: absolute; z-index: -1; top: calc(var(--w, 90px) * -.82); left: var(--x, auto); right: var(--r, auto); width: var(--w, 90px); height: auto; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(70,96,124,.15)); animation: peekIn .8s cubic-bezier(.2,1.2,.4,1) both; }
.peek.flip { transform: scaleX(-1); }
@keyframes peekIn { from { transform: translateY(40%); opacity: 0; } }
.peek.flip { animation-name: peekInFlip; }
@keyframes peekInFlip { from { transform: scaleX(-1) translateY(40%); opacity: 0; } }
main, .cookies, form { isolation: isolate; }
section.card { margin-top: 30px; }
section.card:has(> .peek), section.card:has(> .peek-row) { margin-top: 60px; isolation: isolate; }
form > section.card { padding-bottom: 52px; }
.cookie:last-child .bottom { padding-bottom: 14px; }
.peek-row { position: absolute; z-index: -1; left: 6px; right: 6px; top: 0; display: flex; justify-content: space-between; align-items: flex-end; pointer-events: none; }
.peek-row img { width: 13.5%; height: auto; transform: translateY(-74%); filter: drop-shadow(0 2px 2px rgba(70,96,124,.15)); animation: peekIn .8s cubic-bezier(.2,1.2,.4,1) both; animation-delay: calc(var(--i, 0) * 80ms); }
.peek-row img:nth-child(2) { --i: 1 } .peek-row img:nth-child(3) { --i: 2 } .peek-row img:nth-child(4) { --i: 3 } .peek-row img:nth-child(5) { --i: 4 } .peek-row img:nth-child(6) { --i: 5 } .peek-row img:nth-child(7) { --i: 6 }

/* form */
.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-weight: 800; font-size: .88rem; color: var(--blue-2); }
.field input, .field textarea, .field select {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff; font-size: 1rem; min-width: 0;
}
.field input:focus, .field textarea:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(111,138,166,.18); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row.three { grid-template-columns: 2fr 1fr 1.2fr; }
@media (max-width: 380px) { .row.three { grid-template-columns: 1fr 1fr; } .row.three .field:first-child { grid-column: 1 / -1; } }
textarea { resize: vertical; min-height: 70px; }
.optional { font-weight: 600; color: var(--ink-2); font-size: .8rem; }

.summary { background: var(--blue-wash); border-radius: 12px; padding: 12px 14px; font-size: .95rem; display: grid; gap: 4px; }
.summary strong { color: var(--blue-2); }
.summary ul { margin: 0; padding-left: 1.1em; }
.summary .empty { color: var(--ink-2); font-style: italic; }

.submit {
  width: 100%; border: 0; border-radius: 999px; padding: 14px 20px; font-size: 1.6rem; font-weight: 700; font-family: var(--display); line-height: 1;
  background: var(--berry); color: #fff; cursor: pointer; box-shadow: 0 4px 0 var(--berry-2), 0 8px 18px rgba(196,87,76,.25); transition: transform .1s, box-shadow .1s, background .2s;
  display: flex; justify-content: center; align-items: center; gap: 10px;
}
.submit:hover { background: #d0625a; }
.submit:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--berry-2); }
.submit:disabled { opacity: .7; cursor: wait; }
.error { color: var(--berry); font-weight: 700; font-size: .95rem; display: grid; gap: 2px; }
.error:empty { display: none; }

footer { text-align: center; color: var(--ink-2); font-size: .9rem; display: grid; gap: 6px; justify-items: center; }
footer .parade { width: 92%; max-width: 440px; margin-bottom: 4px; }
footer p { font-family: var(--display); font-size: 1.5rem; color: var(--ink); }
footer a { color: var(--blue-2); }

/* ---------- A Year with the Dentons ---------- */
section.card.year { grid-template-columns: 120px 1fr; column-gap: 14px; align-items: center; padding: 14px; }
.year-pic { width: 120px; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; }
.year-pic img { width: 100%; height: 100%; object-fit: cover; object-position: center 70%; }
.year-text { display: grid; gap: 8px; min-width: 0; }
.year-text h2 { font-size: 2rem; color: var(--blue-2); }
.year-text p { font-size: .9rem; color: var(--ink); }
.open-card { background: var(--blue-2); box-shadow: 0 4px 0 #2f4458, 0 8px 18px rgba(70,96,124,.25); font-size: 1.3rem; padding: 10px 14px; }
.open-card:hover { background: var(--blue); }
@media (max-width: 400px) { section.card.year { grid-template-columns: 96px 1fr; } .year-pic { width: 96px; } .year-text h2 { font-size: 1.7rem; } }

.card-overlay { position: fixed; inset: 0; z-index: 90; background: rgba(70,96,124,.55); backdrop-filter: blur(3px); overflow-y: auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); padding-top: calc(env(safe-area-inset-top, 0px) + 16px); animation: fadeIn .3s ease; }
.xmas-card {
  position: relative; max-width: 520px; margin: 0 auto; background: #fbf8f0;
  border: clamp(58px, 16vw, 110px) solid transparent;
  border-image: url("img/card-frame.jpg") 22% fill / clamp(58px, 16vw, 110px) / 0 round;
  box-shadow: 0 20px 50px rgba(30,45,60,.35); animation: cardOpen .7s cubic-bezier(.2,1.1,.4,1);
  transform-origin: top center;
}
@keyframes cardOpen { from { transform: rotateX(-60deg) scale(.92); opacity: 0; } }
.xmas-inner { padding: 4px 2px; display: grid; gap: 14px; text-align: center; }
.xmas-inner .eyebrow { font-size: .75rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 800; color: var(--berry); }
.xmas-inner h2 { font-size: 2.4rem; color: var(--blue-2); }
.xmas-inner p { font-size: .93rem; line-height: 1.55; text-align: left; }
.xmas-inner .wish { font-family: var(--display); font-size: 1.6rem; line-height: 1.2; color: var(--berry); text-align: center; }
.xmas-inner .signoff { font-family: var(--display); font-size: 1.5rem; line-height: 1.2; color: var(--ink); text-align: center; }
.close { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 12px); right: max(12px, env(safe-area-inset-right, 0px)); width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; color: var(--blue-2); font-size: 1.6rem; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(70,96,124,.25); z-index: 2; }
.photos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 4px 0 6px; }
.photo { margin: 0; background: #fff; padding: 6px 6px 16px; box-shadow: 0 4px 12px rgba(70,96,124,.2); transform: rotate(var(--tilt, 0deg)); }
.photo img { width: 100%; aspect-ratio: 1; object-fit: cover; object-position: center 12%; }
.photo:nth-child(3n) { grid-column: 1 / -1; }
.photo:nth-child(3n) img { aspect-ratio: 4 / 3; }
.no-photos { grid-column: 1 / -1; display: grid; justify-items: center; gap: 4px; font-family: var(--display); font-size: 1.3rem; color: var(--ink-2); }
.no-photos img { max-width: 320px; mix-blend-mode: multiply; }

/* ---------- confirmation ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(70,96,124,.5); backdrop-filter: blur(2px); display: grid; place-items: center; padding: 20px; z-index: 100; animation: fadeIn .25s ease; overflow-y: auto; }
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--paper-2); border-radius: 22px; padding: 10px 22px 22px; max-width: 420px; width: 100%; text-align: center;
  display: grid; gap: 10px; justify-items: center; position: relative; overflow: hidden;
  animation: popIn .5s cubic-bezier(.2,1.3,.4,1);
}
@keyframes popIn { from { transform: scale(.7); opacity: 0; } }
.modal h2 { font-size: 3rem; color: var(--berry); }
.modal .big { width: 220px; height: 190px; overflow: hidden; }
.modal .big img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.35) translateY(-2%); animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: scale(1.35) translateY(-4%); } }
.modal p { color: var(--ink); }
.modal .summary { text-align: left; width: 100%; }
.modal .submit { background: var(--blue-2); box-shadow: 0 4px 0 #2f4458; font-size: 1.4rem; padding: 12px; }
.modal .submit:hover { background: var(--blue); }
.confetti { position: absolute; top: -10px; width: 9px; height: 13px; border-radius: 3px; animation: fall 2.6s linear forwards; }
@keyframes fall { to { transform: translateY(620px) rotate(540deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
