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

html {
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    background: #1a0a0f;
    color: #f0e6d6;
    font-family: 'Instrument Serif', serif;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.85;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    min-height: 100vh;
    /* palette refs: #2d0f1a #4a1a2a #b87350 */
}

/* === Honeycomb Background === */
.honeycomb {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    overflow: hidden;
}

#honeycomb-svg {
    width: 100%;
    height: 100%;
}

#honeycomb-svg polygon {
    transition: none;
}

#honeycomb-svg polygon.settle {
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

/* === Candle Glow === */
.candle-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: radial-gradient(ellipse 600px 900px at 65% 30%, rgba(232, 168, 56, 0.08), transparent);
    z-index: 2;
    pointer-events: none;
}

/* === Content Layer === */
.content {
    position: relative;
    z-index: 3;
    min-height: 500vh;
}

/* === Hero Section === */
.hero-section {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.wordmark {
    display: flex;
    gap: clamp(0.5rem, 2vw, 2rem);
    align-items: center;
    justify-content: center;
}

.letter {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(4rem, 12vw, 10rem);
    font-weight: 700;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: #f0e6d6;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: clamp(4rem, 10vw, 8rem);
    height: clamp(4.6rem, 11.5vw, 9.2rem);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: rgba(74, 26, 42, 0.4);
    position: relative;
    text-indent: -0.15em;
}

.letter::after {
    content: '';
    position: absolute;
    inset: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 1px solid rgba(232, 168, 56, 0.3);
    pointer-events: none;
}

.subtitle {
    margin-top: 2rem;
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: #c9a8a0;
    letter-spacing: 0.1em;
    opacity: 0.8;
}

/* === Phase Text (Aphorisms) === */
.phase-text {
    height: 60vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 4rem 2rem;
}

.aphorism {
    font-family: 'Instrument Serif', serif;
    font-style: italic;
    font-size: clamp(1.1rem, 2vw, 1.6rem);
    color: #c9a8a0;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.8s ease, transform 0.8s ease;
    text-align: center;
}

.aphorism.visible {
    opacity: 0.9;
    transform: translateY(0);
}

/* === Narrative Sections === */
.narrative-section {
    padding: 8vh 0;
    display: flex;
    justify-content: center;
}

.section-hex-container {
    max-width: 680px;
    padding: 4rem 3rem;
    clip-path: polygon(50% 0%, 100% 4%, 100% 96%, 50% 100%, 0% 96%, 0% 4%);
    background: rgba(45, 15, 26, 0.6);
    transition: clip-path 1.2s cubic-bezier(0.23, 1, 0.32, 1), background 0.8s ease;
    position: relative;
    opacity: 0;
    transform: translateY(40px);
    transition: clip-path 1.2s cubic-bezier(0.23, 1, 0.32, 1),
                background 0.8s ease,
                opacity 0.8s ease,
                transform 0.8s ease;
}

.section-hex-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.section-hex-container.morphed {
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%, 0% 100%, 0% 0%);
    border-radius: 4px;
    background: rgba(45, 15, 26, 0.45);
}

.section-heading {
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #e8a838;
    margin-bottom: 0.25rem;
}

.section-subhead {
    margin-bottom: 2rem;
}

.mono-accent {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: #c9a8a0;
    opacity: 0.6;
}

.narrative-text {
    color: #f0e6d6;
    margin-bottom: 1.5rem;
}

.narrative-text:last-child {
    margin-bottom: 0;
}

.narrative-text em {
    color: #c9a8a0;
}

/* === Wax Border === */
.wax-border {
    width: 100%;
    max-width: 600px;
    height: 20px;
    margin: 0 auto 3rem;
    position: relative;
}

.wax-border svg {
    width: 100%;
    height: 100%;
}

/* === Colophon === */
.colophon {
    padding: 6rem 2rem 4rem;
    text-align: center;
}

.timestamp {
    color: #c9a8a0;
    opacity: 0.4;
}

/* === Grain Overlay === */
.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    pointer-events: none;
    mix-blend-mode: overlay;
}

.grain svg {
    width: 100%;
    height: 100%;
}

/* === Glitch Effects === */
.glitch-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 8000;
    pointer-events: none;
}

.glitch-band {
    position: absolute;
    left: 0;
    width: 100vw;
    background: #ff2d6f;
    opacity: 0.5;
    mix-blend-mode: screen;
}

/* === Hex breathing animation === */
@keyframes hex-breathe {
    0%, 100% { fill-opacity: 0.4; }
    50% { fill-opacity: 0.8; }
}

/* === Responsive === */
@media (max-width: 768px) {
    .section-hex-container {
        padding: 3rem 1.5rem;
        margin: 0 1rem;
        clip-path: none;
        background: rgba(45, 15, 26, 0.5);
    }

    .letter {
        clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    }

    .narrative-section {
        padding: 4vh 0;
    }
}

/* Odd sections get offset left margin */
.narrative-section:nth-child(odd) .section-hex-container {
    margin-left: 5vw;
}

.narrative-section:nth-child(even) .section-hex-container {
    margin-right: 5vw;
}

@media (min-width: 1024px) {
    .narrative-section:nth-child(odd) .section-hex-container {
        margin-left: 15vw;
    }

    .narrative-section:nth-child(even) .section-hex-container {
        margin-right: 15vw;
    }
}
