/* =========================================================
   aglowbug COLORS & FONTS
   Purple and green come from the aglowbug glowbug logo;
   cream and ivory are the soft paper tones around them.
   ========================================================= */
:root {
  --cream:        #fdf9f1;   /* page background */
  --ivory:        #f6efe0;   /* tinted sections */
  --ink:          #2b2135;   /* main text */
  --ink-soft:     #5e5468;   /* secondary text */
  --purple:       #6a4a80;   /* headings, links, buttons */
  --purple-dark:  #553a68;   /* button hover */
  --purple-light: #b58ab5;   /* glowbug's head */
  --purple-deep:  #2e1f3b;   /* night sky */
  --purple-night: #1d1426;
  --green:        #57a847;   /* glowbug's body */
  --green-light:  #a8d754;   /* the glow */
  --green-deep:   #2f7430;   /* small green text */

  /* Chaloops Regular (Adobe Fonts) is only for the "aglowbug" name next to the logo.
     Headings use Fredoka; body text uses Nunito. */
  --font-brand:   "chaloops", "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-heading: "Fredoka", "Trebuchet MS", system-ui, sans-serif;
  --font-body:    "Nunito", "Segoe UI", system-ui, sans-serif;
  --radius: 18px;
  --shadow: 0 12px 30px rgba(43, 33, 53, .12);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.075rem;
  line-height: 1.65;
}

img { max-width: 100%; display: block; }
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-synthesis: none;
  line-height: 1.15;
  margin: 0 0 .5em;
  color: var(--purple);
}
h1 { font-size: clamp(2.3rem, 5.5vw, 4rem); }
h2 { font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
h3 { font-size: 1.4rem; }
p  { margin: 0 0 1em; }
a  { color: var(--purple); }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .78rem;
  font-weight: 800;
  color: var(--green-deep);
  margin-bottom: .6em;
}
.series { font-weight: 800; color: var(--green-deep); font-size: 1.1rem; margin: -.3em 0 .8em; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: .85em 1.6em;
  border-radius: 999px;
  font-weight: 800;
  font-family: var(--font-body);
  font-size: 1rem;
  text-decoration: none;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, background .2s ease, box-shadow .2s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--purple); color: var(--cream); }
.btn-primary:hover { background: var(--purple-dark); box-shadow: 0 0 22px rgba(168, 215, 84, .55); }
.btn-ghost { border-color: currentColor; color: inherit; }
.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  gap: 1rem; flex-wrap: wrap;
  padding: .6rem clamp(1rem, 5vw, 4rem);
  background: rgba(253, 249, 241, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--ivory);
}
.brand {
  display: flex; align-items: center; gap: .55rem;
  font-family: var(--font-brand); font-weight: 400; font-style: normal; font-size: 1.9rem;
  color: var(--purple); text-decoration: none;
}
.brand img { height: 48px; width: auto; }

/* The name "aglowbug" wherever it appears in text: Chaloops, like the logo.
   Wrap it as <span class="wordmark">aglowbug</span>. Bold inside headings, regular in text. */
.wordmark { font-family: var(--font-brand); font-weight: 400; font-style: normal; font-size: 1.1em; }
h1 .wordmark, h2 .wordmark, h3 .wordmark, .mission-statement .wordmark { font-weight: 700; }
.nav nav { display: flex; gap: clamp(.8rem, 2.5vw, 2rem); flex-wrap: wrap; }
.nav nav a { color: var(--ink); text-decoration: none; font-weight: 600; }
.nav nav a:hover { color: var(--purple); }

/* ---------- Layout ---------- */
.section { padding: clamp(3.5rem, 8vw, 6rem) clamp(1rem, 5vw, 4rem); }
.section-tint { background: var(--ivory); }
.section-head { text-align: center; max-width: 640px; margin: 0 auto 2.5rem; }

/* ---------- Brand hero (home) ---------- */
.brand-hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  color: var(--cream);
  background: radial-gradient(ellipse at 50% 0%, #4d3563 0%, var(--purple-deep) 50%, var(--purple-night) 100%);
  padding: clamp(3rem, 7vw, 5rem) clamp(1rem, 5vw, 4rem) clamp(6rem, 13vw, 10rem);
}
.brand-hero > *:not(.fireflies):not(.hero-hills) { position: relative; }
.brand-hero .eyebrow { color: var(--green-light); }
.brand-hero h1 { color: var(--cream); font-size: clamp(2.1rem, 5vw, 3.5rem); max-width: 20ch; margin: 0 auto .3em; }
.hero-sub {
  font-family: var(--font-heading); font-weight: 600;
  font-size: clamp(1.3rem, 2.6vw, 1.75rem);
  color: var(--green-light);
  margin: 0 auto .8em;
  /* Soft gold-orange outer glow, matching the glow behind the logo */
  text-shadow:
    0 0 6px rgba(255, 200, 110, .6),
    0 0 16px rgba(255, 179, 71, .45),
    0 0 32px rgba(255, 179, 71, .28);
}
.brand-hero .lead { font-size: 1.25rem; max-width: 40ch; margin: 0 auto; color: #e9e1f0; }
.brand-hero .hero-buttons { justify-content: center; }
.brand-hero .btn-primary { background: var(--green-light); color: var(--ink); }
.brand-hero .btn-primary:hover { background: #bfe36e; }
.hero-hills { position: absolute; left: 0; bottom: -1px; width: 100%; height: clamp(50px, 8vw, 110px); }

/* The glowbug in a soft, warm campfire-style glow that fades out with no hard edge */
.hero-logo-wrap {
  width: clamp(240px, 30vw, 330px);
  aspect-ratio: 1;
  margin: -1.5rem auto 0;
  display: grid; place-items: center;
}
.hero-logo-wrap::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle closest-side,
    rgba(255, 200, 110, .75) 0%,
    rgba(255, 179, 71, .45) 35%,
    rgba(255, 179, 71, .18) 65%,
    rgba(255, 179, 71, 0) 100%);
  animation: glow 4s ease-in-out infinite;
}
.glowbug {
  position: relative;
  height: 58%;
  aspect-ratio: 435 / 560;
  animation: float 5s ease-in-out infinite;
}
.glowbug img { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Wings flap in random bursts of 1–3 beats (see script.js). Each wing pivots where it meets the body. */
.wing-left  { transform-origin: 32.7% 50.7%; }
.wing-right { transform-origin: 70.5% 50.7%; }
@keyframes glow {
  50% { transform: scale(1.06); opacity: .85; }
}
@keyframes float {
  50% { transform: translateY(-8px) rotate(2deg); }
}

.fireflies span {
  position: absolute;
  width: 6px; height: 6px; border-radius: 50%;
  background: #d4f07a;
  box-shadow: 0 0 12px 5px rgba(168, 215, 84, .6);
  animation: twinkle 4s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: .15; transform: translate(0, 0); }
  50%      { opacity: 1;   transform: translate(6px, -10px); }
}

/* ---------- Featured book ---------- */
.feature {
  display: grid;
  grid-template-columns: .9fr 1.1fr;
  align-items: center;
  gap: clamp(2rem, 5vw, 5rem);
  max-width: 1100px; margin: 0 auto;
}
.feature-title { font-size: clamp(1.9rem, 3.8vw, 2.8rem); }
.tagline { font-size: 1.2rem; color: var(--ink-soft); max-width: 36ch; }
.byline { font-size: 1.05rem; }
.back-link { display: inline-block; margin-bottom: 1.2rem; font-weight: 800; text-decoration: none; }

.cover-wrap { display: flex; justify-content: center; }
.cover {
  width: min(340px, 80vw);
  aspect-ratio: 300 / 380;
  object-fit: cover;
  border-radius: 6px 14px 14px 6px;
  box-shadow: 0 24px 50px rgba(43, 33, 53, .3);
  transform: rotate(-3deg);
  transition: transform .4s ease;
}
.cover-wrap:hover .cover { transform: rotate(0deg) scale(1.02); }

.countdown { display: flex; gap: .8rem; margin: 1.4rem 0 .4rem; flex-wrap: wrap; }
.countdown .unit {
  background: #fff; border-radius: 14px; box-shadow: var(--shadow);
  padding: .6rem .9rem; text-align: center; min-width: 4.5rem;
}
.countdown .num { font-family: var(--font-heading); font-size: 1.8rem; font-weight: 600; color: var(--purple); display: block; line-height: 1.1; }
.countdown .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--ink-soft); }
.countdown .soon { background: var(--green-light); padding: .4rem 1rem; border-radius: 999px; font-weight: 800; }

.more-books {
  max-width: 560px; margin: 4rem auto 0; padding: 1.2rem 1.5rem;
  text-align: center; font-weight: 700; color: var(--ink-soft);
  border: 3px dashed #e3d8c2; border-radius: var(--radius);
}

/* ---------- Book page ---------- */
.book-summary { max-width: 680px; margin: 0 auto; font-size: 1.15rem; }
.book-facts {
  list-style: none; padding: 0; margin: 2rem 0 0;
  display: flex; justify-content: center; gap: 1rem; flex-wrap: wrap;
}
/* "Inside the book" bonus callout, with a fluttering blue butterfly */
.bonus {
  display: flex; gap: 1.2rem; align-items: center;
  margin: 2rem 0 0; padding: 1.3rem 1.5rem;
  background: #fff; border: 2px dashed #9cc4ea; border-radius: var(--radius); box-shadow: var(--shadow);
}
.bonus-butterfly { position: relative; flex: 0 0 auto; width: 96px; aspect-ratio: 200 / 139; }
.bonus-butterfly img { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Both wings fold in toward the body (the hinge line), twice, then rest */
.bf-wing { transform-origin: 50.9% 48.2%; animation: flutter 4s ease-in-out infinite; }
/* Each flap takes 0.6s (it was 0.32s); about 2.2s rest between pairs of flaps */
@keyframes flutter {
  0%, 55%, 70%, 85%, 100% { transform: none; }
  62.5%, 77.5%            { transform: scaleX(.3); }
}
.bonus p { margin: 0 0 .4em; }
.bonus .eyebrow { margin-bottom: .3em; }
.bonus-find { font-weight: 800; color: var(--purple); margin: 0 !important; }

.book-facts li { background: #fff; border-radius: 999px; padding: .5rem 1.1rem; box-shadow: var(--shadow); font-weight: 600; }
.book-facts span { color: var(--ink-soft); font-weight: 400; margin-right: .35rem; }

.gallery {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem; max-width: 1100px; margin: 0 auto;
}
.gallery-item {
  margin: 0; background: #fff; padding: .7rem .7rem 0; border-radius: var(--radius);
  box-shadow: var(--shadow); cursor: zoom-in; transition: transform .2s ease;
}
.gallery-item:nth-child(odd)  { transform: rotate(-1.2deg); }
.gallery-item:nth-child(even) { transform: rotate(1deg); }
.gallery-item:hover, .gallery-item:focus { transform: rotate(0) translateY(-4px); outline: none; }
.gallery-item img { border-radius: 12px; aspect-ratio: 4 / 5; width: 100%; object-fit: cover; }
.gallery-item figcaption { text-align: center; padding: .6rem 0 .8rem; color: var(--ink-soft); font-size: .95rem; }

/* ---------- About ---------- */
.about {
  display: grid; grid-template-columns: 320px 1fr; gap: clamp(2rem, 5vw, 4rem);
  align-items: center; max-width: 1000px; margin: 0 auto;
}
.about-photo {
  width: 100%; aspect-ratio: 1; border-radius: 50%; object-fit: cover;
  border: 10px solid #fff; box-shadow: var(--shadow);
}
.about .btn { margin-top: .5rem; }
.mission-line { font-style: italic; color: var(--ink-soft); }
.nav nav a[aria-current="page"] { color: var(--purple); font-weight: 800; }

/* ---------- About page ---------- */
.story {
  display: grid; grid-template-columns: 180px 1fr; gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start; max-width: 900px; margin: 0 auto;
}
.story-bug { width: 100%; max-width: 180px; margin: 0 auto; filter: drop-shadow(0 0 22px rgba(255, 179, 71, .45)); }

/* Scripture quote: set apart with a soft gold edge */
.scripture {
  margin: 0 0 1.2em; padding: 1rem 1.4rem;
  background: rgba(255, 255, 255, .6);
  border-left: 4px solid rgba(255, 179, 71, .85);
  border-radius: 0 14px 14px 0;
}
.scripture p { margin: 0 0 .3em; font-style: italic; font-size: 1.1rem; color: var(--ink); }
.scripture cite { font-style: normal; font-weight: 800; font-size: .9rem; color: var(--purple); }
.scripture cite::before { content: "— "; }

/* Mission: a night-sky card with the soft gold glow */
.mission {
  max-width: 820px; margin: 0 auto; text-align: center;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 5vw, 4rem);
  border-radius: 28px; color: var(--cream);
  background: radial-gradient(ellipse at 50% 0%, #4d3563 0%, var(--purple-deep) 60%, var(--purple-night) 100%);
  box-shadow: 0 0 60px rgba(255, 179, 71, .25), var(--shadow);
}
.mission .eyebrow { color: var(--green-light); }
.mission-statement {
  font-family: var(--font-heading); font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 2rem); line-height: 1.35;
  max-width: 40ch; margin: 0 auto .8em;
}
.mission .hero-sub { margin-bottom: 0; }

.next-steps { display: flex; gap: 1.5rem; justify-content: center; flex-wrap: wrap; max-width: 900px; margin: 0 auto; }
.next-card {
  flex: 1 1 260px; max-width: 360px;
  background: #fff; border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink); transition: transform .2s ease;
}
.next-card:hover { transform: translateY(-4px); }
.next-card h3 { margin-bottom: .3em; }
.next-card p { margin: 0; color: var(--ink-soft); }

/* ---------- Signup ---------- */
.signup-card {
  max-width: 680px; margin: 0 auto; text-align: center;
  background: #fff; border-radius: 28px; padding: clamp(2rem, 5vw, 3.5rem);
  box-shadow: var(--shadow);
  border: 3px dashed var(--green-light);
}
.signup-form { display: flex; gap: .8rem; justify-content: center; flex-wrap: wrap; margin-top: 1.5rem; }
.signup-form[hidden] { display: none; }
.signup-form input {
  flex: 1 1 260px; max-width: 360px;
  padding: .85em 1.2em; border-radius: 999px; font-size: 1rem; font-family: var(--font-body);
  border: 2px solid var(--ivory); background: var(--cream);
}
.signup-form input:focus { outline: none; border-color: var(--purple); }
.signup-thanks { font-size: 1.2rem; font-weight: 800; color: var(--green-deep); margin-top: 1.2rem; }

/* ---------- Stores + Contact ---------- */
.stores { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.store {
  background: #fff; padding: 1rem 1.6rem; border-radius: var(--radius); box-shadow: var(--shadow);
  text-decoration: none; color: var(--ink); font-weight: 800; text-align: center; min-width: 190px;
}
.store small { display: block; font-weight: 400; color: var(--ink-soft); }
.store.is-soon { opacity: .7; pointer-events: none; }

.contact-box { text-align: center; margin: 0 auto; max-width: 560px; }
.contact-email { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 600; }

/* ---------- Footer ---------- */
.footer { text-align: center; padding: 2rem 1rem; color: var(--ink-soft); font-size: .95rem; }

/* ---------- Lightbox (book pages are portrait: fit to screen height) ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(29, 20, 38, .9);
  display: grid; place-items: center; padding: 2rem;
}
.lightbox[hidden] { display: none; }
.lightbox-content img { width: auto; max-width: 100%; max-height: 85vh; margin: 0 auto; border-radius: 14px; display: block; }
.lightbox-close {
  position: absolute; top: 1rem; right: 1.2rem;
  background: none; border: 0; color: #fff; font-size: 2.6rem; cursor: pointer; line-height: 1;
}

/* ---------- Mobile ---------- */
@media (max-width: 780px) {
  .feature { grid-template-columns: 1fr; text-align: center; }
  .tagline { margin-left: auto; margin-right: auto; }
  .countdown, .hero-buttons { justify-content: center; }
  .about { grid-template-columns: 1fr; text-align: center; }
  .about-photo { max-width: 240px; margin: 0 auto; }
  .story { grid-template-columns: 1fr; text-align: center; }
  .bonus { flex-direction: column; text-align: center; }
  .story-bug { max-width: 130px; }
  .brand img { height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
  .fireflies span { opacity: .7; }
}
