/* ============================================
   mujun.dev - Crystalline Street Style
   ============================================ */

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

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

body {
    background-color: #0A1628;
    color: #8AACCC;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    line-height: 1.8;
    overflow-x: hidden;
}

/* --- Noise Texture Overlay --- */
#noise-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    pointer-events: none;
    opacity: 0.05;
    background-image:
        repeating-radial-gradient(circle at 17% 32%, #C8DCF0 0px, transparent 1px),
        repeating-radial-gradient(circle at 63% 71%, #C8DCF0 0px, transparent 1px),
        repeating-radial-gradient(circle at 41% 88%, #C8DCF0 0px, transparent 1px),
        repeating-radial-gradient(circle at 89% 14%, #C8DCF0 0px, transparent 1px);
    background-size: 3px 3px, 5px 5px, 4px 4px, 6px 6px;
}

/* --- Main SVG Path --- */
#main-path-svg {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    pointer-events: none;
}

#main-path {
    filter: drop-shadow(0 0 6px rgba(74,139,194,0.4));
}

/* --- Typography --- */
h1 {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-style: italic;
    font-size: clamp(2.5rem, 7vw, 5.5rem);
    letter-spacing: 0.02em;
    color: #C8DCF0;
    line-height: 1.1;
}

h2 {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    letter-spacing: 0em;
    color: #C8DCF0;
    line-height: 1.3;
    margin-bottom: 2rem;
}

p {
    margin-bottom: 1.5rem;
}

/* --- Code / Technical Labels --- */
code, .project-label, .icon-label, .waypoint-label, .step-number {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    color: #4A8BC2;
}

/* --- Parallax Sections --- */
.parallax-section {
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.parallax-layer {
    position: absolute;
    inset: 0;
    will-change: transform;
}

.parallax-layer.layer-front {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    min-height: 100vh;
}

.parallax-layer.layer-mid {
    z-index: 2;
}

.parallax-layer.layer-deep {
    z-index: 1;
}

/* --- Section Content --- */
.section-content {
    width: 100%;
    padding: 4rem 2rem;
    position: relative;
    z-index: 3;
}

.content-column {
    max-width: 720px;
    margin-left: calc(50% - 400px);
}

/* --- Section I: Crystalline Tag --- */
#section-crystalline {
    background: linear-gradient(180deg, #060E1A 0%, #0A1628 40%, #0F2240 100%);
}

.voronoi-bg {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

/* Crystalline text - individual character spans */
.crystalline-text .char {
    display: inline-block;
    transition: clip-path 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    clip-path: polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%);
}

.crystalline-text .char.shattered {
    filter: drop-shadow(0 0 8px rgba(106,180,240,0.3));
}

.crystalline-text .char:nth-child(1).shattered { clip-path: polygon(8% 0%, 95% 3%, 98% 88%, 3% 100%); }
.crystalline-text .char:nth-child(2).shattered { clip-path: polygon(5% 2%, 92% 0%, 100% 92%, 8% 95%); }
.crystalline-text .char:nth-child(3).shattered { clip-path: polygon(0% 5%, 98% 0%, 95% 100%, 5% 90%); }
.crystalline-text .char:nth-child(4).shattered { clip-path: polygon(3% 0%, 100% 8%, 92% 100%, 0% 95%); }
.crystalline-text .char:nth-child(5).shattered { clip-path: polygon(0% 0%, 90% 5%, 100% 90%, 10% 100%); }
.crystalline-text .char:nth-child(6).shattered { clip-path: polygon(5% 3%, 98% 0%, 95% 95%, 0% 100%); }
.crystalline-text .char:nth-child(7).shattered { clip-path: polygon(2% 0%, 100% 5%, 98% 100%, 8% 92%); }
.crystalline-text .char:nth-child(8).shattered { clip-path: polygon(0% 8%, 95% 0%, 100% 88%, 5% 100%); }
.crystalline-text .char:nth-child(9).shattered { clip-path: polygon(10% 0%, 100% 3%, 90% 100%, 0% 95%); }

.hero-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: clamp(0.9rem, 2vw, 1.2rem);
    color: #8AACCC;
    margin-top: 1.5rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease 0.5s, transform 1s ease 0.5s;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

.hero-subtitle .kanji {
    font-size: 1.3em;
    color: #A8C8E8;
    letter-spacing: 0.05em;
}

.hero-subtitle .separator {
    color: #4A8BC2;
    margin: 0 0.5em;
}

/* Crystal fragments - mid layer */
.crystal-fragment {
    position: absolute;
    opacity: 0.6;
}

.frag-1 {
    width: 120px;
    height: 120px;
    top: 15%;
    left: 10%;
}

.frag-2 {
    width: 80px;
    height: 80px;
    top: 60%;
    right: 15%;
}

.frag-3 {
    width: 60px;
    height: 60px;
    top: 30%;
    right: 25%;
}

/* --- Section II: Code Wall --- */
#section-codewall {
    background: linear-gradient(180deg, #0F2240 0%, #0A1628 50%, #0F2240 100%);
}

.codewall-content .content-column {
    margin-left: calc(50% - 420px);
}

.project-block {
    border-left: 2px solid #1E3A5F;
    padding-left: 1.5rem;
    margin-bottom: 2rem;
    transition: border-color 0.4s ease;
}

.project-block:hover {
    border-color: #4A8BC2;
}

.project-label {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #4A8BC2;
    background: rgba(10,22,40,0.6);
    border: 1px solid #1E3A5F;
    padding: 0.2rem 0.8rem;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.project-block p {
    color: #8AACCC;
    margin-bottom: 0;
}

/* Isometric Icons */
.iso-icon {
    position: absolute;
    width: 60px;
    height: 60px;
    display: flex;
    flex-direction: column;
    align-items: center;
    filter: drop-shadow(0 0 4px rgba(74,139,194,0.3));
    transition: filter 0.3s ease;
}

.iso-icon svg {
    width: 60px;
    height: 60px;
}

.icon-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #4A8BC2;
    margin-top: 0.25rem;
    opacity: 0.7;
}

.icon-function { top: 15%; left: 8%; }
.icon-loop { top: 45%; left: 18%; }
.icon-variable { top: 25%; right: 12%; }
.icon-branch { top: 65%; right: 8%; }
.icon-array { top: 75%; left: 25%; }

/* --- Section III: The Path --- */
#section-path {
    background: linear-gradient(180deg, #0F2240 0%, #0A1628 50%, #0F2240 100%);
}

.path-content .content-column {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

.path-steps {
    margin-top: 2rem;
}

.path-step {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem 0;
    border-bottom: 1px solid rgba(30,58,95,0.5);
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.path-step.visible {
    opacity: 1;
    transform: translateX(0);
}

.step-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    color: #6AB4F0;
    font-weight: 400;
    min-width: 3rem;
}

.step-text {
    font-family: 'Libre Baskerville', serif;
    font-style: italic;
    font-size: clamp(1rem, 2vw, 1.2rem);
    color: #C8DCF0;
}

/* Waypoints */
.waypoint {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.waypoint svg {
    width: 40px;
    height: 40px;
    filter: drop-shadow(0 0 6px rgba(106,180,240,0.4));
}

.waypoint-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #6AB4F0;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    opacity: 0.8;
}

.waypoint-1 { top: 20%; left: 20%; }
.waypoint-2 { top: 50%; right: 20%; }
.waypoint-3 { top: 80%; left: 35%; }

/* --- Section IV: Convergence --- */
#section-convergence {
    background: linear-gradient(180deg, #0F2240 0%, #0A1628 40%, #060E1A 100%);
}

.convergence-lines {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
}

.convergence-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
}

.convergence-statement {
    font-family: 'Libre Baskerville', serif;
    font-weight: 700;
    font-size: clamp(1.3rem, 3vw, 2.2rem);
    color: #C8DCF0;
    line-height: 1.6;
    max-width: 600px;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.convergence-statement.visible {
    opacity: 1;
    transform: translateY(0);
}

.convergence-statement em {
    font-style: italic;
}

.convergence-signature {
    margin-top: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 1.5s ease 0.5s;
}

.convergence-signature.visible {
    opacity: 1;
}

.sig-domain {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: #4A8BC2;
    letter-spacing: 0.15em;
}

.sig-kanji {
    font-size: 1.5rem;
    color: #A8C8E8;
    opacity: 0.6;
}

/* --- Glow Effects --- */
.voronoi-bg polygon {
    transition: filter 0.5s ease;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-column {
        margin-left: 1.5rem;
        margin-right: 1.5rem;
        max-width: 100%;
    }

    .codewall-content .content-column {
        margin-left: 1.5rem;
    }

    .iso-icon {
        display: none;
    }

    .crystal-fragment {
        opacity: 0.3;
    }

    .waypoint {
        display: none;
    }

    .path-content .content-column {
        margin-left: 1.5rem;
        margin-right: 1.5rem;
    }

    #main-path-svg {
        display: none;
    }
}

@media (max-width: 480px) {
    .section-content {
        padding: 3rem 1rem;
    }

    h1 {
        font-size: clamp(2rem, 10vw, 3rem);
    }
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #060E1A;
}

::-webkit-scrollbar-thumb {
    background: #1E3A5F;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #2E6A9E;
}

/* --- Selection --- */
::selection {
    background: rgba(106,180,240,0.3);
    color: #C8DCF0;
}
