/* AI-4Kids Stories (/read). Builds on styles.css, theme.css and lesson.css (tags, backdrop, confetti). */

/* Shelf */
.st-hero { background: linear-gradient(135deg, #fff4cc 0%, #ffe3ef 55%, #e6e3ff 100%); padding: 40px 0 34px; overflow: hidden; }
.st-hero .wrap { display: grid; grid-template-columns: 1.4fr 1fr; align-items: center; gap: 24px; }
.st-hero h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); font-weight: 900; margin-bottom: 8px; }
.st-hero .lead { font-size: 1.15rem; color: var(--ink-2); max-width: 560px; margin: 0; }
.st-hero__art { position: relative; height: 190px; }
.st-float { position: absolute; width: 120px; height: auto; filter: drop-shadow(0 10px 14px rgba(18, 34, 74, .18)); animation: st-bob 4s ease-in-out infinite; }
.st-float--1 { left: 30%; top: 20px; width: 150px; }
.st-float--2 { left: 0; top: 60px; width: 100px; animation-delay: -1.3s; }
.st-float--3 { right: 0; top: 80px; width: 100px; animation-delay: -2.6s; }
@keyframes st-bob { 50% { transform: translateY(-10px) rotate(-3deg); } }

.st-shelf { padding: 28px 0 56px; }
.st-shelf .tabs { max-width: 560px; }
.tab[aria-pressed="true"] { border-color: var(--blue); transform: translateY(-2px); }
.st-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.st-thumb { aspect-ratio: 4 / 3; }
.st-thumb__a { position: absolute; left: 14%; bottom: 14%; width: 44%; height: auto; filter: drop-shadow(0 8px 10px rgba(0,0,0,.18)); transition: transform .2s; }
.st-thumb__b { position: absolute; right: 12%; top: 22%; width: 30%; height: auto; filter: drop-shadow(0 8px 10px rgba(0,0,0,.18)); transform: rotate(8deg); transition: transform .2s; }
.st-card:hover .st-thumb__a { transform: rotate(-5deg) scale(1.06); }
.st-card:hover .st-thumb__b { transform: rotate(-6deg) scale(1.1); }
.st-done { position: absolute; left: 10px; bottom: 10px; background: #fff; color: var(--green-dark); font-size: .78rem; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.st-empty { padding: 30px 0; color: var(--ink-2); font-size: 1.1rem; }
.st-note { display: flex; gap: 14px; align-items: flex-start; background: var(--tint); border-radius: var(--radius); padding: 18px 20px; margin-top: 18px; }
.st-note img { flex: none; }
.st-note p { margin: 0 0 6px; }

/* Reader */
.st-reader { padding: 24px 0 56px; max-width: 860px; }
.st-title { font-size: clamp(1.7rem, 4vw, 2.6rem); font-weight: 900; margin-bottom: 14px; }
.st-book { position: relative; }
.st-page { background: #fff; border: 3px solid var(--ink); border-radius: 26px; overflow: hidden; box-shadow: 6px 6px 0 var(--ink); animation: st-in .35s ease-out; }
@keyframes st-in { from { opacity: 0; transform: translateX(18px) rotate(.6deg); } }
.st-scene { position: relative; height: clamp(170px, 30vw, 260px); border-bottom: 3px solid var(--ink); overflow: hidden; }
.st-cast { position: absolute; inset: auto 0 6% 0; display: flex; justify-content: center; align-items: flex-end; gap: clamp(10px, 4vw, 48px); }
.st-actor { display: block; animation: st-hop .6s calc(var(--n) * .15s) cubic-bezier(.2, 1.6, .4, 1) both; }
.st-actor img { width: clamp(80px, 16vw, 140px); height: auto; filter: drop-shadow(0 10px 10px rgba(18, 34, 74, .2)); }
.st-actor:nth-child(2) img { transform: scaleX(-1); }
@keyframes st-hop { from { opacity: 0; transform: translateY(30px) scale(.8); } }
.st-boom {
  opacity: 0; visibility: hidden;
  position: absolute; right: 5%; top: 10%; transform: rotate(-7deg); padding: 10px 18px; background: #ffd23f; color: #12224a;
  font-weight: 900; font-size: clamp(1.1rem, 3.4vw, 1.9rem); letter-spacing: .02em; border: 3px solid #12224a; border-radius: 14px;
  box-shadow: 4px 4px 0 #12224a; max-width: 60%; text-align: center; line-height: 1.1;
}
.st-boom.is-on { opacity: 1; visibility: visible; animation: st-pop .5s cubic-bezier(.2, 1.8, .4, 1) both; }
@keyframes st-pop { from { opacity: 0; transform: rotate(-7deg) scale(.3); } }

.st-lines { display: grid; gap: 14px; padding: clamp(16px, 3vw, 28px); }
.st-page--early .st-lines { font-size: clamp(1.2rem, 2.6vw, 1.45rem); line-height: 1.45; }
.st-page--young .st-lines { font-size: clamp(1.05rem, 2.2vw, 1.22rem); line-height: 1.5; }
.st-cap { margin: 0; background: #fff8d6; border: 2px solid #f0d77a; border-radius: 12px; padding: 10px 14px; color: #12224a; }
.st-fx.sr { clip-path: inset(50%); white-space: nowrap; margin: 0; }
.st-fx { margin: 0; justify-self: center; font-weight: 900; font-size: 1.5em; color: #c4167c; transform: rotate(var(--r)); letter-spacing: .03em; text-shadow: 2px 2px 0 #ffd23f; }
.st-say { display: flex; align-items: flex-end; gap: 10px; }
.st-say--r { flex-direction: row-reverse; }
.st-say__face { width: 54px; height: 54px; flex: none; }
.st-say__bubble { position: relative; background: #eef4ff; border: 2px solid #c9d8f5; border-radius: 18px; padding: 8px 14px; max-width: 85%; color: #12224a; }
.st-say--r .st-say__bubble { background: #e9faf3; border-color: #b6ead3; }
.st-say__bubble b { display: block; font-size: .72em; text-transform: uppercase; letter-spacing: .06em; color: var(--blue-text); }
.st-say--r .st-say__bubble b { color: var(--green-dark); }
.is-reading { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 14px; }

.st-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.st-bar [data-prev][disabled] { visibility: hidden; }
.st-bar [data-next][disabled] { opacity: .55; cursor: not-allowed; transform: none; }
.st-dots { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.st-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.st-dots i.is-past { background: #9fc8ff; }
.st-dots i.is-on { background: var(--blue); transform: scale(1.3); }
.st-dots__q { border-radius: 3px !important; }
.st-listen-row { text-align: center; margin: 16px 0 0; }
.st-listen { font: inherit; font-weight: 800; cursor: pointer; border: 2px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 999px; padding: 8px 18px; }
.st-listen[aria-pressed="true"] { border-color: var(--orange); background: #fff4e0; color: #12224a; }

.st-think { padding: clamp(18px, 4vw, 34px); text-align: center; }
.st-think h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 900; color: #12224a; }
.st-opts { display: grid; gap: 12px; max-width: 560px; margin: 18px auto 0; }
.st-opt { font: inherit; font-weight: 800; font-size: 1.08rem; cursor: pointer; padding: 14px 18px; border-radius: 16px; border: 3px solid #c9d8f5; background: #eef4ff; color: #12224a; transition: transform .12s; }
.st-opt:hover { transform: translateY(-2px); border-color: var(--blue); }
.st-opt.is-right { background: #e3f7ee; border-color: var(--green); }
.st-opt.is-wrong { background: #ffecec; border-color: var(--red); animation: st-shake .35s; }
@keyframes st-shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.st-feedback { font-weight: 800; font-size: 1.1rem; margin: 16px 0 0; color: #12224a; }
.st-big { display: flex; gap: 14px; align-items: center; text-align: left; max-width: 560px; margin: 18px auto 0; background: #fff8d6; border: 2px solid #f0d77a; border-radius: 18px; padding: 14px 18px; color: #12224a; }
.st-big img { width: 64px; height: 64px; flex: none; }
.st-big p { margin: 0; font-weight: 800; font-size: 1.1rem; }
.st-big .kicker { font-size: .78rem; }
.st-more { margin-top: 34px; }
.st-privacy { display: flex; gap: 8px; align-items: center; margin-top: 26px; }

/* Story chips: every story has an AI idea and a life skill */
.st-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 4px; }
.st-chip { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 800; padding: 3px 10px 3px 5px; border-radius: 999px; line-height: 1.3; }
.st-chip img { width: 18px; height: 18px; }
.st-chip--ai { background: #e6e3ff; color: #3b2a8f; }
.st-chip--skill { background: #fff1c9; color: #7a4b00; }
.st-reader > .st-chips { margin: -4px 0 12px; }

/* Line-by-line reading */
.st-progress { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; margin: 0 0 14px; }
.st-progress i { display: block; height: 100%; width: var(--p, 0%); background: linear-gradient(90deg, var(--blue), #8b5cf6); border-radius: inherit; transition: width .35s ease; }
.st-lines { cursor: pointer; }
.st-lines [hidden] { display: none; }
.st-new { animation: st-line .35s cubic-bezier(.2, 1.3, .4, 1) both; }
@keyframes st-line { from { opacity: 0; transform: translateY(12px) scale(.97); } }
.st-tap { margin: 0; justify-self: center; font-size: .85rem; font-weight: 800; color: var(--ink-2); animation: st-blink 1.6s ease-in-out infinite; }
.st-tap[hidden] { display: none; }
@keyframes st-blink { 50% { opacity: .35; } }
.st-actor { transition: translate .25s, scale .25s, opacity .25s, filter .25s; }
.st-actor.is-talking { translate: 0 -10px; scale: 1.12; }
.st-actor.is-quiet { opacity: .55; filter: saturate(.6); }

/* You decide! and Did you know? */
.st-badge { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 14px 6px 8px; border-radius: 999px; background: #ffd23f; color: #12224a; font-weight: 900; font-size: 1rem; border: 2px solid #12224a; }
.st-badge img { width: 28px; height: 28px; }
.st-sub { color: var(--ink-2); margin: 4px 0 0; }
.st-decide { background: linear-gradient(180deg, #fff 0%, #f3f0ff 100%); }
.st-opt[aria-pressed="true"]:not(.is-right):not(.is-wrong) { border-color: var(--blue); }
.st-decide .st-opt.is-wrong { background: #fff4e0; border-color: var(--orange); animation: none; }
.st-facts { padding: clamp(18px, 4vw, 34px); background: linear-gradient(180deg, #fff 0%, #eafaf3 100%); }
.st-factlist { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 12px; }
.st-factlist li { display: flex; gap: 12px; align-items: center; background: #fff; border: 2px solid #b6ead3; border-radius: 18px; padding: 12px 16px; color: #12224a; font-weight: 700; font-size: 1.08rem; line-height: 1.45; }
.st-factlist img { width: 48px; height: 48px; flex: none; }
.st-word { margin-top: 14px; background: #e6e3ff; border: 2px dashed #8b5cf6; border-radius: 18px; padding: 12px 18px; color: #12224a; }
.st-word p { margin: 0; font-size: 1.1rem; }
.st-word .kicker { font-size: .78rem; color: #5b3fd6; }

@media (max-width: 760px) {
  .st-hero .wrap { grid-template-columns: 1fr; }
  .st-hero__art { display: none; }
  .st-say__face { width: 42px; height: 42px; }
  .st-bar .btn { padding-inline: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .st-float, .st-actor, .st-boom.is-on, .st-page, .st-opt.is-wrong, .st-new, .st-tap { animation: none; }
  .st-actor, .st-progress i { transition: none; }
}

[data-theme="dark"] .st-hero { background: linear-gradient(135deg, #1f2a58, #2a1f4f); }
[data-theme="dark"] .st-hero h1 { color: var(--ink); }
[data-theme="dark"] .st-page { border-color: #8ab4ff; box-shadow: 6px 6px 0 #8ab4ff; background: var(--surface); }
[data-theme="dark"] .st-scene { border-color: #8ab4ff; }
[data-theme="dark"] .st-think h2, [data-theme="dark"] .st-feedback { color: var(--ink); }
[data-theme="dark"] .st-listen { background: var(--surface); }
[data-theme="dark"] .st-note { background: var(--surface); }
[data-theme="dark"] .st-decide, [data-theme="dark"] .st-facts { background: var(--surface); }
[data-theme="dark"] .st-chip--ai { background: #3b2a8f; color: #e6e3ff; }
[data-theme="dark"] .st-chip--skill { background: #5a3d00; color: #fff1c9; }

/* Banner to Stories Around the World (/world) */
.st-world { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin: 0 0 22px; padding: 16px 18px; border-radius: var(--radius); background: linear-gradient(120deg, #fff1cc, #e3f4ff 60%, #e9f9d9); color: #12224a; text-decoration: none; box-shadow: var(--shadow); }
.st-world:hover { transform: translateY(-2px); }
.st-world__art { display: flex; flex: none; }
.st-world__art img { width: 76px; height: auto; }
.st-world__copy { flex: 1 1 220px; display: flex; flex-direction: column; gap: 2px; }
.st-world__copy .kicker { margin: 0; color: #c4167c; }
.st-world__copy b { font-size: 1.3rem; line-height: 1.2; }
.st-world__copy > span:last-child { color: #4b5878; }
.st-world .btn { flex: none; }
