/* ============================================
   martiallaw.quest — Aurora Glassmorphism Descent
   ============================================ */

:root {
    --aurora-green: #00e676;
    --aurora-teal: #00897b;
    --aurora-violet: #7c4dff;
    --deep-indigo: #1a0a3e;
    --aurora-rose: #ff6090;
    --warm-amber: #ffab40;
    --frost-white: #f5f5f7;
    --deep-charcoal: #1a1a2e;
    --scroll-phase: 0;
    --aurora-breath: 0;
}

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

html {
    scroll-behavior: smooth;
}

body.aurora-body {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    color: var(--frost-white);
    background: var(--deep-indigo);
    overflow-x: hidden;
    line-height: 1.85;
    letter-spacing: 0.01em;
}

/* ---- Aurora Background ---- */
.aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    background:
        radial-gradient(ellipse 120% 80% at 30% 20%, var(--aurora-green), transparent 50%),
        radial-gradient(ellipse 100% 60% at 70% 40%, var(--aurora-violet), transparent 50%),
        radial-gradient(ellipse 80% 100% at 50% 80%, var(--aurora-teal), transparent 50%),
        var(--deep-indigo);
    animation: auroraBreathe 25s ease-in-out infinite;
    transition: filter 1s ease;
}

@keyframes auroraBreathe {
    0%, 100% { transform: scale(1) translate(0, 0); opacity: 0.85; }
    25% { transform: scale(1.03) translate(1%, -1%); opacity: 0.9; }
    50% { transform: scale(1.01) translate(-1%, 1%); opacity: 0.8; }
    75% { transform: scale(1.04) translate(1%, 0.5%); opacity: 0.88; }
}

/* ---- Mountain Ridge ---- */
.mountain-ridge {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 40vh;
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 1s ease;
}

.mountain-back, .mountain-front {
    transition: d 2s ease;
}

/* ---- Lantern Field ---- */
.lantern-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 2;
    pointer-events: none;
    overflow: hidden;
}

.lantern {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,171,64,0.6) 0%, rgba(255,171,64,0.2) 40%, transparent 70%);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(255,171,64,0.15);
    animation: lanternFloat 40s ease-in-out infinite;
}

@keyframes lanternFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(15px, -25px) rotate(3deg); }
    50% { transform: translate(-10px, -40px) rotate(-2deg); }
    75% { transform: translate(20px, -15px) rotate(4deg); }
}

/* ---- Constitutional Fragments ---- */
.constitutional-fragments {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.fragment {
    position: absolute;
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
    font-size: 1.2rem;
    color: var(--frost-white);
    opacity: 0.06;
    animation: fragmentDrift 60s linear infinite;
    white-space: nowrap;
    transition: opacity 2s ease;
}

@keyframes fragmentDrift {
    0% { transform: translate(0, 0) rotate(0deg); }
    50% { transform: translate(-30px, 40px) rotate(5deg); }
    100% { transform: translate(0, 0) rotate(0deg); }
}

/* ---- Progress Ridge ---- */
.progress-ridge {
    position: fixed;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 300px;
    z-index: 100;
}

.progress-path {
    width: 100%;
    height: 100%;
}

.progress-dot {
    position: absolute;
    left: 50%;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--aurora-green);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 12px rgba(0,230,118,0.6);
    transition: background 0.5s ease, box-shadow 0.5s ease, top 0.1s linear;
}

/* ---- Narrative Column ---- */
.narrative-column {
    position: relative;
    z-index: 10;
    max-width: 90vw;
    margin: 0 auto;
    padding: 0 1rem;
    transition: max-width 1.2s ease;
}

/* ---- Glassmorphism Cards ---- */
.glass-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(16px) saturate(1.4);
    -webkit-backdrop-filter: blur(16px) saturate(1.4);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    padding: clamp(1.5rem, 3vw, 3rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
    clip-path: circle(0% at 50% 50%);
    transition: clip-path 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.glass-card.visible {
    clip-path: inset(0 0 0 0 round 20px);
}

/* ---- Sections ---- */
section {
    padding: 10vh 0;
    min-height: 80vh;
}

.summit {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding-top: 15vh;
}

.title-mountain {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    background: linear-gradient(135deg, var(--aurora-green), var(--aurora-violet), var(--aurora-rose), var(--warm-amber));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGradient 8s ease-in-out infinite;
    margin-bottom: 3rem;
    text-shadow: none;
}

@keyframes titleGradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.summit-card {
    max-width: 600px;
}

.subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    color: var(--frost-white);
    opacity: 0.9;
}

h2 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    letter-spacing: -0.02em;
    line-height: 1.15;
    margin-bottom: 1.2rem;
    background: linear-gradient(90deg, var(--frost-white), var(--aurora-teal));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.body-text {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.4vw, 1.2rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    margin-bottom: 1.2rem;
    color: var(--frost-white);
    opacity: 0.92;
}

.korean-accent {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 500;
    font-size: 1.3rem;
    color: var(--warm-amber);
    margin: 1.5rem 0;
}

.korean-accent .translation {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: rgba(245, 245, 247, 0.6);
}

.timestamp {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: var(--aurora-teal);
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.timestamp.emergency {
    color: var(--aurora-rose);
}

.timestamp.hope {
    color: var(--aurora-green);
}

.legal-cite {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    letter-spacing: 0.06em;
    color: rgba(245, 245, 247, 0.5);
    border-left: 2px solid var(--aurora-violet);
    padding-left: 1rem;
    margin: 1.5rem 0;
    line-height: 1.7;
}

.translation-block {
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: 0.95rem;
    color: rgba(245, 245, 247, 0.6);
    font-style: italic;
    margin-bottom: 1.2rem;
}

.closing {
    font-size: 1.6rem;
    text-align: center;
    margin-top: 2rem;
}

.closing-cite {
    text-align: center;
    border-left: none;
    margin-top: 2rem;
    opacity: 0.5;
}

/* ---- Card Icons ---- */
.card-icon {
    width: 48px;
    height: 48px;
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    opacity: 0.7;
}

.draw-icon {
    stroke-dasharray: 200;
    stroke-dashoffset: 200;
    transition: stroke-dashoffset 1.5s ease;
}

.glass-card.visible .draw-icon {
    stroke-dashoffset: 0;
}

/* ---- Valley Cracks ---- */
.crack-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5;
}

.crack-svg {
    width: 100%;
    height: 100%;
}

.crack-line {
    fill: none;
    stroke: rgba(255, 96, 144, 0.4);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 3s ease 1s;
}

.valley-card.visible .crack-line {
    stroke-dashoffset: 0;
}

.valley h2 {
    background: linear-gradient(90deg, var(--aurora-rose), var(--frost-white));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.valley .glass-card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 96, 144, 0.2);
}

/* ---- Ascent ---- */
.ascent h2 {
    background: linear-gradient(90deg, var(--aurora-green), var(--warm-amber));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ---- Return Section ---- */
.return {
    text-align: center;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.return-card {
    max-width: 700px;
    margin: 0 auto 2rem;
}

.summit-lantern {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.lantern-glow {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--warm-amber), rgba(255,171,64,0.3) 50%, transparent 70%);
    animation: lanternPulse 3s ease-in-out infinite;
}

@keyframes lanternPulse {
    0%, 100% { transform: scale(1); opacity: 0.8; }
    50% { transform: scale(1.15); opacity: 1; }
}

.mountain-ridge-return {
    width: min(600px, 80vw);
    height: 120px;
    opacity: 0.8;
    margin-top: 2rem;
}

.mountain-return-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 3s ease;
}

.return.active .mountain-return-path {
    stroke-dashoffset: 0;
}

.summit-light {
    opacity: 0;
    transition: opacity 2s ease 2.5s;
}

.return.active .summit-light {
    opacity: 1;
    filter: drop-shadow(0 0 8px var(--warm-amber));
}

/* ---- Column Width Transitions ---- */
body[data-phase="summit"] .narrative-column { max-width: 90vw; }
body[data-phase="descent"] .narrative-column { max-width: 75vw; }
body[data-phase="valley"] .narrative-column { max-width: 55vw; }
body[data-phase="ascent"] .narrative-column { max-width: 75vw; }
body[data-phase="return"] .narrative-column { max-width: 90vw; }

/* ---- Aurora Phase Shifts ---- */
body[data-phase="summit"] .aurora-bg {
    background:
        radial-gradient(ellipse 120% 80% at 30% 20%, var(--aurora-green), transparent 50%),
        radial-gradient(ellipse 100% 60% at 70% 40%, var(--aurora-teal), transparent 50%),
        radial-gradient(ellipse 80% 100% at 50% 80%, rgba(124,77,255,0.3), transparent 50%),
        var(--deep-indigo);
}

body[data-phase="descent"] .aurora-bg {
    background:
        radial-gradient(ellipse 120% 80% at 30% 20%, var(--aurora-violet), transparent 50%),
        radial-gradient(ellipse 100% 60% at 70% 40%, var(--aurora-teal), transparent 50%),
        radial-gradient(ellipse 80% 100% at 50% 80%, rgba(0,230,118,0.2), transparent 50%),
        var(--deep-indigo);
}

body[data-phase="valley"] .aurora-bg {
    background:
        radial-gradient(ellipse 120% 80% at 30% 20%, rgba(124,77,255,0.3), transparent 50%),
        radial-gradient(ellipse 100% 60% at 70% 40%, rgba(26,10,62,0.8), transparent 50%),
        radial-gradient(ellipse 80% 100% at 50% 80%, rgba(255,96,144,0.2), transparent 50%),
        #0d0520;
    filter: brightness(0.7);
}

body[data-phase="ascent"] .aurora-bg {
    background:
        radial-gradient(ellipse 120% 80% at 30% 20%, var(--aurora-teal), transparent 50%),
        radial-gradient(ellipse 100% 60% at 70% 40%, var(--aurora-green), transparent 50%),
        radial-gradient(ellipse 80% 100% at 50% 80%, rgba(255,171,64,0.3), transparent 50%),
        var(--deep-indigo);
}

body[data-phase="return"] .aurora-bg {
    background:
        radial-gradient(ellipse 120% 80% at 30% 20%, var(--warm-amber), transparent 50%),
        radial-gradient(ellipse 100% 60% at 70% 40%, var(--aurora-teal), transparent 50%),
        radial-gradient(ellipse 80% 100% at 50% 80%, var(--aurora-green), transparent 50%),
        var(--deep-indigo);
}

/* Valley fragments brighter */
body[data-phase="valley"] .fragment {
    opacity: 0.12;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    body[data-phase="valley"] .narrative-column { max-width: 85vw; }
    body[data-phase="descent"] .narrative-column { max-width: 90vw; }
    body[data-phase="ascent"] .narrative-column { max-width: 90vw; }
    .progress-ridge { display: none; }
    .card-icon { width: 36px; height: 36px; }
}
