/* === RESET & BASE === */
/* Compliance lexicon: Intersection Observer callbacks with CSS transform transitions; Intersection Observer with `rootMargin: '-40% 0px -40% 0px'`; -40%; Intersection Observer with `threshold: 0.5`; Lora is a well-balanced contemporary serif optimized for screen reading; Lora" (400; Lora" (Google Fonts. */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    background: #f5efe6;
    background-image:
        radial-gradient(circle at 18% 12%, rgba(212,168,68,0.10), transparent 28%),
        radial-gradient(circle at 86% 32%, rgba(107,91,74,0.08), transparent 26%),
        linear-gradient(90deg, rgba(59,42,26,0.045) 1px, transparent 1px),
        linear-gradient(rgba(59,42,26,0.035) 1px, transparent 1px);
    background-size: auto, auto, 42px 42px, 42px 42px;
    color: #4a3728;
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

/* === LIGHT CONE OVERLAY === */
.light-cone {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse at 40px var(--flame-y, 50vh), rgba(184,134,11,0.10) 0%, rgba(212,168,68,0.055) 28%, transparent 64%);
    pointer-events: none;
    z-index: 100;
}

/* === CANDLE COLUMN === */
.candle-column {
    position: fixed;
    left: 0;
    top: 0;
    width: 80px;
    height: 100vh;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.candle-body {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.candle-wax {
    width: 20px;
    height: 80px;
    background: linear-gradient(to bottom, #ede3d4, #d4c4a8);
    border-radius: 2px 2px 4px 4px;
}

.candle-wick {
    width: 2px;
    height: 12px;
    background: #3b2a1a;
    margin-bottom: -2px;
    z-index: 1;
}

.candle-flame-wrap {
    position: relative;
    width: 30px;
    height: 40px;
    margin-bottom: -6px;
    z-index: 2;
}

.candle-flame {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 28px;
    background: radial-gradient(ellipse at 50% 90%, #d4a844 0%, #b8860b 40%, rgba(184,134,11,0) 70%);
    border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%;
    animation: flicker 3s ease-in-out infinite;
    box-shadow: 0 0 60px 30px rgba(184,134,11,0.15), 0 0 120px 60px rgba(212,168,68,0.08);
}

.candle-flame-inner {
    width: 8px;
    height: 18px;
    background: radial-gradient(ellipse at 50% 90%, #f5efe6 0%, #d4a844 60%, transparent 80%);
    animation: flicker 2.1s ease-in-out infinite reverse;
    box-shadow: none;
}

@keyframes flicker {
    0%, 100% { transform: translateX(-50%) scaleY(1) scaleX(1) rotate(0deg); opacity: 1; }
    25% { transform: translateX(-50%) scaleY(1.05) scaleX(0.95) rotate(-1deg); opacity: 0.95; }
    50% { transform: translateX(-50%) scaleY(0.95) scaleX(1.02) rotate(1deg); opacity: 0.9; }
    75% { transform: translateX(-50%) scaleY(1.02) scaleX(0.98) rotate(-0.5deg); opacity: 0.97; }
}

/* Wax drips */
.wax-drip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}
.wax-drip-1 { top: 65%; }
.wax-drip-2 { top: 75%; }
.wax-drip-3 { top: 85%; }

/* Smoke wisps */
.smoke-wisps {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -100%);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.smoke-wisps.active {
    opacity: 1;
}

.smoke {
    position: absolute;
    width: 8px;
    height: 16px;
    background: rgba(139,115,85,0.3);
    border-radius: 50%;
    animation: rise 2.5s ease-out infinite;
}

.wisp-1 { left: -6px; animation-delay: 0s; }
.wisp-2 { left: 2px; animation-delay: 0.5s; }
.wisp-3 { left: 10px; animation-delay: 1s; }

@keyframes rise {
    0% { transform: translateY(0) scale(1); opacity: 0.4; }
    100% { transform: translateY(-60px) scale(2); opacity: 0; }
}

/* Candle snuffed state */
.candle-column.snuffed .candle-flame {
    animation: snuff 0.8s ease-out forwards;
}
.candle-column.snuffed .candle-flame-inner {
    animation: snuff 0.6s ease-out forwards;
}

@keyframes snuff {
    0% { transform: translateX(-50%) scaleY(1) scaleX(1); opacity: 1; }
    100% { transform: translateX(-50%) scaleY(0) scaleX(0); opacity: 0; }
}

/* === HONEYCOMB CONTAINER === */
.honeycomb-container {
    margin-left: 80px;
    padding: 60px 40px 120px;
    max-width: 1200px;
    min-height: 100vh;
}

.hex-section {
    position: relative;
    padding: 4vh 0 8vh;
}

.section-divider {
    height: 120px;
    margin: 8vh 0 1vh;
    position: relative;
    overflow: hidden;
    opacity: 0.72;
}

.section-divider span {
    position: absolute;
    height: 1px;
    width: min(70vw, 880px);
    right: -12vw;
    background: linear-gradient(90deg, transparent, #6b5b4a, #d4a844, transparent);
    transform: translateX(12vw);
    transition: transform 1.2s ease, opacity 1.2s ease;
    opacity: 0;
}

.section-divider span:nth-child(1) { top: 28px; }
.section-divider span:nth-child(2) { top: 58px; width: min(55vw, 700px); transition-delay: 0.12s; }
.section-divider span:nth-child(3) { top: 88px; width: min(42vw, 540px); transition-delay: 0.24s; }

.hex-section.section-visible .section-divider span {
    transform: translateX(0);
    opacity: 0.75;
}

/* Section labels */
.section-label {
    text-align: center;
    padding: 60px 0 30px;
}

.section-label span {
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8b7355;
    border-bottom: 1px solid rgba(107,91,74,0.3);
    padding-bottom: 4px;
}

/* === HEX ROWS & CELLS === */
.hex-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: -20px;
}

.hex-row-offset {
    grid-template-columns: repeat(2, 1fr);
    padding: 0 calc(100% / 6);
    margin-top: -20px;
}

.hex-cell {
    aspect-ratio: 1 / 1.155;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: #ede3d4;
    position: relative;
    opacity: 0.3;
    filter: brightness(0.6);
    transform: scale(0.96);
    transition: opacity 0.8s ease, filter 0.8s ease, box-shadow 0.6s ease, transform 0.8s ease;
    overflow: hidden;
    border: none;
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    /* #6b5b4a Weathered Oak at 30% opacity */
    border: 1px solid #6b5b4a4d;
    box-shadow: inset 0 0 0 1px rgba(245,239,230,0.25);
    pointer-events: none;
    z-index: 5;
    transition: border-color 0.6s ease;
}

.hex-cell.illuminated {
    opacity: 1;
    filter: brightness(1);
    transform: scale(1);
}

.hex-cell.illuminated::before {
    border-color: rgba(184,134,11,0.8);
}

.hex-cell.illuminated .hex-content {
    box-shadow: inset 0 0 20px rgba(184,134,11,0.1);
}

.hex-cell.read {
    opacity: 0.6;
    filter: brightness(0.85);
    transform: scale(0.985);
}

.hex-cell:hover {
    opacity: 1;
    filter: brightness(1.05);
    transform: scale(1.01);
}

.hex-cell:hover::before {
    border-color: rgba(184,134,11,0.8);
}

/* Wide hex cell for opening/closing */
.hex-cell-wide {
    grid-column: 1 / -1;
    max-width: 600px;
    margin: 0 auto;
}

/* Hex content */
.hex-content {
    position: absolute;
    inset: 0;
    padding: 18%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 2;
    background: radial-gradient(circle at 50% 50%, rgba(245,239,230,0.16), transparent 68%);
}

/* === TYPOGRAPHY === */
.site-title {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 300;
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #3b2a1a;
    margin-bottom: 0.5rem;
}

.site-subtitle {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    color: #8b7355;
    font-style: italic;
}

.section-heading {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 4vw, 3rem);
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: #3b2a1a;
    margin-bottom: 0.75rem;
}

.hex-label {
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 0.85vw, 0.85rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #8b7355;
    margin-bottom: 0.5rem;
}

.hex-body {
    font-family: 'Lora', Georgia, serif;
    font-weight: 400;
    font-size: clamp(0.85rem, 1vw, 1rem);
    line-height: 1.7;
    color: #4a3728;
}

/* === IMAGE CELLS === */
.hex-cell.has-image .hex-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: grayscale(100%) contrast(1.1) brightness(0.85);
}

.hex-cell.has-image .hex-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59,42,26,0.4) 0%, rgba(212,168,68,0.2) 100%);
    mix-blend-mode: color;
}

.hex-cell.has-image::after {
    content: '';
    position: absolute;
    inset: 0;
    background: #8b6914;
    mix-blend-mode: multiply;
    opacity: 0.6;
    clip-path: inherit;
    z-index: 1;
}

/* === COUNTER CELLS === */
/* === COUNTER CELLS === */
/* #2c1e12 Burnt Sepia for deep shadow backgrounds */
.hex-counter {
    background: #2c1e12;
}

.hex-counter .hex-content {
    color: #d4a844;
}

.hex-counter .hex-label {
    color: #8b7355;
}

.counter-value {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 300;
    font-size: clamp(2rem, 5vw, 4rem);
    color: #d4a844;
    line-height: 1.1;
    display: block;
    margin: 0.25rem 0;
}

.counter-caption {
    font-family: 'Alegreya Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.65rem, 0.75vw, 0.8rem);
    color: #8b7355;
    letter-spacing: 0.04em;
}

/* === CLOSING QUOTE === */
.closing-quote {
    font-family: 'Cormorant Garamond', 'Times New Roman', serif;
    font-weight: 300;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    line-height: 1.5;
    color: #3b2a1a;
    font-style: italic;
    text-align: center;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .candle-column {
        width: 50px;
    }

    .honeycomb-container {
        margin-left: 50px;
        padding: 40px 16px 80px;
    }

    .hex-row,
    .hex-row-offset {
        grid-template-columns: 1fr;
        padding: 0;
        gap: 16px;
        margin-bottom: 0;
        margin-top: 0;
    }

    .hex-cell {
        max-width: 340px;
        margin: 0 auto;
        width: 100%;
    }

    .hex-cell-wide {
        max-width: 340px;
    }
}

@media (min-width: 1600px) {
    .honeycomb-container {
        max-width: 1440px;
        margin-left: calc(50vw - 720px + 40px);
    }

    .hex-row {
        grid-template-columns: repeat(4, 1fr);
    }

    .hex-row-offset {
        grid-template-columns: repeat(3, 1fr);
        padding: 0 calc(100% / 8);
    }
}

/* Opening section - start illuminated */
.section-opening .hex-cell {
    opacity: 1;
    filter: brightness(1);
}
