/* ===========================
   mujun.art — Zen Atelier
   ========================= */

:root {
    --kuro: #0a0a0a;
    --sumi: #141210;
    --kin: #c9a84c;
    --kinsabi: #8b7432;
    --shiro: #e8e0d0;
    --hai: #9a9285;
    --kumo: #1a1815;
    --akane: #b85c3a;
    --code-bg: #0d0b08;
}

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

html {
    scroll-behavior: smooth;
}

body.mujun-atelier {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    background: var(--kuro);
    color: var(--shiro);
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
    overflow: hidden;
}

/* ===========================
   Gold Dust Seam
   ========================= */

.gold-dust-seam {
    position: fixed;
    left: 240px;
    top: 0;
    bottom: 0;
    width: 2px;
    z-index: 10;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 8px,
        rgba(201, 168, 76, 0.25) 8px,
        rgba(201, 168, 76, 0.25) 9px,
        transparent 9px,
        transparent 20px
    );
    background-size: 2px 60px;
    animation: dustDrift 8s linear infinite;
}

@keyframes dustDrift {
    0% { background-position: 0 0; }
    100% { background-position: 0 60px; }
}

/* ===========================
   Sidebar
   ========================= */

.koan-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 240px;
    background: rgba(10, 10, 10, 0.92);
    border-right: 1px solid rgba(201, 168, 76, 0.15);
    z-index: 20;
    display: flex;
    flex-direction: column;
    padding: 48px 24px 24px;
    overflow-y: auto;
}

.sidebar-title {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.85rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--kin);
    margin-bottom: 48px;
}

.koan-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.koan-link {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 12px;
    text-decoration: none;
    color: var(--kinsabi);
    border-left: 2px solid transparent;
    transition: color 0.4s ease, border-color 0.4s ease;
    border-radius: 0;
}

.koan-link:hover {
    color: var(--shiro);
}

.koan-link.active {
    color: var(--kin);
    border-left-color: var(--kin);
}

.koan-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.koan-name {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 300;
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.4;
}

/* ===========================
   Mobile Menu Toggle
   ========================= */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 100;
    background: rgba(10, 10, 10, 0.9);
    border: 1px solid rgba(201, 168, 76, 0.3);
    padding: 8px;
    cursor: pointer;
    border-radius: 2px;
}

/* ===========================
   Main Content / Frames
   ========================= */

.koan-frames {
    grid-column: 2;
    height: 100vh;
    overflow-y: auto;
    scroll-snap-type: y mandatory;
}

.koan-frame {
    height: 100vh;
    scroll-snap-align: start;
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 0;
    position: relative;
    border-bottom: 1px solid rgba(201, 168, 76, 0.3);
}

/* ===========================
   Frame Canvas
   ========================= */

.frame-canvas {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 40px;
}

.ambient-blob {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0.04;
    mix-blend-mode: screen;
}

.blob-path {
    animation: blobMorph 20s ease-in-out infinite alternate;
}

@keyframes blobMorph {
    0% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.05) rotate(2deg); }
    50% { transform: scale(0.95) rotate(-1deg); }
    75% { transform: scale(1.03) rotate(1.5deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.koan-svg {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 80%;
    max-width: 700px;
}

.draw-path {
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke-dashoffset 4s ease-in-out;
}

/* ===========================
   Glassmorphic Tutorial Card
   ========================= */

.frame-tutorial.glassmorphic-card {
    background: rgba(26, 24, 21, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-left: 1px solid rgba(201, 168, 76, 0.12);
    border-radius: 0;
    padding: 48px 32px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 24px;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease 0.8s, transform 0.8s ease 0.8s;
}

.frame-tutorial.glassmorphic-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.koan-statement {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-style: italic;
    font-size: clamp(1.6rem, 3vw, 2.8rem);
    letter-spacing: 0.04em;
    color: var(--kin);
    line-height: 1.3;
}

.koan-explanation {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.72;
    color: var(--shiro);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.koan-explanation em {
    font-weight: 500;
    color: var(--kin);
    font-style: normal;
}

.koan-code {
    background: var(--code-bg);
    border: 1px solid rgba(201, 168, 76, 0.08);
    border-radius: 2px;
    padding: 20px;
    overflow-x: auto;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.6;
    tab-size: 2;
    color: var(--shiro);
}

.code-comment { color: var(--hai); }
.code-keyword { color: var(--kin); }
.code-string { color: var(--akane); }
.code-number { color: #e8e0d0; }

/* ===========================
   Responsive
   ========================= */

@media (max-width: 768px) {
    body.mujun-atelier {
        grid-template-columns: 1fr;
    }

    .koan-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .koan-sidebar.open {
        transform: translateX(0);
    }

    .mobile-menu-toggle {
        display: block;
    }

    .gold-dust-seam {
        display: none;
    }

    .koan-frames {
        grid-column: 1;
    }

    .koan-frame {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
    }

    .frame-tutorial.glassmorphic-card {
        padding: 24px 20px;
        border-left: none;
        border-top: 1px solid rgba(201, 168, 76, 0.12);
    }
}
