/* Brightbyte Books — the website reads like one of our picture books: cream paper, a story told
   page by page, morning at Grandma's turning to dusk. Brand fonts are self-hosted (SIL OFL). */

@font-face { font-family: "Fraunces Soft"; src: url("/assets/fonts/fraunces-soft.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Lilita One"; src: url("/assets/fonts/lilita-one.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Andika"; src: url("/assets/fonts/andika.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Andika"; src: url("/assets/fonts/andika-bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #FFF6E6;
  --paper-deep: #FBEBD0;
  --ink: #2B211A;
  --ink-soft: #6B5B4B;
  --mint: #9CCBB4;
  --mint-deep: #3F8468;
  --peach: #F4B08E;
  --coral: #D9664A;
  --gold: #E2AE48;
  --gold-soft: #F6D88F;
  --night: #2B3456;
  --night-deep: #222944;
  --moon: #FFF1D6;
  --story: "Fraunces Soft", Georgia, "Times New Roman", serif;
  --display: "Lilita One", "Arial Rounded MT Bold", system-ui, sans-serif;
  --body: "Andika", "Trebuchet MS", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --top-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--paper);
  /* soft paper grain */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35  0 0 0 0 .25  0 0 0 0 .15  0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  line-height: 1.55;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--paper); padding: .5em 1em; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 40;
  height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--gutter);
  background: var(--paper);
  border-bottom: 2px solid transparent;
  transition: border-color .3s;
}
.top.is-scrolled { border-bottom-color: rgba(43, 33, 26, .12); }
.top__logo img { height: 46px; width: auto; }
.top__nav { display: flex; align-items: center; gap: clamp(12px, 2.4vw, 28px); font-weight: 700; }
.top__nav a { text-decoration: none; }
.top__nav a:not(.top__club):hover { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }
.top__club { background: var(--ink); color: var(--paper); padding: .45em 1em; border-radius: 999px; }
.top__club:hover { background: var(--coral); }

/* ---------- type ---------- */
.kicker { font-family: var(--display); color: var(--coral); letter-spacing: .04em; font-size: 1.05rem; margin: 0 0 .6rem; }
.kicker--gold { color: var(--gold); }
h1, h2, h3 { font-family: var(--story); font-weight: 400; line-height: 1.12; margin: 0; }
.story-text { font-family: var(--story); font-size: clamp(1.2rem, 1.05rem + .6vw, 1.55rem); line-height: 1.5; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--body); font-weight: 700; font-size: 1.05rem; text-decoration: none;
  padding: .8em 1.4em; border-radius: 999px; border: 2.5px solid var(--ink);
  box-shadow: 0 4px 0 var(--ink);
  transition: transform .15s ease, box-shadow .15s ease, background .2s;
  cursor: pointer;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn--ink { background: var(--ink); color: var(--paper); }
.btn--line { background: transparent; color: var(--ink); }
.btn--gold { background: var(--gold); color: var(--ink); }
.btn[aria-disabled="true"] { opacity: .75; }

/* ---------- characters (shared) ---------- */
.char { position: relative; }
.char img { width: 100%; height: auto; }
.lid {
  position: absolute; border-radius: 50%;
  background: var(--lid, #fde3a6);
  border-bottom: 3px solid #5B3A22;
  transform: scaleY(0); transform-origin: 50% 0;
  pointer-events: none;
}
.glow {
  position: absolute; width: 11%; aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 222, 140, .95) 0%, rgba(255, 205, 100, .35) 40%, rgba(255, 200, 90, 0) 70%);
  mix-blend-mode: screen; opacity: .55; pointer-events: none;
}

/* ---------- cover ---------- */
.cover {
  position: relative;
  min-height: calc(100svh - var(--top-h));
  display: grid; grid-template-columns: 1.05fr .95fr; align-items: center; gap: clamp(16px, 4vw, 64px);
  padding: clamp(24px, 5vh, 64px) var(--gutter) 96px;
  max-width: 1280px; margin: 0 auto;
}
.cover__title { font-size: clamp(2.4rem, 1.6rem + 3.4vw, 4.6rem); letter-spacing: -.01em; }
.cover__lede { font-size: clamp(1.1rem, 1rem + .4vw, 1.3rem); max-width: 34em; color: var(--ink-soft); margin: 1.1rem 0 1.8rem; }
.cover__actions { display: flex; flex-wrap: wrap; gap: 14px; }
.cover__art { margin: 0; }
.cover__art .char { width: min(560px, 100%); margin-left: auto; }
.turn {
  position: absolute; right: 0; bottom: 0;
  width: 150px; height: 150px; text-decoration: none;
}
.turn::before { /* the curled page corner */
  content: ""; position: absolute; right: 0; bottom: 0; width: 86px; height: 86px;
  background: linear-gradient(135deg, var(--paper) 0 49%, #E9D3AE 50%, #F5E3C3 62%, var(--paper-deep) 100%);
  border-top-left-radius: 14px;
  box-shadow: -6px -6px 14px rgba(43, 33, 26, .12);
  transition: width .25s, height .25s;
}
.turn:hover::before { width: 104px; height: 104px; }
.turn span {
  position: absolute; right: 96px; bottom: 30px; white-space: nowrap;
  font-family: var(--story); font-style: italic; font-size: 1.1rem; color: var(--ink-soft);
}

/* ---------- story scenes ---------- */
.scene { position: relative; }
.scene__pin {
  position: relative;
  min-height: calc(100svh - var(--top-h));
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px var(--gutter) 64px;
}
.beats { width: min(920px, 100%); text-align: center; }
.beat { font-family: var(--story); font-size: clamp(1.45rem, 1.1rem + 1.8vw, 2.6rem); line-height: 1.25; margin: 0 0 .6rem; }
.beat--big { font-size: clamp(1.7rem, 1.2rem + 2.4vw, 3.2rem); color: var(--mint-deep); }
.js .beats { position: relative; height: clamp(7.5rem, 20svh, 11rem); }
.js .beat { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0; opacity: 0; }
.js .beat.is-on { opacity: 1; }

.stage {
  position: relative;
  width: min(1100px, 100%);
  aspect-ratio: 16 / 9;
  max-height: calc(100svh - var(--top-h) - 13rem);
  margin: 0 auto;
}
.stage > * { position: absolute; }
.stage .char img { height: 100%; width: auto; }

/* page 1: meet Remi and Pip */
.meet-remi { left: 14%; bottom: 0; height: 96%; }
.meet-pip { left: 58%; bottom: 0; height: 92%; }
.q {
  margin: 0; font-family: var(--story); font-size: clamp(1rem, .8rem + .9vw, 1.6rem);
  background: #fff; border: 2.5px solid var(--ink); border-radius: 999px; padding: .3em .85em;
  box-shadow: 0 4px 0 var(--ink); white-space: nowrap;
}
.q1 { left: 0; top: 16%; transform: rotate(-6deg); }
.q2 { left: 39%; top: 3%; transform: rotate(3deg); }
.q3 { left: 41%; top: 27%; transform: rotate(-2deg); }
.bubble {
  margin: 0; background: #fff; border: 2.5px solid var(--ink); border-radius: 22px 22px 6px 22px;
  padding: .45em .9em; white-space: nowrap;
  font-family: var(--story); font-size: clamp(1.1rem, .8rem + 1.1vw, 1.8rem);
  box-shadow: 0 4px 0 var(--ink);
}
.bubble--meet { left: 70%; top: 0; border-radius: 22px 22px 22px 6px; background: var(--gold-soft); }

/* page 2: a walk through Remi's house */
.house { position: relative; width: min(1180px, 100%); margin: 0 auto; }
.house__frame {
  position: relative; overflow: hidden; border-radius: 22px;
  aspect-ratio: 2400 / 1357;
  max-height: calc(100svh - var(--top-h) - 15rem);
  margin: 0 auto;
  border: 3px solid var(--ink); box-shadow: 0 8px 0 var(--ink);
  background: var(--paper-deep);
}
.house__canvas { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.house__canvas img { width: 100%; height: 100%; object-fit: cover; }
.spot {
  position: absolute; width: 7%; aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%; border: 4px solid var(--gold);
  box-shadow: 0 0 0 6px rgba(255, 246, 230, .55), 0 0 30px rgba(226, 174, 72, .9);
  opacity: 0; pointer-events: none;
}
.no-motion .spot { opacity: .9; }
.house-pip { position: absolute; left: -2%; bottom: -6%; height: 46%; pointer-events: none; }
.house-pip img { height: 100%; width: auto; filter: drop-shadow(0 6px 10px rgba(43, 33, 26, .25)); }
.tag { display: inline-block; white-space: nowrap; font-family: var(--display); font-size: .55em; background: var(--coral); color: #fff; padding: .2em .7em; border-radius: 999px; vertical-align: .35em; margin-left: .3em; transform: rotate(-3deg); }

/* page numbers, like a real book */
.folio { position: absolute; left: 0; right: 0; bottom: 18px; margin: 0; text-align: center; font-family: var(--story); font-style: italic; color: var(--ink-soft); }
.folio::before { content: "— "; } .folio::after { content: " —"; }
.folio--light { color: rgba(255, 241, 214, .6); }

/* ---------- refrain + contents ---------- */
.refrain { position: relative; padding: clamp(64px, 12vh, 140px) var(--gutter) 110px; max-width: 1180px; margin: 0 auto; }
.refrain__line { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: clamp(8px, 2vw, 32px); }
.refrain h2 { font-size: clamp(2.8rem, 1.4rem + 7vw, 7.2rem); line-height: .98; text-align: center; letter-spacing: -.015em; }
.refrain h2 .w { display: inline-block; }
.refrain h2 .w:nth-child(n+4) { color: var(--mint-deep); }
.refrain__pip { width: min(190px, 100%); justify-self: end; }
.refrain__remi { width: min(150px, 85%); justify-self: start; }
.refrain__note { max-width: 760px; margin: clamp(40px, 8vh, 80px) auto 0; }
.contents__title { font-family: var(--display); color: var(--coral); font-size: 1.15rem; letter-spacing: .03em; margin: 2.4rem 0 .8rem; }
.contents { list-style: none; padding: 0; margin: 0; counter-reset: c; }
.contents li { display: flex; align-items: baseline; gap: 10px; padding: .55rem 0; counter-increment: c; }
.contents li::before { content: counter(c); font-family: var(--story); font-style: italic; color: var(--ink-soft); width: 1.4em; flex: none; }
.contents__what { font-family: var(--story); font-size: 1.3rem; white-space: nowrap; }
.contents__dots { flex: 1; border-bottom: 2.5px dotted rgba(43, 33, 26, .35); transform: translateY(-5px); min-width: 24px; }
.contents__why { color: var(--ink-soft); text-align: right; max-width: 22em; }

/* ---------- shelf ---------- */
.shelf { position: relative; padding: clamp(40px, 8vh, 96px) 0 110px; background: var(--paper-deep); }
.shelf__book { display: grid; grid-template-columns: .9fr 1.1fr; gap: clamp(24px, 5vw, 72px); align-items: center; max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }
.shelf__heading { font-family: var(--display); color: var(--coral); font-size: clamp(1.3rem, 1rem + 1vw, 1.8rem); text-align: center; margin: 0 0 clamp(28px, 6vh, 64px); letter-spacing: .03em; }
.shelf__title { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.8rem); }
.next-book { display: flex; align-items: center; gap: clamp(20px, 4vw, 44px); max-width: 760px; margin: clamp(40px, 7vh, 80px) auto 0; padding: 0 var(--gutter); }
.next-book .story-text { margin: .2rem 0 1rem; }
.next-book__spine {
  flex: none; width: 74px; height: 260px; border-radius: 6px 10px 10px 6px;
  background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(43, 33, 26, .05) 22px 24px), var(--mint);
  border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
  display: flex; align-items: center; justify-content: center;
}
.next-book__spine span { writing-mode: vertical-rl; transform: rotate(180deg); font-family: var(--display); letter-spacing: .08em; color: var(--ink); }
.shelf__meta { color: var(--ink-soft); margin: .5rem 0 1.2rem; }
.shelf__idea { margin: 1.4rem 0 1.8rem; font-family: var(--story); font-size: 1.35rem; }
.shelf__idea span { font-family: var(--display); font-size: .95rem; color: var(--paper); background: var(--mint-deep); padding: .2em .7em; border-radius: 999px; margin-right: .5em; vertical-align: .2em; }
.book3d { perspective: 1400px; }
.book3d img {
  border-radius: 4px 10px 10px 4px;
  transform: rotateY(-14deg) rotateX(2deg);
  transform-origin: left center;
  box-shadow: 18px 22px 40px rgba(43, 33, 26, .28), inset 6px 0 0 rgba(0, 0, 0, .08);
  transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}
.book3d:hover img { transform: rotateY(-4deg); }
.inside { margin-top: clamp(48px, 8vh, 96px); overflow-x: auto; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.inside__track { display: flex; gap: clamp(14px, 2vw, 28px); padding: 8px var(--gutter) 24px; width: max-content; }
.spread { margin: 0; width: min(420px, 78vw); scroll-snap-align: center; flex: none; }
.spread img { border-radius: 6px; box-shadow: 0 10px 28px rgba(43, 33, 26, .18); background: #fff; }
.inside.pinned { overflow: visible; }

/* ---------- dusk + night ---------- */
.dusk { height: 46vh; background: linear-gradient(to bottom, var(--paper-deep) 0%, #F8D5A8 30%, #E9A27E 52%, #8C6F8E 74%, var(--night) 100%); position: relative; overflow: hidden; }
.dusk::after { /* the sun going down */
  content: ""; position: absolute; left: 70%; top: 30%; width: 90px; height: 90px; border-radius: 50%;
  background: radial-gradient(circle, #FFE7A8 0 45%, rgba(255, 215, 130, 0) 72%);
  transform: translateY(var(--sun, 0));
}
.night { background: var(--night); color: var(--moon); }
.stars { position: absolute; inset: 0; pointer-events: none; }
.star { position: absolute; width: 3px; height: 3px; border-radius: 50%; background: var(--moon); opacity: .7; }
.club { position: relative; padding: clamp(40px, 8vh, 90px) var(--gutter) 120px; overflow: hidden; }
.club__inner { position: relative; display: grid; grid-template-columns: .8fr 1.2fr; gap: clamp(24px, 5vw, 72px); align-items: center; max-width: 1100px; margin: 0 auto; }
.club__pip { width: min(330px, 100%); justify-self: center; }
.club h2 { font-size: clamp(2.1rem, 1.4rem + 3vw, 3.6rem); }
.club__list { list-style: none; padding: 0; margin: 1.3rem 0 1.8rem; font-family: var(--story); font-size: 1.3rem; }
.club__list li { padding: .3rem 0 .3rem 1.8rem; position: relative; }
.club__list li::before { content: ""; position: absolute; left: 0; top: .78em; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 12px rgba(226, 174, 72, .7); }
.signup { max-width: 560px; }
.signup__label { display: block; font-weight: 700; margin-bottom: .4rem; }
.signup__row { display: flex; gap: 10px; flex-wrap: wrap; }
.signup input[type=email] {
  flex: 1 1 240px; min-width: 0; font: inherit; font-size: 1.05rem;
  padding: .8em 1.1em; border-radius: 999px; border: 2.5px solid var(--ink);
  background: var(--moon); color: var(--ink);
}
.signup__check { display: flex; gap: .6em; align-items: flex-start; margin: 1rem 0 .4rem; cursor: pointer; }
.signup__check input { width: 20px; height: 20px; margin-top: .15em; accent-color: var(--gold); flex: none; }
.signup__fine { font-size: .92rem; opacity: .8; margin: .4rem 0 0; }
.signup__fine a { color: var(--gold-soft); }
.signup__msg { margin: 1rem 0 0; padding: .8em 1.1em; border-radius: 16px; background: rgba(255, 241, 214, .1); border: 2px dashed rgba(255, 241, 214, .4); font-family: var(--story); font-size: 1.15rem; }
.night .btn { border-color: var(--night-deep); box-shadow: 0 4px 0 var(--night-deep); }

.end { position: relative; padding: 40px var(--gutter) 56px; background: linear-gradient(var(--night), var(--night-deep)); text-align: center; overflow: hidden; }
.end__the { font-family: var(--story); font-style: italic; font-size: clamp(3rem, 2rem + 5vw, 6rem); margin: 0; color: var(--gold-soft); }
.end__art { width: min(380px, 80vw); margin: 1rem auto 0; filter: drop-shadow(0 0 60px rgba(255, 210, 130, .35)); }
.end__next { font-family: var(--story); font-style: italic; opacity: .8; margin: .6rem 0 2rem; }
.end__nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 28px; font-weight: 700; }
.end__nav a { text-decoration: none; }
.end__nav a:hover { color: var(--gold-soft); }
.end__fine { max-width: 640px; margin: 2rem auto 0; font-size: .9rem; opacity: .7; }

/* ---------- simple inner pages (free, privacy) ---------- */
.page { max-width: 980px; margin: 0 auto; padding: clamp(32px, 7vh, 80px) var(--gutter) 96px; }
.page h1 { font-size: clamp(2.3rem, 1.6rem + 3vw, 3.8rem); }
.page .lede { font-family: var(--story); font-size: clamp(1.2rem, 1.05rem + .6vw, 1.5rem); color: var(--ink-soft); max-width: 36em; margin: 1rem 0 2.4rem; }
.freebies { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: clamp(20px, 4vw, 40px); }
.freebie { margin: 0; }
.freebie img { border-radius: 6px; box-shadow: 0 10px 26px rgba(43, 33, 26, .16); background: #fff; transform: rotate(-1.2deg); transition: transform .3s; }
.freebie:nth-child(2) img { transform: rotate(1.4deg); }
.freebie:hover img { transform: rotate(0); }
.freebie h2 { font-size: 1.6rem; margin: 1.2rem 0 .3rem; }
.freebie p { color: var(--ink-soft); margin: 0 0 1rem; }
.page-peek { display: flex; align-items: center; gap: 20px; margin-top: 3.5rem; padding: 24px; background: var(--paper-deep); border-radius: 24px; }
.page-peek img { width: 120px; flex: none; }
.prose { max-width: 680px; }
.prose h2 { font-size: 1.6rem; margin: 2.2rem 0 .5rem; }
.prose p, .prose li { color: var(--ink); }

/* ---------- small screens ---------- */
@media (max-width: 860px) {
  .top__nav a:not(.top__club) { display: none; }
  .top__logo img { height: 40px; }
  .cover { grid-template-columns: 1fr; text-align: left; padding-bottom: 120px; }
  .cover__art { order: -1; }
  .cover__art .char { width: min(380px, 86%); margin: 0 auto; }
  .stage { aspect-ratio: 4 / 5; width: min(520px, 100%); max-height: calc(100svh - var(--top-h) - 12rem); }
  .meet-remi { left: 4%; height: 70%; }
  .meet-pip { left: 52%; height: 66%; }
  .q1 { left: 0; top: 2%; } .q2 { left: 34%; top: 0; } .q3 { left: 2%; top: 14%; }
  .bubble--meet { left: 48%; top: 22%; }
  .scene--house .scene__pin { padding-left: 0; padding-right: 0; }
  .scene--house .beats { padding: 0 var(--gutter); }
  .house { margin-top: 1.5rem; }
  .house__frame { max-height: none; border-radius: 0; border-left: 0; border-right: 0; }
  .house-pip { height: 58%; left: 2%; bottom: -34%; }
  .club__pip { margin-bottom: 12px; }
  .refrain__line { grid-template-columns: 1fr 1fr; }
  .refrain h2 { grid-column: 1 / -1; order: -1; }
  .refrain__pip, .refrain__remi { width: 130px; justify-self: center; }
  .contents li { flex-wrap: wrap; }
  .contents__dots { display: none; }
  .contents__why { flex-basis: 100%; text-align: left; padding-left: calc(1.4em + 10px); }
  .shelf__book, .club__inner { grid-template-columns: 1fr; }
  .book3d { width: min(420px, 90%); margin: 0 auto; }
  .club__pip { width: 210px; }
  .turn span { display: none; }
}

/* motion off: everything is visible and still */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .btn, .book3d img, .freebie img { transition: none; }
}
