/* === Reset & Base === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
    overflow-x: hidden;
    background: #1a1118;
    color: #fff8f0;
    font-family: 'Quicksand', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    line-height: 1.75;
    scroll-behavior: smooth;
}

/* === Navigation Dots === */
#nav-dots {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 18px;
    align-items: center;
}
.nav-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #3d3036;
    border: 1px solid rgba(245, 166, 35, 0.3);
    cursor: pointer;
    position: relative;
    transition: background 0.4s ease, box-shadow 0.4s ease;
}
.nav-dot.active {
    background: #f5a623;
    box-shadow: 0 0 12px rgba(245, 166, 35, 0.6);
}
.dot-label {
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Baloo 2', cursive;
    font-weight: 600;
    font-size: clamp(0.875rem, 1.5vw, 1.125rem);
    color: #ffd4a3;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}
.nav-dot:hover .dot-label {
    opacity: 1;
}

/* === Full Sections === */
.full-section {
    min-height: 100vh;
    width: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    overflow: hidden;
}

/* === Animation Base === */
.animate-in {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform, opacity;
}
.animate-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === Glassmorphic Panels === */
.glass-panel {
    backdrop-filter: blur(20px) saturate(1.4);
    -webkit-backdrop-filter: blur(20px) saturate(1.4);
    background: rgba(255, 212, 163, 0.06);
    border: 1px solid rgba(255, 212, 163, 0.12);
    border-radius: 24px;
    padding: clamp(1.5rem, 4vw, 3rem);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 248, 240, 0.1);
    max-width: 640px;
    width: 90%;
    transition: border-color 0.4s ease, background 0.4s ease;
    position: relative;
    z-index: 2;
}
.glass-panel:hover {
    border-color: rgba(255, 212, 163, 0.25);
    background: rgba(255, 212, 163, 0.10);
}
.glass-panel.shake {
    animation: shake 0.5s ease;
}

/* === Typography === */
.hero-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(3rem, 10vw, 8rem);
    letter-spacing: 0.04em;
    color: #fff8f0;
    text-align: center;
    line-height: 1.1;
}
.dot-accent {
    color: #f5a623;
}
.hero-subtitle {
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    color: #ffd4a3;
    text-align: center;
    margin-top: 0.5em;
    font-size: clamp(1rem, 2.5vw, 1.25rem);
}
.section-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: 0.04em;
    color: #fff8f0;
    margin-bottom: 0.5em;
}
.section-text {
    color: #ffd4a3;
    font-weight: 400;
    margin-bottom: 1em;
}
.section-text:last-child {
    margin-bottom: 0;
}
.closing-text {
    color: #f5a623;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    text-align: center;
    margin-top: 1em;
}

/* === Section 1: The Forge (Hero) === */
#section-forge {
    background: radial-gradient(ellipse at 50% 60%, #f5a623 0%, #e8941a 20%, #3d3036 50%, #1a1118 100%);
}
.hero-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 60%, rgba(245,166,35,0.15) 0%, transparent 70%);
    pointer-events: none;
}
.allotrope-glyphs {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    z-index: 2;
}
.scroll-hint {
    position: absolute;
    bottom: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: #6b5a52;
    font-family: 'Baloo 2', cursive;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 2;
}
.scroll-arrow {
    width: 2px;
    height: 24px;
    background: linear-gradient(to bottom, #6b5a52, transparent);
    animation: scroll-bounce 2s ease-in-out infinite;
}
@keyframes scroll-bounce {
    0%, 100% { transform: translateY(0); opacity: 0.6; }
    50% { transform: translateY(8px); opacity: 1; }
}

/* === Section 2: The Lattice === */
#section-lattice {
    background: linear-gradient(180deg, #1a1118 0%, #3d3036 100%);
}
.lattice-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.15;
    pointer-events: none;
}
.lattice-bg line {
    stroke: #f5a623;
    stroke-width: 1.5;
    fill: none;
}
.lattice-bg circle {
    fill: #f5a623;
}
.lattice-node-pulse {
    animation: node-pulse 3s ease-in-out infinite;
}
@keyframes node-pulse {
    0% { r: 4; opacity: 0.7; }
    50% { r: 5.5; opacity: 1; }
    100% { r: 4; opacity: 0.7; }
}
.lattice-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 3s ease-in-out;
}
.lattice-path.drawn {
    stroke-dashoffset: 0;
}

/* === Section 3: The Flame === */
#section-flame {
    background: linear-gradient(180deg, #3d3036 0%, #1a1118 100%);
}
.candle-container {
    position: relative;
    width: 60px;
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    margin-bottom: 2rem;
    z-index: 2;
}
.flame-inner {
    position: absolute;
    bottom: 80px;
    width: 16px;
    height: 40px;
    background: #fff8f0;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker-inner 0.8s ease-in-out infinite alternate;
    z-index: 3;
    will-change: transform;
}
.flame-mid {
    position: absolute;
    bottom: 75px;
    width: 24px;
    height: 50px;
    background: #f5a623;
    opacity: 0.7;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker-mid 1.2s ease-in-out infinite alternate;
    z-index: 2;
    will-change: transform;
}
.flame-outer {
    position: absolute;
    bottom: 60px;
    width: 100px;
    height: 100px;
    background: radial-gradient(ellipse, rgba(245, 166, 35, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: flicker-outer 2s ease-in-out infinite alternate;
    filter: blur(1px);
    z-index: 1;
    will-change: transform;
}
.candle-body {
    width: 24px;
    height: 70px;
    background: #6b5a52;
    border-radius: 4px;
    position: relative;
}
.candle-wick {
    width: 2px;
    height: 10px;
    background: #3d3036;
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
}

@keyframes flicker-inner {
    0% { transform: skewX(-2deg) scaleY(1); }
    50% { transform: skewX(3deg) scaleY(1.05); }
    100% { transform: skewX(-1deg) scaleY(0.95); }
}
@keyframes flicker-mid {
    0% { transform: skewX(1deg) scaleY(1); }
    50% { transform: skewX(-2deg) scaleY(1.08); }
    100% { transform: skewX(2deg) scaleY(0.92); }
}
@keyframes flicker-outer {
    0% { transform: scale(1); opacity: 0.4; }
    50% { transform: scale(1.1); opacity: 0.5; }
    100% { transform: scale(0.95); opacity: 0.35; }
}

/* === Section 4: The Cycle === */
#section-cycle {
    background: linear-gradient(180deg, #1a1118 0%, #3d3036 50%, #1a1118 100%);
}
.dot-trail {
    display: flex;
    justify-content: space-between;
    width: 100%;
    padding: 0 5vw;
    margin-top: 2rem;
    z-index: 2;
    position: relative;
}
.trail-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3d3036;
    transition: background-color 0.3s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
}
.trail-dot.active {
    background: #f5a623;
    box-shadow: 0 0 12px rgba(245, 166, 35, 0.6);
}
.trail-dot-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.trail-label {
    font-family: 'Baloo 2', cursive;
    font-weight: 600;
    font-size: 0.75rem;
    color: #ffd4a3;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    white-space: nowrap;
}
.trail-dot-wrapper.active .trail-label {
    opacity: 1;
    transform: translateY(0);
}

/* === Section 5: The Breath === */
#section-breath {
    background: radial-gradient(ellipse at 50% 50%, #3d3036 0%, #1a1118 100%);
}

/* === Shake Animation === */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* === Responsive === */
@media (max-width: 600px) {
    #nav-dots {
        right: 12px;
    }
    .allotrope-glyphs {
        gap: 1rem;
    }
    .allotrope-glyphs svg {
        width: 40px;
        height: 40px;
    }
}
