/* ============================================
   yongjoon.net — Watercolor Atelier in Geometric Suspension
   ============================================ */

:root {
    --rice-paper: #f4f0e8;
    --midnight: #1a1040;
    --plum-charcoal: #2a2444;
    --sapphire: #2d4a7a;
    --amethyst: #7b4f8a;
    --emerald: #2a6b5a;
    --ruby: #8a3a4a;
    --wash: rgba(26, 16, 64, 0.06);
    --muted-amethyst: #6b5e8a;
    --golden-ratio: 1.618;
    --narrow-col: calc(100% / (1 + var(--golden-ratio)));
    --wide-col: calc(100% - var(--narrow-col));
}

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

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

body.scroll-painting {
    background-color: var(--rice-paper);
    color: var(--plum-charcoal);
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.005em;
    overflow-x: hidden;
    position: relative;
}

/* ---- Dot-Grid Substrate ---- */
.dot-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: radial-gradient(circle, #2a2444 0.5px, transparent 0.5px);
    background-size: 24px 24px;
    opacity: 0.04;
    pointer-events: none;
    z-index: 0;
}

/* ---- Sacred Geometry Overlay ---- */
.geometry-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.6;
    will-change: transform;
}

/* ---- SVG Filters (hidden) ---- */
.svg-filters {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ---- Typography ---- */
.section-title {
    font-family: 'Playfair Display', 'Georgia', serif;
    font-weight: 400;
    font-style: normal;
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--midnight);
    margin-bottom: 2rem;
}

.section-title em {
    font-style: italic;
}

.body-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.05rem, 1.8vw, 1.25rem);
    line-height: 1.75;
    letter-spacing: 0.005em;
    color: var(--plum-charcoal);
    margin-bottom: 1.5rem;
    max-width: 48ch;
}

.caption-text {
    font-family: 'IBM Plex Sans', 'Helvetica Neue', sans-serif;
    font-weight: 300;
    font-size: clamp(0.75rem, 1.2vw, 0.875rem);
    line-height: 1.5;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted-amethyst);
    display: block;
    margin-bottom: 1rem;
}

/* ---- Reveal Animation ---- */
.reveal-element {
    opacity: 0;
    transform: translateY(2rem);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.reveal-element.revealed {
    opacity: 1;
    transform: none;
}

/* ============================================
   HEADER — Opening Void
   ============================================ */
.void-opening {
    position: relative;
    height: 100vh;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: clamp(2rem, 5vw, 4rem);
    background-color: var(--rice-paper);
    z-index: 2;
}

.void-opening .polyhedron-container {
    position: absolute;
    top: 20%;
    right: 20%;
}

.void-opening .domain-name {
    position: relative;
    z-index: 3;
}

/* ============================================
   3D POLYHEDRA
   ============================================ */
.polyhedron-container {
    perspective: 800px;
    width: 200px;
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.poly-section {
    width: 260px;
    height: 260px;
    margin: 4rem auto;
}

.poly-convergence {
    width: 320px;
    height: 320px;
    margin: 0 auto;
}

/* Icosahedron */
.icosahedron, .dodecahedron, .octahedron {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    animation: gentle-rotate 45s linear infinite;
}

.ico-alt {
    animation-direction: reverse;
    animation-duration: 55s;
}

.ico-final {
    animation-duration: 60s;
}

.dodecahedron {
    animation-duration: 50s;
    animation-direction: reverse;
}

.octahedron {
    animation-duration: 40s;
}

@keyframes gentle-rotate {
    from { transform: rotateX(0deg) rotateY(0deg) rotateZ(0deg); }
    to { transform: rotateX(360deg) rotateY(216deg) rotateZ(144deg); }
}

.face {
    position: absolute;
    width: 80px;
    height: 80px;
    border: 1px solid rgba(107, 94, 138, 0.2);
    backface-visibility: visible;
    opacity: 0.75;
}

/* Watercolor gradient faces — jewel tones */
.face-1 { background: linear-gradient(135deg, #2d4a7a 0%, #2d4a7a88 40%, #f4f0e8 100%); transform: rotateY(0deg) translateZ(60px); }
.face-2 { background: linear-gradient(225deg, #7b4f8a 0%, #7b4f8a88 40%, #f4f0e8 100%); transform: rotateY(60deg) translateZ(60px); }
.face-3 { background: linear-gradient(45deg, #2a6b5a 0%, #2a6b5a88 40%, #f4f0e8 100%); transform: rotateY(120deg) translateZ(60px); }
.face-4 { background: linear-gradient(315deg, #8a3a4a 0%, #8a3a4a88 40%, #f4f0e8 100%); transform: rotateY(180deg) translateZ(60px); }
.face-5 { background: linear-gradient(135deg, #7b4f8a 0%, #2d4a7a88 50%, #f4f0e8 100%); transform: rotateY(240deg) translateZ(60px); }
.face-6 { background: linear-gradient(225deg, #2a6b5a 0%, #7b4f8a88 50%, #f4f0e8 100%); transform: rotateY(300deg) translateZ(60px); }
.face-7 { background: linear-gradient(90deg, #2d4a7a 0%, #2a6b5a88 50%, #f4f0e8 100%); transform: rotateX(90deg) translateZ(60px); }
.face-8 { background: linear-gradient(270deg, #8a3a4a 0%, #2d4a7a88 50%, #f4f0e8 100%); transform: rotateX(-90deg) translateZ(60px); }
.face-9 { background: linear-gradient(160deg, #2d4a7a 0%, #7b4f8a66 50%, transparent 100%); transform: rotateX(45deg) rotateY(30deg) translateZ(60px); }
.face-10 { background: linear-gradient(200deg, #2a6b5a 0%, #8a3a4a66 50%, transparent 100%); transform: rotateX(-45deg) rotateY(30deg) translateZ(60px); }
.face-11 { background: linear-gradient(340deg, #7b4f8a 0%, #2a6b5a66 50%, transparent 100%); transform: rotateX(45deg) rotateY(-30deg) translateZ(60px); }
.face-12 { background: linear-gradient(20deg, #8a3a4a 0%, #2d4a7a66 50%, transparent 100%); transform: rotateX(-45deg) rotateY(-30deg) translateZ(60px); }

/* clip faces into triangular shapes for icosahedra */
.icosahedron .face {
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
}

/* Pentagon clip for dodecahedron */
.dodecahedron .face {
    clip-path: polygon(50% 0%, 97.6% 34.5%, 79.4% 90.5%, 20.6% 90.5%, 2.4% 34.5%);
}

/* Diamond clip for octahedron */
.octahedron .face {
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    width: 100px;
    height: 100px;
}

/* ============================================
   EDITORIAL FRAMES — Ink Descent
   ============================================ */
.ink-descent {
    position: relative;
    z-index: 2;
}

.editorial-frame {
    display: grid;
    grid-template-columns: var(--narrow-col) var(--wide-col);
    min-height: 80vh;
    padding: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 4rem);
    position: relative;
    align-items: center;
}

.editorial-frame.reversed {
    grid-template-columns: var(--wide-col) var(--narrow-col);
}

.section-marker {
    position: absolute;
    top: clamp(2rem, 5vw, 4rem);
    left: clamp(2rem, 5vw, 4rem);
    z-index: 3;
}

.narrow-column {
    padding: 2rem;
    position: relative;
}

.wide-column {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
}

/* Staggered vertical offsets */
.editorial-frame[data-section="1"] .narrow-column { margin-top: 6rem; }
.editorial-frame[data-section="2"] .narrow-column { margin-top: 2rem; }
.editorial-frame[data-section="3"] .narrow-column { margin-top: 10rem; }

/* ---- Dark section ---- */
.dark-section {
    background-color: var(--midnight);
}

.dark-section .section-title {
    color: var(--rice-paper);
}

.dark-section .body-text {
    color: rgba(244, 240, 232, 0.85);
}

.dark-section .caption-text {
    color: rgba(107, 94, 138, 0.8);
}

/* ============================================
   WATERCOLOR TRANSITIONS
   ============================================ */
.watercolor-transition {
    position: relative;
    height: 20vh;
    overflow: hidden;
    z-index: 2;
}

.wash {
    position: absolute;
    inset: 0;
    filter: url(#watercolor-blur);
}

.wash-sapphire {
    background: linear-gradient(
        180deg,
        var(--rice-paper) 0%,
        rgba(45, 74, 122, 0.15) 30%,
        rgba(45, 74, 122, 0.25) 50%,
        rgba(26, 16, 64, 0.4) 70%,
        var(--midnight) 100%
    );
}

.wash-amethyst {
    background: linear-gradient(
        180deg,
        var(--midnight) 0%,
        rgba(123, 79, 138, 0.3) 30%,
        rgba(123, 79, 138, 0.15) 50%,
        rgba(244, 240, 232, 0.4) 70%,
        var(--rice-paper) 100%
    );
}

.wash-emerald {
    background: linear-gradient(
        180deg,
        var(--rice-paper) 0%,
        rgba(42, 107, 90, 0.15) 30%,
        rgba(42, 107, 90, 0.25) 50%,
        rgba(26, 16, 64, 0.3) 70%,
        var(--midnight) 100%
    );
}

/* ============================================
   CONVERGENCE POOL
   ============================================ */
.convergence-pool {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: var(--midnight);
    padding: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 4rem);
    text-align: center;
    z-index: 2;
}

.convergence-text {
    font-family: 'Playfair Display', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    line-height: 1.4;
    color: var(--rice-paper);
    max-width: 40ch;
    margin-top: 3rem;
}

.convergence-attr {
    margin-top: 2rem;
    color: rgba(107, 94, 138, 0.6);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1199px) and (min-width: 768px) {
    .editorial-frame,
    .editorial-frame.reversed {
        grid-template-columns: 40% 60%;
    }
}

@media (max-width: 767px) {
    .editorial-frame,
    .editorial-frame.reversed {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 3rem 1.5rem;
    }

    .editorial-frame .narrow-column {
        margin-top: 0 !important;
        margin-inline-start: 1.5rem;
    }

    .editorial-frame.reversed .narrow-column {
        margin-inline-start: 3rem;
        order: -1;
    }

    .wide-column {
        min-height: 200px;
    }

    .poly-section {
        width: 180px;
        height: 180px;
    }

    .void-opening .polyhedron-container {
        top: 15%;
        right: 10%;
    }

    .watercolor-transition {
        height: 15vh;
    }
}
