/* Kể chuyện /ke-chuyen/ (02/10/2026) — nạp riêng trên các trang truyện, dùng biến màu của style.css. */
.story-hero-meta { display: flex; flex-wrap: wrap; gap: 10px 18px; margin: 22px 0 0; color: var(--ink); font-weight: 700; font-size: 14px; }
.story-hero-meta span { display: inline-flex; align-items: center; gap: 8px; }
.story-hero-meta svg { width: 20px; height: 20px; color: var(--coral); }

.story-filter { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }
.story-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px; }
.story-card { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; overflow: hidden; transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
.story-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.story-card[hidden] { display: none; }
.story-card-link { display: flex; flex-direction: column; height: 100%; color: inherit; }
.story-card-art { position: relative; aspect-ratio: 16 / 9; background: var(--blue); overflow: hidden; }
.story-card-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.story-card:hover .story-card-art img { transform: scale(1.04); }
.story-card-play { position: absolute; right: 14px; bottom: 14px; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--coral); box-shadow: 0 8px 18px rgba(206,75,53,.35); }
.story-card-play svg { width: 22px; height: 22px; margin-left: 3px; }
.story-card-body { padding: 18px 22px 22px; }
.story-card-kicker { margin: 0 0 4px; color: var(--muted); font-size: 13px; font-weight: 600; }
.story-card-kicker b { color: var(--coral-dark); font-weight: 800; }
.story-card h3 { margin: 0 0 8px; font-family: var(--display); font-size: 23px; font-weight: 800; line-height: 1.2; }
.story-card-body > p { margin: 0; color: var(--muted); font-size: 14.5px; }
.story-card .story-card-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.story-card-meta span { padding: 3px 10px; border-radius: 999px; color: var(--ink); background: var(--cream); font-size: 12.5px; font-weight: 700; }

.story-tip-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.story-tip-grid p { margin: 0; color: var(--muted); }
.story-note { margin: 24px 0 0; color: var(--muted); font-size: 14px; }
.story-tips { background: var(--paper); }

/* ---- trang đọc truyện ---- */
.story-hero { padding: 36px 0 56px; background: radial-gradient(700px 400px at 95% 0%, rgba(239,104,79,.10), transparent 60%), var(--cream); }
.story-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; margin-bottom: 22px; }
.story-head h1 { margin: 0; font-family: var(--display); font-size: clamp(32px, 4.4vw, 48px); font-weight: 800; line-height: 1.1; }
.story-head p { margin: 8px 0 0; max-width: 640px; color: var(--muted); }
.story-chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 0; }
.story-chips span { padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 13px; font-weight: 700; white-space: nowrap; }

.story-reader { position: relative; max-width: 980px; margin-inline: auto; }
/* tranh + chữ + nút vừa một màn hình laptop: bề rộng theo chiều cao màn hình */
.story-reader.is-ready { max-width: max(560px, min(980px, calc((100vh - 330px) * 16 / 9))); scroll-margin-top: 84px; }
.story-pages { margin: 0; padding: 0; list-style: none; display: grid; gap: 28px; }
.story-page { position: relative; border-radius: var(--radius); background: #fff; border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow-sm); }
.story-page figure { margin: 0; aspect-ratio: 16 / 9; background: var(--blue); }
.story-page img { width: 100%; height: 100%; object-fit: cover; }
.story-text { margin: 0; padding: 22px 28px 26px; font-size: clamp(18px, 2.1vw, 22px); line-height: 1.65; color: var(--ink); }
.story-page-no { position: absolute; top: 14px; left: 14px; padding: 4px 12px; border-radius: 999px; background: rgba(255,255,255,.92); font-size: 13px; font-weight: 800; }
.story-text .cau { border-radius: 6px; transition: background .2s, box-shadow .2s; }
.story-text .cau.dang-doc { background: #ffe9a3; box-shadow: 0 0 0 3px #ffe9a3; }

/* khi JS chạy: chỉ hiện một trang, có thanh điều khiển */
.story-reader.is-ready .story-pages { display: block; }
.story-reader.is-ready .story-page { display: none; border-radius: var(--radius) var(--radius) 0 0; box-shadow: none; }
.story-reader.is-ready .story-page.is-current { display: block; animation: lat .45s var(--ease); }
.story-reader.is-ready .story-text { min-height: 6.7em; padding-top: 18px; padding-bottom: 18px; font-size: clamp(18px, 1.9vw, 21px); }
@keyframes lat { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.story-reader.lui .story-page.is-current { animation-name: lat-lui; }
@keyframes lat-lui { from { opacity: 0; transform: translateX(-18px); } to { opacity: 1; transform: none; } }

.story-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px; padding: 14px 18px; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); background: #fff; box-shadow: var(--shadow-sm); }
.story-controls[hidden] { display: none; }
.story-btn { width: 46px; height: 46px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--ink); transition: background .2s, border-color .2s; }
.story-btn:hover:not(:disabled) { border-color: var(--ink); background: #fff; }
.story-btn:disabled { opacity: .35; cursor: default; }
.story-btn svg { width: 22px; height: 22px; }
.story-btn-sm { width: 40px; height: 40px; }
.story-btn-sm svg { width: 19px; height: 19px; }
.story-play { display: inline-flex; align-items: center; gap: 10px; height: 52px; padding: 0 24px 0 18px; border: 0; border-radius: 999px; color: #fff; background: var(--coral); font-family: var(--display); font-size: 19px; box-shadow: 0 10px 24px rgba(239,104,79,.28); transition: background .2s, transform .2s; }
.story-play:hover { background: var(--coral-dark); transform: translateY(-1px); }
.story-play svg { width: 24px; height: 24px; }
.story-play .i-pause, .story-play.is-playing .i-play { display: none; }
.story-play.is-playing .i-pause { display: inline; }
.story-play.is-playing { background: var(--ink); }
.story-dots { display: flex; gap: 6px; flex-wrap: wrap; flex: 1 1 auto; justify-content: center; }
.story-dots button { width: 12px; height: 12px; padding: 0; border: 0; border-radius: 999px; background: var(--line); transition: width .25s var(--ease), background .2s; }
.story-dots button.is-current { width: 30px; background: var(--coral); }
.story-dots button.da-xem { background: #f6b4a6; }
.story-opts { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 14px; font-weight: 600; }
.story-opt { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.story-opt[hidden] { display: none; }
.story-opt input { width: 18px; height: 18px; accent-color: var(--coral); }
.story-opt select { height: 34px; max-width: 170px; padding: 0 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 600; }
.story-voice-note { margin: 12px 4px 0; color: var(--muted); font-size: 14px; }
.story-voice-note[hidden] { display: none; }

.story-end { padding: 44px 32px; border: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; background: var(--ink); color: #fff; text-align: center; animation: lat .45s var(--ease); }
.story-end[hidden] { display: none; }
.story-end .eyebrow { color: var(--yellow); justify-content: center; }
.story-end h2 { margin: 0 0 12px; font-family: var(--display); font-size: clamp(28px, 3.6vw, 40px); }
.story-end-lesson { max-width: 620px; margin: 0 auto 26px; color: #d5e3e0; font-size: 18px; }
.story-end-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.story-end .btn-secondary { background: #fff; color: var(--ink); }

.story-after { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.story-lesson { margin: 0; color: #fff; font-size: 18px; }
.story-questions { margin: 0; padding-left: 22px; }
.story-questions li { padding: 6px 0; font-size: 16.5px; }
.story-more { background: var(--paper); }

/* toàn màn hình: tranh to, chữ to, nền tối dịu cho giờ đi ngủ */
.story-reader:fullscreen { max-width: none; display: flex; flex-direction: column; justify-content: center; padding: 2vh 3vw; background: #10241f; overflow: auto; }
.story-reader:fullscreen .story-page, .story-reader:fullscreen .story-end { max-width: min(96vw, 150vh); width: 100%; margin-inline: auto; }
.story-reader:fullscreen .story-controls { max-width: min(96vw, 150vh); width: 100%; margin-inline: auto; }
.story-reader:fullscreen .story-text { font-size: clamp(20px, 2.4vw, 30px); min-height: 0; }

@media (max-width: 960px) {
  .story-grid, .story-tip-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 680px) {
  .story-grid, .story-tip-grid, .story-after { grid-template-columns: 1fr; }
  .story-head { flex-direction: column; align-items: start; }
  .story-hero { padding: 24px 0 36px; }
  .story-text { padding: 16px 18px 20px; font-size: 18px; }
  .story-reader.is-ready .story-text { min-height: 12em; }
  .story-controls { padding: 12px; gap: 10px; justify-content: center; }
  .story-play { height: 50px; padding: 0 20px 0 16px; font-size: 18px; }
  .story-dots { order: 5; flex-basis: 100%; }
  .story-opts { order: 6; flex-basis: 100%; justify-content: center; }
  .story-end { padding: 32px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .story-reader.is-ready .story-page.is-current, .story-end { animation: none; }
}
