/* ==============================================
   muhan.studio — Fairycore-Academic Grimoire
   ============================================== */

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

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

body {
    background-color: #0d0d2b;
    color: #c8c8e0;
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.8vw, 20px);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Typography --- */
.display-title,
.site-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(32px, 5vw, 72px);
    letter-spacing: 0.02em;
    line-height: 1.15;
    color: #c8c8e0;
}

.body-text {
    font-family: 'EB Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(16px, 1.8vw, 20px);
    line-height: 1.7;
    color: #c8c8e0;
}

.body-text em {
    font-style: italic;
    color: #00ffaa;
}

.annotation {
    font-family: 'Inconsolata', 'Courier New', monospace;
    font-weight: 400;
    font-size: clamp(11px, 1.2vw, 14px);
    color: #6a6a9e;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.korean-char {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: clamp(14px, 1.5vw, 18px);
    color: #6a6a9e;
    letter-spacing: 0.05em;
}

.work-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(16px, 2vw, 24px);
    color: #c8c8e0;
    margin: 8px 0;
    line-height: 1.3;
}

.work-desc {
    font-family: 'EB Garamond', Georgia, serif;
    font-size: clamp(13px, 1.4vw, 16px);
    color: #6a6a9e;
    line-height: 1.5;
}

.separator {
    display: block;
    text-align: center;
    font-size: 20px;
    color: #6a6a9e;
    margin: 20px 0;
    opacity: 0.6;
}

/* --- Infinity Glyph (Fixed Nav) --- */
.infinity-glyph {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-weight: 700;
    font-size: 28px;
    color: #00ffaa;
    opacity: 0.6;
    text-decoration: none;
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.infinity-glyph:hover {
    opacity: 1;
    transform: scale(1.2);
}

/* --- Clusters (Sections) --- */
.cluster {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10vh 5vw 20vh;
    overflow: hidden;
}

.cluster-title {
    background-color: #0d0d2b;
}

.cluster-concept {
    background-color: #12122e;
}

.cluster-collection {
    background-color: #0d0d2b;
}

.cluster-colophon {
    background-color: #12122e;
}

/* --- Folio Numbers (Ghost Background) --- */
.folio-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Playfair Display', Georgia, serif;
    font-style: italic;
    font-weight: 700;
    font-size: 10vw;
    color: #6a6a9e;
    opacity: 0.04;
    pointer-events: none;
    user-select: none;
    z-index: 0;
}

/* --- Cluster Heading --- */
.cluster-heading {
    text-align: center;
    margin-bottom: 6vh;
    z-index: 2;
    position: relative;
}

.cluster-heading .annotation {
    display: block;
    margin-top: 8px;
}

/* --- Hexagonal Cells --- */
.hex-cell {
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    position: relative;
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    background: radial-gradient(ellipse at center, rgba(0, 255, 170, 0.04), transparent 70%);
    background-color: rgba(13, 13, 43, 0.6);
}

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

.hex-glow {
    position: absolute;
    inset: -4px;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: #00ffaa;
    opacity: 0;
    z-index: -1;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: scale(0.95);
}

.hex-cell:hover .hex-glow {
    opacity: 0.08;
    transform: scale(1.0);
}

.hex-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 15%;
}

/* --- Hex Grid: Hero Cluster --- */
.hex-grid-hero {
    position: relative;
    width: 80vw;
    max-width: 900px;
    height: 70vh;
    z-index: 1;
}

.hex-hero-main {
    position: absolute;
    width: 55vw;
    max-width: 500px;
    aspect-ratio: 1 / 1.15;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse at center, rgba(0, 255, 170, 0.06), rgba(13, 13, 43, 0.8) 70%);
    box-shadow: 0 0 30px rgba(0, 255, 170, 0.08);
}

.hex-hero-main:hover {
    transform: translate(-50%, -50%) scale(1.04);
}

.hex-hero-main .site-title {
    font-size: clamp(28px, 5vw, 64px);
    color: #c8c8e0;
    margin-bottom: 12px;
}

.hex-hero-main .site-subtitle {
    font-size: clamp(11px, 1.2vw, 14px);
}

.hex-hero-deco {
    position: absolute;
    width: clamp(60px, 10vw, 120px);
    aspect-ratio: 1 / 1.15;
    background: #0a3d3d4d;
    box-shadow: 0 0 20px rgba(0, 255, 170, 0.06);
}

.hex-hero-deco .hex-content {
    padding: 10%;
}

.hex-hero-deco .annotation {
    font-size: clamp(16px, 2vw, 28px);
}

.hex-deco-1 {
    top: 8%;
    left: 12%;
    animation: hexPulse 4s ease-in-out infinite;
}

.hex-deco-2 {
    top: 5%;
    right: 15%;
    animation: hexPulse 5s ease-in-out infinite 1s;
}

.hex-deco-3 {
    bottom: 12%;
    left: 8%;
    animation: hexPulse 6s ease-in-out infinite 0.5s;
}

.hex-deco-4 {
    bottom: 8%;
    right: 10%;
    animation: hexPulse 4.5s ease-in-out infinite 2s;
}

.hex-deco-5 {
    top: 50%;
    left: 2%;
    transform: translateY(-50%);
    width: clamp(40px, 6vw, 80px);
    animation: hexPulse 5.5s ease-in-out infinite 1.5s;
}

@keyframes hexPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(0, 255, 170, 0.04);
        opacity: 0.7;
    }
    50% {
        box-shadow: 0 0 40px rgba(0, 255, 170, 0.12);
        opacity: 1;
    }
}

/* --- Hex Grid: Concept Cluster --- */
.hex-grid-concept {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 2vw;
    max-width: 1100px;
    z-index: 1;
    position: relative;
}

.hex-concept-1,
.hex-concept-2,
.hex-concept-3 {
    width: clamp(250px, 30vw, 360px);
    aspect-ratio: 1 / 1.15;
    background: radial-gradient(ellipse at center, rgba(0, 255, 170, 0.04), rgba(18, 18, 46, 0.8) 70%);
    box-shadow: 0 0 30px rgba(0, 255, 170, 0.08);
}

.hex-concept-2 {
    margin-top: -3vw;
}

/* --- Hex Grid: Collection Cluster --- */
.hex-grid-collection {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5vw;
    max-width: 900px;
    width: 80vw;
    z-index: 1;
    position: relative;
}

.hex-work-item {
    width: 100%;
    aspect-ratio: 1 / 1.15;
    background: radial-gradient(ellipse at center, #0a3d3d66, rgba(13, 13, 43, 0.6) 70%);
    box-shadow: 0 0 20px rgba(0, 255, 170, 0.06);
    cursor: pointer;
}

.hex-work-item:nth-child(4),
.hex-work-item:nth-child(5),
.hex-work-item:nth-child(6) {
    margin-top: -4vw;
}

.hex-work-item:hover {
    transform: scale(1.15);
    box-shadow: 0 0 40px rgba(0, 255, 170, 0.15);
}

.hex-work-item .annotation {
    font-size: clamp(9px, 1vw, 12px);
    color: #00ffaa;
    opacity: 0.6;
}

/* --- Hex Grid: Colophon Cluster --- */
.hex-grid-colophon {
    position: relative;
    width: 80vw;
    max-width: 800px;
    min-height: 60vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.hex-colophon-main {
    width: clamp(300px, 45vw, 520px);
    aspect-ratio: 1 / 1.15;
    background: radial-gradient(ellipse at center, rgba(0, 255, 170, 0.04), rgba(18, 18, 46, 0.8) 70%);
    box-shadow: 0 0 30px rgba(0, 255, 170, 0.08);
    z-index: 2;
}

.hex-colophon-main .hex-content {
    padding: 12%;
}

.hex-colophon-main .body-text {
    font-size: clamp(14px, 1.5vw, 17px);
    line-height: 1.6;
}

/* --- Dust Hexagons (Colophon) --- */
.hex-dust {
    position: absolute;
    background: rgba(0, 255, 170, 0.04);
    border: none;
    box-shadow: 0 0 15px rgba(0, 255, 170, 0.06);
}

.hex-dust-1  { width: 30px; height: 35px; top: 10%; left: 10%; animation: dustDrift1 25s ease-in-out infinite; }
.hex-dust-2  { width: 20px; height: 23px; top: 20%; left: 25%; animation: dustDrift2 30s ease-in-out infinite 2s; }
.hex-dust-3  { width: 25px; height: 29px; top: 5%; right: 20%; animation: dustDrift1 28s ease-in-out infinite 4s; }
.hex-dust-4  { width: 15px; height: 17px; top: 30%; right: 10%; animation: dustDrift2 22s ease-in-out infinite 1s; }
.hex-dust-5  { width: 35px; height: 40px; bottom: 15%; left: 15%; animation: dustDrift1 35s ease-in-out infinite 3s; }
.hex-dust-6  { width: 18px; height: 21px; bottom: 25%; left: 30%; animation: dustDrift2 27s ease-in-out infinite 5s; }
.hex-dust-7  { width: 22px; height: 25px; bottom: 10%; right: 25%; animation: dustDrift1 32s ease-in-out infinite 2s; }
.hex-dust-8  { width: 28px; height: 32px; bottom: 30%; right: 8%; animation: dustDrift2 24s ease-in-out infinite 6s; }
.hex-dust-9  { width: 16px; height: 18px; top: 45%; left: 5%; animation: dustDrift1 29s ease-in-out infinite 1s; }
.hex-dust-10 { width: 24px; height: 28px; top: 50%; right: 5%; animation: dustDrift2 33s ease-in-out infinite 3s; }
.hex-dust-11 { width: 12px; height: 14px; top: 15%; left: 45%; animation: dustDrift1 26s ease-in-out infinite 7s; }
.hex-dust-12 { width: 20px; height: 23px; bottom: 20%; right: 40%; animation: dustDrift2 31s ease-in-out infinite 4s; }

@keyframes dustDrift1 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(15px, -10px); }
    50% { transform: translate(-8px, -18px); }
    75% { transform: translate(10px, 8px); }
}

@keyframes dustDrift2 {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(-12px, 8px); }
    50% { transform: translate(10px, 15px); }
    75% { transform: translate(-15px, -5px); }
}

/* --- Draw Link (Underline Animation) --- */
.draw-link {
    position: relative;
    text-decoration: none;
    color: #00ffaa;
    transition: color 0.3s ease;
}

.draw-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: #00ffaa;
    transition: width 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.draw-link:hover::after {
    width: 100%;
}

.draw-link:hover {
    color: #ff44cc;
}

/* --- SVG Vines --- */
.vine {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    opacity: 0.6;
}

.vine-1 {
    width: 80px;
    height: 100%;
    right: 8%;
    top: 0;
}

.vine-2 {
    width: 60%;
    height: 50%;
    left: 20%;
    top: 5%;
}

.vine-3 {
    width: 80%;
    height: 30%;
    left: 10%;
    top: 10%;
}

.vine-4 {
    width: 60px;
    height: 80%;
    left: 15%;
    top: 10%;
}

.vine-path {
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 2s ease-in-out;
}

.vine-path.drawn {
    stroke-dashoffset: 0;
}

/* --- Firefly Particles --- */
.fireflies {
    position: fixed;
    inset: 0;
    z-index: 999;
    pointer-events: none;
    overflow: hidden;
}

.firefly {
    position: absolute;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    opacity: 0.4;
}

/* Generate 25 fireflies with varied positions and animations */
.firefly-1  { background: #00ffaa; top: 8%;  left: 12%; animation: flyDrift1 32s linear infinite, flyGlow1 4s ease-in-out infinite; }
.firefly-2  { background: #ff44cc; top: 15%; left: 78%; animation: flyDrift2 38s linear infinite 2s, flyGlow2 5s ease-in-out infinite 1s; }
.firefly-3  { background: #00ffaa; top: 25%; left: 45%; animation: flyDrift3 42s linear infinite 4s, flyGlow1 6s ease-in-out infinite 2s; }
.firefly-4  { background: #ff44cc; top: 32%; left: 8%;  animation: flyDrift1 28s linear infinite 1s, flyGlow2 4.5s ease-in-out infinite; }
.firefly-5  { background: #00ffaa; top: 40%; left: 90%; animation: flyDrift2 35s linear infinite 3s, flyGlow1 5.5s ease-in-out infinite 0.5s; }
.firefly-6  { background: #00ffaa; top: 48%; left: 55%; animation: flyDrift3 40s linear infinite 5s, flyGlow2 3.5s ease-in-out infinite 1.5s; }
.firefly-7  { background: #ff44cc; top: 55%; left: 22%; animation: flyDrift1 45s linear infinite 6s, flyGlow1 7s ease-in-out infinite 3s; }
.firefly-8  { background: #00ffaa; top: 62%; left: 70%; animation: flyDrift2 30s linear infinite 2s, flyGlow2 4s ease-in-out infinite 2s; }
.firefly-9  { background: #00ffaa; top: 70%; left: 35%; animation: flyDrift3 36s linear infinite 7s, flyGlow1 5s ease-in-out infinite; }
.firefly-10 { background: #ff44cc; top: 78%; left: 85%; animation: flyDrift1 33s linear infinite 4s, flyGlow2 6s ease-in-out infinite 1s; }
.firefly-11 { background: #00ffaa; top: 85%; left: 15%; animation: flyDrift2 44s linear infinite 8s, flyGlow1 3s ease-in-out infinite 0.5s; }
.firefly-12 { background: #00ffaa; top: 92%; left: 60%; animation: flyDrift3 37s linear infinite 1s, flyGlow2 5.5s ease-in-out infinite 2s; }
.firefly-13 { background: #ff44cc; top: 5%;  left: 50%; animation: flyDrift1 41s linear infinite 9s, flyGlow1 4.5s ease-in-out infinite 1s; }
.firefly-14 { background: #00ffaa; top: 18%; left: 30%; animation: flyDrift2 29s linear infinite 3s, flyGlow2 6.5s ease-in-out infinite; }
.firefly-15 { background: #00ffaa; top: 35%; left: 65%; animation: flyDrift3 34s linear infinite 5s, flyGlow1 3.5s ease-in-out infinite 2s; }
.firefly-16 { background: #ff44cc; top: 45%; left: 5%;  animation: flyDrift1 39s linear infinite 7s, flyGlow2 5s ease-in-out infinite 1s; }
.firefly-17 { background: #00ffaa; top: 58%; left: 42%; animation: flyDrift2 43s linear infinite 2s, flyGlow1 4s ease-in-out infinite 3s; }
.firefly-18 { background: #00ffaa; top: 65%; left: 95%; animation: flyDrift3 31s linear infinite 6s, flyGlow2 7s ease-in-out infinite; }
.firefly-19 { background: #ff44cc; top: 75%; left: 50%; animation: flyDrift1 46s linear infinite 4s, flyGlow1 5s ease-in-out infinite 2s; }
.firefly-20 { background: #00ffaa; top: 88%; left: 28%; animation: flyDrift2 36s linear infinite 8s, flyGlow2 3s ease-in-out infinite 1s; }
.firefly-21 { background: #00ffaa; top: 12%; left: 92%; animation: flyDrift3 40s linear infinite 3s, flyGlow1 6s ease-in-out infinite; }
.firefly-22 { background: #ff44cc; top: 28%; left: 18%; animation: flyDrift1 34s linear infinite 5s, flyGlow2 4.5s ease-in-out infinite 2s; }
.firefly-23 { background: #00ffaa; top: 52%; left: 80%; animation: flyDrift2 38s linear infinite 1s, flyGlow1 5.5s ease-in-out infinite 1s; }
.firefly-24 { background: #00ffaa; top: 68%; left: 10%; animation: flyDrift3 42s linear infinite 7s, flyGlow2 3.5s ease-in-out infinite; }
.firefly-25 { background: #ff44cc; top: 82%; left: 72%; animation: flyDrift1 30s linear infinite 9s, flyGlow1 7s ease-in-out infinite 3s; }

.firefly:nth-child(odd) { width: 2px; height: 2px; }
.firefly:nth-child(3n)  { width: 4px; height: 4px; }

@keyframes flyDrift1 {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(30px, -20px); }
    50%  { transform: translate(-15px, -35px); }
    75%  { transform: translate(20px, 15px); }
    100% { transform: translate(0, 0); }
}

@keyframes flyDrift2 {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(-25px, 15px); }
    50%  { transform: translate(20px, 30px); }
    75%  { transform: translate(-30px, -10px); }
    100% { transform: translate(0, 0); }
}

@keyframes flyDrift3 {
    0%   { transform: translate(0, 0); }
    25%  { transform: translate(15px, 25px); }
    50%  { transform: translate(-25px, -15px); }
    75%  { transform: translate(10px, -30px); }
    100% { transform: translate(0, 0); }
}

@keyframes flyGlow1 {
    0%, 100% { opacity: 0.2; }
    50%      { opacity: 0.8; }
}

@keyframes flyGlow2 {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 0.7; }
}

/* --- Scroll-triggered fade in for clusters --- */
.cluster {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

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

/* Title cluster always visible on load */
.cluster-title {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .hex-grid-concept {
        flex-direction: column;
        align-items: center;
    }

    .hex-concept-1,
    .hex-concept-2,
    .hex-concept-3 {
        width: clamp(250px, 75vw, 340px);
    }

    .hex-concept-2 {
        margin-top: 0;
    }

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

    .hex-work-item:nth-child(4),
    .hex-work-item:nth-child(5),
    .hex-work-item:nth-child(6) {
        margin-top: 0;
    }

    .hex-hero-main {
        width: 75vw;
    }

    .hex-colophon-main {
        width: clamp(260px, 80vw, 400px);
    }

    .vine {
        display: none;
    }
}

@media (max-width: 480px) {
    .hex-grid-collection {
        grid-template-columns: 1fr;
        max-width: 280px;
    }

    .cluster {
        padding: 8vh 4vw 15vh;
    }
}