:root {
  --citrine: #F4C95D;
  --emerald: #0F6B4A;
  --sapphire: #134E8A;
  --amethyst: #32144D;
  --blackberry: #160F24;
  --ruby: #B83252;
  --parchment: #F6E7C8;
  --serif: "Cormorant Garamond", Cormorant, Georgia, serif;
  --body: "Libre Baskerville", Georgia, serif;
  --pixel: "Press Start 2P", Inter, monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: #160F24;
  color: #F6E7C8;
  font-family: var(--body);
  overflow-x: hidden;
}

button { font: inherit; }

.story {
  position: relative;
  min-height: 400vh;
  background:
    radial-gradient(circle at 50% 18%, rgba(244, 201, 93, .18), transparent 17rem),
    radial-gradient(circle at 12% 34%, rgba(184, 50, 82, .24), transparent 18rem),
    radial-gradient(circle at 88% 58%, rgba(19, 78, 138, .28), transparent 22rem),
    linear-gradient(180deg, #32144D 0%, #160F24 35%, #0F6B4A 73%, #160F24 100%);
}

.grain,
.grain::before {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  opacity: .18;
  mix-blend-mode: overlay;
  background-image: linear-gradient(90deg, rgba(246,231,200,.08) 1px, transparent 1px), linear-gradient(rgba(246,231,200,.08) 1px, transparent 1px);
  background-size: 4px 4px;
}

.grain::before {
  content: "";
  opacity: .45;
  background-image: radial-gradient(circle, rgba(246,231,200,.32) 1px, transparent 1.2px);
  background-size: 17px 19px;
}

.pixel-wipe {
  position: fixed;
  inset: 0;
  z-index: 25;
  pointer-events: none;
  transform: translateY(100%);
  background: repeating-linear-gradient(90deg, #F4C95D 0 10px, #B83252 10px 20px, #134E8A 20px 30px, #0F6B4A 30px 40px);
  opacity: 0;
}

.pixel-wipe.flash { animation: pixelWipe .75s steps(8) both; }

.scene {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 8vh 6vw;
  overflow: hidden;
  isolation: isolate;
}

.scene::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 23vh;
  z-index: -1;
  background: repeating-linear-gradient(90deg, transparent 0 20px, rgba(15,107,74,.44) 20px 36px), linear-gradient(0deg, #0F6B4A, transparent);
  clip-path: polygon(0 45%, 6% 34%, 10% 48%, 15% 30%, 19% 51%, 25% 38%, 30% 58%, 36% 31%, 43% 56%, 50% 34%, 57% 55%, 62% 30%, 70% 52%, 76% 37%, 83% 56%, 90% 32%, 100% 50%, 100% 100%, 0 100%);
}

.scene-title { background: radial-gradient(circle at 50% 54%, rgba(15,107,74,.42), transparent 32rem); }
.scene-village { background: radial-gradient(circle at 50% 42%, rgba(184,50,82,.16), transparent 35rem); }
.scene-pond { background: radial-gradient(circle at center, rgba(19,78,138,.34), transparent 34rem); }
.scene-studio { background: radial-gradient(circle at center, rgba(244,201,93,.14), transparent 29rem); }

.title-card,
.center-copy {
  position: relative;
  z-index: 5;
  width: min(780px, 92vw);
  text-align: center;
  filter: drop-shadow(0 18px 55px rgba(22,15,36,.8));
}

.pixel-label {
  margin: 0 0 1.5rem;
  font-family: var(--pixel);
  font-size: clamp(.48rem, 1.1vw, .66rem);
  line-height: 1.9;
  letter-spacing: .06em;
  color: #F4C95D;
  text-shadow: 3px 3px 0 #160F24;
}

h1,
h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: .06em;
  color: #F6E7C8;
  text-shadow: 0 0 26px rgba(244,201,93,.34), 5px 5px 0 rgba(22,15,36,.82);
}

h1 { font-size: clamp(4.7rem, 14vw, 11.5rem); line-height: .78; }
h2 { font-size: clamp(2.7rem, 6vw, 6.5rem); line-height: .88; }

.fragment,
.center-copy p:not(.pixel-label) {
  width: min(620px, 90vw);
  margin: 1.6rem auto 0;
  color: rgba(246, 231, 200, .86);
  font-size: clamp(1rem, 1.8vw, 1.35rem);
  font-style: italic;
  line-height: 1.8;
}

.start-button {
  margin-top: 2rem;
  border: 3px solid #F4C95D;
  background: #160F24;
  color: #F4C95D;
  padding: 1rem 1.2rem;
  box-shadow: 6px 6px 0 #B83252, 0 0 28px rgba(244,201,93,.24);
  font-family: var(--pixel);
  font-size: .62rem;
  cursor: pointer;
  animation: blink 1.45s steps(2, end) infinite;
}

.meadow-layer {
  position: absolute;
  inset: 0;
  z-index: -2;
  background: radial-gradient(ellipse at bottom, rgba(15,107,74,.56), transparent 54%), linear-gradient(#32144D, #160F24);
}

.coin-fireflies i,
.coin {
  position: absolute;
  width: 22px;
  height: 22px;
  background: #F4C95D;
  border: 4px solid #F6E7C8;
  box-shadow: 0 0 0 4px #B83252, 0 0 24px #F4C95D;
  image-rendering: pixelated;
  animation: coinBob 3.5s steps(2, jump-none) infinite, glow 1.7s ease-in-out infinite alternate;
  opacity: 0;
}

.c1 { left: 18%; top: 22%; animation-delay: .1s, .1s; }
.c2 { left: 72%; top: 18%; animation-delay: .45s, .45s; }
.c3 { left: 28%; top: 68%; animation-delay: .8s, .8s; }
.c4 { left: 82%; top: 62%; animation-delay: 1.15s, 1.15s; }
.c5 { left: 12%; top: 52%; animation-delay: 1.45s, 1.45s; }
.c6 { left: 58%; top: 74%; animation-delay: 1.8s, 1.8s; }
.c7 { left: 39%; top: 15%; animation-delay: 2.15s, 2.15s; }
.c8 { left: 88%; top: 32%; animation-delay: 2.5s, 2.5s; }

.sprite {
  position: absolute;
  z-index: 2;
  image-rendering: pixelated;
  opacity: .92;
  animation: floatSlow 5s steps(4, end) infinite;
}

.sprite span,
.cottage::before,
.well::before,
.dove::before { content: ""; display: block; }

.cottage { left: 7vw; bottom: 18vh; width: 132px; height: 105px; background: #0F6B4A; box-shadow: inset 0 -30px #32144D, 0 12px 0 rgba(22,15,36,.4); }
.cottage::before { width: 150px; height: 38px; margin: -28px 0 0 -9px; background: #B83252; box-shadow: inset 0 12px #F4C95D; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.cottage span { width: 24px; height: 38px; margin: 42px auto; background: #F4C95D; box-shadow: -42px -8px 0 #134E8A, 42px -8px 0 #134E8A; }
.well { right: 9vw; bottom: 21vh; width: 95px; height: 62px; border: 8px solid #134E8A; background: #160F24; box-shadow: inset 0 0 0 8px #F4C95D; animation-delay: .5s; }
.well::before { width: 105px; height: 22px; margin: -30px 0 0 -13px; background: #B83252; }
.dove { right: 16vw; top: 17vh; width: 72px; height: 42px; background: #F6E7C8; clip-path: polygon(0 45%, 33% 18%, 52% 35%, 100% 0, 78% 48%, 100% 80%, 55% 65%, 31% 86%); animation-delay: .85s; }
.dove::before { width: 16px; height: 16px; margin: 27px 0 0 20px; background: #F4C95D; box-shadow: 0 0 0 3px #B83252; }

.photo-frame,
.pond-orb,
.altar {
  position: absolute;
  z-index: 1;
  width: min(72vw, 760px);
  aspect-ratio: 1.45;
  border: 12px solid rgba(246,231,200,.92);
  box-shadow: 0 0 0 5px #B83252, 0 25px 80px rgba(22,15,36,.76);
  opacity: .78;
}

.photo-frame { top: 9vh; background: linear-gradient(140deg, rgba(246,231,200,.68), rgba(19,78,138,.38)), repeating-linear-gradient(0deg, rgba(22,15,36,.18) 0 3px, transparent 3px 11px); filter: sepia(.26) saturate(1.25); animation: photoBloom 8s ease-in-out infinite alternate; }
.photo-corners::before,
.photo-corners::after { content: ""; position: absolute; width: 66px; height: 66px; border: solid #F4C95D; }
.photo-corners::before { left: -24px; top: -24px; border-width: 12px 0 0 12px; }
.photo-corners::after { right: -24px; bottom: -24px; border-width: 0 12px 12px 0; }
.village-sky { position: absolute; inset: 0; background: radial-gradient(circle at 70% 15%, #F4C95D 0 26px, transparent 28px), linear-gradient(#32144D 0 45%, #0F6B4A 45%); opacity: .92; }
.village-bank { position: absolute; left: 18%; bottom: 15%; width: 180px; height: 130px; background: #F6E7C8; box-shadow: inset 0 -28px #0F6B4A; }
.roof { position: absolute; left: -20px; top: -45px; width: 220px; height: 50px; background: #B83252; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.door { position: absolute; left: 74px; bottom: 0; width: 38px; height: 62px; background: #32144D; }
.window { position: absolute; top: 42px; width: 34px; height: 28px; background: #134E8A; box-shadow: inset 0 0 0 6px #F4C95D; }
.w1 { left: 24px; } .w2 { right: 24px; }
.exchange-path { position: absolute; right: 13%; bottom: 20%; display: flex; gap: 18px; transform: rotate(-8deg); }
.exchange-path b { width: 24px; height: 24px; background: #F4C95D; box-shadow: 0 0 0 4px #B83252; animation: glow 1.2s ease-in-out infinite alternate; }
.exchange-path b:nth-child(2) { animation-delay: .25s; } .exchange-path b:nth-child(3) { animation-delay: .5s; } .exchange-path b:nth-child(4) { animation-delay: .75s; }
.hidden-rails span { position: absolute; height: 4px; background: #F4C95D; box-shadow: 0 0 18px #F4C95D; transform-origin: left; }
.hidden-rails span:nth-child(1) { left: 36%; top: 42%; width: 255px; transform: rotate(9deg); }
.hidden-rails span:nth-child(2) { left: 38%; top: 52%; width: 305px; transform: rotate(-5deg); }
.hidden-rails span:nth-child(3) { left: 42%; top: 61%; width: 235px; transform: rotate(4deg); }

.pond-orb { width: min(78vw, 690px); border-radius: 50%; aspect-ratio: 1; border-color: #134E8A; background: radial-gradient(circle, rgba(246,231,200,.13) 0 18%, rgba(19,78,138,.74) 19% 45%, rgba(22,15,36,.92) 70%); }
.moon { position: absolute; left: 50%; top: 12%; width: 80px; height: 80px; margin-left: -40px; background: #F6E7C8; box-shadow: 0 0 32px #F4C95D; border-radius: 50%; }
.ripple { position: absolute; left: 50%; top: 56%; border: 4px solid rgba(244,201,93,.75); border-radius: 50%; transform: translate(-50%, -50%); animation: ripple 3.8s ease-out infinite; }
.r1 { width: 110px; height: 46px; } .r2 { width: 210px; height: 82px; animation-delay: .55s; } .r3 { width: 320px; height: 125px; animation-delay: 1.1s; } .r4 { width: 440px; height: 170px; animation-delay: 1.65s; }
.ledger-row { position: absolute; left: 50%; display: flex; gap: 11px; transform: translateX(-50%); }
.ledger-row i { width: 32px; height: 14px; background: #0F6B4A; box-shadow: inset 0 0 0 3px #F4C95D; animation: seedPlant 2.8s steps(4, end) infinite; }
.row1 { top: 48%; } .row2 { top: 58%; } .row3 { top: 68%; }
.row2 i { animation-delay: .35s; } .row3 i { animation-delay: .7s; }

.altar { width: min(82vw, 820px); aspect-ratio: 1.4; top: 12vh; background: linear-gradient(35deg, rgba(246,231,200,.88), rgba(244,201,93,.2)), repeating-linear-gradient(90deg, rgba(50,20,77,.16) 0 2px, transparent 2px 16px); transform: rotate(-1deg); }
.paper { position: absolute; background: #F6E7C8; color: #160F24; border: 4px solid #32144D; box-shadow: 9px 9px 0 rgba(22,15,36,.45); font-family: var(--pixel); font-size: .55rem; display: grid; place-items: center; }
.receipt { left: 9%; top: 14%; width: 180px; height: 120px; transform: rotate(-8deg); }
.seed { right: 9%; top: 18%; width: 155px; height: 170px; transform: rotate(7deg); }
.wax-seal { position: absolute; left: 48%; top: 39%; width: 76px; height: 76px; background: #B83252; box-shadow: 0 0 0 8px #F4C95D, 0 0 24px #B83252; border-radius: 50%; }
.stamp { position: absolute; padding: 1rem; border: 4px solid #B83252; color: #B83252; font-family: var(--pixel); font-size: .58rem; transform: rotate(-12deg); }
.stamp-a { left: 23%; bottom: 17%; } .stamp-b { right: 24%; bottom: 20%; transform: rotate(10deg); color: #134E8A; border-color: #134E8A; }
.sketch-lines { position: absolute; left: 38%; bottom: 17%; display: grid; gap: 12px; }
.sketch-lines i { display: block; width: 210px; height: 5px; background: #32144D; box-shadow: 22px 12px 0 #0F6B4A; }
.final-wordmark { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); font-size: clamp(3.2rem, 8vw, 7rem); letter-spacing: .06em; color: #32144D; opacity: .2; }

.scene-nav { position: fixed; right: 1.4rem; top: 50%; transform: translateY(-50%); z-index: 40; display: grid; gap: .7rem; }
.scene-nav button { width: 42px; height: 42px; border: 3px solid #F6E7C8; background: #160F24; color: #F6E7C8; font-family: var(--pixel); font-size: .45rem; cursor: pointer; box-shadow: 4px 4px 0 #32144D; }
.scene-nav button.active { background: #F4C95D; color: #160F24; border-color: #B83252; }

.scene .center-copy,
.scene .title-card { transform: translateY(34px); opacity: .35; transition: opacity .9s ease, transform .9s ease; }
.scene.is-current .center-copy,
.scene.is-current .title-card { transform: translateY(0); opacity: 1; }

@keyframes blink { 0%, 46% { opacity: 1; } 47%, 100% { opacity: .38; } }
@keyframes coinBob { 0% { transform: translateY(14px) scale(.72); opacity: 0; } 25% { opacity: 1; } 50% { transform: translateY(-10px) scale(1); opacity: 1; } 100% { transform: translateY(14px) scale(.84); opacity: .7; } }
@keyframes glow { from { filter: brightness(.88); } to { filter: brightness(1.35); } }
@keyframes floatSlow { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-18px); } }
@keyframes photoBloom { from { filter: sepia(.55) blur(1px) saturate(.9); } to { filter: sepia(.12) blur(0) saturate(1.45); } }
@keyframes ripple { 0% { opacity: .85; transform: translate(-50%, -50%) scale(.7); } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.45); } }
@keyframes seedPlant { 0% { transform: translateY(16px); opacity: 0; } 35%, 100% { transform: translateY(0); opacity: 1; } }
@keyframes pixelWipe { 0% { opacity: 0; transform: translateY(100%); } 35% { opacity: .45; transform: translateY(0); } 65% { opacity: .45; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-100%); } }

@media (max-width: 760px) {
  .scene { padding: 9vh 5vw; }
  h1 { font-size: 4.4rem; }
  .photo-frame, .pond-orb, .altar { width: 92vw; }
  .cottage, .well, .dove { opacity: .45; transform: scale(.75); }
  .scene-nav { right: .5rem; }
  .scene-nav button { width: 34px; height: 34px; font-size: .38rem; }
  .receipt { left: 4%; }
  .seed { right: 4%; }
}
