/* ==========================================================
   Beams of Light Media: site styles
   Palette: "Sunshine and sky"
   ========================================================== */

/* ---------- Color tokens: light mode (default) ---------- */
:root {
  --bg: #ffffff;
  --surface: #f3f6fc;
  --text: #1b1b3a;
  --text-soft: #4a4a68;
  --link: #1971c2;
  --headline-accent: #1b1b3a;
  --border: #dde1ee;
  --sun: #ffd23f;
  --sun-soft: #ffffff;
  --hero-bg: #e6f6fd;
  --band-bg: #fff6d6;
  --sky: #4cc9f0;
  --pink: #ff8fab;
  --on-fill: #1b1b3a; /* text on sun, sky, and pink */
  --focus: #1b1b3a;
  --shadow: 0 0.5rem 1.5rem rgb(27 27 58 / 0.08);

  --font-heading: "Fredoka", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 1.25rem;
  --wrap: 90rem;

  color-scheme: light;
}

/* ---------- Dark mode tokens ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14132b;
    --surface: #221f3d;
    --text: #f5f3ff;
    --text-soft: #d9d6f0;
    --link: #4cc9f0;
    --headline-accent: #ffd23f;
    --sun-soft: #2e2a55;
    --hero-bg: #1c1a3b;
    --band-bg: #221f3d;
    --border: #3a3660;
    --on-fill: #14132b;
    --focus: #ffd23f;
    --shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14132b;
  --surface: #221f3d;
  --text: #f5f3ff;
  --text-soft: #d9d6f0;
  --link: #4cc9f0;
  --headline-accent: #ffd23f;
  --sun-soft: #2e2a55;
  --hero-bg: #1c1a3b;
  --band-bg: #221f3d;
  --border: #3a3660;
  --on-fill: #14132b;
  --focus: #ffd23f;
  --shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

img, svg { display: block; max-width: 100%; height: auto; }

h1, h2, h3, .h2-size, .h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  line-height: 1.15;
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: clamp(2.25rem, 1.6rem + 3vw, 3.75rem); }
h2, .h2-size { font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.25rem); }
h3, .h3 { font-size: 1.35rem; }

p { margin: 0 0 1rem; }

a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 0.08em; }
a:hover { text-decoration-thickness: 0.16em; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 0.35rem;
}
main:focus { outline: none; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: 1rem;
}
@media (min-width: 40em) { .wrap { padding-inline: 2rem; } }

.section { padding-block: 3rem; }
.narrow { max-width: 46rem; }
.lead { font-size: 1.25rem; color: var(--text-soft); max-width: 42rem; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -10rem;
  z-index: 100;
  background: var(--sun);
  color: var(--on-fill);
  font-weight: 700;
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
}
.skip-link:focus { top: 1rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.35em;
  min-height: 2.75rem;
  padding: 0.6rem 1.35rem;
  border: 2px solid transparent;
  border-radius: 999px;
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  color: var(--on-fill);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-sun { background: var(--sun); }
.btn-sky { background: var(--sky); }
.btn-pink { background: var(--pink); }
.btn-outline { background: transparent; color: var(--text); border-color: currentColor; }
.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-block: 1.5rem; }
.file-meta { font-weight: 400; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  padding-block: 0.75rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.2;
  margin-right: auto;
}
.brand .logo { width: 2.5rem; flex-shrink: 0; }


.header-tools { display: flex; gap: 0.5rem; align-items: center; }

.theme-toggle,
.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: 700 1rem var(--font-body);
  cursor: pointer;
}
.theme-toggle:hover,
.menu-toggle:hover { border-color: var(--text); }
.icon {
  width: 1.25rem;
  height: 1.25rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sun { display: none; }
.theme-toggle.is-dark .icon-sun { display: block; }
.theme-toggle.is-dark .icon-moon { display: none; }

/* Mobile menu: the Menu button only appears when JavaScript is running,
   so the links are always reachable without it. */
.menu-toggle { display: none; }
.js .menu-toggle { display: inline-flex; }

.site-nav { flex-basis: 100%; }
.js .site-nav:not(.is-open) { display: none; }
.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.site-nav a {
  display: block;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}
.site-nav a:hover { background: var(--surface); text-decoration: underline; }
.site-nav a[aria-current] { background: var(--sun); color: var(--on-fill); }

@media (min-width: 56em) {
  .header-inner { flex-wrap: nowrap; }
  .js .menu-toggle { display: none; }
  .site-nav, .js .site-nav:not(.is-open) { display: block; flex-basis: auto; order: 2; }
  .header-tools { order: 3; }
  .site-nav ul { flex-direction: row; padding: 0; }
  .site-nav a { padding: 0.45rem 0.9rem; }
}

/* Hide the toggle's text on very narrow screens (it keeps its name for screen readers) */
@media (max-width: 24em) {
  .theme-toggle-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
}

/* ---------- Home hero ---------- */
.hero { padding-block: 3rem 2rem; overflow: hidden; background: var(--hero-bg); }
.hero-inner { display: grid; gap: 2rem; align-items: center; }
.eyebrow {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.95rem;
  color: var(--text-soft);
}
.highlight {
  background: var(--sun);
  color: var(--on-fill);
  padding: 0 0.2em;
  border-radius: 0.35em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.hero-art { position: relative; width: min(20rem, 70vw); aspect-ratio: 1; margin-inline: auto; }
.hero-art .logo { position: absolute; inset: 18%; width: 64%; }
.dot { position: absolute; border-radius: 50%; }
.dot-sun { background: var(--sun-soft); width: 62%; height: 62%; top: 8%; left: 10%; }
.dot-sky { background: var(--sky); width: 30%; height: 30%; bottom: 4%; right: 6%; }
.dot-pink { background: var(--pink); width: 16%; height: 16%; top: 4%; right: 14%; }

@media (min-width: 48em) {
  .hero { padding-block: 5rem 3rem; }
  .hero-inner { grid-template-columns: 3fr 2fr; }
}

/* ---------- Featured book ---------- */
.featured-inner {
  display: grid;
  gap: 2rem;
  align-items: center;
  background: var(--surface);
  border-radius: calc(var(--radius) * 1.5);
  padding: 1.5rem;
}
.featured-cover img { border-radius: var(--radius); box-shadow: var(--shadow); }
@media (min-width: 48em) {
  .featured-inner { grid-template-columns: minmax(0, 22rem) 1fr; padding: 2.5rem; }
}

/* ---------- Cards ---------- */
.book-grid,
.freebie-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  margin-block: 1.5rem;
}

.book-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.book-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.book-card-body { padding: 1.25rem; }
.card-title { font-size: 1.35rem; }
.card-link { color: var(--text); text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; } /* whole card is clickable */
.book-card:focus-within { outline: 3px solid var(--focus); outline-offset: 3px; }
.book-card .card-link:focus-visible { outline: none; }
.book-age { font-weight: 700; color: var(--text-soft); margin-bottom: 0.5rem; }

.cover-placeholder {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background: var(--sun);
}
.cover-placeholder .logo { width: 40%; }
.cover-placeholder-large { border-radius: var(--radius); }

.tag {
  display: inline-block;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.15rem 0.75rem;
  border-radius: 999px;
  margin-bottom: 0.5rem;
}
.tag-soon { background: var(--pink); color: var(--on-fill); }

.freebie-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem;
}
.freebie-card .card-title { font-size: 1.2rem; }
.freebie-icon {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0.5rem;
  border-radius: 0.9rem;
  background: var(--sky);
  fill: none;
  stroke: var(--on-fill);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.freebie-book { font-weight: 700; color: var(--text-soft); margin-bottom: 0.5rem; }
.freebie-card .btn { font-size: 1rem; margin-top: 0.25rem; }

.activity-group { margin-top: 2.5rem; }

/* ---------- Book mini sites ---------- */
.book-band {
  background: var(--book-light);
  color: #1b1b3a;
  padding-block: 1rem;
}
.book-band a { color: #1b1b3a; }
.book-band-label { font-weight: 700; margin: 0 0 0.5rem; }
.book-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.book-nav a {
  display: inline-block;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: #ffffff;
  font-weight: 700;
  text-decoration: none;
}
.book-nav a:hover { text-decoration: underline; }
.book-nav a[aria-current="page"] { background: #1b1b3a; color: #ffffff; }
.book-band :focus-visible { outline-color: #1b1b3a; }

/* In dark mode, keep the band calm: dark surface with a color stripe */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .book-band {
    background: var(--surface);
    color: var(--text);
    border-bottom: 6px solid var(--book-light);
  }
  :root:not([data-theme="light"]) .book-band a { color: var(--text); }
  :root:not([data-theme="light"]) .book-nav a { background: var(--bg); }
  :root:not([data-theme="light"]) .book-nav a[aria-current="page"] { background: var(--book-light); color: #1b1b3a; }
  :root:not([data-theme="light"]) .book-band :focus-visible { outline-color: var(--focus); }
}
:root[data-theme="dark"] .book-band {
  background: var(--surface);
  color: var(--text);
  border-bottom: 6px solid var(--book-light);
}
:root[data-theme="dark"] .book-band a { color: var(--text); }
:root[data-theme="dark"] .book-nav a { background: var(--bg); }
:root[data-theme="dark"] .book-nav a[aria-current="page"] { background: var(--book-light); color: #1b1b3a; }
:root[data-theme="dark"] .book-band :focus-visible { outline-color: var(--focus); }

.book-hero {
  display: grid;
  gap: 2rem;
  padding-block: 2.5rem;
  align-items: start;
}
.book-hero-cover img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 6px solid var(--book-light);
}
@media (min-width: 48em) {
  .book-hero { grid-template-columns: minmax(0, 26rem) 1fr; gap: 3rem; padding-block: 3.5rem; }
}
.buy-links { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }

.tips-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  margin-block: 2rem;
}
.tip-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  border-top: 8px solid var(--book-light);
}
.tip-box ul { margin: 0; padding-left: 1.25rem; }
.tip-box li + li { margin-top: 0.5rem; }

.placeholder-note {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  color: var(--text-soft);
  font-style: italic;
}

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 3rem;
  background: var(--surface);
  border-top: 6px solid var(--sun);
  padding-block: 2.5rem;
}
.footer-inner { display: grid; gap: 1.5rem; }
.footer-brand { display: flex; gap: 0.75rem; align-items: center; margin: 0; }
.footer-brand .logo { width: 3rem; flex-shrink: 0; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.site-footer nav a { color: var(--text); font-weight: 700; }
.copyright { color: var(--text-soft); font-size: 1rem; margin: 0; }

/* ---------- Respect "reduce motion" settings ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .btn:hover,
  .book-card:hover { transform: none; }
}

/* ---------- Text for screen readers only ---------- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Small phone adjustments ---------- */
@media (max-width: 36em) {
  .header-inner { flex-wrap: wrap; }
  .brand { flex: 1 1 0; min-width: 0; font-size: 1.1rem; }
  .brand .logo { width: 2.1rem; }
  .hero { padding-block: 2rem 1rem; }
  .hero-art { width: 11rem; }
}

.nowrap { white-space: nowrap; }

/* ---------- About page authors ---------- */
.author {
  display: grid;
  gap: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-top: 1.5rem;
}
.author h3 { margin-bottom: 0.15em; }
.author-role { font-weight: 700; color: var(--text-soft); }
.author-photo { width: 10rem; aspect-ratio: 1; object-fit: cover; border-radius: 50%; }
@media (min-width: 40em) {
  .author:has(.author-photo) { grid-template-columns: 10rem 1fr; align-items: start; }
}

/* ---------- Wide screens ---------- */
/* Full-width color bands; the content inside stays centered */
.band { background: var(--band-bg); }
.band .featured-inner { background: var(--bg); }

/* Keep paragraphs a comfortable reading length */
p, li { max-width: 70ch; }

@media (min-width: 90em) {
  html { font-size: 112.5%; }
  .hero-art { width: 24rem; }
}
@media (min-width: 120em) {
  html { font-size: 125%; }
}

/* ---------- Freebie cards with a preview image ---------- */
/* Just the white coloring page, with the title and button underneath (no box). */
.freebie-card.has-preview {
  flex-direction: column;
  align-items: stretch;
  background: transparent;
  padding: 0;
  gap: 0.75rem;
}
.freebie-preview {
  display: block;
  width: 50%; /* half the card width (Sonya's choice, October 25, 2026) */
  background: #ffffff; /* the page stays white in dark mode too */
  border-radius: 0.25rem;
  box-shadow: 0 0.15rem 0.6rem rgb(27 27 58 / 0.18); /* soft edge so the page shows on a white background */
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.freebie-preview:hover { transform: translateY(-3px); box-shadow: 0 0.5rem 1.25rem rgb(27 27 58 / 0.22); }
.freebie-preview img { width: 100%; aspect-ratio: 8.5 / 11; object-fit: contain; border-radius: 0.25rem; }
@media (prefers-reduced-motion: reduce) {
  .freebie-preview:hover { transform: none; }
}

/* Print it now + Download buttons on freebie cards */
.freebie-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.25rem; }
.freebie-actions .btn { margin-top: 0; }
