/* ==========================================================
   I Love You More than the Day Before — book site
   Palette from the book's watercolors: sky blue, blush,
   meadow green, firefly gold, slate-blue hand lettering.
   ========================================================== */

:root {
  --ink: #3e536e;
  --ink-soft: #5d6f86;
  --paper: #fbf7ef;
  --blush: #e9b2a3;
  --blush-deep: #c97c6c;
  --gold: #f6d77a;
  --font-hand: "Shadows Into Light Two", "Segoe Print", cursive;
  --font-body: "Lora", Georgia, serif;
  --gutter: clamp(16px, 5vw, 72px);
  --topbar: 60px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #1f3048;
  color: var(--ink);
  font: 400 clamp(1rem, .95rem + .3vw, 1.15rem)/1.65 var(--font-body);
  overflow-x: hidden;
}
/* paper grain over everything */
body::after {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .09;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .35 0 0 0 0 .3 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-hand); font-weight: 400; line-height: 1.1; margin: 0 0 .5em; letter-spacing: .01em; }
h2 { font-size: clamp(2rem, 1.4rem + 2.6vw, 3.4rem); }
h3 { font-size: 1.8rem; margin-bottom: .1em; }
p { margin: 0 0 1em; max-width: 34em; }

:focus-visible { outline: 3px solid var(--blush-deep); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  background: var(--paper); padding: .6em 1em; border-radius: 8px;
}
.skip:focus { top: 12px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  min-height: 48px; padding: .7em 1.4em;
  border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font: 500 1rem/1 var(--font-body);
  text-decoration: none;
  box-shadow: 0 6px 20px -8px rgba(30, 40, 60, .5);
  transition: transform .25s ease, box-shadow .25s ease, background .25s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 26px -8px rgba(30, 40, 60, .55); }
.btn-ghost { background: rgba(255, 255, 255, .5); color: var(--ink); box-shadow: inset 0 0 0 1.5px currentColor; }
.btn-ghost:hover { background: rgba(255, 255, 255, .75); }
.btn-small { min-height: 44px; padding: .5em 1.1em; font-size: .92rem; }
.btn-glow { background: var(--gold); color: #2a2f3d; box-shadow: 0 0 0 0 rgba(246, 215, 122, .6), 0 0 40px rgba(246, 215, 122, .45); }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 1.4em; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; z-index: 40; top: 0; left: 0; right: 0;
  height: var(--topbar);
  display: flex; align-items: center; gap: 12px;
  padding: 8px var(--gutter);
  padding-top: max(8px, env(safe-area-inset-top));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand, .toc summary {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 14px;
  border-radius: 999px;
  background: rgba(251, 247, 239, .78);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  color: var(--ink);
  font-family: var(--font-hand); font-size: 1.2rem;
  text-decoration: none;
}
.brand span { white-space: nowrap; }
.toc { margin-left: auto; position: relative; }
.toc summary { cursor: pointer; list-style: none; font-size: 1.1rem; }
.toc summary::-webkit-details-marker { display: none; }
.pageno { font-family: var(--font-body); font-size: .8rem; opacity: .7; }
.toc ol {
  position: absolute; right: 0; top: calc(100% + 8px);
  margin: 0; padding: 14px 18px 14px 40px;
  width: min(280px, calc(100vw - 32px));
  background: var(--paper); color: var(--ink);
  border-radius: 14px;
  box-shadow: 0 18px 40px -12px rgba(20, 30, 50, .45);
  font-size: .95rem;
}
.toc li { padding: 2px 0; }
.toc a { display: block; padding: 6px 0; text-decoration: none; }
.toc a:hover { color: var(--blush-deep); }

/* bookmark ribbon = reading progress */
.ribbon { position: fixed; z-index: 39; top: 0; right: clamp(10px, 2.5vw, 34px); width: 10px; height: 34vh; pointer-events: none; }
.ribbon span {
  display: block; width: 100%; height: 100%;
  background: linear-gradient(var(--blush), var(--blush-deep));
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 7px), 0 100%);
  transform-origin: top; transform: scaleY(.04);
  opacity: .9;
}

/* mobile buy bar */
.buybar {
  position: fixed; z-index: 41;
  left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom));
  min-height: 52px;
  display: flex; align-items: center; justify-content: center; gap: .5em;
  border-radius: 999px;
  background: var(--ink); color: var(--paper);
  text-decoration: none; font-weight: 500;
  box-shadow: 0 10px 30px -8px rgba(20, 30, 50, .6);
  transform: translateY(140%);
  transition: transform .4s cubic-bezier(.2, .7, .2, 1);
}
.buybar.show { transform: none; }
@media (min-width: 760px) { .buybar { display: none; } }
@media (max-width: 759px) { .topbar .btn-small { display: none; } }

/* ==========================================================
   PAGES — each section is a sticky page; the next one slides
   over it like a turning leaf.
   ========================================================== */
.book { position: relative; }
.page {
  position: sticky; top: 0;
  min-height: 100vh; min-height: 100svh;
  --t: 0;
}
.page-inner {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bot) 78%);
  color: var(--ink);
  box-shadow: 0 -24px 50px -20px rgba(20, 28, 45, .35);
  transform-origin: 50% 0;
}
/* a soft highlight along the top edge, like the lip of a page */
.page-inner::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 18px; z-index: 3;
  background: linear-gradient(rgba(255, 255, 255, .35), transparent);
  pointer-events: none;
}
/* dimming as the next page covers this one */
.page-inner::after {
  content: ""; position: absolute; inset: 0; z-index: 6;
  background: #1c2433;
  opacity: calc(var(--t) * .5);
  pointer-events: none;
}
.js .page-inner {
  transform: perspective(1400px) rotateX(calc(var(--t) * 5deg)) scale(calc(1 - var(--t) * .07));
  will-change: transform;
}
.page:first-child .page-inner { box-shadow: none; }

/* sky palettes — one day, dawn to night */
.sky-cover     { --sky-top: #7fa3c3; --sky-bot: #c4d6cf; --hill-back: #7f9f8c; --hill-front: #5f8574; --path: #8a7563; --ink: #2f4260; }
.sky-dawn      { --sky-top: #f1d4cb; --sky-bot: #fbf0e3; --hill-back: #c6d3ad; --hill-front: #a8bf90; }
.sky-morning   { --sky-top: #a9cbe3; --sky-bot: #eef3f1; --hill-back: #b7cc9d; --hill-front: #93b37e; }
.sky-midday    { --sky-top: #8fbfe2; --sky-bot: #f3f1dd; --hill-back: #a9c48c; --hill-front: #86ab6f; }
.sky-golden    { --sky-top: #eac8a0; --sky-bot: #f8e9c9; --hill-back: #c2bf8a; --hill-front: #a3a56e; --ink: #4a4258; }
.sky-afternoon { --sky-top: #b9d3e2; --sky-bot: #f6e8cb; --hill-back: #b5c693; --hill-front: #96ad78; }
.sky-sunset    { --sky-top: #c9a8c4; --sky-bot: #f3c8ab; --hill-back: #a6a487; --hill-front: #848a70; --ink: #3f3a55; }
.sky-dusk      { --sky-top: #4d6d8c; --sky-bot: #9fb7b2; --hill-back: #5d7c78; --hill-front: #45635f; --ink: #fbf7ef; }
.sky-night     { --sky-top: #16233a; --sky-bot: #33506a; --hill-back: #2c4a50; --hill-front: #1f3a3e; --ink: #fbf7ef; }

/* ---------- spreads ---------- */
.spread {
  position: relative; z-index: 2;
  min-height: 100vh; min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr;
  align-content: center;
  gap: 24px;
  padding: calc(var(--topbar) + 32px) var(--gutter) clamp(140px, 22vh, 220px);
  max-width: 1320px; margin: 0 auto;
}
.leaf-art { position: relative; min-height: 200px; }
@media (min-width: 900px) {
  .spread { grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(40px, 6vw, 110px); }
  .spread-flip .leaf-text { order: 2; }
  .leaf-art { min-height: 360px; }
  /* the book's gutter: a faint fold down the middle of each spread */
  .spread:not(.spread-center):not(.spread-stack):not(.spread-cover)::after {
    content: ""; position: absolute; top: 12%; bottom: 18%; left: 50%; width: 40px; transform: translateX(-50%);
    background: linear-gradient(90deg, transparent, rgba(40, 50, 70, .05) 48%, rgba(255, 255, 255, .08) 52%, transparent);
    -webkit-mask: linear-gradient(transparent, #000 20%, #000 80%, transparent);
    mask: linear-gradient(transparent, #000 20%, #000 80%, transparent);
    pointer-events: none;
  }
}
.spread-center { grid-template-columns: 1fr !important; justify-items: center; text-align: center; }
.spread-center p { margin-left: auto; margin-right: auto; }
.spread-stack { grid-template-columns: 1fr !important; }

.kicker {
  font-family: var(--font-hand);
  font-size: clamp(1.3rem, 1.1rem + .6vw, 1.7rem);
  color: var(--blush-deep);
  margin: 0 0 .4em;
}
.sky-dusk .kicker, .sky-night .kicker { color: var(--gold); }
.sky-dusk p, .sky-night p { color: rgba(251, 247, 239, .9); }

.folio {
  position: absolute; z-index: 2; left: 0; right: 0; bottom: 14px;
  margin: 0 auto; text-align: center;
  font-family: var(--font-hand); font-size: 1.1rem;
  color: rgba(255, 255, 255, .85);
}

.hills { position: absolute; z-index: 1; left: -2%; bottom: -2px; width: 104%; height: clamp(140px, 26vh, 260px); }

/* ---------- cover ---------- */
.title {
  font-size: clamp(2.6rem, 1.2rem + 4.4vw, 4.6rem);
  text-transform: uppercase;
  line-height: .98;
  color: var(--ink);
}
.title span { display: inline-block; text-transform: none; font-size: .62em; padding-left: .7em; }
.byline { font-size: 1rem; line-height: 1.6; color: var(--ink); }
.byline strong { font-weight: 500; }
.lede { font-size: 1.1em; font-style: italic; }
.sky-cover .kicker { color: #8a4f45; }

.bookmock { perspective: 1400px; display: grid; place-items: center; padding: 10px 0; }
.bookmock-cover {
  position: relative;
  width: min(78vw, 400px); aspect-ratio: 1;
  border-radius: 3px 10px 10px 3px;
  overflow: hidden;
  background:
    radial-gradient(60% 30% at 70% 72%, rgba(246, 215, 122, .35), transparent 70%),
    linear-gradient(180deg, #a9c6dc 0%, #c9dbe0 46%, #8fb49a 64%, #6c9174 84%, #7a6656 100%);
  transform: rotateY(-14deg) rotateX(3deg);
  box-shadow: -2px 0 0 #d9d0bf inset, 28px 32px 60px -18px rgba(20, 30, 50, .55), 6px 4px 0 -1px #e7dfcf, 10px 7px 0 -2px #d6cdbb;
  transition: transform .8s cubic-bezier(.2, .7, .2, 1);
}
.bookmock:hover .bookmock-cover { transform: rotateY(-6deg) rotateX(1deg); }
.bookmock-cover::before { /* spine crease */
  content: ""; position: absolute; inset: 0 auto 0 0; width: 16px; z-index: 4;
  background: linear-gradient(90deg, rgba(0, 0, 0, .18), rgba(255, 255, 255, .15) 40%, transparent);
}
.bm-title {
  position: absolute; top: 9%; right: 8%; z-index: 2;
  text-align: center; font-family: var(--font-hand); text-transform: uppercase;
  font-size: clamp(1.4rem, 5.6vw, 2.2rem); line-height: 1.05; color: #34465f;
}
.bm-title em { font-style: normal; text-transform: none; font-size: .85em; }
.bm-names { position: absolute; bottom: 5%; left: 0; right: 0; z-index: 2; text-align: center; font-family: var(--font-hand); color: #fbf7ef; font-size: .95rem; }
.bm-glow {
  position: absolute; inset: 40% 0 10%; z-index: 1;
  background-image:
    radial-gradient(circle at 12% 30%, #ffe9a0 0 2.5px, transparent 4px),
    radial-gradient(circle at 34% 62%, #ffe9a0 0 2px, transparent 3px),
    radial-gradient(circle at 58% 22%, #ffe9a0 0 2px, transparent 3px),
    radial-gradient(circle at 76% 70%, #ffe9a0 0 3px, transparent 4.5px),
    radial-gradient(circle at 90% 38%, #ffe9a0 0 1.8px, transparent 3px),
    radial-gradient(circle at 46% 86%, #ffe9a0 0 2.2px, transparent 3.5px),
    radial-gradient(circle at 22% 80%, #ffe9a0 0 1.6px, transparent 2.6px),
    radial-gradient(circle at 66% 48%, #ffe9a0 0 1.5px, transparent 2.5px);
  background-size: 100% 100%;
  filter: drop-shadow(0 0 4px #f6d77a);
  opacity: .85;
}
.bm-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 3; }

/* ---------- fireflies + scenery ---------- */
canvas.fireflies { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; pointer-events: none; }
.sky-cover canvas.fireflies { z-index: 2; mix-blend-mode: screen; }

.cloud {
  position: absolute; width: 220px; height: 70px; border-radius: 50%;
  background: rgba(255, 255, 255, .8);
  filter: blur(14px);
  animation: drift 40s linear infinite alternate;
}
.cloud::before, .cloud::after { content: ""; position: absolute; border-radius: 50%; background: inherit; }
.cloud::before { width: 120px; height: 90px; left: 30px; top: -40px; }
.cloud::after  { width: 100px; height: 70px; left: 110px; top: -25px; }
.c1 { top: 8%; left: 6%; }
.c2 { top: 28%; right: 2%; transform: scale(.7); animation-duration: 55s; }
.c3 { bottom: 12%; left: 30%; transform: scale(.55); opacity: .8; animation-duration: 48s; }
@keyframes drift { to { translate: 40px 0; } }

.sun { position: absolute; border-radius: 50%; pointer-events: none; }
.sun-rising {
  width: 220px; height: 220px; left: 50%; bottom: -60px; transform: translateX(-50%);
  background: radial-gradient(circle, #fff3d6 0 40%, rgba(255, 220, 170, .7) 55%, transparent 72%);
}
@media (max-width: 899px) { .sun-rising { bottom: -120px; } }
.sun-low {
  z-index: 0; width: 70vmin; height: 70vmin; left: 50%; bottom: 4%; transform: translateX(-50%);
  background: radial-gradient(circle, rgba(255, 246, 214, .95) 0 18%, rgba(255, 222, 160, .55) 40%, transparent 70%);
}

.balloon {
  position: absolute; left: 50%; top: 6%; width: clamp(70px, 9vw, 110px); height: auto;
  animation: float 7s ease-in-out infinite;
}
@keyframes float { 50% { translate: 10px -18px; rotate: 3deg; } }

.butterfly { position: absolute; width: clamp(46px, 5vw, 68px); height: auto; animation: flutter .5s ease-in-out infinite alternate, wander 12s ease-in-out infinite; }
.b1 { left: 18%; top: 14%; }
.b2 { left: 58%; top: 38%; width: clamp(36px, 4vw, 52px); animation-delay: -.2s, -4s; }
.b3 { left: 34%; top: 62%; width: clamp(30px, 3vw, 42px); animation-delay: -.35s, -8s; }
@keyframes flutter { to { transform: scaleX(.55); } }
@keyframes wander { 50% { translate: 24px -20px; } }

.moon {
  position: absolute; z-index: 0; top: 14%; right: 14%;
  width: 90px; height: 90px; border-radius: 50%;
  box-shadow: inset -18px 8px 0 0 #f7eccd;
  filter: drop-shadow(0 0 18px rgba(247, 236, 205, .45));
}
@media (max-width: 759px) { .moon { top: 11%; right: 10%; width: 60px; height: 60px; box-shadow: inset -12px 6px 0 0 #f7eccd; } }

/* ---------- book lines ---------- */
.book-line {
  font-family: var(--font-hand);
  font-size: clamp(2rem, 1.3rem + 3.2vw, 3.6rem);
  line-height: 1.25;
  max-width: 14em;
  color: var(--ink);
}

.refrain { margin: 0; max-width: min(920px, 100%); position: relative; z-index: 2; }
.refrain blockquote { margin: 0; }
.refrain p {
  font-family: var(--font-hand);
  font-size: clamp(2.3rem, 1.4rem + 4.4vw, 4.8rem);
  line-height: 1.15; max-width: none; margin: 0 0 .5em;
}
.refrain figcaption { font-size: .95rem; color: var(--ink); opacity: .85; }

/* ---------- inside ---------- */
.notes { list-style: none; padding: 0; margin: 1.2em 0 0; display: grid; gap: 1em; max-width: 34em; }
.notes li { padding-left: 1.6em; position: relative; }
.notes li::before {
  content: ""; position: absolute; left: 0; top: .55em; width: .7em; height: .7em; border-radius: 50%;
  background: var(--gold); box-shadow: 0 0 10px var(--gold);
}
.notes strong { font-weight: 500; }
.facts {
  margin: 0; padding: clamp(20px, 3vw, 34px);
  background: rgba(251, 247, 239, .78);
  border-radius: 6px 18px 18px 6px;
  box-shadow: 0 20px 40px -20px rgba(30, 40, 60, .4);
  display: grid; gap: 14px;
  max-width: 420px;
}
.facts div { display: flex; justify-content: space-between; gap: 16px; border-bottom: 1px dashed rgba(62, 83, 110, .25); padding-bottom: 10px; }
.facts div:last-child { border: 0; padding: 0; }
.facts dt { font-family: var(--font-hand); font-size: 1.25rem; }
.facts dd { margin: 0; text-align: right; }

/* ---------- makers ---------- */
.makers { display: grid; gap: 22px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .makers { grid-template-columns: 1fr 1fr; } }
.maker {
  background: rgba(251, 247, 239, .8);
  border-radius: 18px;
  padding: clamp(20px, 3vw, 32px);
  box-shadow: 0 20px 40px -24px rgba(40, 30, 60, .45);
}
.portrait {
  width: 84px; height: 84px; border-radius: 50%;
  display: grid; place-items: center; margin-bottom: 14px;
  background: radial-gradient(circle at 35% 30%, #fbe3d6, var(--blush));
  font-family: var(--font-hand); font-size: 1.6rem; color: var(--ink);
}
.role { font-size: .85rem; letter-spacing: .14em; text-transform: uppercase; opacity: .75; margin-bottom: .8em; }

/* ---------- gift ---------- */
.occasions { list-style: none; padding: 0; margin: 0 0 1.2em; display: flex; flex-wrap: wrap; gap: 10px; }
.occasions li {
  padding: .35em 1em; border-radius: 999px;
  border: 1.5px solid rgba(251, 247, 239, .7);
  font-family: var(--font-hand); font-size: 1.2rem;
}
.keepsake { max-width: 440px; margin: 0 auto; display: grid; gap: 12px; }
.keepsake label { font-family: var(--font-hand); font-size: 1.3rem; color: var(--gold); }
.keepsake-card {
  background: var(--paper); color: #3e536e;
  padding: 28px 26px;
  border-radius: 4px;
  transform: rotate(-2deg);
  box-shadow: 0 24px 40px -18px rgba(0, 0, 0, .55);
  font-family: var(--font-hand); font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.2rem); line-height: 1.25;
  min-height: 170px;
}
.keepsake-card span { display: block; }
.keepsake-card output { color: var(--blush-deep); }
.keepsake input {
  min-height: 48px; width: 100%;
  padding: .6em 1em; border-radius: 12px;
  border: 1.5px solid rgba(251, 247, 239, .7);
  background: rgba(20, 30, 50, .25); color: var(--paper);
  font: inherit;
}
.keepsake input::placeholder { color: rgba(251, 247, 239, .65); }
html:not(.js) .keepsake input, html:not(.js) .keepsake label { display: none; }

/* ---------- end ---------- */
.end { position: relative; z-index: 3; max-width: 38em; }
.end h2 { font-size: clamp(2.4rem, 1.5rem + 4vw, 4.4rem); color: var(--paper); }
.end .actions { justify-content: center; }
.end .btn-ghost { background: transparent; color: var(--paper); }
.end .btn-ghost:hover { background: rgba(255, 255, 255, .1); }
.small { font-size: .9rem; margin-top: 1.6em; opacity: .75; }
.colophon {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  padding: 0 var(--gutter) max(84px, calc(env(safe-area-inset-bottom) + 84px));
  text-align: center; font-size: .78rem; color: rgba(251, 247, 239, .7);
}
.colophon p { max-width: none; margin: 0; }
@media (min-width: 760px) { .colophon { padding-bottom: 18px; } }

/* ---------- reveals (only when JS is on) ---------- */
.js .reveal { opacity: 0; translate: 0 18px; transition: opacity .9s ease, translate .9s cubic-bezier(.2, .7, .2, 1); }
.js .reveal.in { opacity: 1; translate: 0 0; }
.js .spread .reveal:nth-child(2) { transition-delay: .08s; }
.js .spread .reveal:nth-child(3) { transition-delay: .16s; }
.js .spread .reveal:nth-child(4) { transition-delay: .24s; }
.js .spread .reveal:nth-child(5) { transition-delay: .32s; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .page-inner { transform: none; }
  .js .reveal { opacity: 1; translate: none; }
}
