/* Child Fairy — "Twilight Spellbook" theme, matching the mobile app
   (see mobile-apps/child-fairy-app/ChildFairyWorld/Views/TwilightTheme.swift).
   Starry indigo shell for the marketing sections, ivory book-page panels
   for the content-heavy ones — the same contrast the app uses between its
   night sky and its open book pages. */
:root{
  /* character brand colors, locked in ../CHARACTER-DESIGN-BRIEF.md — used
     for character-adjacent accents, not page chrome */
  --skin:#F5DCC6;
  --cheeks:#F3A79B;
  --hair:#E8AE46;
  --hair-dark:#754629;
  --turquoise:#22BED0;
  --pink:#F45A91;
  --green:#75CE4F;
  --aqua:#A3EBDE;

  /* Twilight Spellbook theme */
  --ink:#241052;
  --ink-soft:#4A3E7A;
  --gold:#EDB94A;
  --gold-deep:#C79A2E;
  --lavender:#DCD0FA;
  --cream:#FFF8E6;
  --cream-2:#F7ECD1;
  --white:#FFFFFF;
  --night-1:#111D69;
  --night-2:#24216A;
  --night-3:#454295;
  --night-deep:#171C5D;

  --dark:var(--ink);

  --radius-lg:28px;
  --radius-md:18px;
  --radius-sm:12px;
  --shadow-soft:0 14px 34px -14px rgba(17,15,55,.45);
  --shadow-pop:0 20px 44px -12px rgba(199,154,46,.4);

  --font-display:'Fraunces', Georgia, serif;
  --font-body:'Nunito', system-ui, sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
body{
  margin:0;
  font-family:var(--font-body);
  color:var(--ink-soft);
  background:var(--night-2);
  -webkit-font-smoothing:antialiased;
  overflow-x:hidden;
}
img{ max-width:100%; display:block; }
a{ color:inherit; text-decoration:none; }
h1,h2,h3{ font-family:var(--font-display); font-weight:700; color:var(--ink); line-height:1.15; margin:0 0 .5em; }
p{ margin:0 0 1em; color:var(--ink-soft); line-height:1.6; }

.wrap{ max-width:1180px; margin:0 auto; padding:0 24px; }

/* ---------- starry night backdrop (fixed, behind every section) ---------- */
.bg-decor{
  position:fixed; inset:0; z-index:-1; pointer-events:none; overflow:hidden;
  background:
    radial-gradient(ellipse at 85% 8%, rgba(82,109,204,.35), transparent 55%),
    linear-gradient(160deg, var(--night-1), var(--night-2) 45%, var(--night-3));
}
.blob{ position:absolute; border-radius:50%; }
/* small + large star dots, scattered by hand rather than randomized so
   they read as a deliberate constellation, not noise */
.blob-1, .blob-2, .blob-3{ filter:blur(1px); background:var(--gold); opacity:.8; }
.blob-1{ width:4px; height:4px; top:12%; left:8%; box-shadow:
  120px 60px 0 -1px rgba(255,255,255,.55), 260px 20px 0 -1px rgba(255,255,255,.4),
  400px 140px 0 -1px var(--gold), 60px 220px 0 -1px rgba(255,255,255,.5),
  520px 60px 0 -1px rgba(255,255,255,.35), 720px 180px 0 -1px var(--gold),
  860px 40px 0 -1px rgba(255,255,255,.5), 980px 160px 0 -1px rgba(255,255,255,.4);
}
.blob-2{ width:3px; height:3px; top:38%; right:6%; box-shadow:
  -140px 40px 0 -1px rgba(255,255,255,.45), -300px 100px 0 -1px var(--gold),
  -60px 160px 0 -1px rgba(255,255,255,.5), -420px 20px 0 -1px rgba(255,255,255,.35);
}
.blob-3{ width:3px; height:3px; bottom:20%; left:20%; box-shadow:
  100px 40px 0 -1px rgba(255,255,255,.4), 240px -20px 0 -1px var(--gold),
  380px 60px 0 -1px rgba(255,255,255,.5), -120px 30px 0 -1px rgba(255,255,255,.35);
}

/* ---------- buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:.5em;
  font-family:var(--font-display); font-weight:700; font-size:1.02rem;
  padding:.8em 1.7em; border-radius:999px; border:2px solid var(--gold);
  cursor:pointer; transition:transform .18s ease, box-shadow .18s ease, background .18s ease;
  white-space:nowrap; box-shadow:0 0 0 4px rgba(255,255,255,.55) inset;
}
.btn-primary{ background:linear-gradient(180deg, #FFE59C, var(--gold-deep)); color:var(--ink); box-shadow:0 0 0 4px rgba(255,255,255,.6) inset, var(--shadow-pop); }
.btn-primary:hover{ transform:translateY(-3px) scale(1.02); box-shadow:0 0 0 4px rgba(255,255,255,.6) inset, 0 26px 50px -14px rgba(199,154,46,.5); }
.btn-ghost{ background:linear-gradient(180deg, #FFFCF1, var(--lavender)); color:var(--ink); }
.btn-ghost:hover{ transform:translateY(-3px); }
.btn-preview{ background:linear-gradient(180deg, #FFFCF1, var(--lavender)); color:var(--ink); }
.btn-preview:hover{ transform:translateY(-3px) scale(1.02); }
.btn-disabled{
  background:var(--cream-2); color:var(--ink-soft); cursor:not-allowed;
  box-shadow:none; opacity:.85; border-color:rgba(199,154,46,.4);
}
.btn-small{ padding:.6em 1.3em; font-size:.92rem; width:100%; }

/* ---------- header ---------- */
.site-header{
  position:sticky; top:0; z-index:50;
  background:rgba(23,28,93,.72); backdrop-filter:blur(10px);
  border-bottom:1px solid rgba(237,185,74,.35);
}
.header-inner{ display:flex; align-items:center; justify-content:space-between; padding:14px 24px; }
.logo{ display:flex; align-items:center; gap:.5em; font-family:var(--font-display); font-weight:700; font-size:1.3rem; color:var(--cream); }
.logo-mark{ font-size:1.6rem; }
.site-nav{ display:flex; align-items:center; gap:28px; font-weight:700; }
.site-nav a{ color:var(--cream); opacity:.85; transition:opacity .15s ease; }
.site-nav a:hover{ opacity:1; color:var(--gold); }
.nav-cta{
  background:linear-gradient(180deg, #FFE59C, var(--gold-deep)); color:var(--ink) !important; opacity:1 !important;
  padding:.55em 1.3em; border-radius:999px; border:1.5px solid var(--gold);
}
.nav-cta:hover{ filter:brightness(1.05); }
.nav-toggle{ display:none; flex-direction:column; gap:5px; background:none; border:0; cursor:pointer; padding:8px; }
.nav-toggle span{ width:24px; height:3px; border-radius:2px; background:var(--gold); }

/* ---------- hero (on the night backdrop) ---------- */
.hero{ position:relative; padding:64px 0 0; overflow:hidden; }
.hero-inner{ display:grid; grid-template-columns:1.05fr .95fr; gap:40px; align-items:center; padding-bottom:70px; }
.hero-copy, .hero-art{ min-width:0; }
.eyebrow{
  display:inline-block; font-family:var(--font-display); font-weight:700; font-size:.95rem;
  color:var(--ink); background:var(--gold); padding:.4em 1.1em; border-radius:999px; margin-bottom:16px;
  border:1px solid rgba(255,255,255,.7);
}
.eyebrow.center{ display:block; width:fit-content; margin-inline:auto; }
h1{ font-size:clamp(2.1rem, 4.4vw, 3.4rem); color:var(--cream); }
h1 .hl{ color:var(--gold); position:relative; }
.hero .lede{ font-size:1.15rem; max-width:46ch; color:rgba(255,248,230,.85); }
.hero-actions{ display:flex; gap:16px; flex-wrap:wrap; margin:24px 0 32px; }
.hero-stats{ display:flex; gap:34px; }
.hero-stats div{ display:flex; flex-direction:column; }
.hero-stats strong{ font-family:var(--font-display); font-size:1.6rem; color:var(--gold); }
.hero-stats span{ font-size:.85rem; color:rgba(255,248,230,.75); font-weight:700; }

.hero-art{ position:relative; max-width:100%; text-align:center; }
.hero-art img{
  display:inline-block; width:100%; max-width:420px; height:auto; aspect-ratio:1/1;
  border-radius:28px; border:4px solid var(--gold);
  box-shadow:0 0 0 8px rgba(237,185,74,.18), 0 26px 50px -14px rgba(0,0,0,.55);
  animation:float 5s ease-in-out infinite;
}
.sparkle{ position:absolute; font-size:1.6rem; color:var(--gold); animation:twinkle 2.4s ease-in-out infinite; }
.sparkle-a{ top:4%; right:2%; animation-delay:.2s; }
.sparkle-b{ top:40%; left:-4%; font-size:1.1rem; color:var(--lavender); animation-delay:.9s; }
.sparkle-c{ bottom:14%; right:6%; font-size:1.3rem; color:var(--gold); animation-delay:1.5s; }
.sparkle-d{ top:14%; left:4%; font-size:1rem; color:var(--lavender); animation-delay:.5s; }
.sparkle-e{ top:62%; right:-2%; font-size:1.8rem; color:var(--gold); animation-delay:1.1s; }
.sparkle-f{ bottom:26%; left:2%; font-size:.9rem; color:var(--lavender); animation-delay:1.9s; }
.sparkle-g{ top:2%; left:32%; font-size:1.2rem; color:var(--gold); animation-delay:.7s; }
.sparkle-h{ bottom:2%; left:38%; font-size:1rem; color:var(--lavender); animation-delay:2.2s; }

@keyframes float{ 0%,100%{ transform:translateY(0);} 50%{ transform:translateY(-14px);} }
@keyframes twinkle{ 0%,100%{ opacity:.3; transform:scale(.85);} 50%{ opacity:1; transform:scale(1.1);} }

.hero-wave{ width:100%; height:70px; display:block; }
.hero-wave path{ fill:var(--cream); }

/* ---------- books (an open book page, floating on the night sky) ---------- */
.books{ background:var(--cream); padding:80px 0 90px; position:relative; }
.center{ text-align:center; }
.section-lede{ max-width:56ch; margin:0 auto 48px; }
h2{ font-size:clamp(1.7rem, 3vw, 2.3rem); }

.book-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(250px, 1fr)); gap:28px; }

.book-card{
  background:linear-gradient(180deg, var(--cream), var(--cream-2)); border-radius:var(--radius-lg); padding:18px 18px 22px; text-align:left;
  box-shadow:var(--shadow-soft); transition:transform .22s ease, box-shadow .22s ease;
  display:flex; flex-direction:column;
  opacity:0; transform:translateY(24px);
  border:1.5px solid rgba(199,154,46,.4);
}
.book-card.is-visible{ animation:riseIn .6s ease forwards; }
@keyframes riseIn{ to{ opacity:1; transform:translateY(0);} }

.book-card:hover{ transform:translateY(-8px); box-shadow:0 26px 46px -16px rgba(36,16,82,.35); }

.book-cover{ position:relative; border-radius:var(--radius-md); overflow:hidden; margin-bottom:16px; aspect-ratio:1/1; border:1px solid rgba(199,154,46,.35); }
.book-cover img{ width:100%; height:100%; object-fit:cover; }
.book-badge{
  position:absolute; top:10px; left:10px; font-family:var(--font-display); font-weight:700; font-size:.75rem;
  background:var(--gold); color:var(--ink); padding:.35em .8em; border-radius:999px; box-shadow:var(--shadow-soft);
}
.book-num{
  position:absolute; top:10px; right:10px; width:30px; height:30px; border-radius:50%;
  background:var(--ink); color:var(--gold); font-family:var(--font-display); font-weight:700;
  display:flex; align-items:center; justify-content:center; font-size:.9rem; box-shadow:var(--shadow-soft);
  border:1.5px solid var(--gold);
}

.book-title{ font-family:var(--font-display); font-size:1.18rem; color:var(--ink); margin:0 0 .3em; line-height:1.25; }
.book-meta{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:.6em; }
.book-meta span{
  font-size:.72rem; font-weight:700; color:var(--ink-soft); background:var(--cream-2);
  padding:.3em .7em; border-radius:999px; border:1px solid rgba(199,154,46,.3);
}
.book-blurb{ font-size:.92rem; flex-grow:1; margin-bottom:14px; }
.book-price{
  font-family:var(--font-display); font-weight:700; color:var(--ink); font-size:.98rem;
  align-self:flex-end; background:var(--lavender); padding:.3em 1.1em; border-radius:999px; margin:0 0 12px;
}
.book-btn-row{ display:flex; flex-direction:column; gap:10px; }

/* ---------- coming-soon shelf: a literal shelf, matching the app's
   LibraryBookshelfView -- dark "still on the shelf, unopened" cards,
   deliberately contrasting with the light "open book" cards above,
   sitting on a gold ledge, same as the app's own composition. */
.shelf-wrap{
  margin-top:48px; position:relative; padding:32px 24px 40px; border-radius:var(--radius-lg);
  background:linear-gradient(160deg, var(--night-1), var(--night-3));
  box-shadow:inset 0 0 0 1px rgba(237,185,74,.25), var(--shadow-soft);
  overflow:hidden;
}
.shelf-heading{
  font-family:var(--font-display); font-weight:700; color:var(--cream); text-align:center;
  font-size:1.15rem; margin:0 0 26px;
}
.shelf-row{
  display:flex; gap:22px; overflow-x:auto; padding:4px 4px 26px; scroll-snap-type:x proximity;
  -webkit-overflow-scrolling:touch;
}
.shelf-row::-webkit-scrollbar{ height:8px; }
.shelf-row::-webkit-scrollbar-thumb{ background:rgba(237,185,74,.5); border-radius:999px; }

.shelf-card{
  flex:0 0 178px; scroll-snap-align:start; position:relative; padding:18px 14px 16px;
  border-radius:16px; text-align:center;
  background:linear-gradient(165deg, color-mix(in srgb, var(--accent) 35%, transparent), #20204F), #252155;
  border:2px solid var(--accent); box-shadow:0 14px 26px -12px rgba(6,9,46,.6);
  transition:transform .2s ease, box-shadow .2s ease;
}
.shelf-card::before{
  content:""; position:absolute; left:0; top:14px; bottom:14px; width:4px; border-radius:3px;
  background:var(--accent); opacity:.85;
}
.shelf-card:hover{ transform:translateY(-6px); box-shadow:0 22px 34px -14px rgba(6,9,46,.7); }
.shelf-icon{ font-size:1.9rem; display:block; margin-bottom:8px; }
.shelf-title{
  font-family:var(--font-display); font-weight:700; font-size:1rem; color:var(--cream);
  margin:0 0 .4em; line-height:1.2;
}
.shelf-invite{ font-size:.8rem; color:rgba(220,208,250,.85); margin:0 0 12px; min-height:2.4em; }
.shelf-pill{
  display:inline-block; font-size:.72rem; font-weight:700; color:var(--ink);
  background:var(--lavender); padding:.35em .9em; border-radius:999px;
}

.shelf-ledge{
  position:absolute; left:20px; right:20px; bottom:22px; height:13px; border-radius:5px;
  background:linear-gradient(180deg, #F4D38D, var(--gold-deep));
  box-shadow:0 8px 14px -4px rgba(0,0,0,.5);
}

/* ---------- world / cast (on the night backdrop) ---------- */
.world{ padding:90px 0; }
.world-inner{ max-width:820px; margin:0 auto; text-align:center; }
.world h2{ color:var(--cream); }
.world > .world-inner > p{ color:rgba(255,248,230,.8); }
.cast{ display:grid; grid-template-columns:repeat(auto-fit, minmax(190px,1fr)); gap:20px; margin-top:36px; text-align:left; }
.cast-card{ background:linear-gradient(180deg, var(--cream), var(--cream-2)); border-radius:var(--radius-md); padding:22px; box-shadow:var(--shadow-soft); border:1.5px solid rgba(199,154,46,.4); }
.cast-card-soon{ background:linear-gradient(155deg, var(--lavender), var(--cream)); display:flex; flex-direction:column; justify-content:center; }
.cast-emoji{ font-size:2rem; display:block; margin-bottom:8px; }
.cast-portrait{
  width:84px; height:84px; border-radius:50%; object-fit:cover; object-position:center 30%;
  border:3px solid var(--gold); box-shadow:var(--shadow-soft); margin-bottom:12px;
}
.cast-card h3{ font-size:1.1rem; margin-bottom:.3em; }
.cast-card p{ font-size:.9rem; margin:0; }

/* ---------- about (book page) ---------- */
.about{ background:var(--cream); padding:90px 0; }
.about-inner{ text-align:center; }
.about-grid{ display:grid; grid-template-columns:repeat(auto-fit, minmax(230px,1fr)); gap:26px; margin-top:40px; text-align:left; }
.about-card{ background:var(--cream-2); border-radius:var(--radius-md); padding:28px 24px; border:1.5px solid rgba(199,154,46,.35); }
.about-emoji{ font-size:2.1rem; display:block; margin-bottom:10px; }
.about-card h3{ font-size:1.12rem; }
.about-card p{ font-size:.94rem; margin:0; }

/* ---------- follow (gold banner, like the app's primary CTA) ---------- */
.follow{
  background:linear-gradient(135deg, #2A2578, var(--night-1));
  padding:80px 0; text-align:center; color:var(--cream);
  border-top:1px solid rgba(237,185,74,.35); border-bottom:1px solid rgba(237,185,74,.35);
}
.follow-emoji{ font-size:2.4rem; display:block; margin-bottom:14px; }
.follow h2{ color:var(--cream); }
.follow p{ color:rgba(255,248,230,.85); max-width:50ch; margin-inline:auto; }
.follow .btn-primary{ margin-top:10px; }

/* ---------- contact (book page) ---------- */
.contact{ background:var(--cream-2); padding:90px 0; }
.contact-inner{ max-width:600px; margin:0 auto; }
.contact-card{
  background:var(--cream); border-radius:var(--radius-lg); box-shadow:var(--shadow-soft);
  padding:32px; margin-top:36px; display:flex; align-items:center; justify-content:space-between;
  gap:20px; flex-wrap:wrap; border:1.5px solid rgba(199,154,46,.4);
}
.contact-row{ display:flex; align-items:center; gap:16px; }
.contact-icon{
  font-size:1.6rem; width:56px; height:56px; border-radius:50%; background:var(--lavender);
  display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.contact-row h3{ font-size:1.05rem; margin:0 0 .25em; }
.contact-link{ color:var(--ink); font-weight:700; border-bottom:2px solid var(--gold); }
.contact-link:hover{ color:var(--gold-deep); }

/* ---------- PDF preview modal ---------- */
.modal-overlay{
  position:fixed; inset:0; z-index:200; display:flex; align-items:center; justify-content:center;
  padding:24px; background:rgba(17,29,105,.65); backdrop-filter:blur(6px);
  opacity:0; transition:opacity .25s ease;
}
.modal-overlay.is-open{ opacity:1; }
.modal-overlay[hidden]{ display:none; }

.modal-box{
  position:relative; width:min(720px, 100%); max-height:88vh; overflow:hidden;
  background:linear-gradient(165deg, var(--white), var(--cream));
  border-radius:32px; padding:28px 28px 26px;
  box-shadow:0 40px 90px -20px rgba(17,15,55,.6);
  border:4px solid var(--gold);
  outline:3px dashed rgba(237,185,74,.4); outline-offset:-14px;
  transform:translateY(18px) scale(.97); transition:transform .3s ease;
  display:flex; flex-direction:column;
}
.modal-overlay.is-open .modal-box{ transform:translateY(0) scale(1); }

.modal-glow{ position:absolute; border-radius:50%; filter:blur(50px); opacity:.45; pointer-events:none; z-index:0; }
.modal-glow-a{ width:220px; height:220px; background:var(--gold); top:-80px; right:-60px; }
.modal-glow-b{ width:200px; height:200px; background:var(--lavender); bottom:-80px; left:-60px; }
.modal-sparkle{ position:absolute; color:var(--gold); font-size:1.4rem; animation:twinkle 2.2s ease-in-out infinite; z-index:0; }
.modal-sparkle-a{ top:18px; left:24px; }
.modal-sparkle-b{ bottom:70px; right:26px; color:var(--ink-soft); font-size:1.1rem; animation-delay:.8s; }

.modal-close{
  position:absolute; top:16px; right:16px; z-index:2; width:38px; height:38px; border-radius:50%;
  border:1.5px solid var(--gold); background:var(--cream); color:var(--ink); font-size:1rem; cursor:pointer;
  box-shadow:var(--shadow-soft); transition:transform .15s ease, background .15s ease;
}
.modal-close:hover{ background:var(--gold); color:var(--ink); transform:scale(1.08) rotate(90deg); }

.modal-head{ position:relative; z-index:1; text-align:center; margin-bottom:16px; padding-right:30px; }
.modal-head h3{ font-size:1.3rem; margin-bottom:.2em; }
.modal-head p{ margin:0; font-size:.85rem; font-weight:700; color:var(--gold-deep); }

.modal-pages{
  position:relative; z-index:1; flex:1; min-height:0; overflow-y:auto; overflow-x:hidden;
  display:flex; flex-direction:column; align-items:center; gap:22px; padding:6px 4px 14px;
}
.modal-page{ margin:0; width:min(420px, 100%); }
.modal-page img{
  display:block; width:100%; aspect-ratio:1/1; object-fit:cover; border-radius:16px;
  box-shadow:0 18px 34px -14px rgba(36,16,82,.4); border:3px solid var(--white);
}
.modal-page figcaption{
  text-align:center; margin-top:8px; font-size:.78rem; font-weight:700; color:var(--ink-soft);
  text-transform:uppercase; letter-spacing:.04em;
}
.modal-page-back img{ box-shadow:0 12px 26px -14px rgba(36,16,82,.32); }

.modal-actions{ position:relative; z-index:1; text-align:center; margin-top:18px; }
.modal-actions .btn{ min-width:220px; }

@media (max-width: 560px){
  .modal-box{ padding:22px 18px 20px; border-radius:24px; max-height:92vh; }
  .modal-actions .btn{ width:100%; min-width:0; }
}

/* ---------- footer ---------- */
.site-footer{ background:linear-gradient(135deg, var(--night-deep), var(--night-1)); color:var(--cream); padding:38px 0; border-top:1px solid rgba(237,185,74,.35); }
.footer-inner{ display:flex; align-items:center; justify-content:space-between; flex-wrap:wrap; gap:12px; }
.footer-brand{ display:flex; align-items:center; gap:.5em; font-family:var(--font-display); font-weight:700; color:var(--cream); }
.footer-note, .footer-domain{ margin:0; font-size:.88rem; color:rgba(255,248,230,.75); }
.footer-domain{ font-weight:700; color:var(--gold); }

/* ---------- responsive ---------- */
@media (max-width: 880px){
  .hero-inner{ grid-template-columns:1fr; padding-bottom:50px; }
  .hero-art{ order:-1; }
  .hero-stats{ gap:24px; }
}

@media (max-width: 680px){
  .site-nav{
    position:absolute; top:100%; left:0; right:0; background:var(--night-deep);
    flex-direction:column; align-items:flex-start; gap:2px; padding:10px 24px 20px;
    border-bottom:1px solid rgba(237,185,74,.35);
    display:none;
  }
  .site-nav.is-open{ display:flex; }
  .site-nav a{ width:100%; padding:12px 0; }
  .nav-cta{ margin-top:8px; text-align:center; }
  .nav-toggle{ display:flex; }
  .hero{ padding-top:32px; }
  .hero-actions .btn{ width:100%; }
  .footer-inner{ flex-direction:column; text-align:center; }
  .contact-card{ flex-direction:column; align-items:stretch; text-align:center; }
  .contact-row{ flex-direction:column; }
  .contact-card .btn{ width:100%; }
}
