/* ============================================
   mujun.io — Retro Duotone Circuit Lab
   ============================================ */

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

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

body {
    background-color: #F6F4F0;
    color: #1A1A28;
    font-family: 'Work Sans', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.85;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, .hero-title, .section-heading, .terminus-title {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    color: #1A1A28;
    letter-spacing: 0.02em;
}

.hero-title {
    font-size: clamp(4rem, 12vw, 10rem);
    line-height: 0.95;
    position: relative;
}

.section-heading {
    font-size: clamp(2.5rem, 6vw, 5rem);
    line-height: 1.05;
    margin-bottom: 2rem;
}

.terminus-title {
    font-size: clamp(3rem, 8vw, 7rem);
    line-height: 0.95;
}

.body-text {
    font-family: 'Work Sans', sans-serif;
    font-weight: 300;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.85;
    color: #4A4A58;
    max-width: 480px;
}

.code-label {
    font-family: 'Fira Code', monospace;
    font-weight: 400;
    font-size: 0.75rem;
    color: #D05030;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    display: inline-block;
    margin-bottom: 1.5rem;
}

/* --- Layout: Ma Negative Space --- */
.section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8rem 2rem;
    position: relative;
}

.ma-container {
    width: 50%;
    max-width: 600px;
    position: relative;
    opacity: 0;
    transform: translateY(40px);
    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);
}

.ma-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.ma-center {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.ma-center .body-text {
    margin-left: auto;
    margin-right: auto;
}

.ma-offset-left {
    margin-right: auto;
    margin-left: 12%;
}

.ma-offset-right {
    margin-left: auto;
    margin-right: 12%;
    text-align: right;
}

.ma-offset-right .body-text {
    margin-left: auto;
}

/* --- Hero Section --- */
#hero {
    min-height: 100vh;
}

#hero .ma-container {
    opacity: 1;
    transform: translateY(0);
}

.hero-label {
    margin-top: 2rem;
}

.hero-label .code-label {
    margin-bottom: 0;
}

/* --- Circuit SVG Overlay --- */
#circuit-svg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.circuit-line {
    fill: none;
    stroke: #1A1A28;
    stroke-width: 1.5;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
    transition: stroke-dashoffset 0.05s linear;
}

/* --- Circuit Nodes --- */
.circuit-node {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #D05030;
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.6s ease, box-shadow 0.6s ease;
    z-index: 2;
}

.ma-offset-left .circuit-node {
    left: -30px;
    top: 0;
    transform: none;
}

.ma-offset-right .circuit-node {
    left: auto;
    right: -30px;
    top: 0;
    transform: none;
}

.circuit-node.pulse {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(208, 80, 48, 0.5);
    animation: nodePulse 2s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite;
}

@keyframes nodePulse {
    0% {
        box-shadow: 0 0 0 0 rgba(208, 80, 48, 0.5);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(208, 80, 48, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(208, 80, 48, 0);
    }
}

/* --- Organic Blobs --- */
.blob {
    position: fixed;
    border-radius: 30% 70% 60% 40% / 50% 40% 60% 50%;
    background-color: rgba(208, 80, 48, 0.08);
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transition: opacity 1.5s ease;
}

.blob.visible {
    opacity: 1;
}

.blob-1 {
    width: 500px;
    height: 500px;
    top: 5vh;
    right: -100px;
    animation: blobMorph1 20s ease-in-out infinite;
}

.blob-2 {
    width: 400px;
    height: 400px;
    top: 40vh;
    left: -80px;
    border-radius: 60% 40% 30% 70% / 40% 60% 40% 60%;
    animation: blobMorph2 25s ease-in-out infinite;
}

.blob-3 {
    width: 350px;
    height: 350px;
    bottom: 20vh;
    right: 10vw;
    border-radius: 40% 60% 70% 30% / 60% 30% 70% 40%;
    animation: blobMorph3 22s ease-in-out infinite;
}

.blob-4 {
    width: 450px;
    height: 450px;
    bottom: -50px;
    left: 15vw;
    border-radius: 70% 30% 50% 50% / 30% 70% 30% 70%;
    animation: blobMorph4 18s ease-in-out infinite;
}

@keyframes blobMorph1 {
    0%, 100% { border-radius: 30% 70% 60% 40% / 50% 40% 60% 50%; }
    25% { border-radius: 50% 50% 40% 60% / 40% 60% 50% 50%; }
    50% { border-radius: 40% 60% 50% 50% / 60% 40% 40% 60%; }
    75% { border-radius: 60% 40% 70% 30% / 50% 50% 60% 40%; }
}

@keyframes blobMorph2 {
    0%, 100% { border-radius: 60% 40% 30% 70% / 40% 60% 40% 60%; }
    33% { border-radius: 40% 60% 50% 50% / 60% 40% 60% 40%; }
    66% { border-radius: 50% 50% 60% 40% / 40% 50% 50% 60%; }
}

@keyframes blobMorph3 {
    0%, 100% { border-radius: 40% 60% 70% 30% / 60% 30% 70% 40%; }
    50% { border-radius: 60% 40% 30% 70% / 40% 70% 30% 60%; }
}

@keyframes blobMorph4 {
    0%, 100% { border-radius: 70% 30% 50% 50% / 30% 70% 30% 70%; }
    33% { border-radius: 50% 50% 30% 70% / 50% 50% 70% 30%; }
    66% { border-radius: 30% 70% 70% 30% / 70% 30% 50% 50%; }
}

/* --- Duotone Swatches --- */
.duotone-grid {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin: 3rem 0;
}

.duotone-swatch {
    width: 120px;
    height: 120px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.75rem;
}

.duotone-swatch .code-label {
    margin-bottom: 0;
    font-size: 0.65rem;
}

.swatch-indigo {
    background-color: #1A1A28;
    border-radius: 4px;
}

.swatch-indigo .code-label {
    color: #F6F4F0;
}

.swatch-red {
    background-color: #D05030;
    border-radius: 4px;
}

.swatch-red .code-label {
    color: #F6F4F0;
}

/* --- Terminus --- */
.section-terminus {
    min-height: 60vh;
}

.terminus-text {
    margin-top: 1.5rem;
}

/* --- Content z-index --- */
.section {
    position: relative;
    z-index: 2;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .ma-container {
        width: 80%;
    }

    .ma-offset-left {
        margin-left: 5%;
    }

    .ma-offset-right {
        margin-right: 5%;
    }

    .blob-1 {
        width: 300px;
        height: 300px;
    }

    .blob-2 {
        width: 250px;
        height: 250px;
    }

    .blob-3 {
        width: 200px;
        height: 200px;
    }

    .blob-4 {
        width: 280px;
        height: 280px;
    }

    .duotone-grid {
        gap: 1.5rem;
    }

    .duotone-swatch {
        width: 90px;
        height: 90px;
    }
}

@media (max-width: 480px) {
    .ma-container {
        width: 90%;
    }

    .ma-offset-left {
        margin-left: 2%;
    }

    .ma-offset-right {
        margin-right: 2%;
    }

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

    .section {
        padding: 6rem 1.5rem;
    }
}
