/* ============================================================
   saram.quest — A Pilgrimage Through Landscapes
   Five-landscape vertical narrative scroll
   ============================================================ */

:root {
    /* Landscape Spectrum */
    --horizon-peach: #F5C6A0;
    --morning-gold: #E8B84D;
    --forest-sage: #2D4A3E;
    --forest-deep: #1F3A2E;
    --forest-darkest: #0F2A1E;
    --slate-sky: #6B7B8D;
    --stone-grey: #4A5568;
    --slate-light: #8997A6;
    --river-teal: #2B6777;
    --river-deep: #1F4F5C;
    --twilight-amber: #C4956A;
    --deep-earth: #1A1510;
    --parchment: #F0E8D8;

    /* Active landscape transition variables */
    --bg-primary: #F5C6A0;
    --bg-secondary: #E8B84D;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Lora', Georgia, serif;
    color: var(--parchment);
    background-color: var(--bg-primary);
    overflow-x: hidden;
    transition: background-color 2s ease-in-out;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================
   Progress marker — fixed pilgrimage chapter indicator
   ============================================================ */
.progress-marker {
    position: fixed;
    top: 50%;
    right: 32px;
    transform: translateY(-50%);
    z-index: 50;
    font-family: 'Caveat', 'Lora', cursive;
    font-size: 22px;
    color: var(--parchment);
    letter-spacing: 0.04em;
    background: rgba(26, 21, 16, 0.32);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(240, 232, 216, 0.3);
    transition: color 1.2s ease, background 1.2s ease, border 1.2s ease;
    pointer-events: none;
}

.progress-marker .marker-current {
    font-weight: 500;
    font-size: 24px;
}

.progress-marker .marker-divider {
    margin: 0 4px;
    opacity: 0.6;
}

.progress-marker.is-light {
    color: var(--deep-earth);
    background: rgba(245, 198, 160, 0.45);
    border-color: rgba(26, 21, 16, 0.18);
}

/* ============================================================
   Pilgrimage container
   ============================================================ */
.pilgrimage {
    width: 100%;
    overflow: hidden;
}

.landscape {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.landscape-inner {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.landscape-origin   { height: 100vh;  background: linear-gradient(180deg, #F5C6A0 0%, #F0B870 45%, #E8B84D 100%); }
.landscape-forest   { height: 120vh;  background: radial-gradient(ellipse at 50% 30%, #3A5A4D 0%, #2D4A3E 55%, #1F3A2E 100%); }
.landscape-mountain { height: 100vh;  background: linear-gradient(180deg, #8FA0B0 0%, #6B7B8D 60%, #4A5568 100%); }
.landscape-river    { height: 130vh;  background: linear-gradient(180deg, #2B6777 0%, #25596A 50%, #1F4F5C 100%); }
.landscape-return   { height: 100vh;  background: radial-gradient(ellipse at 50% 75%, #C4956A 0%, #6E4A30 35%, #2A1F18 70%, #1A1510 100%); }

/* ============================================================
   Landscape Marker — Korean character + label
   ============================================================ */
.landscape-marker {
    position: absolute;
    top: 48px;
    left: 56px;
    display: flex;
    align-items: baseline;
    gap: 18px;
    z-index: 4;
    color: var(--deep-earth);
}

.landscape-marker-light,
.landscape-forest .landscape-marker,
.landscape-mountain .landscape-marker,
.landscape-river .landscape-marker,
.landscape-return .landscape-marker {
    color: var(--parchment);
}

.landscape-marker .marker-korean {
    font-family: 'Playfair Display', 'Lora', serif;
    font-weight: 700;
    font-size: 44px;
    line-height: 1;
    letter-spacing: 0.02em;
}

.landscape-marker .marker-label {
    font-family: 'Caveat', cursive;
    font-size: 20px;
    letter-spacing: 0.05em;
    opacity: 0.7;
}

/* ============================================================
   Display titles + body prose
   ============================================================ */
.display-title {
    font-family: 'Playfair Display', 'Lora', serif;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.01em;
    margin: 0;
}

.display-warm       { color: #2A1F18; font-size: clamp(54px, 9vw, 96px); }
.display-warm-deep  { color: var(--horizon-peach); font-size: clamp(54px, 9vw, 96px); text-shadow: 0 4px 38px rgba(196, 149, 106, 0.45); }
.display-cool       { color: var(--parchment); font-size: clamp(54px, 9vw, 96px); }
.display-cool-light { color: var(--parchment); font-size: clamp(46px, 7vw, 80px); }

.invitation {
    font-family: 'Lora', serif;
    font-size: clamp(18px, 1.6vw, 22px);
    font-weight: 400;
    line-height: 1.8;
    color: #2A1F18;
    margin-top: 28px;
    max-width: 540px;
    opacity: 0.85;
}

.prose {
    font-family: 'Lora', serif;
    font-size: clamp(17px, 1.35vw, 20px);
    line-height: 1.85;
    color: var(--parchment);
    max-width: 56ch;
    opacity: 0.92;
}

.annotation {
    font-family: 'Caveat', cursive;
    font-size: 17px;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    color: var(--twilight-amber);
    opacity: 0.75;
}

.annotation-light {
    color: var(--parchment);
    opacity: 0.65;
}

/* ============================================================
   Landscape 1 — Origin / 시작
   ============================================================ */
.origin-content {
    position: absolute;
    top: 18%;
    left: 8%;
    max-width: 720px;
    z-index: 3;
    animation: fade-up 1.6s ease-out 0.2s both;
}

.origin-rays {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.origin-rays .ray {
    position: absolute;
    bottom: 14%;
    left: 50%;
    width: 2px;
    height: 78vh;
    background: linear-gradient(to top, rgba(255, 240, 210, 0.55), rgba(255, 240, 210, 0));
    transform-origin: bottom center;
    opacity: 0.55;
    filter: blur(0.4px);
    animation: ray-pulse 6s ease-in-out infinite;
}

.origin-rays .ray-1 { transform: translateX(-50%) rotate(-32deg); animation-delay: 0s; }
.origin-rays .ray-2 { transform: translateX(-50%) rotate(-16deg); animation-delay: 0.8s; opacity: 0.7; }
.origin-rays .ray-3 { transform: translateX(-50%) rotate(0deg);   animation-delay: 1.6s; opacity: 0.85; }
.origin-rays .ray-4 { transform: translateX(-50%) rotate(16deg);  animation-delay: 2.4s; opacity: 0.7; }
.origin-rays .ray-5 { transform: translateX(-50%) rotate(32deg);  animation-delay: 3.2s; opacity: 0.55; }

@keyframes ray-pulse {
    0%, 100% { opacity: 0.45; }
    50%      { opacity: 0.85; }
}

/* Pilgrim figure — drawn purely with CSS */
.pilgrim {
    position: absolute;
    bottom: 14%;
    left: 50%;
    transform: translateX(-50%);
    width: 56px;
    height: 160px;
    z-index: 4;
    animation: pilgrim-rise 2.4s ease-out 0.4s both;
}

.pilgrim-figure {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 110px;
    background: var(--deep-earth);
    opacity: 0.82;
    /* head + body silhouette */
    clip-path: polygon(
        46% 0%,  54% 0%,  60% 6%,  62% 14%,  58% 22%,  52% 25%,
        66% 30%, 72% 42%, 70% 64%, 64% 100%,
        52% 100%, 50% 70%, 50% 70%,
        48% 100%, 36% 100%, 30% 64%, 28% 42%, 34% 30%,
        48% 25%, 42% 22%, 38% 14%, 40% 6%
    );
}

.pilgrim-forward .pilgrim-figure {
    transform: translateX(-50%);
}

.pilgrim-back .pilgrim-figure {
    transform: translateX(-50%) scaleX(-1);
}

.pilgrim-shadow {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 14px;
    background: radial-gradient(ellipse at center, rgba(26, 21, 16, 0.45), rgba(26, 21, 16, 0));
    filter: blur(2px);
}

@keyframes pilgrim-rise {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(28px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   SVG section dividers
   ============================================================ */
.divider {
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 110px;
    z-index: 5;
    display: block;
    pointer-events: none;
}

.divider-treeline { height: 110px; }
.divider-ridge    { height: 120px; }
.divider-river    { height: 110px; }
.divider-horizon  { height: 110px; }

/* ============================================================
   Landscape 2 — Forest / 숲
   ============================================================ */
.forest-trees {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.forest-trees .trees {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70%;
    will-change: transform;
}

.forest-trees .trees-far  { opacity: 0.55; transform: translateY(0); }
.forest-trees .trees-mid  { opacity: 0.78; height: 60%; }
.forest-trees .trees-near { opacity: 1;    height: 50%; }

.forest-content {
    position: relative;
    z-index: 3;
    max-width: 1100px;
    margin: 0 auto;
    padding: 18vh 8vw 0;
    display: flex;
    flex-direction: column;
    gap: 7vh;
}

.forest-content .display-title {
    text-align: left;
    margin-bottom: 1vh;
}

.clearing {
    max-width: 640px;
    padding: 24px 32px;
    border-left: 2px solid rgba(240, 232, 216, 0.18);
    background: linear-gradient(120deg, rgba(15, 42, 30, 0.4), rgba(15, 42, 30, 0.1));
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border-radius: 2px;
    transform: translateX(-12px);
    opacity: 0;
    transition: transform 1.2s ease, opacity 1.2s ease;
}

.clearing.is-visible {
    transform: translateX(0);
    opacity: 1;
}

.clearing-one  { align-self: flex-start; }
.clearing-two  { align-self: center; }
.clearing-three { align-self: flex-end; }

/* ============================================================
   Landscape 3 — Mountain / 산
   ============================================================ */
.mountains {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80%;
    pointer-events: none;
    z-index: 1;
}

.mountain-content {
    position: absolute;
    top: 16%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 3;
    max-width: 760px;
    padding: 0 6vw;
}

.mountain-content .annotation {
    margin-bottom: 24px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 14px;
}

.mountain-content .display-title {
    margin-bottom: 32px;
}

.aphorism {
    font-family: 'Lora', serif;
    font-size: clamp(20px, 2vw, 26px);
    font-style: italic;
    font-weight: 400;
    line-height: 1.7;
    color: var(--parchment);
    opacity: 0.88;
    max-width: 640px;
    margin: 0 auto;
}

/* ============================================================
   Landscape 4 — River / 강
   ============================================================ */
.waves {
    position: absolute;
    left: 0;
    width: 100%;
    height: 200px;
    pointer-events: none;
    z-index: 1;
    overflow: visible;
}

.waves-back  { top: 30%; }
.waves-mid   { top: 48%; }
.waves-front { top: 66%; }

.waves-back  path { animation: wave-drift-slow 25s linear infinite; }
.waves-mid   path { animation: wave-drift-mid 18s linear infinite; }
.waves-front path { animation: wave-drift-fast 12s linear infinite; }

@keyframes wave-drift-slow {
    from { transform: translateX(0); }
    to   { transform: translateX(-720px); }
}
@keyframes wave-drift-mid {
    from { transform: translateX(0); }
    to   { transform: translateX(-720px); }
}
@keyframes wave-drift-fast {
    from { transform: translateX(0); }
    to   { transform: translateX(-720px); }
}

.river-content {
    position: relative;
    z-index: 3;
    max-width: 1280px;
    margin: 0 auto;
    padding: 14vh 6vw 6vh;
}

.river-content .annotation {
    text-align: center;
    margin-bottom: 14px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-size: 14px;
}

.river-content .display-title {
    text-align: center;
    margin-bottom: 8vh;
}

.river-grid {
    display: grid;
    grid-auto-flow: column;
    grid-template-columns: repeat(4, minmax(260px, 1fr));
    gap: 32px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 24px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
    scrollbar-color: rgba(240, 232, 216, 0.4) transparent;
}

.river-grid::-webkit-scrollbar          { height: 6px; }
.river-grid::-webkit-scrollbar-track    { background: transparent; }
.river-grid::-webkit-scrollbar-thumb    { background: rgba(240, 232, 216, 0.3); border-radius: 4px; }

.river-card {
    background: linear-gradient(150deg, rgba(31, 79, 92, 0.7), rgba(20, 56, 68, 0.6));
    border: 1px solid rgba(240, 232, 216, 0.18);
    border-radius: 4px;
    padding: 32px 28px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    scroll-snap-align: start;
    transform: translateY(20px);
    opacity: 0;
    transition: transform 1s ease, opacity 1s ease;
}

.river-card.is-visible {
    transform: translateY(0);
    opacity: 1;
}

.river-card .annotation {
    text-align: left;
    margin-bottom: 16px;
    letter-spacing: 0.04em;
    text-transform: none;
    font-size: 17px;
    color: var(--horizon-peach);
}

.river-card .prose {
    font-size: 17px;
    line-height: 1.8;
    color: var(--parchment);
}

@media (max-width: 1024px) {
    .river-grid { grid-template-columns: repeat(4, minmax(240px, 70vw)); }
}

/* ============================================================
   Landscape 5 — Return / 귀환
   ============================================================ */
.return-glow {
    position: absolute;
    top: 18%;
    left: 50%;
    transform: translate(-50%, 0);
    width: 720px;
    height: 720px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(196, 149, 106, 0.55) 0%, rgba(196, 149, 106, 0.18) 38%, rgba(26, 21, 16, 0) 70%);
    filter: blur(2px);
    pointer-events: none;
    z-index: 1;
    animation: return-glow-pulse 8s ease-in-out infinite;
}

@keyframes return-glow-pulse {
    0%, 100% { opacity: 0.7; transform: translate(-50%, 0) scale(1); }
    50%      { opacity: 1;   transform: translate(-50%, 0) scale(1.06); }
}

.landscape-return .pilgrim {
    top: 18%;
    bottom: auto;
    z-index: 4;
    animation: pilgrim-arrive 2s ease-out 0.4s both;
}

@keyframes pilgrim-arrive {
    from { opacity: 0; transform: translateX(-50%) translateY(-12px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.return-content {
    position: absolute;
    bottom: 18%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 3;
    max-width: 820px;
    width: 90%;
}

.return-content .display-title {
    margin-bottom: 28px;
}

.closing-prose {
    font-family: 'Lora', serif;
    font-size: clamp(18px, 1.6vw, 22px);
    line-height: 1.85;
    color: var(--parchment);
    opacity: 0.88;
    margin-bottom: 36px;
}

.closing-annotation {
    font-family: 'Caveat', cursive;
    font-size: 18px;
    letter-spacing: 0.18em;
    color: var(--twilight-amber);
    opacity: 0.85;
}

.return-stars {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 60%;
    pointer-events: none;
    z-index: 2;
}

.return-stars .star {
    position: absolute;
    top: var(--y);
    left: var(--x);
    width: 3px;
    height: 3px;
    background: var(--parchment);
    border-radius: 50%;
    opacity: 0.7;
    box-shadow: 0 0 6px rgba(245, 232, 216, 0.6);
    animation: star-twinkle 4.4s ease-in-out infinite;
    animation-delay: var(--d);
}

@keyframes star-twinkle {
    0%, 100% { opacity: 0.25; transform: scale(0.85); }
    50%      { opacity: 1;    transform: scale(1.15); }
}

/* ============================================================
   Reveal-on-scroll for content blocks
   ============================================================ */
.origin-content,
.forest-content .display-title,
.mountain-content,
.return-content {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 1.4s ease, transform 1.4s ease;
}

.origin-content.is-visible,
.forest-content .display-title.is-visible,
.mountain-content.is-visible,
.return-content.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Origin gets initial fade-up animation, so don't double-hide it on first paint */
.landscape-origin .origin-content { opacity: 1; transform: translateY(0); }

/* ============================================================
   Responsive shaping
   ============================================================ */
@media (max-width: 768px) {
    .landscape-marker { top: 24px; left: 24px; gap: 12px; }
    .landscape-marker .marker-korean { font-size: 30px; }
    .landscape-marker .marker-label  { font-size: 16px; }

    .progress-marker { right: 16px; font-size: 18px; padding: 8px 12px; }

    .origin-content { top: 14%; left: 6%; }

    .forest-content { padding: 12vh 6vw 0; gap: 5vh; }
    .clearing { padding: 18px 22px; }
    .clearing-one,
    .clearing-two,
    .clearing-three { align-self: flex-start; }

    .mountain-content { top: 12%; padding: 0 6vw; }

    .river-content { padding: 12vh 4vw 4vh; }
    .river-grid { grid-template-columns: repeat(4, 80vw); gap: 18px; }

    .return-content { bottom: 14%; }
}

@media (max-width: 480px) {
    .display-warm,
    .display-warm-deep,
    .display-cool,
    .display-cool-light { font-size: clamp(40px, 11vw, 56px); }

    .pilgrim { width: 40px; height: 120px; }
    .pilgrim-figure { width: 22px; height: 90px; }

    .return-glow { width: 420px; height: 420px; }
}
