/* muhan.dev - Infinity (무한) - Isometric Dashboard */
:root {
    --void-bg: #0a0a12;
    --panel-bg: #0d1b2a;
    --neon-pink: #ff2d6f;
    --neon-mint: #00f5d4;
    --neon-amber: #ffc400;
    --neon-violet: #7b2dff;
    --text-primary: #e0e0ff;
    --text-secondary: #a8b2d1;
    --text-muted: #6c7590;
    --bezel-color: #1a1a2e;
    --accent-color: #ff2d6f;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void-bg);
    color: var(--text-primary);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    overflow-x: hidden;
    cursor: crosshair;
    min-height: 100vh;
}

/* Scanline Overlay */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 1px,
        rgba(0, 0, 0, 0.05) 1px,
        rgba(0, 0, 0, 0.05) 2px
    );
    pointer-events: none;
    z-index: 9999;
}

/* Isometric Grid Background */
#isometric-grid {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    opacity: 0;
    z-index: 0;
    background:
        linear-gradient(60deg, transparent 48.5%, rgba(255, 45, 111, 0.12) 48.5%, rgba(255, 45, 111, 0.12) 49.5%, transparent 49.5%) 0 0 / 60px 104px,
        linear-gradient(120deg, transparent 48.5%, rgba(255, 45, 111, 0.12) 48.5%, rgba(255, 45, 111, 0.12) 49.5%, transparent 49.5%) 0 0 / 60px 104px,
        linear-gradient(0deg, transparent 48.5%, rgba(255, 45, 111, 0.08) 48.5%, rgba(255, 45, 111, 0.08) 49.5%, transparent 49.5%) 0 0 / 60px 104px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 80%);
    animation: gridReveal 1.2s 0.4s ease forwards;
}

@keyframes gridReveal {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Particle Canvas */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

/* Infinity Watermark */
#infinity-watermark {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 30vw;
    opacity: 0.4;
    z-index: 1;
    pointer-events: none;
}

#infinity-path {
    stroke-dasharray: 600;
    stroke-dashoffset: 600;
    animation: drawInfinity 12s linear infinite;
}

@keyframes drawInfinity {
    0% { stroke-dashoffset: 600; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -600; }
}

/* Dashboard Layout */
#dashboard {
    position: relative;
    z-index: 2;
    padding: 10vh 5vw 20vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 40px;
    max-width: 1400px;
    margin: 0 auto;
    perspective: 1200px;
}

/* Tiles - General */
.tile {
    opacity: 0;
    transform: translateY(30px) scale(0.96);
    transition: opacity 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

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

.tile-bezel {
    position: relative;
    border: 3px solid var(--bezel-color);
    border-radius: 8px;
    background: var(--panel-bg);
    box-shadow:
        inset 0 0 20px rgba(0, 0, 0, 0.5),
        0 0 40px rgba(255, 45, 111, 0.1);
    overflow: hidden;
    transition: box-shadow 0.4s ease, transform 0.4s ease;
}

.tile:hover .tile-bezel {
    box-shadow:
        inset 0 0 20px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(255, 45, 111, 0.15);
    transform: translateY(-2px);
}

/* Power LED */
.power-led {
    position: absolute;
    top: 10px;
    left: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--neon-mint);
    box-shadow: 0 0 8px var(--neon-mint);
    z-index: 10;
    animation: pulse 3s ease-in-out infinite;
}

.tile:hover .power-led {
    animation: none;
    opacity: 1;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.crt-screen {
    padding: 28px 24px 24px;
    position: relative;
}

.crt-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
    pointer-events: none;
    z-index: 5;
}

.tile-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--text-primary);
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}

/* Tile 1: Hero / Monitor Bank */
.tile-hero {
    grid-column: 1 / -1;
    transform: translate3d(-20px, -10px, -30px) scale(0.96);
    opacity: 0;
}

.tile-hero.visible {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
}

.tile-hero .tile-bezel {
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.5),
        0 0 60px rgba(255, 45, 111, 0.15);
}

.monitor-cluster {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    gap: 16px;
    align-items: stretch;
}

.monitor {
    background: rgba(10, 10, 18, 0.8);
    border: 2px solid var(--bezel-color);
    border-radius: 6px;
    overflow: hidden;
}

.monitor-content {
    padding: 20px;
}

.monitor-main {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.hero-title {
    font-family: 'Bungee', cursive;
    font-weight: 400;
    font-size: clamp(5rem, 15vw, 12rem);
    letter-spacing: 0.06em;
    line-height: 1;
    text-align: center;
    color: transparent;
    -webkit-text-stroke: 1px var(--neon-pink);
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    color: transparent;
    -webkit-text-stroke: 1px var(--neon-pink);
    animation: charReveal 0.4s forwards;
}

@keyframes charReveal {
    0% { opacity: 0; color: #fff; -webkit-text-stroke-color: #fff; }
    30% { opacity: 1; color: #fff; -webkit-text-stroke-color: #fff; }
    100% { opacity: 1; color: transparent; -webkit-text-stroke-color: var(--neon-pink); }
}

.hero-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(1rem, 2.5vw, 2rem);
    text-align: center;
    margin-top: 12px;
    background: linear-gradient(135deg, var(--neon-pink), var(--neon-amber), var(--neon-mint));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.system-readout {
    font-family: 'VT323', monospace;
    font-size: clamp(0.75rem, 1vw, 0.9rem);
    letter-spacing: 0.05em;
    color: var(--neon-mint);
    padding: 12px;
}

.readout-line {
    padding: 2px 0;
    white-space: nowrap;
    overflow: hidden;
}

.monitor-right .system-readout {
    color: var(--neon-amber);
}

/* Tile 2: Memory Archive */
.tile-archive {
    grid-column: 1;
}

.tile-archive.visible {
    transform: translateX(0) translateY(0) scale(1);
}

.photo-board {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 16px 0;
}

.polaroid {
    background: #f0f0e8;
    padding: 12px 12px 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    transform: rotate(-3deg);
    transition: transform 0.3s ease;
}

.polaroid:hover {
    transform: rotate(0deg) scale(1.05);
}

.polaroid-2 {
    transform: rotate(2deg) translateY(8px);
}

.polaroid-2:hover {
    transform: rotate(0deg) scale(1.05);
}

.polaroid-3 {
    transform: rotate(-1deg) translateY(-4px);
}

.polaroid-3:hover {
    transform: rotate(0deg) scale(1.05);
}

.polaroid-image {
    width: 120px;
    height: 100px;
    filter: sepia(0.6) contrast(1.3) brightness(0.9) saturate(0.7) blur(0.3px);
    position: relative;
    overflow: hidden;
}

#photo-1 {
    background: linear-gradient(135deg, #2a1a3e 0%, #4a2a1e 40%, #1a2a3e 70%, #3e2a1a 100%);
}

#photo-2 {
    background: linear-gradient(45deg, #1a1a2e 0%, #2e3a4e 30%, #1e2a1a 60%, #4e3a2e 100%);
}

#photo-3 {
    background: linear-gradient(180deg, #3e2a1a 0%, #1a2a3e 50%, #2a3a1e 100%);
}

.polaroid-image::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 2px,
        rgba(0, 0, 0, 0.15) 4px
    );
}

.polaroid-label {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.65rem;
    color: #4a4a3e;
    text-align: center;
    margin-top: 8px;
    font-weight: 300;
}

/* Tile 3: Infinity Engine */
.tile-engine {
    grid-column: 2;
    grid-row: 2 / 4;
}

.engine-text-container {
    height: 300px;
    overflow: hidden;
    position: relative;
}

.engine-text-container::before,
.engine-text-container::after {
    content: '';
    position: absolute;
    left: 0;
    width: 100%;
    height: 40px;
    z-index: 6;
    pointer-events: none;
}

.engine-text-container::before {
    top: 0;
    background: linear-gradient(to bottom, var(--panel-bg), transparent);
}

.engine-text-container::after {
    bottom: 0;
    background: linear-gradient(to top, var(--panel-bg), transparent);
}

.engine-text-scroll {
    animation: scrollText 60s linear infinite;
}

@keyframes scrollText {
    0% { transform: translateY(0); }
    100% { transform: translateY(-50%); }
}

.engine-text-block p {
    color: var(--text-secondary);
    font-family: 'IBM Plex Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.875rem, 1.2vw, 1.1rem);
    line-height: 1.75;
    letter-spacing: 0.02em;
    margin-bottom: 1.5em;
}

/* Tile 4: Oscilloscope */
.tile-oscilloscope {
    grid-column: 1;
    grid-row: 3;
}

#oscilloscope-canvas {
    width: 100%;
    height: 200px;
    display: block;
    border-radius: 4px;
    background: rgba(10, 10, 18, 0.6);
}

/* Tile 5: Patch Bay */
.tile-patchbay {
    grid-column: 1 / -1;
    grid-row: 4;
}

.patchbay-grid {
    display: flex;
    gap: 24px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 16px 0;
}

.jack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.jack-hole {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid var(--text-muted);
    background: var(--void-bg);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
}

.jack-hole::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s ease, box-shadow 0.3s ease;
}

.jack:hover .jack-hole {
    border-color: var(--accent-color);
    box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 45, 111, 0.3);
}

.jack:hover .jack-hole::after {
    background: var(--accent-color);
    box-shadow: 0 0 12px var(--accent-color);
}

.jack-label {
    font-family: 'VT323', monospace;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.jack:hover .jack-label {
    color: var(--accent-color);
}

/* Tile entrance directions */
.tile-archive {
    transform: translateX(-30px) translateY(30px) scale(0.96);
}

.tile-engine {
    transform: translateY(30px) scale(0.96);
}

.tile-oscilloscope {
    transform: translateX(-30px) translateY(30px) scale(0.96);
}

.tile-patchbay {
    transform: translateY(40px) scale(0.96);
}

/* Responsive */
@media (max-width: 900px) {
    #dashboard {
        grid-template-columns: 1fr;
        padding: 5vh 4vw 15vh;
        gap: 24px;
    }

    .tile-hero, .tile-archive, .tile-engine, .tile-oscilloscope, .tile-patchbay {
        grid-column: 1;
        grid-row: auto;
    }

    .monitor-cluster {
        grid-template-columns: 1fr;
    }

    .monitor-side {
        display: none;
    }

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

    .engine-text-container {
        height: 250px;
    }
}

@media (max-width: 600px) {
    .photo-board {
        flex-direction: column;
        align-items: center;
    }

    .polaroid {
        transform: none;
    }

    .patchbay-grid {
        gap: 16px;
    }
}
