:root {
    --oxblood: #2E0A0F;
    --burgundy: #6B1D2A;
    --rose: #9E3545;
    --amber: #D4943A;
    --cream: #F2E4D0;
    --mauve: #8B6B7A;
    --plum: #4A1A2E;
    --flare-pink: #E8758A;
    --cell-size: clamp(140px, 16vw, 280px);
    color-scheme: dark;
}

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

body {
    background: radial-gradient(ellipse at 30% 40%, #2E0A0F 0%, #4A1A2E 70%, #2E0A0F 100%);
    background-attachment: fixed;
    color: var(--cream);
    font-family: 'Source Serif 4', serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw + 0.5rem, 1.25rem);
    line-height: 1.72;
    overflow: hidden;
    height: 100vh;
}

/* Honeycomb World */
.honeycomb-world {
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Cultural pattern bg */
.honeycomb-world::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='52'%3E%3Cpath d='M15 0L30 0L45 8.66L45 26L30 34.64L15 34.64L0 26L0 8.66Z' fill='none' stroke='%239E3545' stroke-width='0.5'/%3E%3Cpath d='M45 17.32L60 17.32L75 25.98L75 43.3L60 51.96L45 51.96L30 43.3L30 25.98Z' fill='none' stroke='%239E3545' stroke-width='0.5'/%3E%3C/svg%3E");
    background-size: 60px 52px;
    animation: patternDrift 300s linear infinite;
    pointer-events: none;
}

@keyframes patternDrift {
    from { background-position: 0 0; }
    to { background-position: 100px 57.7px; }
}

/* Lens Flares */
.lens-flare {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 5;
    mix-blend-mode: screen;
    animation: flareBreathe 6s ease-in-out infinite;
}

.flare-1 {
    width: 100px;
    height: 100px;
    top: 20%;
    left: 25%;
    background: radial-gradient(circle, #E8758A 0%, #D4943A 40%, transparent 70%);
    animation-delay: 0s;
}

.flare-2 {
    width: 80px;
    height: 80px;
    top: 60%;
    right: 20%;
    background: radial-gradient(circle, #E8758A 0%, #D4943A 40%, transparent 70%);
    animation-delay: -2s;
}

.flare-3 {
    width: 120px;
    height: 120px;
    bottom: 25%;
    left: 45%;
    background: radial-gradient(circle, #E8758A 0%, #D4943A 40%, transparent 70%);
    animation-delay: -4s;
}

.flare-1::after, .flare-2::after, .flare-3::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 300%;
    height: 300%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(158, 53, 69, 0.15) 0%, transparent 70%);
}

@keyframes flareBreathe {
    0%, 100% { opacity: 0.6; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}

/* Hex Grid */
.hex-grid {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

.hex-row {
    display: flex;
    gap: 4px;
}

.hex-row-offset {
    margin-top: -20px;
}

/* Hex Cell */
.hex-cell {
    width: var(--cell-size);
    height: calc(var(--cell-size) * 0.866);
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: default;
    overflow: hidden;
}

.hex-cell::after {
    content: '';
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 8px rgba(155, 53, 69, 0.3);
    clip-path: inherit;
    pointer-events: none;
    transition: box-shadow 0.4s ease;
}

.hex-cell:hover::after {
    box-shadow: inset 0 0 12px rgba(155, 53, 69, 0.6);
}

/* Depth Layers */
.depth-fg {
    background: linear-gradient(120deg, var(--burgundy), var(--plum));
    transform: scale(1);
    z-index: 3;
}

.depth-mid {
    background: linear-gradient(120deg, var(--plum), var(--oxblood));
    transform: scale(0.92);
    z-index: 2;
    opacity: 0.85;
}

.depth-bg {
    background: var(--oxblood);
    transform: scale(0.84);
    z-index: 1;
    opacity: 0.6;
}

/* Cell Content */
.cell-content {
    text-align: center;
    z-index: 2;
    position: relative;
}

.site-title {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(2.4rem, 7vw, 5rem);
    letter-spacing: 0.08em;
    color: var(--cream);
    line-height: 1;
}

.cell-label {
    font-family: 'Zilla Slab', serif;
    font-weight: 500;
    font-size: 0.85rem;
    letter-spacing: 0.12em;
    color: var(--cream);
    opacity: 0.8;
}

/* Nav Cells */
.nav-cell {
    background: linear-gradient(120deg, var(--burgundy), var(--plum));
    cursor: pointer;
    z-index: 3;
    animation: navPulse 4s ease-in-out infinite;
}

.nav-cell:hover {
    transform: scale(1.08);
}

@keyframes navPulse {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(0.5deg); }
    75% { transform: rotate(-0.5deg); }
}

/* Cell Patterns */
.cell-pattern {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.pattern-islamic {
    opacity: 0.06;
    background:
        radial-gradient(circle 8px at 33% 33%, var(--mauve) 0%, transparent 100%),
        radial-gradient(circle 8px at 66% 66%, var(--mauve) 0%, transparent 100%);
}

.pattern-tortoise {
    opacity: 0.04;
    background: repeating-conic-gradient(from 0deg, transparent 0deg, transparent 55deg, var(--rose) 55deg, var(--rose) 60deg);
}

/* Flare Cells */
.flare-cell {
    position: relative;
}

.mini-flare {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--flare-pink) 0%, var(--amber) 40%, transparent 70%);
    mix-blend-mode: screen;
    animation: flareBreathe 6s ease-in-out infinite -1s;
}

/* Expand Panels */
.expand-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: min(600px, 90vw);
    max-height: 80vh;
    background: rgba(46, 10, 15, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(158, 53, 69, 0.3);
    border-radius: 16px;
    padding: 48px 40px;
    z-index: 100;
    opacity: 0;
    transition: transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    overflow-y: auto;
}

.expand-panel.active {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.panel-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: var(--rose);
    font-size: 1.8rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.panel-close:hover {
    opacity: 1;
}

.panel-heading {
    font-family: 'Zilla Slab', serif;
    font-weight: 700;
    font-size: clamp(2rem, 5vw, 3rem);
    letter-spacing: 0.08em;
    color: var(--cream);
    margin-bottom: 24px;
}

.panel-text {
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    color: var(--cream);
    margin-bottom: 1.5rem;
    line-height: 1.72;
}

.panel-whisper {
    font-family: 'Newsreader', serif;
    font-style: italic;
    font-size: 1.4rem;
    letter-spacing: 0.03em;
    color: var(--cream);
    opacity: 0.75;
    line-height: 1.8;
    text-align: center;
}

/* Overlay dimmer */
.overlay-dim {
    position: fixed;
    inset: 0;
    background: rgba(46, 10, 15, 0.6);
    z-index: 90;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay-dim.active {
    opacity: 1;
    pointer-events: auto;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
        height: auto;
    }

    .honeycomb-world {
        height: auto;
        min-height: 100vh;
        padding: 40px 0;
    }

    .hex-grid {
        flex-direction: column;
    }

    .hex-row {
        flex-wrap: wrap;
        justify-content: center;
    }

    .hex-row-offset {
        margin-top: -10px;
    }

    .hex-cell {
        --cell-size: clamp(100px, 28vw, 160px);
    }

    .site-title {
        font-size: clamp(1.6rem, 5vw, 2.5rem);
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .lens-flare {
        animation: none;
        opacity: 0.7;
    }

    .nav-cell {
        animation: none;
    }

    .mini-flare {
        animation: none;
    }

    .honeycomb-world::before {
        animation: none;
    }

    .expand-panel {
        transition: opacity 0.3s ease;
    }

    .expand-panel.active {
        transform: translate(-50%, -50%) scale(1);
    }

    .hex-cell {
        transition: none;
    }
}
