/* ============================================================
   yongzoon.net - Crystalline Honeycomb Design
   Mid-century atomic-age meets crystal geode
   ============================================================ */

/* --- CSS Custom Properties --- */
:root {
    --burgundy-velvet: #5B0E2D;
    --oxblood-shadow: #3A0A1E;
    --burnished-copper: #C77B4A;
    --crystal-frost: #A8D5E2;
    --champagne-haze: #F2E8DC;
    --carbon-espresso: #1C1014;
    --rose-gold-flash: #E8B4B8;

    --hex-primary: 380px;
    --hex-secondary: 260px;
    --hex-tertiary: 180px;

    --font-headline: 'Space Mono', monospace;
    --font-body: 'IBM Plex Mono', monospace;
    --font-accent: 'Overpass Mono', monospace;

    --spring-ease: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --smooth-ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--carbon-espresso);
    color: var(--champagne-haze);
    font-family: var(--font-body);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.7;
    font-size: clamp(0.85rem, 1.2vw, 1.05rem);
}

/* --- Particle Canvas --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
}

/* --- Fracture Lines SVG Overlay --- */
#fracture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 500;
}

.fracture-line {
    stroke: var(--crystal-frost);
    stroke-width: 0.5;
    opacity: 0.3;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: opacity 0.3s ease;
}

.fracture-line.active {
    opacity: 1;
    filter: drop-shadow(0 0 4px var(--crystal-frost));
}

.fracture-line.revealed {
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.4s ease;
}

/* --- Hexagonal Clip Path --- */
.hex-clip {
    clip-path: polygon(25% 0%, 75% 0%, 100% 50%, 75% 100%, 25% 100%, 0% 50%);
}

/* --- Hero Cell --- */
#hero-cell {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 85vmin;
    height: 85vmin;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--burgundy-velvet);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.8s var(--spring-ease);
    overflow: hidden;
}

#hero-cell .hex-gradient-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(ellipse at 20% 30%, var(--burgundy-velvet) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, var(--burnished-copper) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 70%, var(--oxblood-shadow) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 80%, var(--rose-gold-flash) 0%, transparent 35%),
        radial-gradient(ellipse at 50% 50%, var(--burgundy-velvet) 0%, transparent 70%),
        radial-gradient(ellipse at 10% 60%, var(--crystal-frost) 0%, transparent 25%),
        radial-gradient(ellipse at 90% 50%, var(--burnished-copper) 0%, transparent 30%),
        radial-gradient(ellipse at 70% 30%, var(--oxblood-shadow) 0%, transparent 45%),
        radial-gradient(circle at 40% 40%, var(--rose-gold-flash) 0%, transparent 20%),
        radial-gradient(circle at 85% 80%, var(--crystal-frost) 0%, transparent 15%),
        radial-gradient(ellipse at 50% 10%, var(--burnished-copper) 0%, transparent 30%),
        radial-gradient(ellipse at 15% 90%, var(--burgundy-velvet) 0%, transparent 40%);
    animation: meshDrift 20s ease-in-out infinite alternate;
    opacity: 0.85;
}

#hero-cell .hex-content {
    position: relative;
    z-index: 10;
    text-align: center;
}

.hero-title {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 5rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--champagne-haze);
    text-shadow: 0 0 40px rgba(200, 123, 74, 0.4), 0 2px 10px rgba(0,0,0,0.5);
    line-height: 1.1;
}

.title-dot {
    color: var(--burnished-copper);
}

.hero-subtitle {
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: clamp(0.65rem, 1.2vw, 0.75rem);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--crystal-frost);
    margin-top: 1rem;
    opacity: 0.8;
}

#hero-cell.fractured {
    animation: heroFracture 0.8s var(--spring-ease) forwards;
}

@keyframes heroFracture {
    0% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        opacity: 0.8;
    }
    100% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
}

/* --- Honeycomb Grid --- */
#honeycomb-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    opacity: 1;
    transition: opacity 0.5s ease;
}

#honeycomb-grid.honeycomb-hidden {
    opacity: 0;
    pointer-events: none;
}

/* --- Hex Cell Base --- */
.hex-cell {
    position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--burgundy-velvet);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.6s var(--spring-ease), box-shadow 0.3s ease, z-index 0s;
    overflow: hidden;
}

.hex-cell::before {
    content: '';
    position: absolute;
    inset: 2px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    pointer-events: none;
    z-index: 5;
}

.hex-cell.proximity::before {
    border-color: var(--burnished-copper);
}

.hex-cell.hovered {
    transform: scale(1.03);
    z-index: 200;
}

.hex-cell.hovered::before {
    border-color: var(--burnished-copper);
}

.hex-cell.hovered::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--crystal-frost);
    opacity: 0.15;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    pointer-events: none;
    z-index: 4;
}

/* --- Cell Sizes and Positions --- */
.hex-primary {
    width: var(--hex-primary);
    height: calc(var(--hex-primary) * 1.1547);
}

.hex-secondary {
    width: var(--hex-secondary);
    height: calc(var(--hex-secondary) * 1.1547);
}

.hex-tertiary {
    width: var(--hex-tertiary);
    height: calc(var(--hex-tertiary) * 1.1547);
}

/* Primary cell positions */
#cell-about {
    top: 5%;
    left: 15%;
}

#cell-works {
    top: 8%;
    left: 52%;
}

#cell-explore {
    top: 48%;
    left: 35%;
}

/* Secondary cell positions */
#cell-s1 {
    top: 3%;
    left: 38%;
}

#cell-s2 {
    top: 42%;
    left: 12%;
}

#cell-s3 {
    top: 22%;
    left: 72%;
}

#cell-s4 {
    top: 50%;
    left: 65%;
}

#cell-contact {
    top: 65%;
    left: 18%;
}

#cell-s5 {
    top: 68%;
    left: 52%;
}

/* Tertiary cell positions */
#cell-t1 { top: 2%; left: 5%; }
#cell-t2 { top: 15%; left: 88%; }
#cell-t3 { top: 35%; left: 2%; }
#cell-t4 { top: 78%; left: 8%; }
#cell-t5 { top: 82%; left: 40%; }
#cell-t6 { top: 75%; left: 75%; }
#cell-t7 { top: 55%; left: 88%; }
#cell-t8 { top: 30%; left: 55%; }

/* Hex void spaces */
.hex-void {
    position: absolute;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: transparent;
    border: 0.5px solid rgba(168, 213, 226, 0.08);
    pointer-events: none;
}

#void-1 {
    width: 200px;
    height: 231px;
    top: 38%;
    left: 88%;
}

#void-2 {
    width: 150px;
    height: 173px;
    top: 85%;
    left: 62%;
}

#void-3 {
    width: 120px;
    height: 139px;
    top: 90%;
    left: 88%;
}

/* --- Gradient Meshes --- */
.hex-gradient-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.7;
    animation: meshDrift 20s ease-in-out infinite alternate;
}

#cell-about .hex-gradient-mesh {
    background:
        radial-gradient(ellipse at 30% 40%, var(--burgundy-velvet) 0%, transparent 60%),
        radial-gradient(ellipse at 70% 20%, var(--burnished-copper) 0%, transparent 45%),
        radial-gradient(ellipse at 50% 80%, var(--oxblood-shadow) 0%, transparent 50%),
        radial-gradient(circle at 20% 70%, var(--rose-gold-flash) 0%, transparent 30%),
        radial-gradient(ellipse at 80% 60%, var(--crystal-frost) 0%, transparent 20%),
        radial-gradient(ellipse at 10% 10%, var(--burnished-copper) 0%, transparent 35%),
        radial-gradient(circle at 60% 50%, var(--burgundy-velvet) 0%, transparent 40%),
        radial-gradient(ellipse at 90% 90%, var(--oxblood-shadow) 0%, transparent 50%);
    animation-delay: -3s;
}

#cell-works .hex-gradient-mesh {
    background:
        radial-gradient(ellipse at 60% 30%, var(--burnished-copper) 0%, transparent 50%),
        radial-gradient(ellipse at 20% 60%, var(--burgundy-velvet) 0%, transparent 55%),
        radial-gradient(circle at 80% 70%, var(--rose-gold-flash) 0%, transparent 35%),
        radial-gradient(ellipse at 40% 90%, var(--oxblood-shadow) 0%, transparent 45%),
        radial-gradient(ellipse at 10% 20%, var(--crystal-frost) 0%, transparent 25%),
        radial-gradient(circle at 70% 10%, var(--burgundy-velvet) 0%, transparent 40%),
        radial-gradient(ellipse at 50% 50%, var(--burnished-copper) 0%, transparent 30%),
        radial-gradient(ellipse at 90% 40%, var(--oxblood-shadow) 0%, transparent 50%);
    animation-delay: -7s;
}

#cell-explore .hex-gradient-mesh {
    background:
        radial-gradient(ellipse at 40% 50%, var(--oxblood-shadow) 0%, transparent 55%),
        radial-gradient(ellipse at 80% 30%, var(--burnished-copper) 0%, transparent 40%),
        radial-gradient(circle at 20% 20%, var(--crystal-frost) 0%, transparent 30%),
        radial-gradient(ellipse at 60% 80%, var(--burgundy-velvet) 0%, transparent 50%),
        radial-gradient(ellipse at 10% 70%, var(--rose-gold-flash) 0%, transparent 25%),
        radial-gradient(circle at 90% 60%, var(--burnished-copper) 0%, transparent 35%),
        radial-gradient(ellipse at 50% 10%, var(--oxblood-shadow) 0%, transparent 45%),
        radial-gradient(ellipse at 30% 90%, var(--burgundy-velvet) 0%, transparent 40%);
    animation-delay: -12s;
}

/* Secondary cell meshes */
.hex-secondary .hex-gradient-mesh {
    background:
        radial-gradient(ellipse at 35% 45%, var(--burgundy-velvet) 0%, transparent 55%),
        radial-gradient(ellipse at 75% 25%, var(--burnished-copper) 0%, transparent 40%),
        radial-gradient(circle at 50% 75%, var(--oxblood-shadow) 0%, transparent 45%),
        radial-gradient(ellipse at 15% 60%, var(--rose-gold-flash) 0%, transparent 30%),
        radial-gradient(ellipse at 85% 80%, var(--crystal-frost) 0%, transparent 20%),
        radial-gradient(circle at 60% 15%, var(--burgundy-velvet) 0%, transparent 35%);
}

#cell-s2 .hex-gradient-mesh { animation-delay: -5s; }
#cell-s3 .hex-gradient-mesh { animation-delay: -9s; }
#cell-s4 .hex-gradient-mesh { animation-delay: -14s; }
#cell-contact .hex-gradient-mesh { animation-delay: -2s; }
#cell-s5 .hex-gradient-mesh { animation-delay: -17s; }

/* Tertiary cell meshes */
.hex-tertiary .hex-gradient-mesh {
    background:
        radial-gradient(ellipse at 50% 50%, var(--burgundy-velvet) 0%, transparent 60%),
        radial-gradient(ellipse at 20% 30%, var(--burnished-copper) 0%, transparent 40%),
        radial-gradient(circle at 80% 70%, var(--oxblood-shadow) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, var(--rose-gold-flash) 0%, transparent 25%);
}

#cell-t1 .hex-gradient-mesh { animation-delay: -1s; }
#cell-t2 .hex-gradient-mesh { animation-delay: -4s; }
#cell-t3 .hex-gradient-mesh { animation-delay: -8s; }
#cell-t4 .hex-gradient-mesh { animation-delay: -11s; }
#cell-t5 .hex-gradient-mesh { animation-delay: -15s; }
#cell-t6 .hex-gradient-mesh { animation-delay: -6s; }
#cell-t7 .hex-gradient-mesh { animation-delay: -13s; }
#cell-t8 .hex-gradient-mesh { animation-delay: -18s; }

@keyframes meshDrift {
    0% {
        background-position:
            0% 0%, 100% 0%, 50% 100%,
            0% 100%, 100% 50%, 50% 0%,
            25% 75%, 75% 25%;
    }
    25% {
        background-position:
            5% 3%, 95% 5%, 48% 97%,
            3% 97%, 97% 48%, 52% 3%,
            28% 72%, 72% 28%;
    }
    50% {
        background-position:
            3% 5%, 97% 3%, 52% 95%,
            5% 95%, 95% 52%, 48% 5%,
            22% 78%, 78% 22%;
    }
    75% {
        background-position:
            7% 2%, 93% 7%, 46% 98%,
            2% 93%, 98% 46%, 54% 7%,
            30% 70%, 70% 30%;
    }
    100% {
        background-position:
            2% 7%, 98% 2%, 54% 93%,
            7% 98%, 93% 54%, 46% 2%,
            20% 80%, 80% 20%;
    }
}

/* --- Hex Content --- */
.hex-content {
    position: relative;
    z-index: 10;
    text-align: center;
    padding: 15%;
    max-width: 100%;
}

.hex-cell h2 {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.8rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--champagne-haze);
    margin-bottom: 0.8rem;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.hex-cell h3 {
    font-family: var(--font-headline);
    font-weight: 700;
    font-size: clamp(1rem, 2vw, 1.4rem);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--burnished-copper);
    margin-bottom: 0.5rem;
}

.hex-cell p {
    font-family: var(--font-body);
    font-weight: 400;
    font-size: clamp(0.75rem, 1vw, 0.95rem);
    letter-spacing: 0.02em;
    line-height: 1.7;
    color: var(--champagne-haze);
    opacity: 0.85;
}

/* --- Navigation --- */
#hex-nav {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 300;
}

.nav-hex {
    width: 52px;
    height: 60px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--oxblood-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.4s var(--spring-ease), background 0.3s ease;
    position: relative;
}

.nav-hex:hover {
    transform: rotate(30deg) scale(1.1);
    background: var(--burgundy-velvet);
}

.nav-hex:hover .nav-label {
    opacity: 1;
    transform: translateX(0);
}

.nav-hex .nav-icon {
    width: 22px;
    height: 22px;
    color: var(--burnished-copper);
    transition: color 0.3s ease;
}

.nav-hex:hover .nav-icon {
    color: var(--crystal-frost);
}

.nav-label {
    position: absolute;
    left: 62px;
    top: 50%;
    transform: translateX(-10px) translateY(-50%);
    font-family: var(--font-accent);
    font-weight: 300;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--burnished-copper);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s var(--spring-ease);
    pointer-events: none;
}

/* --- Crystalline Growth Decorations --- */
.crystalline-growth {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.hex-cell.hovered .crystalline-growth {
    opacity: 1;
}

.crystalline-growth::before,
.crystalline-growth::after {
    content: '';
    position: absolute;
    border: 1px solid var(--burnished-copper);
    opacity: 0.6;
}

.crystalline-growth::before {
    top: 5%;
    left: 5%;
    width: 30px;
    height: 30px;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    transform: scale(0);
    transition: transform 0.6s var(--spring-ease);
}

.crystalline-growth::after {
    bottom: 5%;
    right: 5%;
    width: 25px;
    height: 25px;
    clip-path: polygon(50% 0%, 100% 38%, 82% 100%, 18% 100%, 0% 38%);
    transform: scale(0) rotate(36deg);
    transition: transform 0.6s var(--spring-ease) 0.1s;
}

.hex-cell.hovered .crystalline-growth::before {
    transform: scale(1);
}

.hex-cell.hovered .crystalline-growth::after {
    transform: scale(1) rotate(36deg);
}

/* --- Starburst Markers --- */
.starburst-marker {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    z-index: 15;
    pointer-events: none;
}

.starburst-marker::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    background: var(--burnished-copper);
    transform: translate(-50%, -50%);
    box-shadow:
        0 0 0 0 transparent,
        0 0 0 0 transparent;
}

.starburst-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 2px;
    background: var(--burnished-copper);
    transform: translate(-50%, -50%) rotate(60deg);
}

/* --- Boomerang Dividers --- */
.boomerang-divider {
    position: fixed;
    width: 200px;
    height: 40px;
    z-index: 250;
    opacity: 0.5;
    pointer-events: none;
}

#boomerang-1 {
    bottom: 12%;
    right: 8%;
    transform: rotate(-15deg);
}

#boomerang-2 {
    top: 8%;
    right: 25%;
    transform: rotate(10deg);
}

/* --- Googie Arrows --- */
.googie-arrow {
    position: fixed;
    width: 60px;
    height: 30px;
    z-index: 250;
    opacity: 0.4;
    pointer-events: none;
}

#arrow-1 {
    top: 45%;
    left: 82px;
    transform: rotate(90deg);
}

#arrow-2 {
    bottom: 20%;
    right: 5%;
    transform: rotate(-30deg);
}

/* --- Active/Expanded Cell --- */
.hex-cell.expanded {
    z-index: 999;
    transition: all 0.6s var(--spring-ease);
}

/* --- Prismatic Junction Effect --- */
.hex-cell::before {
    background: linear-gradient(
        135deg,
        transparent 0%,
        rgba(168, 213, 226, 0.1) 48%,
        rgba(232, 180, 184, 0.1) 50%,
        rgba(199, 123, 74, 0.1) 52%,
        transparent 100%
    );
}

/* --- Tertiary Cell Pulse --- */
.hex-tertiary {
    animation: tertiaryPulse 4s ease-in-out infinite;
}

#cell-t1 { animation-delay: 0s; }
#cell-t2 { animation-delay: 0.5s; }
#cell-t3 { animation-delay: 1s; }
#cell-t4 { animation-delay: 1.5s; }
#cell-t5 { animation-delay: 2s; }
#cell-t6 { animation-delay: 2.5s; }
#cell-t7 { animation-delay: 3s; }
#cell-t8 { animation-delay: 3.5s; }

@keyframes tertiaryPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 0.8; }
}

/* --- Cell Entry Animation --- */
.hex-cell.entering {
    animation: cellEnter 0.8s var(--spring-ease) forwards;
}

@keyframes cellEnter {
    0% {
        transform: scale(0) rotate(60deg);
        opacity: 0;
    }
    60% {
        transform: scale(1.08) rotate(-5deg);
        opacity: 0.9;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* --- Faceted Shadows --- */
.hex-primary::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 100%;
    height: 100%;
    clip-path: polygon(50% 2%, 98% 26%, 98% 74%, 50% 98%, 2% 74%, 2% 26%);
    background: var(--carbon-espresso);
    opacity: 0.3;
    z-index: -1;
}

/* --- Cursor Frost Overlay --- */
.frost-overlay {
    position: absolute;
    inset: 0;
    background: var(--crystal-frost);
    opacity: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    pointer-events: none;
    z-index: 4;
    transition: opacity 0.3s ease;
}

.hex-cell.hovered .frost-overlay {
    opacity: 0.15;
}

/* --- Responsive Adjustments --- */
@media (max-width: 1200px) {
    :root {
        --hex-primary: 300px;
        --hex-secondary: 210px;
        --hex-tertiary: 150px;
    }
}

@media (max-width: 768px) {
    :root {
        --hex-primary: 220px;
        --hex-secondary: 160px;
        --hex-tertiary: 110px;
    }

    #hex-nav {
        left: 10px;
    }

    .nav-hex {
        width: 40px;
        height: 46px;
    }

    .hex-content {
        padding: 20%;
    }
}

@media (max-width: 480px) {
    :root {
        --hex-primary: 180px;
        --hex-secondary: 130px;
        --hex-tertiary: 90px;
    }
}
