/* ============================================
   mujun.works — Playful Chrome Toybox
   Diagonal sections, inflated chrome, marble
   ============================================ */

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

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

body {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #6b7280;
    background: #1a1a2e;
    overflow-x: hidden;
}

/* --- Color Variables --- */
:root {
    --chrome-base: #c0c0c0;
    --chrome-highlight: #e5e4e2;
    --chrome-shadow: #2c3e50;
    --marble-white: #f5f0eb;
    --marble-vein: #9e8e7e;
    --accent-lavender: #8b5cf6;
    --deep-ground: #1a1a2e;
    --accent-mint: #6ee7b7;
    --chrome-mid: #8e8e8e;
}

/* --- Floating Navigation Pill --- */
#nav-pill {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%) rotate(-12deg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 12px;
    background: linear-gradient(135deg, rgba(44,62,80,0.7) 0%, rgba(192,192,192,0.3) 50%, rgba(44,62,80,0.7) 100%);
    backdrop-filter: blur(12px);
    border-radius: 999px;
    border: 1px solid rgba(192,192,192,0.2);
}

.nav-label {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(192, 192, 192, 0.8);
    cursor: pointer;
    transition: color 0.3s ease, transform 0.3s ease;
    writing-mode: vertical-rl;
    text-orientation: mixed;
}

.nav-label:hover {
    color: var(--accent-lavender);
    transform: scale(1.1);
}

.nav-label.active {
    color: var(--accent-mint);
}

/* --- Stage Base --- */
.stage {
    position: relative;
    width: 100vw;
    overflow: hidden;
}

/* --- Stage 0: The Inflation --- */
#stage-0 {
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--deep-ground);
}

.stage-0-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 50%, rgba(44,62,80,0.4) 0%, var(--deep-ground) 70%);
}

/* Chrome Sphere Base */
.chrome-sphere {
    border-radius: 50%;
    position: relative;
    background: radial-gradient(circle at 30% 30%, #e5e4e2 0%, #c0c0c0 25%, #8e8e8e 50%, #2c3e50 80%, #1a1a2e 100%);
    z-index: 2;
}

.chrome-sphere::before {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(ellipse at 35% 25%, rgba(255,255,255,0.9) 0%, transparent 50%);
    width: 60%;
    height: 50%;
    top: 8%;
    left: 12%;
}

/* Inflation sphere initial state */
#inflation-sphere {
    width: 20px;
    height: 20px;
    animation: inflate 2.5s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    z-index: 2;
}

@keyframes inflate {
    0% {
        width: 20px;
        height: 20px;
    }
    100% {
        width: min(400px, 50vw);
        height: min(400px, 50vw);
    }
}

/* Post-inflation drift */
#inflation-sphere.inflated {
    animation: drift 8s ease-in-out infinite alternate;
}

@keyframes drift {
    0% { transform: translateY(0); }
    100% { transform: translateY(-30px); }
}

/* Title Reveal */
#title-reveal {
    position: relative;
    z-index: 3;
    margin-top: 40px;
    opacity: 0;
}

#title-reveal.visible {
    opacity: 1;
}

#domain-title {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3.5rem, 8vw, 7rem);
    color: var(--chrome-highlight);
    text-shadow:
        0 1px 0 #c0c0c0,
        0 2px 0 #b0b0b0,
        0 3px 0 #a0a0a0,
        0 4px 0 #909090,
        0 5px 8px rgba(0,0,0,0.15);
    display: inline-block;
}

#domain-title span {
    display: inline-block;
    opacity: 0;
    transform: translateY(20px);
}

#domain-title span.revealed {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

.letter-works {
    color: var(--accent-lavender);
}

.letter-dot {
    color: var(--chrome-base);
}

/* --- Diagonal Sections --- */
.diagonal-section {
    min-height: 100vh;
    position: relative;
}

.diagonal-left {
    clip-path: polygon(0 8vh, 100% 0, 100% calc(100% - 8vh), 0 100%);
    margin-top: -8vh;
}

.diagonal-right {
    clip-path: polygon(0 0, 100% 8vh, 100% 100%, 0 calc(100% - 8vh));
    margin-top: -8vh;
}

/* --- Chrome Gradient Background --- */
.chrome-gradient-bg {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #2c3e50 0%, #c0c0c0 40%, #e5e4e2 50%, #c0c0c0 60%, #2c3e50 100%);
    background-size: 200% 200%;
    animation: chromeShift 12s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes chromeShift {
    0% { background-position: 0% 0%; }
    100% { background-position: 100% 100%; }
}

/* --- Marble Background --- */
.marble-bg {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 30%, rgba(158,142,126,0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(158,142,126,0.1) 0%, transparent 40%),
        radial-gradient(ellipse at 40% 80%, rgba(158,142,126,0.08) 0%, transparent 45%),
        radial-gradient(ellipse at 80% 20%, rgba(158,142,126,0.15) 0%, transparent 35%),
        radial-gradient(ellipse at 55% 45%, rgba(158,142,126,0.06) 0%, transparent 55%),
        linear-gradient(135deg, #f5f0eb 0%, #ece7e1 100%);
    filter: contrast(1.1) brightness(1.02);
    z-index: 0;
}

/* --- Marble Gutter --- */
.marble-gutter {
    position: absolute;
    left: 0;
    right: 0;
    height: 20px;
    background:
        radial-gradient(ellipse at 30% 50%, rgba(158,142,126,0.2) 0%, transparent 70%),
        radial-gradient(ellipse at 70% 50%, rgba(158,142,126,0.15) 0%, transparent 60%),
        linear-gradient(90deg, #f5f0eb, #ece7e1, #f5f0eb);
    z-index: 5;
}

.marble-gutter-bottom {
    bottom: 0;
}

/* --- Diagonal Content --- */
.diagonal-content {
    position: relative;
    z-index: 2;
    padding: 15vh 5vw;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-downhill-right {
    align-items: flex-end;
    justify-content: flex-end;
    text-align: right;
    padding-right: 10vw;
    padding-bottom: 20vh;
}

.content-downhill-left {
    align-items: flex-start;
    justify-content: flex-end;
    text-align: left;
    padding-left: 10vw;
    padding-bottom: 20vh;
}

/* --- Section Labels --- */
.section-label {
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(192, 192, 192, 0.8);
    margin-bottom: 2rem;
    position: relative;
    display: inline-block;
    padding: 6px 16px;
    background: rgba(192,192,192,0.08);
    backdrop-filter: brightness(1.2);
    border-radius: 4px;
}

.section-label-dark {
    color: rgba(158,142,126,0.8);
    background: rgba(158,142,126,0.08);
}

/* --- Statement Text --- */
.statement {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    color: var(--marble-white);
    line-height: 1.15;
    max-width: 65vw;
    text-shadow:
        0 1px 0 #c0c0c0,
        0 2px 0 #b0b0b0,
        0 3px 0 #a0a0a0,
        0 4px 0 #909090,
        0 5px 8px rgba(0,0,0,0.15);
}

/* --- Body Text --- */
.body-text {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.2vw, 1.15rem);
    line-height: 1.72;
    letter-spacing: 0.01em;
    color: #6b7280;
    max-width: 55ch;
    margin-bottom: 1.5rem;
}

.marble-content-block {
    max-width: 600px;
}

/* --- Fade Reveal Animation --- */
.fade-reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.fade-reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Chrome Capsules --- */
.chrome-capsule {
    position: absolute;
    border-radius: 999px;
    background: linear-gradient(135deg, #2c3e50 0%, #c0c0c0 40%, #e5e4e2 50%, #c0c0c0 60%, #2c3e50 100%);
    z-index: 1;
}

.chrome-capsule::before {
    content: '';
    position: absolute;
    top: 10%;
    left: 15%;
    width: 50%;
    height: 30%;
    border-radius: 999px;
    background: radial-gradient(ellipse at 40% 30%, rgba(255,255,255,0.7) 0%, transparent 60%);
}

.capsule-left {
    width: 180px;
    height: 60px;
    left: 5vw;
    top: 30%;
    transform: rotate(-25deg);
}

.capsule-right {
    width: 140px;
    height: 50px;
    right: -30px;
    top: 50%;
    transform: rotate(15deg);
}

/* --- Chrome Sphere Variants --- */
.sphere-resting {
    position: absolute;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.sphere-sm {
    width: 40px;
    height: 40px;
    bottom: 25%;
    right: 65%;
}

.sphere-md {
    width: 90px;
    height: 90px;
    bottom: 18%;
    right: 45%;
}

.sphere-lg {
    width: 150px;
    height: 150px;
    bottom: 12%;
    right: 20%;
}

/* --- Toroid Container --- */
.toroid-container {
    position: relative;
    width: 100%;
    max-width: 800px;
    height: 60vh;
    margin: 0 auto;
}

.chrome-toroid {
    position: absolute;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.4s ease;
    cursor: pointer;
    filter: drop-shadow(0 8px 24px rgba(0,0,0,0.3));
}

.toroid-1 {
    width: min(250px, 35vw);
    height: min(250px, 35vw);
    top: 5%;
    left: 25%;
    animation: rotateToroid1 25s linear infinite;
}

.toroid-2 {
    width: min(200px, 28vw);
    height: min(200px, 28vw);
    top: 40%;
    right: 15%;
    animation: rotateToroid2 35s linear infinite;
}

.toroid-3 {
    width: min(180px, 25vw);
    height: min(180px, 25vw);
    bottom: 5%;
    left: 10%;
    animation: rotateToroid3 45s linear infinite;
}

.chrome-toroid:hover {
    transform: scale(1.05);
    filter: drop-shadow(0 12px 32px rgba(139,92,246,0.3)) brightness(1.1) hue-rotate(30deg);
}

@keyframes rotateToroid1 {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes rotateToroid2 {
    from { transform: rotate(0deg); }
    to { transform: rotate(-360deg); }
}

@keyframes rotateToroid3 {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* --- Column Fragments --- */
.column-fragment {
    position: absolute;
    border-radius: 50% 50% 0 0;
    background:
        radial-gradient(ellipse at 30% 40%, rgba(158,142,126,0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(158,142,126,0.1) 0%, transparent 40%),
        linear-gradient(180deg, #f5f0eb 0%, #ece7e1 100%);
    filter: contrast(1.05) brightness(1.01);
    box-shadow: 4px 4px 16px rgba(0,0,0,0.15);
    z-index: 1;
}

.fragment-1 {
    width: 40px;
    height: 280px;
    bottom: 10%;
    left: 8%;
}

.fragment-2 {
    width: 35px;
    height: 200px;
    bottom: 15%;
    right: 30%;
}

.fragment-3 {
    width: 50px;
    height: 350px;
    bottom: 5%;
    right: 8%;
}

/* --- Gallery Content --- */
.gallery-content {
    align-items: center;
    justify-content: center;
    min-height: 120vh;
}

/* --- Stage 4: Dissolution --- */
.dissolution {
    min-height: 100vh;
}

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

#domain-final {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: clamp(3rem, 6vw, 5rem);
}

.final-text {
    color: var(--marble-vein);
}

.sphere-tiny {
    width: 15px;
    height: 15px;
    margin-top: 3rem;
    background: radial-gradient(circle at 30% 30%, var(--accent-mint) 0%, #2c3e50 80%);
    animation: pulse 3s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(110, 231, 183, 0.4);
}

.sphere-tiny::before {
    background: radial-gradient(ellipse at 35% 25%, rgba(255,255,255,0.9) 0%, transparent 50%);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(110, 231, 183, 0.4);
    }
    50% {
        transform: scale(1.3);
        box-shadow: 0 0 40px rgba(110, 231, 183, 0.6);
    }
}

/* --- Acanthus Echo --- */
.acanthus-echo {
    position: absolute;
    bottom: 10%;
    left: 5%;
    width: 90%;
    height: 60px;
    z-index: 1;
    opacity: 0.5;
}

/* --- Marble Expanding (Stage 4) --- */
.marble-expanding {
    transition: opacity 1s ease;
}

/* --- Inflated Interactive Elements --- */
button, .interactive-element {
    border-radius: 999px;
    background: linear-gradient(135deg, #2c3e50 0%, #c0c0c0 40%, #e5e4e2 50%, #c0c0c0 60%, #2c3e50 100%);
    border: none;
    padding: 12px 32px;
    color: var(--marble-white);
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    cursor: pointer;
    box-shadow:
        0 4px 8px rgba(0,0,0,0.2),
        0 8px 24px rgba(0,0,0,0.1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

button:hover, .interactive-element:hover {
    transform: scale(1.03);
    box-shadow:
        0 6px 12px rgba(0,0,0,0.25),
        0 12px 32px rgba(0,0,0,0.15);
}

button:active, .interactive-element:active {
    transform: scale(0.97);
    box-shadow:
        0 2px 4px rgba(0,0,0,0.2),
        0 4px 12px rgba(0,0,0,0.1);
}

/* --- Headline Chrome Hover Effect --- */
.statement:hover {
    text-shadow:
        0 1px 0 #c0c0c0,
        0 2px 0 #c0c0c0,
        0 3px 4px rgba(0,0,0,0.1);
    transition: text-shadow 0.4s ease-out;
}

/* --- Stage sizing --- */
#stage-1 {
    min-height: 110vh;
}

#stage-2 {
    min-height: 100vh;
}

#stage-3 {
    min-height: 130vh;
}

#stage-4 {
    min-height: 100vh;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    #nav-pill {
        right: 10px;
        padding: 10px 8px;
        gap: 8px;
    }

    .nav-label {
        font-size: 0.6rem;
    }

    .diagonal-content {
        padding: 12vh 4vw;
    }

    .content-downhill-right {
        padding-right: 5vw;
        align-items: center;
        text-align: center;
    }

    .content-downhill-left {
        padding-left: 5vw;
        align-items: center;
        text-align: center;
    }

    .capsule-left, .capsule-right {
        display: none;
    }

    .toroid-container {
        height: 50vh;
    }

    .column-fragment {
        display: none;
    }

    .diagonal-left {
        clip-path: polygon(0 4vh, 100% 0, 100% calc(100% - 4vh), 0 100%);
        margin-top: -4vh;
    }

    .diagonal-right {
        clip-path: polygon(0 0, 100% 4vh, 100% 100%, 0 calc(100% - 4vh));
        margin-top: -4vh;
    }

    .sphere-lg {
        width: 80px;
        height: 80px;
    }

    .sphere-md {
        width: 50px;
        height: 50px;
    }
}