/* ==========================================================================
   03 · STORY — horizontal chapter track
   ========================================================================== */

.story__pin { position: relative; height: 100vh; height: 100svh; overflow: hidden; }
.story__track { display: flex; height: 100%; width: max-content; will-change: transform; }

.chapter {
    position: relative;
    flex: none;
    width: 100vw;
    height: 100%;
    overflow: hidden;
}
.chapter + .chapter { border-left: 1px solid var(--line); }

/* intro card */
.chapter--intro { width: min(100vw, 1080px); display: grid; align-items: center; padding: var(--header-h) var(--gutter) 0; }
.chapter__intro { max-width: 760px; }
.story__title { margin-top: 26px; display: flex; flex-direction: column; gap: 10px; }
.story__title-kr { font-family: var(--f-kr); font-weight: 400; font-size: clamp(3.6rem, 8.4vw, 8.4rem); line-height: .95; color: var(--cream); }
.story__title-en { font-family: var(--f-display); font-size: clamp(1.6rem, 3vw, 2.8rem); letter-spacing: -.04em; color: var(--red-hot); }
.story__lead { margin-top: 26px; max-width: 46ch; color: var(--muted); font-size: var(--fs-lead); }
.story__hint { display: inline-flex; align-items: center; gap: 12px; margin-top: 40px; font-size: .75rem; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; color: var(--cream); }
.story__hint .icon { font-size: 1.3rem; color: var(--red-hot); animation: nudge 1.6s var(--ease-in-out) infinite; }
@keyframes nudge { 50% { transform: translateX(8px); } }

/* chapter layers */
.chapter__scene { position: absolute; inset: -2% -6%; pointer-events: none; }
.chapter__num {
    position: absolute;
    top: 9vh;
    left: var(--gutter);
    font-family: var(--f-display);
    font-weight: 800;
    font-size: clamp(9rem, 25vw, 25rem);
    line-height: .8;
    letter-spacing: -.07em;
    color: transparent;
    -webkit-text-stroke: 1.5px rgba(244, 234, 216, .13);
    pointer-events: none;
}
.chapter__gamja {
    position: absolute;
    left: 63%;
    bottom: 13vh;
    z-index: 2;
    height: min(56vh, 580px);
    transform: translateX(-50%);
}
.chapter__gamja .gamja-img, .chapter__gamja img { height: 100%; width: auto; max-width: none; }
.chapter__gamja img { pointer-events: auto; filter: drop-shadow(0 26px 30px rgba(0, 0, 0, .65)); }
.chapter__shadow { position: absolute; left: 50%; bottom: -14px; width: 80%; height: 36px; border-radius: 50%; transform: translateX(-50%); background: radial-gradient(closest-side, rgba(227, 24, 45, .45), transparent); z-index: -1; }
.chapter__gamja--potato-runing-image01, .chapter__gamja--potato-with-suitcase01, .chapter__gamja--potato-cooking-image01 { height: min(52vh, 540px); }
/* the wide 3:2 poses are sized shorter to keep a similar footprint */
.chapter__gamja--potato-lying-image01, .chapter__gamja--potato-roasting-image01 { height: min(40vh, 420px); }

.chapter__copy {
    position: absolute;
    left: var(--gutter);
    bottom: 16vh;
    z-index: 3;
    width: min(34vw, 470px);
}
.chapter:nth-child(odd):not(.chapter--intro) .chapter__gamja { left: 36%; }
.chapter:nth-child(odd):not(.chapter--intro) .chapter__copy { left: auto; right: calc(var(--gutter) + 40px); }
.chapter:nth-child(odd):not(.chapter--intro) .chapter__num { left: auto; right: var(--gutter); }

.chapter__kicker { font-size: .72rem; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--red-hot); }
.chapter__title { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.chapter__title [lang="ko"] { font-family: var(--f-kr); font-weight: 400; font-size: clamp(3rem, 6vw, 6rem); line-height: .95; }
.chapter__title span:last-child { font-family: var(--f-display); font-size: clamp(1.3rem, 2vw, 2rem); letter-spacing: -.035em; color: var(--muted); }
.chapter__text { margin-top: 20px; color: var(--muted); max-width: 40ch; }
.chapter__copy { text-shadow: 0 2px 14px rgba(0, 0, 0, .95), 0 0 2px rgba(0, 0, 0, .8); }

.scene-tag { position: absolute; right: 8%; top: 9%; font-family: var(--f-kr-body); font-size: .8rem; letter-spacing: .12em; color: var(--dim); }

/* 01 field */
.field { position: absolute; inset: 0; width: 100%; height: 100%; }
.field__horizon { stroke: rgba(255, 58, 76, .7); stroke-width: 1.5; filter: drop-shadow(0 0 6px rgba(227, 24, 45, .9)); }
.field__row { stroke: rgba(227, 24, 45, .2); stroke-width: 1; }

/* 02 city */
.skyline { position: absolute; left: 0; bottom: 0; width: 100%; height: 64%; }
.skyline__b rect { fill: #140b0c; }
.skyline .w { fill: rgba(243, 200, 106, .5); }
.skyline .w--red { fill: rgba(255, 58, 76, .85); }
.skyline .tower { fill: #1d1011; }
.skyline .tower-light { fill: var(--red-hot); filter: drop-shadow(0 0 8px var(--red)); animation: blink 2.4s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.neon {
    font-family: var(--f-kr);
    color: #ffe5e7;
    text-shadow: 0 0 4px #fff, 0 0 12px var(--red-hot), 0 0 28px var(--red), 0 0 60px var(--red);
    animation: flicker 5s infinite;
}
.neon--seoul { position: absolute; top: 24%; right: 14%; font-size: clamp(4rem, 9vw, 9rem); line-height: 1; }
@keyframes flicker { 0%, 18%, 22%, 62%, 64%, 100% { opacity: 1; } 20%, 63% { opacity: .45; } }

/* 03 hustle */
.store { position: absolute; right: 7%; bottom: 14%; width: min(40vw, 560px); }
.store__sign { padding: 18px 24px; border-radius: 14px; background: #150709; border: 1px solid rgba(255, 58, 76, .35); box-shadow: 0 0 40px rgba(227, 24, 45, .25); text-align: center; }
.neon--store { font-size: clamp(1.8rem, 3.6vw, 3.4rem); }
.store__window { position: relative; height: 38vh; margin-top: 12px; border-radius: 10px; background: linear-gradient(180deg, rgba(243, 200, 106, .12), rgba(243, 200, 106, .03)); border: 1px solid rgba(243, 200, 106, .18); }
.store__tag { position: absolute; left: 10%; top: 18%; padding: 6px 12px; border-radius: 6px; background: var(--gold-2); color: var(--ink); font-family: var(--f-kr-body); font-weight: 900; font-size: .9rem; transform: rotate(-4deg); }
.store__tag--b { left: auto; right: 12%; top: 48%; transform: rotate(5deg); background: var(--cream); }
.speedlines { position: absolute; inset: 0; overflow: hidden; }
.speedlines i { position: absolute; left: 0; top: var(--t); width: var(--w); height: 1px; background: linear-gradient(90deg, transparent, rgba(244, 234, 216, .45)); animation: speed var(--d) linear infinite; }
@keyframes speed { from { transform: translateX(-100%); } to { transform: translateX(110vw); } }

/* 04 laugh */
.kkk { position: absolute; inset: 0; }
.kkk span {
    position: absolute;
    left: var(--x);
    top: var(--y);
    padding: .15em .55em;
    border-radius: 999px;
    font-family: var(--f-kr);
    font-size: calc(1.6rem * var(--s));
    color: rgba(255, 90, 104, .8);
    background: rgba(227, 24, 45, .08);
    border: 1px solid rgba(227, 24, 45, .25);
    transform: rotate(var(--r));
    animation: floaty var(--d) var(--ease-in-out) infinite alternate;
}
.kkk span:nth-child(3n) { color: rgba(244, 234, 216, .5); background: rgba(244, 234, 216, .04); border-color: rgba(244, 234, 216, .12); }
@keyframes floaty { to { transform: translateY(-22px) rotate(calc(var(--r) * -1)); } }

/* 05 dream */
.stars { position: absolute; inset: 0; }
.stars i { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); border-radius: 50%; background: var(--cream); animation: twinkle var(--d) ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: .15; } to { opacity: .9; } }
.dreamsun { position: absolute; left: 58%; top: 8%; width: min(52vmin, 560px); aspect-ratio: 1; transform: translateX(-50%); }
.dreamsun::before {
    content: "";
    position: absolute;
    inset: -40%;
    background: repeating-conic-gradient(from 0deg, rgba(227, 24, 45, .16) 0 4deg, transparent 4deg 14deg);
    -webkit-mask-image: radial-gradient(closest-side, #000 20%, transparent 75%);
    mask-image: radial-gradient(closest-side, #000 20%, transparent 75%);
    animation: spin 60s linear infinite;
}
.dreamsun span { position: absolute; inset: 18%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ff7a86, var(--red) 45%, #8a0916 80%); box-shadow: 0 0 80px rgba(227, 24, 45, .8), 0 0 200px rgba(227, 24, 45, .45); }
html.has-webgl .dreamsun { display: none; } /* the WebGL dream takes this role */
.hill { position: absolute; left: 0; bottom: 0; width: 100%; height: 32%; }
.hill path { fill: #0b0506; }

/* journey rail */
.story__rail { position: absolute; left: var(--gutter); right: var(--gutter); bottom: 4.5vh; height: 40px; z-index: 5; pointer-events: none; }
.story__rail-line { position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--line-2); }
.story__rail-line span { position: absolute; inset: 0; background: linear-gradient(90deg, var(--red-deep), var(--red-hot)); box-shadow: var(--glow-sm); transform-origin: left; transform: scaleX(0); }
.story__tick { position: absolute; left: var(--p); bottom: 10px; transform: translateX(-100%); font-size: .66rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); white-space: nowrap; padding-right: 10px; }
.story__tick b { color: var(--red-hot); margin-right: 6px; }
.story__tick::after { content: ""; position: absolute; right: 0; bottom: -14px; width: 7px; height: 7px; border-radius: 50%; background: var(--char-3); border: 1px solid var(--line-2); transform: translateX(50%); }
.story__runner { position: absolute; left: 0; bottom: 2px; width: 38px; transform: translateX(-50%); }

/* ---------- mobile + reduced motion: vertical chapters ---------- */
@media (max-width: 767px), (prefers-reduced-motion: reduce) {
    .story__pin { height: auto; overflow: visible; }
    .story__track { flex-direction: column; width: 100%; }
    .chapter { width: 100%; height: auto; min-height: 92svh; display: flex; flex-direction: column; justify-content: flex-end; padding: 18vh var(--gutter) 10vh; }
    .chapter + .chapter { border-left: 0; border-top: 1px solid var(--line); }
    .chapter--intro { min-height: 0; padding-top: 12vh; padding-bottom: 6vh; }
    .chapter__num, .chapter:nth-child(odd):not(.chapter--intro) .chapter__num { top: 6vh; left: var(--gutter); right: auto; font-size: 42vw; }
    .chapter__gamja, .chapter:nth-child(odd):not(.chapter--intro) .chapter__gamja { position: relative; left: auto; bottom: auto; transform: none; height: 38svh; margin: 0 auto 28px; }
    /* the wider poses are sized by width here: at 38svh tall they could overflow a phone */
    .chapter__gamja--potato-lying-image01, .chapter__gamja--potato-roasting-image01 { height: auto; width: min(100%, 480px); }
    .chapter__gamja--potato-with-suitcase01 { height: auto; width: min(100%, 41svh); }
    .chapter__gamja--potato-cooking-image01 { height: auto; width: min(100%, 45svh); }
    .chapter__gamja--potato-lying-image01 .gamja-img, .chapter__gamja--potato-lying-image01 img,
    .chapter__gamja--potato-roasting-image01 .gamja-img, .chapter__gamja--potato-roasting-image01 img,
    .chapter__gamja--potato-with-suitcase01 .gamja-img, .chapter__gamja--potato-with-suitcase01 img,
    .chapter__gamja--potato-cooking-image01 .gamja-img, .chapter__gamja--potato-cooking-image01 img { width: 100%; height: auto; }
    .chapter__copy, .chapter:nth-child(odd):not(.chapter--intro) .chapter__copy { position: relative; left: auto; right: auto; bottom: auto; width: 100%; }
    .store { width: 80vw; right: 10%; top: 12%; bottom: auto; }
    .store__window { height: 18vh; }
    .neon--seoul { top: 8%; right: 8%; }
    .scene-tag { top: auto; bottom: 3%; right: 6%; }
    .dreamsun { top: 6%; width: 70vw; }
    .story__rail { display: none; }
}
