/* ========================================
   riron.net — Zen Futurism / Crystalline Theory
   ======================================== */

/* CSS Custom Properties */
:root {
    --deep-ground: #1a150e;
    --warm-parchment: #f5ede0;
    --amber-theory: #c8944a;
    --frost-quartz: #8fa5b8;
    --charcoal-ink: #2d2a26;
    --stone-gray: #7a7168;
    --crystal-white: #fff8ec;
    --theorem-red: #b85c3a;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-ground);
    color: var(--charcoal-ink);
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.75;
    overflow-x: hidden;
}

/* ========================================
   Crystal Dust Particles
   ======================================== */
#crystal-dust {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.dust-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    transform: rotate(45deg);
    animation: dust-float linear infinite;
}

@keyframes dust-float {
    0% {
        transform: rotate(45deg) translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: var(--dust-opacity, 0.2);
    }
    90% {
        opacity: var(--dust-opacity, 0.2);
    }
    100% {
        transform: rotate(45deg) translateY(-100vh) translateX(20vw);
        opacity: 0;
    }
}

/* ========================================
   Hero Section
   ======================================== */
.hero {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--deep-ground);
    overflow: hidden;
    animation: heroFadeIn 2s ease-out forwards;
    opacity: 0;
}

@keyframes heroFadeIn {
    to { opacity: 1; }
}

.hero-icosahedron {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(250px, 40vw, 500px);
    height: clamp(250px, 40vw, 500px);
    opacity: 0.6;
}

.icosahedron-group {
    transform-origin: 200px 200px;
    animation: icosahedronRotate 60s linear infinite;
}

@keyframes icosahedronRotate {
    to { transform: rotate(360deg); }
}

.vertex-pulse {
    animation: pulse 4s ease-in-out infinite alternate;
}

.vertex-pulse:nth-child(odd) {
    animation-delay: -2s;
}

@keyframes pulse {
    0% { r: 1.5; opacity: 0.5; }
    100% { r: 3; opacity: 1; }
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.hero-kanji {
    font-family: 'Noto Serif JP', serif;
    font-weight: 300;
    font-size: clamp(10rem, 25vw, 20rem);
    color: var(--warm-parchment);
    line-height: 1;
    cursor: default;
    transition: text-shadow 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero-kanji:hover {
    text-shadow: 0 0 40px rgba(200, 148, 74, 0.3);
}

.hero-subtitle {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--amber-theory);
    margin-top: 1.5rem;
}

/* ========================================
   Zen Garden Transition
   ======================================== */
.zen-garden {
    height: 30vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--deep-ground);
}

.zen-svg {
    width: min(800px, 90vw);
    height: auto;
}

.zen-stone {
    animation: stoneBreath 8s ease-in-out infinite alternate;
}

@keyframes stoneBreath {
    0% { opacity: 0.7; }
    100% { opacity: 1; }
}

.raked-line {
    stroke: var(--stone-gray);
    stroke-width: 0.5;
    fill: none;
    stroke-dasharray: var(--line-length, 800);
    stroke-dashoffset: var(--line-length, 800);
    transition: stroke-dashoffset 2s ease-out;
}

.zen-garden.visible .raked-line {
    stroke-dashoffset: 0;
}

/* ========================================
   Masonry Field
   ======================================== */
.masonry-field {
    background-color: var(--deep-ground);
    padding: 0 clamp(1.5rem, 4vw, 4rem);
    padding-bottom: 6rem;
}

.masonry-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    grid-auto-flow: dense;
}

/* Panels */
.panel {
    position: relative;
    background-color: var(--warm-parchment);
    padding: clamp(1.5rem, 3vw, 3rem);
    overflow: hidden;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 800ms cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 400ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 0 40px rgba(200, 148, 74, 0.05);
    border: 1px solid rgba(200, 148, 74, 0.3);
}

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

.panel:hover {
    box-shadow: inset 0 0 60px rgba(200, 148, 74, 0.12);
    border-color: rgba(200, 148, 74, 1);
}

.panel-wide {
    grid-column: span 2;
}

.panel-tall {
    grid-row: span 2;
}

/* Panel Number */
.panel-number {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(3rem, 6vw, 5rem);
    color: var(--stone-gray);
    opacity: 0.15;
    line-height: 1;
    pointer-events: none;
}

/* Panel Title */
.panel-title {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--charcoal-ink);
    margin-bottom: 1rem;
}

/* Panel Body */
.panel-body {
    font-family: 'Source Serif 4', serif;
    font-weight: 300;
    color: var(--charcoal-ink);
    margin-bottom: 0.75rem;
}

/* Panel Annotation */
.panel-annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    color: var(--stone-gray);
    margin-top: 1rem;
}

/* ========================================
   Terminal Zone
   ======================================== */
.terminal {
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--deep-ground);
    text-align: center;
}

.terminal-content {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.terminal-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.terminal-kanji {
    font-family: 'Noto Serif JP', serif;
    font-weight: 300;
    font-size: clamp(6rem, 15vw, 12rem);
    color: var(--warm-parchment);
    line-height: 1;
    margin-bottom: 2rem;
}

.terminal-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(1rem, 2vw, 1.5rem);
    color: var(--frost-quartz);
    line-height: 2;
    letter-spacing: 0.05em;
}

.terminal-annotation {
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 300;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    color: var(--stone-gray);
    margin-top: 3rem;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 1024px) {
    .masonry-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .panel-wide {
        grid-column: span 2;
    }
}

@media (max-width: 768px) {
    .masonry-grid {
        grid-template-columns: 1fr;
    }
    .panel-wide {
        grid-column: span 1;
    }
    .panel-tall {
        grid-row: span 1;
    }
    .hero-kanji {
        font-size: 10rem;
    }
}
