/* world/css/story.css - THE STORY (world/story.html), on top of world.css and guide.css: the guide's cover, chapters
 * and gods, plus the story's own parts: a chapter beside its painting, the four things the Ten take in order, a god
 * that opens to its full story, and the village's side stories. No script and no inline style. Phone first: one column
 * and 16px gutters, no horizontal scroll; the words beside the painting from 900px (convention 45, use the full PC
 * screen). Text floor 13 px (lesson UI-5, convention 34).
 */

.story { --comet: var(--toxic-green); }
.story .chapter--story { --accent: var(--comet); }

/* the cover: the village from above, the comet over its wall */
.story-cover .cover__art { background-image: url("../../assets/backgrounds/painted/web/room-village.jpg"); background-position: 50% 20%; }

/* a chapter beside its painting */
.tale { display: grid; gap: 28px; align-items: center; }
.tale__words { min-width: 0; }
.tale__words h2 { margin: 0 0 18px; }
.tale .prose { margin: 0; max-width: 40em; }
.tale__art { width: 100%; max-width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.tale + .prose { margin-top: 64px; }   /* a chapter that runs on below its painting (IX) */
@media (min-width: 900px) {
  .tale { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 48px; }
  .tale--flip .tale__words { order: 2; }
}

/* the four things they take, in the order they take them */
.takes { list-style: none; margin: 0 auto; padding: 0; display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); counter-reset: take; }
@media (min-width: 700px) { .takes { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .takes { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.takes li {
  counter-increment: take; display: grid; gap: 8px; align-content: start; padding: 22px 20px; border-radius: 18px;
  background: linear-gradient(180deg, rgba(107, 224, 74, .08), rgba(255, 255, 255, .02)); border: 1px solid rgba(107, 224, 74, .28);
}
.takes li::before { content: counter(take); font-family: var(--title-font); font-size: 34px; line-height: 1; color: var(--comet); }
.takes h3 { margin: 0; font-family: var(--title-font); font-size: 22px; color: #fff; }
.takes p { margin: 0; color: #E6E2F8; font-size: 16px; line-height: 1.6; }

/* the Ten: guide.css's cards, at the 13 px floor, each opening to its story */
.story .god i { font-size: 13px; }
.story .hero__kicker, .story .foot__legal { font-size: 13px; }
.story .gods { align-items: start; grid-auto-flow: row dense; }
.story .god:has(.god__story[open]) { grid-column: 1 / -1; }
.god__story { width: 100%; margin-top: 10px; text-align: left; }
.god__story[open] p { max-width: 46em; margin: 0 auto; }
.god__story summary {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border-radius: 999px; cursor: pointer;
  font-size: 14px; font-weight: bold; color: var(--gold-hi); border: 1px solid rgba(255, 231, 160, .3); list-style: none;
}
.god__story summary::-webkit-details-marker { display: none; }
.god__story summary:hover, .god__story summary:focus-visible { border-color: var(--gold); outline: none; }
.god__story[open] summary { margin-bottom: 10px; }
.god__story p { font-size: 16px; line-height: 1.6; color: #E6E2F8; }
.horde-note { border-color: rgba(107, 224, 74, .3); }

.chapter--love::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: radial-gradient(55% 45% at 50% 30%, rgba(255, 143, 199, .16), transparent 70%); }

/* the village's side stories */
.sides-tales { display: grid; gap: 18px; margin: 32px auto; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .sides-tales { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .sides-tales { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.side-tale { display: grid; align-content: start; overflow: hidden; border-radius: 18px; background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 143, 199, .25); }
.side-tale img { width: 100%; max-width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; display: block; }
.side-tale div { display: grid; gap: 6px; padding: 16px 18px 20px; }
.side-tale h3 { margin: 0; font-family: var(--title-font); font-size: 21px; color: #fff; }
.side-tale p { margin: 0; color: #E6E2F8; font-size: 16px; line-height: 1.6; }

/* ---------------------------------------------------------------------------------------------- the animated novel
 * Goliath, 2026-11-09 21:50Z: "an animated novel feel ... fade in and out and movement". All CSS: the paintings drift
 * slowly inside their frames, the comet over the cover breathes, and parts fade in as they scroll into view (and the
 * paintings fade a little as they leave) where the browser has scroll-driven animation. Everything is whole and
 * readable at rest; reduced motion stills all of it.
 */
.cover__comet {
  position: absolute; z-index: -1; left: 38%; top: 2%; width: 34vw; max-width: 520px; aspect-ratio: 1; pointer-events: none;
  background: radial-gradient(closest-side, rgba(150, 255, 170, .32), rgba(107, 224, 74, .12) 45%, transparent 75%);
  animation: comet-breathe 6s ease-in-out infinite alternate;
}
.story-cover .cover__art { animation: cover-drift 40s ease-in-out infinite alternate; }
@keyframes comet-breathe { from { opacity: .45; transform: scale(.92); } to { opacity: 1; transform: scale(1.08); } }
@keyframes cover-drift { from { transform: scale(1.04) translate(0, 0); } to { transform: scale(1.1) translate(-1.5%, 1%); } }

.tale__frame { overflow: hidden; border-radius: 18px; border: 1px solid var(--line); box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.tale__frame .tale__art { border: 0; border-radius: 0; box-shadow: none; display: block; animation: art-drift 26s ease-in-out infinite alternate; }
.tale--flip .tale__frame .tale__art { animation-direction: alternate-reverse; }
@keyframes art-drift { from { transform: scale(1.02) translate(0, 0); } to { transform: scale(1.12) translate(-2.5%, -1.5%); } }

/* the four things, each with its painting */
.takes li { padding: 0 0 20px; overflow: hidden; }
.takes li img { width: 100%; max-width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; display: block; margin-bottom: 4px; animation: art-drift 30s ease-in-out infinite alternate; }
.takes li { position: relative; }
.takes h3, .takes p { padding: 0 20px; }
.takes li::before { position: absolute; z-index: 1; top: 10px; left: 14px; font-size: 40px; color: var(--gold-hi); text-shadow: 0 2px 12px rgba(0, 0, 0, .95), 0 0 18px rgba(7, 11, 30, .9); }
.takes li img { margin-bottom: 8px; }

/* the interludes: a full-width painting with two lines over it, like a page turned in a picture book */
.interlude { position: relative; margin: 0; min-height: clamp(280px, 52vh, 560px); display: grid; place-items: center; overflow: hidden; isolation: isolate; border-top: 1px solid var(--line); }
.interlude__art { position: absolute; inset: -6%; z-index: -2; background-size: cover; background-position: center; animation: art-drift 34s ease-in-out infinite alternate; }
.interlude__art--sky { background-image: url("../../assets/war/web/war_page_hero.jpg"); }
.interlude__art--gate { background-image: url("../../assets/backgrounds/painted/web/gate-siege.jpg"); }
.interlude::after { content: ""; position: absolute; inset: 0; z-index: -1; background: radial-gradient(70% 70% at 50% 50%, rgba(7, 11, 30, .55), rgba(7, 11, 30, .85)); }
.interlude__words { display: grid; gap: 10px; padding-block: 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); text-align: center; font-family: var(--title-font); font-style: italic; font-size: clamp(22px, 3.4vw, 40px); line-height: 1.25; color: #fff; text-shadow: 0 3px 18px rgba(0, 0, 0, .95); text-wrap: balance; }
.interlude__words span + span { color: var(--gold-hi); }

/* the Horde's word, over its own painting */
.horde-note { display: grid; gap: 14px; overflow: hidden; }
.horde-note__art { width: 100%; max-width: 100%; height: auto; aspect-ratio: 21 / 9; object-fit: cover; border-radius: 12px; }

/* love: the dawn rising behind the last chapter */
.chapter--love { overflow: hidden; }
.love__dawn { position: absolute; inset: 0; max-width: none; z-index: -2; background: url("../../assets/backgrounds/painted/web/skirmish-last-signal.jpg") center 60% / cover no-repeat; opacity: .28; animation: dawn-rise 30s ease-in-out infinite alternate; }
@keyframes dawn-rise { from { transform: translateY(4%) scale(1.05); opacity: .2; } to { transform: translateY(-2%) scale(1.1); opacity: .36; } }

/* fade in as each part arrives; the paintings fade a little as they leave */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .reveal { animation: page-in linear both; animation-timeline: view(); animation-range: entry 0% entry 80%; }
    .tale__frame.reveal, .interlude.reveal { animation: page-in-out linear both; animation-timeline: view(); animation-range: entry 0% exit 100%; }
  }
}
@keyframes page-in { from { opacity: .2; transform: translateY(36px); } to { opacity: 1; transform: none; } }
@keyframes page-in-out { 0% { opacity: 0; transform: translateY(40px); } 22%, 78% { opacity: 1; transform: none; } 100% { opacity: .35; transform: translateY(-20px); } }

@media (prefers-reduced-motion: reduce) {
  .cover__comet, .story-cover .cover__art, .tale__frame .tale__art, .takes li img, .interlude__art, .love__dawn { animation: none; }
}
