/* Free phonics pages: /sounds/ and /stories/. Same palette and type as the landing page (home.css). */

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("/fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --green: #006650;
  --green-line: #62a58c;
  --cream: #fff9d9;
  --paper: #fffdf0;
  --yellow: #ffe34b;
  --ink: #112e29;
  --muted: #4d625d;
  --mint: #9ae0cc;
  --coral: #ff633c;
  --peach: #ffd2b8;
  --line: rgba(17, 46, 41, 0.14);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-variation-settings: "opsz" 14;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.1; }
button { font: inherit; color: inherit; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }

/* ---------- Bar ---------- */

.bar { background: var(--green); color: var(--cream); }
.bar-in { display: flex; align-items: center; gap: 24px; max-width: 1120px; margin: 0 auto; padding: 16px; }
.wordmark { font-size: 19px; font-weight: 800; line-height: 1.02; text-decoration: none; }
.bar-nav { display: flex; gap: 22px; margin-left: auto; font-weight: 600; font-size: 15px; }
.bar-nav a { text-decoration: none; }
.bar-nav a:hover, .bar-nav a[aria-current] { text-decoration: underline; text-underline-offset: 5px; }
.bar :focus-visible { outline-color: var(--yellow); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 24px; border: 0; border-radius: 26px;
  font-size: 16px; font-weight: 700; text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-small { min-height: 40px; padding: 0 18px; font-size: 15px; }
.btn-yellow { background: var(--yellow); color: var(--ink); }
.btn-green { background: var(--green); color: var(--cream); }
.btn-ghost { background: transparent; border: 1.5px solid var(--green); color: var(--green); }
.text-link { color: var(--green); font-weight: 700; }
.store img { display: block; }

/* ---------- Page heads ---------- */

.page-head { padding: 44px 0 36px; }
.kicker { color: var(--green); font-weight: 700; font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 10px; }
.page-head h1 { font-size: clamp(32px, 6vw, 54px); font-weight: 800; letter-spacing: -0.02em; max-width: 820px; }
.lede { margin-top: 16px; font-size: 18px; max-width: 680px; color: var(--muted); }
.crumbs { font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--green); font-weight: 600; }
.meta { margin-top: 10px; font-weight: 600; color: var(--muted); }
.muted { color: var(--muted); }

/* ---------- Sound chart ---------- */

.level-block { background: var(--paper); border: 1px solid var(--line); border-radius: 24px; padding: 24px; margin-bottom: 20px; }
.level-head { max-width: 720px; margin-bottom: 18px; }
.level-head p + p { margin-top: 10px; }
.level-head h2 { font-size: 26px; font-weight: 800; margin-bottom: 8px; }
.level-tag { display: inline-block; font-size: 13px; font-weight: 800; padding: 4px 10px; border-radius: 12px; background: var(--mint); margin-bottom: 10px; }
.level-0 .level-tag { background: var(--yellow); }
.level-2 .level-tag { background: var(--peach); }
.level-3 .level-tag { background: #d9d3ff; }
.level-0 .level-head { margin-bottom: 0; }
.soon { font-weight: 600; color: var(--muted); }

.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: stretch; background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.tile-play { border: 0; background: none; cursor: pointer; padding: 18px 6px 10px; }
.tile-play .g { display: block; font-size: 42px; font-weight: 800; line-height: 1; }
.tile-play:hover .g, .tile-play.is-playing .g { color: var(--green); }
.tile-play.is-playing { background: #e6f7f1; }
.tile a { display: block; text-align: center; font-size: 14px; color: var(--muted); padding: 8px 6px 12px; text-decoration: none; border-top: 1px dashed var(--line); }
.tile a:hover { color: var(--green); text-decoration: underline; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { padding: 6px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); font-weight: 700; color: var(--muted); }
.chips-link li { padding: 0; border: 0; background: none; }
.chip { display: inline-block; padding: 8px 14px; border-radius: 16px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--muted); }
.chip b { color: var(--green); font-size: 18px; margin-right: 4px; }
.chip:hover { border-color: var(--green); }
.also-label { margin-top: 14px; font-size: 14px; }
.chips-small { margin-top: 8px; }
.chips-small .chip { padding: 4px 10px; }
.chips-small .chip b { font-size: 16px; margin: 0; }

.tip-card { background: var(--green); color: var(--cream); border-radius: 24px; padding: 28px 24px; margin: 28px 0 48px; }
.tip-card h2 { font-size: 24px; margin-bottom: 10px; }
.tip-card p { max-width: 700px; }
.tip-card .store { margin-top: 18px; display: inline-block; }

/* ---------- Sound page ---------- */

.sound-hero { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; }
.sound-hero h1 { font-size: clamp(30px, 5vw, 46px); }
.big-play {
  position: relative; width: 168px; height: 168px; flex: none; border: 0; border-radius: 36px; cursor: pointer;
  background: #fff; box-shadow: 0 2px 0 var(--line), 0 12px 30px rgba(0, 102, 80, 0.14);
}
.big-play .g { font-size: 78px; font-weight: 800; line-height: 1; }
.big-play .play-icon { position: absolute; right: 12px; bottom: 12px; width: 36px; height: 36px; border-radius: 50%; background: var(--yellow); }
.big-play .play-icon::after { content: ""; position: absolute; left: 14px; top: 10px; border-left: 12px solid var(--ink); border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.big-play.is-playing { background: #e6f7f1; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

.sound-body { display: grid; gap: 16px; padding-bottom: 40px; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; padding: 22px; }
.panel h2 { font-size: 21px; margin-bottom: 10px; }
.panel p + p { margin-top: 10px; }
.word-list { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.word-btn { border: 1px solid var(--line); background: #fff; border-radius: 16px; padding: 10px 18px; font-size: 22px; font-weight: 700; cursor: pointer; }
.word-btn:hover { border-color: var(--green); }
.story-links { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.story-links a { display: flex; flex-direction: column; padding: 14px 16px; border-radius: 14px; background: #fff; border: 1px solid var(--line); text-decoration: none; }
.story-links a:hover { border-color: var(--green); }
.story-links span { color: var(--muted); font-size: 15px; }
.pager { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; padding: 8px 2px; }
.pager a { color: var(--green); }

/* Letters lighting up while a word is sounded out. */
.w .u { border-radius: 4px; transition: background-color 0.1s ease, color 0.1s ease; }
.w .u.on { background: var(--yellow); color: var(--ink); }
.w.is-word { background: var(--yellow); border-radius: 6px; }
.w-word .u { border-radius: 4px; }
.w-word.is-word { background: var(--yellow); border-radius: 6px; padding: 0 2px; }
.btn-yellow .u.on, .btn-yellow .w-word.is-word { background: var(--ink); color: var(--yellow); }

/* ---------- Stories ---------- */

.story-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.story-card { display: flex; flex-direction: column; gap: 4px; padding: 12px 12px 16px; background: #fff; border: 1px solid var(--line); border-radius: 20px; text-decoration: none; height: 100%; }
.story-card:hover { border-color: var(--green); }
.story-card img { width: 100%; height: auto; border-radius: 12px; margin-bottom: 8px; }
.story-card b { font-size: 19px; }
.story-card span { color: var(--muted); font-size: 14px; }

.story-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.story-side { display: grid; gap: 16px; }
.more { padding: 36px 16px 48px; }
.more h2 { font-size: 26px; margin-bottom: 16px; }

.pages { list-style: none; margin: 0; padding: 0; display: grid; gap: 20px; }
.page { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 24px; padding: 14px 14px 22px; }
.page img { display: block; width: 100%; height: auto; border-radius: 14px; background: #f3efd6; }
.text { margin-top: 18px; text-align: center; font-size: clamp(24px, 4vw, 34px); font-weight: 700; line-height: 1.3; }
.text .w { cursor: pointer; padding: 0 1px; }
.page-num { position: absolute; right: 18px; bottom: 10px; font-size: 13px; color: var(--muted); }
.page-end { text-align: center; padding: 32px 20px; background: var(--paper); }
.the-end { font-size: 34px; font-weight: 800; }
.talk { margin: 10px auto 0; max-width: 520px; color: var(--muted); }
.end-cta { margin: 26px auto 0; max-width: 560px; padding: 26px 22px; border-radius: 20px; background: var(--green); color: var(--cream); }
.end-cta h2 { font-size: 28px; margin-bottom: 8px; }
.end-cta .store { display: inline-block; margin-top: 16px; }

/* Paged mode (set by learn.js): one page at a time with a page-turn. */
.reader-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.reader-bar .hint { color: var(--muted); font-size: 15px; }
.read-aloud .ra-off, .read-aloud[aria-pressed="true"] .ra-on { display: none; }
.read-aloud[aria-pressed="true"] .ra-off { display: inline; }
.is-paged .pages { display: block; perspective: 1600px; overflow: clip; }
.is-paged .page { display: none; }
.is-paged .page.is-current { display: block; animation: turn-in 0.42s ease both; transform-origin: left center; }
.is-paged .page.is-current.from-left { animation-name: turn-back; transform-origin: right center; }
@keyframes turn-in { from { transform: rotateY(-14deg) translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes turn-back { from { transform: rotateY(14deg) translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
.reader-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.nav-btn { width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--yellow); font-size: 24px; font-weight: 800; cursor: pointer; }
.nav-btn:disabled { opacity: 0.35; cursor: default; }
.count { font-weight: 700; color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .is-paged .page.is-current { animation: none; } }

/* ---------- Resources hub ---------- */

.res-cards { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.res-card { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 14px 14px 20px; background: #fff; border: 1px solid var(--line); border-radius: 22px; text-decoration: none; }
a.res-card:hover { border-color: var(--green); }
.res-card b { font-size: 22px; line-height: 1.15; }
.res-card > span:not(.res-art):not(.res-tag):not(.res-go) { color: var(--muted); }
.res-art { display: block; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: var(--paper); margin-bottom: 6px; }
.res-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.res-sounds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 14px; background: #e6f7f1; }
.res-sounds span { display: grid; place-items: center; background: #fff; border-radius: 12px; font-size: 30px; font-weight: 800; }
.res-print { position: relative; background: var(--peach); }
.res-print span { position: absolute; width: 44%; height: 70%; top: 15%; background: #fff; border-radius: 6px; box-shadow: 0 4px 10px rgba(17, 46, 41, 0.12); }
.res-print span:nth-child(1) { left: 12%; transform: rotate(-8deg); }
.res-print span:nth-child(2) { left: 28%; }
.res-print span:nth-child(3) { left: 44%; transform: rotate(7deg); }
.res-tag { align-self: flex-start; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; padding: 3px 9px; border-radius: 10px; background: var(--mint); }
.res-soon .res-tag { background: var(--yellow); }
.res-go { margin-top: auto; padding-top: 6px; color: var(--green); font-weight: 700; }

/* ---------- Footer ---------- */

.foot { background: var(--ink); color: var(--cream); padding: 36px 0 28px; }
.foot-cta { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; padding-bottom: 24px; border-bottom: 1px solid rgba(255, 249, 217, 0.18); }
.foot-title { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 22px 0 14px; font-weight: 600; font-size: 15px; }
.foot-nav a { text-decoration: none; }
.foot-nav a:hover { text-decoration: underline; }
.fine { font-size: 13px; opacity: 0.7; max-width: 760px; }
.foot :focus-visible { outline-color: var(--yellow); }

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .story-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .bar-in { gap: 14px; }
  .bar-nav { gap: 14px; }
  .bar-nav .nav-sub { display: none; }
  .btn-small { padding: 0 14px; }
  .wordmark { font-size: 16px; }
  .page-head { padding: 30px 0 24px; }
  .level-block { padding: 18px 14px; border-radius: 20px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 8px; }
  .tile-play .g { font-size: 34px; }
  .big-play { width: 128px; height: 128px; border-radius: 28px; }
  .big-play .g { font-size: 60px; }
  .page { padding: 8px 8px 18px; border-radius: 18px; }
}
