/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #0b1120;
    color: #a3b1c6;
    font-family: 'Nunito Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.15vw, 1.2rem);
    line-height: 1.75;
    letter-spacing: 0.005em;
    overflow-x: hidden;
}

/* === TYPOGRAPHY === */
h1, h2, h3 {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    color: #c0cdde;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

h2 {
    font-size: clamp(2.4rem, 5vw, 4.8rem);
    margin-bottom: 1.5rem;
    position: relative;
    display: inline-block;
}

h2::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #47c8ff;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 0 8px rgba(71, 200, 255, 0);
}

h2.animate-underline::after {
    transform: scaleX(1);
    box-shadow: 0 0 8px rgba(71, 200, 255, 0.4);
}

h3 {
    font-size: clamp(1.4rem, 2.5vw, 2rem);
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

h3::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #47c8ff;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 0 8px rgba(71, 200, 255, 0);
}

h3.animate-underline::after {
    transform: scaleX(1);
    box-shadow: 0 0 8px rgba(71, 200, 255, 0.4);
}

/* === NEON UTILITIES === */
.neon-text {
    color: #47c8ff;
    text-shadow:
        0 0 7px rgba(71, 200, 255, 0.6),
        0 0 20px rgba(71, 200, 255, 0.3),
        0 0 42px rgba(71, 200, 255, 0.15);
}

.neon-border {
    border: 1px solid rgba(71, 200, 255, 0.4);
    box-shadow:
        0 0 8px rgba(71, 200, 255, 0.15),
        inset 0 0 8px rgba(71, 200, 255, 0.05);
}

/* === OPENING CEREMONY === */
.ceremony {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #0b1120;
}

.candle-flame {
    width: 20px;
    height: 32px;
    background: #ffb347;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    opacity: 0;
    animation: flicker 1.5s ease-in-out infinite alternate;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 20px rgba(255, 179, 71, 0.5), 0 0 60px rgba(255, 179, 71, 0.2);
}

.candle-flame.visible {
    opacity: 1;
}

@keyframes flicker {
    0% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.95) translateY(1px); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.05) translateY(-1px); }
    100% { opacity: 0.8; transform: translate(-50%, -50%) scale(1) translateY(0); }
}

.ceremony::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(255, 179, 71, 0.08) 0%, transparent 70%);
    transition: width 1.5s ease-out, height 1.5s ease-out;
}

.ceremony.glow-active::before {
    width: 600px;
    height: 600px;
}

.ceremony-content {
    text-align: center;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    position: relative;
    z-index: 2;
}

.ceremony-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.ceremony-title {
    font-size: clamp(3rem, 7vw, 6rem);
    color: #c0cdde;
    margin-bottom: 0.5rem;
    position: relative;
    display: inline-block;
}

.ceremony-title::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 0;
    width: 100%;
    height: 3px;
    background: #47c8ff;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 0 0 12px rgba(71, 200, 255, 0.5);
}

.ceremony-title.draw-underline::after {
    transform: scaleX(1);
}

.ceremony-subtitle {
    font-family: 'Varela Round', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b7d94;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.ceremony-subtitle.visible {
    opacity: 1;
}

.scroll-indicator {
    position: absolute;
    bottom: 3rem;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.scroll-indicator.visible {
    opacity: 1;
}

.chevron {
    color: #8a9bb0;
    font-size: 1.5rem;
    animation: pulse-down 2s ease-in-out infinite;
}

@keyframes pulse-down {
    0%, 100% { transform: translateY(0); opacity: 0.5; }
    50% { transform: translateY(6px); opacity: 1; }
}

/* === EDITORIAL GRID === */
.editorial-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: clamp(2rem, 4vw, 4rem);
}

/* Block base styles */
.block {
    background: #141e30;
    padding: clamp(2rem, 4vw, 4rem);
    border-radius: 4px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.block.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Row 1 */
.sidebar-stats {
    grid-column: 1 / 4;
    background: #1c2940;
}

.feature-block {
    grid-column: 4 / 9;
}

.pull-quote {
    grid-column: 9 / 13;
    border-left: 4px solid #8a9bb0;
    background: #1c2940;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* Row 2 */
.candle-motif {
    grid-column: 1 / 6;
    position: relative;
    min-height: 250px;
    background: linear-gradient(135deg, #1c2940 0%, #0b1120 40%, #1c2940 60%, #141e30 100%);
    overflow: hidden;
}

.secondary-feature {
    grid-column: 6 / 13;
}

/* Divider */
.metallic-divider {
    grid-column: 1 / -1;
    height: 2px;
    background: linear-gradient(90deg, transparent, #8a9bb0, #c0cdde, #8a9bb0, transparent);
    border: none;
    opacity: 0;
    transition: opacity 0.7s ease-out;
}

.metallic-divider.visible {
    opacity: 1;
}

/* Row 3 */
.equal-col {
    grid-column: span 4;
}

.col-a { grid-column: 1 / 5; }
.col-b { grid-column: 5 / 9; }
.col-c { grid-column: 9 / 13; }

/* === BLOCK SPECIFIC STYLES === */
.block-label {
    font-family: 'Varela Round', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b7d94;
    display: block;
    margin-bottom: 1.5rem;
}

.stat {
    margin-bottom: 1.2rem;
}

.stat-value {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 2.4rem;
    color: #e8edf4;
    display: block;
    line-height: 1.2;
}

.stat-label {
    font-family: 'Varela Round', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b7d94;
}

/* Feature block drop cap */
.feature-block p:first-of-type::first-letter {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 4.5em;
    float: left;
    line-height: 0.85;
    margin-right: 0.08em;
    color: #47c8ff;
    text-shadow:
        0 0 7px rgba(71, 200, 255, 0.6),
        0 0 20px rgba(71, 200, 255, 0.3);
}

.feature-block p {
    margin-bottom: 1.2rem;
    color: #a3b1c6;
}

.secondary-feature p {
    margin-bottom: 1.2rem;
}

/* Pull quote */
.pull-quote p {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    color: #d4dce8;
    line-height: 1.4;
    margin-bottom: 1rem;
}

.pull-quote cite {
    font-family: 'Varela Round', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b7d94;
    font-style: normal;
}

/* Pull quote border animation */
.pull-quote {
    border-left-color: transparent;
    position: relative;
}

.pull-quote::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 4px;
    height: 0;
    background: linear-gradient(180deg, #8a9bb0 0%, #c0cdde 50%, #8a9bb0 100%);
    transition: height 0.5s ease-out;
}

.pull-quote.visible::before {
    height: 100%;
}

/* Candle motif decorative elements */
.candle-glow-pool {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(255, 179, 71, 0.08) 0%, transparent 70%);
}

.candle-decorative {
    position: absolute;
    width: 14px;
    height: 22px;
    background: #ffb347;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    animation: flicker 1.7s ease-in-out infinite alternate;
    box-shadow: 0 0 12px rgba(255, 179, 71, 0.4);
    top: 40%;
    left: 30%;
}

.candle-decorative.second {
    top: 55%;
    left: 55%;
    width: 10px;
    height: 16px;
    animation-duration: 2.3s;
}

.candle-decorative.third {
    top: 35%;
    left: 70%;
    width: 12px;
    height: 18px;
    animation-duration: 1.2s;
}

/* Equal columns */
.equal-col p {
    color: #a3b1c6;
}

/* === CLOSING CEREMONY === */
.closing-ceremony {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #0b1120;
    position: relative;
    text-align: center;
    padding: 2rem;
}

.closing-title {
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: #e8edf4;
    margin-bottom: 3rem;
    position: relative;
    display: inline-block;
}

.closing-title::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 2px;
    background: #47c8ff;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.closing-title.animate-underline::after {
    transform: scaleX(1);
}

.dice-container {
    width: 120px;
    height: 120px;
    cursor: pointer;
    margin-bottom: 2rem;
    perspective: 600px;
}

.dice-face {
    width: 100%;
    height: 100%;
    background: #141e30;
    border-radius: 12%;
    border: 2px solid #8a9bb0;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    padding: 18px;
    transition: transform 0.3s ease;
    box-shadow: 0 0 15px rgba(71, 200, 255, 0.1);
}

.dice-face.rolling {
    animation: dice-roll 0.3s ease;
}

@keyframes dice-roll {
    0% { transform: rotateX(0) rotateY(0); }
    50% { transform: rotateX(180deg) rotateY(90deg); }
    100% { transform: rotateX(360deg) rotateY(180deg); }
}

.dice-dot {
    width: 16px;
    height: 16px;
    background: #47c8ff;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(71, 200, 255, 0.6);
    align-self: center;
    justify-self: center;
}

.dice-result.critical {
    color: #ff4757;
    text-shadow: 0 0 7px rgba(255, 71, 87, 0.6), 0 0 20px rgba(255, 71, 87, 0.3);
}

.dice-result {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 3rem;
    color: #47c8ff;
    text-shadow:
        0 0 7px rgba(71, 200, 255, 0.6),
        0 0 20px rgba(71, 200, 255, 0.3);
    min-height: 4rem;
}

.closing-signoff {
    font-family: 'Varela Round', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b7d94;
    margin-top: 3rem;
}

/* Background pulse on roll */
.closing-ceremony.pulse::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(ellipse at center, rgba(255, 179, 71, 0.1) 0%, transparent 70%);
    animation: pulse-bg 0.8s ease-out forwards;
    pointer-events: none;
}

@keyframes pulse-bg {
    0% { opacity: 1; transform: translate(-50%, -50%) scale(0.5); }
    100% { opacity: 0; transform: translate(-50%, -50%) scale(1.5); }
}

/* === AMBIENT CANDLES === */
.ambient-flame {
    position: fixed;
    width: 10px;
    height: 16px;
    background: #ffb347;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    opacity: 0.5;
    z-index: 1;
    pointer-events: none;
    box-shadow: 0 0 10px rgba(255, 179, 71, 0.3);
    animation: flicker var(--flicker-speed, 1.5s) ease-in-out infinite alternate;
}

/* === MOBILE === */
@media (max-width: 768px) {
    .editorial-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-stats,
    .feature-block,
    .pull-quote,
    .candle-motif,
    .secondary-feature,
    .col-a, .col-b, .col-c {
        grid-column: 1 / -1;
    }

    .pull-quote {
        border-left: none;
        border-top: 4px solid #8a9bb0;
        padding-top: 2rem;
    }

    .pull-quote::before {
        display: none;
    }
}

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }

    .block, .ceremony-content, .ceremony-subtitle, .scroll-indicator, .metallic-divider {
        opacity: 1 !important;
        transform: none !important;
    }

    .candle-flame { opacity: 1 !important; }
    h2::after, h3::after, .ceremony-title::after, .closing-title::after {
        transform: scaleX(1) !important;
    }
    .pull-quote::before { height: 100% !important; }
}
