/* ==========================================================
   aiice.io - Through the Looking-Glass of Ice
   Colors: #0b1622, #132238, #7efaff, #b48eff, #ffd166,
           #e8f0f8, #7e8c9a, #ff6b6b, #2d3436, #1a3a5c
   Fonts: Outfit, DM Sans, JetBrains Mono
   ========================================================== */

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

:root {
    --polar-night: #0b1622;
    --glacial-deep: #132238;
    --aurora-cyan: #7efaff;
    --ice-violet: #b48eff;
    --alice-gold: #ffd166;
    --frost-white: #e8f0f8;
    --rime-grey: #7e8c9a;
    --glass-edge: rgba(255, 255, 255, 0.18);
    --cracked-red: #ff6b6b;
    --mid-blue: #1a3a5c;
    --text-dark: #2d3436;
    --scroll-progress: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'DM Sans', sans-serif;
    background: linear-gradient(180deg, var(--glacial-deep) 0%, var(--mid-blue) 40%, var(--polar-night) 100%);
    color: var(--frost-white);
    overflow-x: hidden;
    min-height: 600vh;
    position: relative;
}

/* Hexagonal Background Grid */
.hex-grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.04;
    background-image:
        linear-gradient(60deg, rgba(126, 250, 255, 0.15) 1px, transparent 1px),
        linear-gradient(-60deg, rgba(126, 250, 255, 0.15) 1px, transparent 1px),
        linear-gradient(0deg, rgba(126, 250, 255, 0.1) 1px, transparent 1px);
    background-size: 80px 138.56px;
    pointer-events: none;
    z-index: 0;
}

/* Navigation Bar */
.nav-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 48px;
    background: rgba(19, 34, 56, 0.7);
    backdrop-filter: blur(20px) saturate(1.3);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    border-bottom: 1px solid var(--glass-edge);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    z-index: 1000;
}

.nav-logo-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--aurora-cyan), var(--ice-violet));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-link {
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: var(--rime-grey);
    text-decoration: none;
    position: relative;
    letter-spacing: 0.03em;
    transition: color 0.4s ease;
    overflow: hidden;
}

.nav-link:hover {
    color: var(--frost-white);
}

/* Aurora Ribbons */
.aurora-ribbons {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.aurora-ribbon {
    position: absolute;
    width: 100%;
    height: 200px;
    opacity: 0.6;
}

.aurora-ribbon-1 {
    top: 30%;
    animation: auroraFloat1 14s ease-in-out infinite;
}

.aurora-ribbon-2 {
    top: 55%;
    animation: auroraFloat2 18s ease-in-out infinite;
}

.aurora-ribbon-3 {
    top: 75%;
    animation: auroraFloat3 16s ease-in-out infinite;
}

@keyframes auroraFloat1 {
    0%, 100% { transform: translateY(0) scaleY(1); }
    50% { transform: translateY(-30px) scaleY(1.1); }
}

@keyframes auroraFloat2 {
    0%, 100% { transform: translateY(0) scaleY(1); }
    50% { transform: translateY(20px) scaleY(0.9); }
}

@keyframes auroraFloat3 {
    0%, 100% { transform: translateY(0) scaleY(1); }
    33% { transform: translateY(-15px) scaleY(1.05); }
    66% { transform: translateY(25px) scaleY(0.95); }
}

/* Section Base */
.section {
    position: relative;
    z-index: 2;
}

/* =========================================
   SECTION 1: THE MIRROR SURFACE
   ========================================= */
.section-mirror {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ice-surface {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.particle-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.5;
    z-index: 1;
}

.frost-cracks {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none;
}

.crack {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 2s ease-out;
}

.cracks-active .crack {
    stroke-dashoffset: 0;
}

.crack-1 { transition-delay: 0s; }
.crack-2 { transition-delay: 0.1s; }
.crack-3 { transition-delay: 0.2s; }
.crack-4 { transition-delay: 0.15s; }
.crack-5 { transition-delay: 0.3s; }
.crack-6 { transition-delay: 0.25s; }
.crack-7 { transition-delay: 0.35s; }
.crack-8 { transition-delay: 0.18s; }
.crack-9 { transition-delay: 0.5s; }
.crack-10 { transition-delay: 0.55s; }
.crack-11 { transition-delay: 0.6s; }
.crack-12 { transition-delay: 0.65s; }

/* Ice Shards */
.ice-shard {
    position: absolute;
    width: 55%;
    height: 55%;
    background: rgba(19, 34, 56, 0.3);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    border: 1px solid rgba(126, 250, 255, 0.15);
    z-index: 4;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.8s ease;
    pointer-events: none;
}

.shard-top-left { top: 0; left: 0; transform-origin: top left; }
.shard-top-right { top: 0; right: 0; transform-origin: top right; }
.shard-bottom-left { bottom: 0; left: 0; transform-origin: bottom left; }
.shard-bottom-right { bottom: 0; right: 0; transform-origin: bottom right; }

.shards-broken .shard-top-left { transform: translate(-60%, -60%) rotate(-15deg); opacity: 0; }
.shards-broken .shard-top-right { transform: translate(60%, -60%) rotate(15deg); opacity: 0; }
.shards-broken .shard-bottom-left { transform: translate(-60%, 60%) rotate(15deg); opacity: 0; }
.shards-broken .shard-bottom-right { transform: translate(60%, 60%) rotate(-15deg); opacity: 0; }

/* Frozen Title */
.ice-title {
    position: relative;
    z-index: 5;
    text-align: center;
}

.frozen-text {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: clamp(64px, 12vw, 140px);
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--frost-white) 0%, var(--aurora-cyan) 50%, var(--ice-violet) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 40px rgba(126, 250, 255, 0.3));
    line-height: 1;
}

.frozen-subtitle {
    margin-top: 16px;
    font-size: 14px;
    letter-spacing: 0.15em;
    color: var(--aurora-cyan);
    opacity: 0.7;
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    animation: fadeInUp 1.5s ease 3s both;
}

.scroll-indicator .mono {
    font-size: 12px;
    color: var(--rime-grey);
    letter-spacing: 0.1em;
    display: block;
    margin-bottom: 12px;
}

.scroll-arrow {
    width: 20px;
    height: 20px;
    border-right: 1.5px solid var(--aurora-cyan);
    border-bottom: 1.5px solid var(--aurora-cyan);
    transform: rotate(45deg);
    margin: 0 auto;
    animation: bounceDown 2s ease-in-out infinite;
    opacity: 0.6;
}

@keyframes bounceDown {
    0%, 100% { transform: rotate(45deg) translateY(0); }
    50% { transform: rotate(45deg) translateY(8px); }
}

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

/* =========================================
   SECTION 2: THE DESCENT
   ========================================= */
.section-descent {
    padding: 100px 0;
    min-height: 250vh;
}

.content-zone {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 30px;
    max-width: 1100px;
    margin: 0 auto 120px;
    padding: 0 40px;
    position: relative;
}

/* Glass Module */
.glass-module {
    background: rgba(19, 34, 56, 0.65);
    backdrop-filter: blur(24px) saturate(1.3);
    -webkit-backdrop-filter: blur(24px) saturate(1.3);
    border: 1px solid var(--glass-edge);
    border-radius: 14px;
    padding: 40px;
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-module:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 30px rgba(126, 250, 255, 0.05);
}

.module-large { flex: 3; min-height: 280px; }
.module-small { flex: 2; min-height: 200px; }

/* Reveal animations */
.glass-module[data-reveal] {
    opacity: 0;
    transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.glass-module[data-reveal="left"] { transform: translateX(-80px); }
.glass-module[data-reveal="right"] { transform: translateX(80px); }
.glass-module[data-reveal="up"] { transform: translateY(60px); }

.glass-module.revealed {
    opacity: 1;
    transform: translateX(0) translateY(0);
}

/* Condensation Droplets */
.condensation-droplets {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.droplet {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.05));
    transition: transform 0.3s ease;
}

/* Typography */
.section-title {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(32px, 4vw, 56px);
    letter-spacing: -0.02em;
    color: var(--frost-white);
    margin-bottom: 20px;
    line-height: 1.15;
}

.section-subtitle {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: clamp(22px, 2.5vw, 32px);
    letter-spacing: -0.02em;
    color: var(--frost-white);
    margin-bottom: 16px;
    line-height: 1.2;
}

.body-text {
    font-family: 'DM Sans', sans-serif;
    font-weight: 400;
    font-size: 17px;
    line-height: 1.75;
    color: #c8d6e5;
    margin-bottom: 16px;
}

.body-text.accent-gold {
    color: var(--alice-gold);
    font-size: 20px;
    font-weight: 500;
    font-style: italic;
}

.mono {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    letter-spacing: 0.05em;
}

.accent-label {
    color: var(--aurora-cyan);
    display: block;
    margin-top: 8px;
}

.data-readout {
    color: var(--ice-violet);
    display: block;
    margin-top: 12px;
}

/* Frost Line Separator */
.frost-line-separator {
    margin: 20px 0;
}

.frost-line-separator svg {
    width: 100%;
    height: 2px;
}

.frost-line line {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
    transition: stroke-dashoffset 1.5s ease-out;
}

.revealed .frost-line line {
    stroke-dashoffset: 0;
}

/* Alice Symbol */
.alice-symbol {
    font-size: 48px;
    color: var(--alice-gold);
    text-align: center;
    margin-top: 20px;
    opacity: 0.6;
    animation: pulseGlow 4s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.4; filter: drop-shadow(0 0 8px rgba(255, 209, 102, 0.3)); }
    50% { opacity: 0.8; filter: drop-shadow(0 0 20px rgba(255, 209, 102, 0.5)); }
}

/* Hex Pattern Mini */
.hex-pattern-mini {
    width: 100%;
    height: 80px;
    margin-top: 16px;
    background:
        linear-gradient(60deg, rgba(126, 250, 255, 0.08) 1px, transparent 1px),
        linear-gradient(-60deg, rgba(126, 250, 255, 0.08) 1px, transparent 1px);
    background-size: 30px 52px;
    border-radius: 8px;
    opacity: 0.5;
}

/* =========================================
   SECTION 3: THE CHAMBER
   ========================================= */
.section-chamber {
    min-height: 150vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 40px;
}

.portal-formation {
    display: flex;
    align-items: stretch;
    justify-content: center;
    gap: 0;
    max-width: 1100px;
    width: 100%;
    position: relative;
}

.portal-left,
.portal-right {
    flex: 1;
    min-height: 400px;
}

.portal-left {
    border-radius: 14px 0 0 14px;
    border-right: none;
}

.portal-right {
    border-radius: 0 14px 14px 0;
    border-left: none;
}

.portal-arch {
    width: 200px;
    min-height: 400px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.portal-glow {
    position: absolute;
    top: 10%;
    left: 10%;
    width: 80%;
    height: 80%;
    border-radius: 100px 100px 0 0;
    background: radial-gradient(ellipse at center, rgba(255, 209, 102, 0.15) 0%, rgba(180, 142, 255, 0.08) 50%, transparent 80%);
    animation: portalPulse 4s ease-in-out infinite;
}

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

.portal-inner {
    position: relative;
    z-index: 2;
    text-align: center;
}

.portal-label {
    color: var(--alice-gold);
    font-size: 11px;
    letter-spacing: 0.1em;
    writing-mode: vertical-lr;
    text-orientation: mixed;
    opacity: 0.7;
}

/* =========================================
   SECTION 4: THE RETURN
   ========================================= */
.section-return {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 40px;
    position: relative;
}

.return-frost-edges {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

.frost-edge {
    position: absolute;
    background: linear-gradient(to right, rgba(126, 250, 255, 0.08), transparent);
    opacity: 0;
    transition: opacity 2s ease;
}

.frost-edge-left {
    top: 0;
    left: 0;
    width: 15%;
    height: 100%;
    background: linear-gradient(to right, rgba(126, 250, 255, 0.1), transparent);
}

.frost-edge-right {
    top: 0;
    right: 0;
    width: 15%;
    height: 100%;
    background: linear-gradient(to left, rgba(126, 250, 255, 0.1), transparent);
}

.frost-edge-top {
    top: 0;
    left: 0;
    width: 100%;
    height: 15%;
    background: linear-gradient(to bottom, rgba(126, 250, 255, 0.08), transparent);
}

.frost-edge-bottom {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 15%;
    background: linear-gradient(to top, rgba(126, 250, 255, 0.06), transparent);
}

.frost-edges-active .frost-edge {
    opacity: 1;
}

.return-panel {
    max-width: 700px;
    text-align: center;
    z-index: 4;
}

.return-title {
    background: linear-gradient(135deg, var(--aurora-cyan), var(--ice-violet));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.return-text {
    color: #c8d6e5;
}

.return-sigil {
    margin-top: 40px;
    padding: 16px 32px;
    border: 1px solid var(--glass-edge);
    border-radius: 8px;
    display: inline-block;
    background: rgba(19, 34, 56, 0.4);
}

.return-sigil .mono {
    color: var(--aurora-cyan);
    font-size: 16px;
    letter-spacing: 0.1em;
}

/* =========================================
   PARALLAX CLASSES
   ========================================= */
.parallax-fg { will-change: transform; }
.parallax-mid { will-change: transform; }

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    .nav-bar {
        padding: 0 20px;
    }

    .nav-links {
        gap: 16px;
    }

    .nav-link {
        font-size: 12px;
    }

    .content-zone {
        flex-direction: column;
        padding: 0 20px;
        gap: 20px;
        margin-bottom: 80px;
    }

    .module-large,
    .module-small {
        flex: none;
        width: 100%;
        min-height: auto;
    }

    .glass-module {
        padding: 28px;
    }

    .portal-formation {
        flex-direction: column;
        gap: 20px;
    }

    .portal-left,
    .portal-right {
        border-radius: 14px;
        min-height: auto;
    }

    .portal-arch {
        width: 100%;
        min-height: 120px;
    }

    .portal-label {
        writing-mode: horizontal-tb;
    }

    .section-descent {
        min-height: auto;
    }

    .section-chamber {
        min-height: auto;
    }

    .frozen-text {
        font-size: clamp(48px, 15vw, 80px);
    }
}
