/* =============================================
   muhan.dev - Isometric Layered-Depth Design
   Palette: Navy-Metallic
   Fonts: Bebas Neue, Work Sans, JetBrains Mono
   ============================================= */

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

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

body {
    background-color: #0E1428;
    color: #C8CCD8;
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.9rem, 1.3vw, 1.05rem);
    line-height: 1.65;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* --- Infinity Nav (Fixed) --- */
#infinity-nav {
    position: fixed;
    top: 1.5rem;
    right: 1.8rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    color: #C8A860;
    z-index: 1000;
    cursor: pointer;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0.8;
}

#infinity-nav:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* --- Isometric Grid Background --- */
#isometric-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.04;
    z-index: 0;
    pointer-events: none;
    background-image:
        repeating-linear-gradient(
            30deg,
            transparent,
            transparent 59px,
            #C8CCD8 59px,
            #C8CCD8 60px
        ),
        repeating-linear-gradient(
            -30deg,
            transparent,
            transparent 59px,
            #C8CCD8 59px,
            #C8CCD8 60px
        );
}

/* --- Star Field --- */
#star-field {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.star-dot {
    position: absolute;
    border-radius: 50%;
    background-color: #C8A860;
    opacity: 0.3;
    transition: opacity 0.1s ease;
}

.star-dot.flare {
    opacity: 0.8;
}

/* --- Landmark Stars --- */
.landmark-star {
    position: absolute;
    width: 6px;
    height: 6px;
    background-color: #C8A860;
    z-index: 2;
    clip-path: polygon(
        50% 0%, 62% 38%, 100% 50%, 62% 62%,
        50% 100%, 38% 62%, 0% 50%, 38% 38%
    );
    opacity: 0.5;
    transition: opacity 0.1s ease;
}

.landmark-star.flare {
    opacity: 0.9;
}

/* --- Perspective Container --- */
#perspective-container {
    position: relative;
    perspective: 1600px;
    width: 100%;
    min-height: 100vh;
}

/* --- Layer System --- */
.layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
}

.layer-back {
    z-index: 1;
    transform: translateZ(-40px);
}

.layer-middle {
    position: relative;
    z-index: 5;
    transform: translateZ(0);
    pointer-events: auto;
}

.layer-front {
    z-index: 10;
    transform: translateZ(40px);
}

/* --- Back Layer Shapes --- */
.back-shape {
    position: absolute;
    background-color: #1A2040;
    border-radius: 2px;
}

.back-shape-1 {
    top: 5vh;
    left: -5%;
    width: 45%;
    height: 35vh;
    transform: skewY(-6deg);
}

.back-shape-2 {
    top: 55vh;
    right: -8%;
    width: 50%;
    height: 40vh;
    transform: skewY(4deg);
}

.back-shape-3 {
    top: 120vh;
    left: 10%;
    width: 35%;
    height: 30vh;
    transform: skewY(-3deg);
}

.back-shape-4 {
    top: 200vh;
    right: 5%;
    width: 40%;
    height: 35vh;
    transform: skewY(5deg);
}

/* --- Content Sections --- */
.content-section {
    position: relative;
    padding: 8vh 8vw;
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* --- Layer Labels --- */
.layer-label {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.15em;
    color: #C8A860;
    opacity: 0.6;
    margin-bottom: 2rem;
    display: block;
}

/* --- Typography --- */
h1, h2 {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #E8ECF0;
}

h1 {
    font-size: clamp(2.4rem, 6vw, 5rem);
    line-height: 1;
}

h2 {
    font-size: clamp(1.6rem, 3.5vw, 3rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #E8ECF0;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
}

p {
    max-width: 600px;
    margin-bottom: 1.5rem;
}

/* --- Hero Section --- */
#hero {
    min-height: 100vh;
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding-top: 25vh;
}

.hero-content {
    position: relative;
    z-index: 5;
}

.hero-title {
    font-size: clamp(3.5rem, 10vw, 9rem);
    line-height: 0.9;
    margin-bottom: 0.5rem;
    color: #E8ECF0;
    position: relative;
}

.hero-subtitle-row {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.hero-korean {
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 700;
    font-size: clamp(1.2rem, 2.5vw, 2rem);
    color: #C8A860;
}

.hero-tagline {
    font-family: 'Work Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(0.75rem, 1.2vw, 1rem);
    letter-spacing: 0.12em;
    color: #C8CCD8;
    opacity: 0.6;
}

/* --- Content Blocks --- */
.content-block {
    position: relative;
    background-color: rgba(34, 40, 64, 0.4);
    border: 1px solid rgba(200, 204, 216, 0.06);
    padding: 2.5rem 3rem;
    border-radius: 3px;
    max-width: 700px;
}

/* Isometric cube pseudo-element hint on content blocks */
.content-block::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    right: -1px;
    height: 3px;
    background: linear-gradient(90deg, #C8A860 0%, transparent 60%);
    opacity: 0.3;
    border-radius: 3px 3px 0 0;
}

/* --- Code Block --- */
.code-block {
    background-color: #222840;
    border-radius: 3px;
    padding: 1.5rem 2rem;
    overflow-x: auto;
    border: 1px solid rgba(200, 204, 216, 0.06);
}

.code-block pre {
    margin: 0;
}

.code-block code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.7;
    color: #C8CCD8;
}

.code-keyword {
    color: #4878E8;
}

.code-string {
    color: #C8A860;
}

/* --- Isometric Project Gallery --- */
.isometric-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    margin-top: 2rem;
    max-width: 900px;
}

.iso-block {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    cursor: pointer;
    transition: transform 0.3s ease;
    pointer-events: auto;
}

.iso-block:hover {
    transform: translateY(-6px);
}

/* Isometric block faces */
.iso-block-top,
.iso-block-front,
.iso-block-side {
    position: absolute;
    transition: background-color 0.3s ease;
}

.iso-block-top {
    width: 80%;
    height: 40%;
    top: 0;
    left: 10%;
    background-color: #222840;
    transform: rotateX(60deg) rotateZ(-45deg) scale(0.7);
    transform-origin: center center;
    clip-path: polygon(50% 0%, 100% 25%, 50% 50%, 0% 25%);
    background-color: rgba(200, 168, 96, 0.08);
}

.iso-block-front {
    width: 50%;
    height: 60%;
    bottom: 0;
    left: 0;
    background-color: #1A2040;
    clip-path: polygon(0% 0%, 100% 17%, 100% 100%, 0% 83%);
}

.iso-block-side {
    width: 50%;
    height: 60%;
    bottom: 0;
    right: 0;
    background-color: #222840;
    clip-path: polygon(0% 17%, 100% 0%, 100% 83%, 0% 100%);
}

.iso-block:hover .iso-block-top {
    background-color: rgba(200, 168, 96, 0.18);
}

.iso-block:hover .iso-block-front {
    background-color: #222840;
}

.iso-block:hover .iso-block-side {
    background-color: #283050;
}

.iso-block-content {
    position: absolute;
    bottom: 12%;
    left: 8%;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.block-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    color: #C8A860;
    opacity: 0.7;
    letter-spacing: 0.08em;
}

.block-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(0.9rem, 1.5vw, 1.3rem);
    color: #E8ECF0;
    letter-spacing: 0.04em;
}

/* --- Detail Panel --- */
.detail-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) translateZ(60px);
    background-color: #1A2040;
    border: 1px solid rgba(200, 168, 96, 0.2);
    padding: 3rem;
    border-radius: 4px;
    z-index: 100;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: auto;
}

.detail-panel.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, -48%) translateZ(60px);
}

.detail-panel.visible {
    opacity: 1;
    transform: translate(-50%, -50%) translateZ(60px);
}

.detail-close {
    position: absolute;
    top: 1rem;
    right: 1.2rem;
    background: none;
    border: none;
    color: #C8CCD8;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    font-family: 'Work Sans', sans-serif;
}

.detail-close:hover {
    opacity: 1;
}

.detail-title {
    margin-bottom: 1rem;
}

.detail-description {
    font-size: 0.9rem;
    line-height: 1.7;
    color: #C8CCD8;
    margin-bottom: 1.5rem;
}

.detail-meta {
    display: flex;
    gap: 0.75rem;
}

.detail-tag {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #C8A860;
    padding: 0.3rem 0.7rem;
    border: 1px solid rgba(200, 168, 96, 0.3);
    border-radius: 2px;
    letter-spacing: 0.05em;
}

/* --- Philosophy Section --- */
.philosophy-grid {
    display: flex;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.philosophy-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.philosophy-number {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 2rem;
    color: #C8A860;
    opacity: 0.4;
    line-height: 1;
}

.philosophy-text {
    font-size: 0.85rem;
    color: #C8CCD8;
    max-width: 180px;
}

/* --- Contact Section --- */
.contact-text {
    opacity: 0.7;
}

.contact-links {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.contact-link {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    color: #E8ECF0;
    text-decoration: none;
    position: relative;
    transition: color 0.2s ease;
}

.contact-link::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 1px;
    background-color: #C8A860;
    transition: width 0.3s ease;
}

.contact-link:hover {
    color: #C8A860;
}

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

/* --- Front Layer Elements --- */
.front-element {
    position: absolute;
    pointer-events: none;
}

#hero-cube {
    top: 15vh;
    right: 12vw;
    width: clamp(120px, 15vw, 200px);
    height: clamp(120px, 15vw, 200px);
}

#projects-shape {
    top: 180vh;
    left: 5vw;
    width: clamp(80px, 10vw, 160px);
    height: clamp(90px, 11vw, 180px);
}

#philosophy-shape {
    top: 270vh;
    right: 8vw;
    width: clamp(90px, 11vw, 180px);
    height: clamp(80px, 10vw, 160px);
}

/* --- Glitch Effect --- */
/* Glitch colors: #E84848 (red channel), #4878E8 (blue channel) */
.glitch-active {
    animation: glitchShift 200ms ease-out;
}

@keyframes glitchShift {
    0% {
        transform: translateX(0);
        filter: none;
    }
    25% {
        transform: translateX(3px);
        filter: drop-shadow(-3px 0 0 rgba(232, 72, 72, 0.6)) drop-shadow(3px 0 0 rgba(72, 120, 232, 0.6));
    }
    50% {
        transform: translateX(-2px);
        filter: drop-shadow(2px 0 0 rgba(232, 72, 72, 0.4)) drop-shadow(-2px 0 0 rgba(72, 120, 232, 0.4));
    }
    75% {
        transform: translateX(1px);
        filter: drop-shadow(-1px 0 0 rgba(232, 72, 72, 0.2)) drop-shadow(1px 0 0 rgba(72, 120, 232, 0.2));
    }
    100% {
        transform: translateX(0);
        filter: none;
    }
}

/* Glitch variant for front layer (preserves translateZ) */
.front-element.glitch-active {
    animation: glitchShiftFront 200ms ease-out;
}

@keyframes glitchShiftFront {
    0% {
        filter: none;
    }
    25% {
        filter: drop-shadow(-3px 0 0 rgba(232, 72, 72, 0.6)) drop-shadow(3px 0 0 rgba(72, 120, 232, 0.6));
    }
    50% {
        filter: drop-shadow(2px 0 0 rgba(232, 72, 72, 0.4)) drop-shadow(-2px 0 0 rgba(72, 120, 232, 0.4));
    }
    75% {
        filter: drop-shadow(-1px 0 0 rgba(232, 72, 72, 0.2)) drop-shadow(1px 0 0 rgba(72, 120, 232, 0.2));
    }
    100% {
        filter: none;
    }
}

/* --- Scroll Reveal Animations --- */
.content-section {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.content-section.revealed {
    opacity: 1;
    transform: translateY(0);
}

/* Hero always visible */
#hero {
    opacity: 1;
    transform: translateY(0);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .content-section {
        padding: 6vh 6vw;
        min-height: 60vh;
    }

    .isometric-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .hero-title {
        font-size: clamp(2.5rem, 12vw, 5rem);
    }

    .philosophy-grid {
        flex-direction: column;
        gap: 1.5rem;
    }

    .contact-links {
        flex-direction: column;
        gap: 1rem;
    }

    #hero-cube {
        right: 5vw;
        top: 20vh;
        width: 100px;
        height: 100px;
    }

    #projects-shape {
        display: none;
    }

    #philosophy-shape {
        display: none;
    }

    .content-block {
        padding: 2rem;
    }
}

@media (max-width: 480px) {
    .isometric-gallery {
        grid-template-columns: 1fr;
    }

    .hero-subtitle-row {
        flex-direction: column;
        gap: 0.5rem;
    }
}
