/* ============================================
   MMIDDL.com - Aurora Japanese-Minimal Design
   ============================================ */

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

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

body {
    background-color: #0a0a14;
    color: #e8e4f0;
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 2.0;
    letter-spacing: 0.02em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Scanline Overlay --- */
#scanline-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 2px,
        rgba(10, 10, 20, 0.08) 2px,
        rgba(10, 10, 20, 0.08) 4px
    );
}

/* --- Scroll Progress Indicator --- */
#scroll-progress {
    position: fixed;
    top: 0;
    right: 12px;
    width: 1px;
    height: 100vh;
    background: rgba(107, 104, 128, 0.15);
    z-index: 900;
}

#scroll-progress-fill {
    width: 100%;
    height: 0%;
    background: #0d4f4f;
    opacity: 0.6;
    transition: height 0.1s linear;
}

/* --- Glitch Bands --- */
#glitch-bands {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 800;
}

.glitch-band {
    position: absolute;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #ff6b8a 0%, #2dffb3 50%, transparent 100%);
    mix-blend-mode: screen;
    opacity: 0;
    transform: translateX(0);
    pointer-events: none;
}

.glitch-band.active {
    animation: glitchAppear 2.5s ease-in-out forwards;
}

@keyframes glitchAppear {
    0% {
        opacity: 0;
        transform: translateX(-8px);
    }
    12% {
        opacity: 0.7;
        transform: translateX(6px);
    }
    50% {
        opacity: 0.5;
        transform: translateX(4px);
    }
    100% {
        opacity: 0;
        transform: translateX(0);
    }
}

/* --- Sections --- */
.section {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

/* --- Parallax Layers --- */
.parallax-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    will-change: transform;
}

.parallax-far {
    z-index: 1;
}

.parallax-mid {
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.parallax-near {
    z-index: 3;
    pointer-events: none;
}

/* --- Aurora Backgrounds --- */
.aurora-bg {
    position: absolute;
    top: -10%;
    left: -5%;
    width: 110%;
    height: 120%;
    will-change: background-position;
}

.aurora-hero {
    background: linear-gradient(170deg, #0a0a14 0%, #1a1040 35%, #0d4f4f 70%, #0a0a14 100%);
    background-size: 200% 200%;
    animation: auroraShift 20s ease-in-out infinite;
}

.aurora-vignette {
    background: radial-gradient(ellipse at 50% 0%, #1a1040 0%, #0a0a14 80%);
    background-size: 200% 200%;
    animation: auroraShift 25s ease-in-out infinite;
    animation-delay: -5s;
}

.aurora-gallery {
    background: linear-gradient(170deg, #0a0a14 0%, #1a1040 25%, #0d4f4f 55%, #1a1040 80%, #0a0a14 100%);
    background-size: 200% 200%;
    animation: auroraShift 22s ease-in-out infinite;
    animation-delay: -8s;
}

.aurora-statement {
    background: linear-gradient(170deg, #0a0a14 0%, #0d4f4f 30%, #1a1040 60%, #0d4f4f 85%, #0a0a14 100%);
    background-size: 200% 200%;
    animation: auroraShift 24s ease-in-out infinite;
    animation-delay: -12s;
}

.aurora-coda {
    background: radial-gradient(ellipse at 50% 50%, #1a1040 0%, #0a0a14 60%, #0a0a14 100%);
    background-size: 200% 200%;
    animation: auroraFade 20s ease-in-out infinite;
}

@keyframes auroraShift {
    0% {
        background-position: 0% 0%;
    }
    25% {
        background-position: 50% 30%;
    }
    50% {
        background-position: 100% 50%;
    }
    75% {
        background-position: 50% 70%;
    }
    100% {
        background-position: 0% 0%;
    }
}

@keyframes auroraFade {
    0% {
        background-position: 50% 50%;
        opacity: 1;
    }
    50% {
        background-position: 50% 45%;
        opacity: 0.85;
    }
    100% {
        background-position: 50% 50%;
        opacity: 1;
    }
}

/* --- Typography --- */
.hero-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 300;
    font-size: clamp(4rem, 12vw, 10rem);
    letter-spacing: 0.08em;
    line-height: 1.1;
    color: #e8e4f0;
    text-align: center;
}

.section-heading {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: #e8e4f0;
    margin-bottom: 4vh;
}

.body-text {
    font-family: 'Karla', sans-serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.1vw, 1.15rem);
    line-height: 2.0;
    letter-spacing: 0.02em;
    color: #e8e4f0;
    margin-bottom: 3vh;
}

.body-text:last-child {
    margin-bottom: 0;
}

/* --- Section 1: Hero --- */
.hero-content {
    text-align: center;
    position: relative;
}

.hero-line {
    width: 0;
    height: 1px;
    background: #e8e4f0;
    margin: 3vh auto 0;
    opacity: 0.4;
}

.hero-line.animate {
    animation: lineExpand 3s ease-in-out forwards;
}

@keyframes lineExpand {
    0% {
        width: 0;
    }
    100% {
        width: min(60vw, 400px);
    }
}

/* --- Rain Particles --- */
#rain-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.rain-drop {
    position: absolute;
    width: 1px;
    background: #6b6880;
    top: -20px;
    animation: rainFall linear infinite;
}

@keyframes rainFall {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }
    10% {
        opacity: var(--rain-opacity, 0.25);
    }
    90% {
        opacity: var(--rain-opacity, 0.25);
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* --- Section 2: Vignette --- */
.vignette-content {
    max-width: 480px;
    width: 90%;
    position: relative;
    padding: 4vh 0;
}

/* --- Corner Marks --- */
.corner-mark {
    position: absolute;
    width: 12px;
    height: 12px;
}

.corner-mark::before,
.corner-mark::after {
    content: '';
    position: absolute;
    background: #0d4f4f;
}

.corner-top-left {
    top: -8px;
    left: -16px;
}

.corner-top-left::before {
    top: 0;
    left: 0;
    width: 12px;
    height: 1px;
}

.corner-top-left::after {
    top: 0;
    left: 0;
    width: 1px;
    height: 12px;
}

.corner-bottom-right {
    bottom: -8px;
    right: -16px;
}

.corner-bottom-right::before {
    bottom: 0;
    right: 0;
    width: 12px;
    height: 1px;
}

.corner-bottom-right::after {
    bottom: 0;
    right: 0;
    width: 1px;
    height: 12px;
}

/* --- Calligraphic Marks --- */
.calligraphic-mark {
    position: absolute;
    pointer-events: none;
}

.mark-1 {
    width: 250px;
    height: 375px;
    right: 8vw;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.15;
}

.mark-2 {
    width: 300px;
    height: 300px;
    left: 6vw;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.15;
}

/* --- Skyline Strips --- */
.skyline-strip {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    z-index: 4;
    will-change: transform;
}

.skyline-svg {
    width: 100%;
    height: 100%;
}

/* --- Section 3: Gallery --- */
.gallery-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(16px, 3vw, 40px);
    width: 90%;
    max-width: 900px;
    height: 70vh;
}

.gallery-panel {
    flex: 0 0 auto;
    width: clamp(100px, 18vw, 200px);
    height: clamp(250px, 45vh, 500px);
    position: relative;
    overflow: hidden;
    will-change: transform;
}

.panel-inner {
    width: 100%;
    height: 100%;
    position: relative;
}

.panel-gradient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.panel-gradient-1 {
    background: linear-gradient(180deg, #1a1040 0%, #0d4f4f 50%, #0a0a14 100%);
    opacity: 0.6;
}

.panel-gradient-2 {
    background: linear-gradient(180deg, #0d4f4f 0%, #1a1040 40%, #0a0a14 100%);
    opacity: 0.7;
}

.panel-gradient-3 {
    background: linear-gradient(180deg, #0a0a14 0%, #0d4f4f 60%, #1a1040 100%);
    opacity: 0.6;
}

.panel-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* --- Section 4: Statement --- */
.statement-content {
    max-width: 540px;
    width: 90%;
    position: relative;
    padding: 4vh 0;
}

/* --- Section 5: Coda --- */
.coda-content {
    display: flex;
    align-items: center;
    justify-content: center;
}

.coda-mark {
    width: 60px;
    height: 60px;
}

.coda-mark svg {
    width: 100%;
    height: 100%;
}

/* --- Skeleton Loading --- */
.skeleton {
    position: absolute;
    background: #1a1040;
    border-radius: 4px;
    overflow: hidden;
}

.skeleton::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        #1a1040 40%,
        rgba(26, 16, 64, 0.6) 50%,
        #1a1040 60%,
        transparent 100%
    );
    animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

/* Skeleton sizing */
.skeleton-hero {
    width: clamp(200px, 60vw, 600px);
    height: clamp(60px, 12vw, 120px);
    position: relative;
}

.skeleton-heading {
    width: clamp(150px, 40vw, 350px);
    height: clamp(30px, 5vw, 50px);
    position: relative;
    margin-bottom: 4vh;
}

.skeleton-text {
    width: 100%;
    height: 80px;
    position: relative;
    margin-bottom: 3vh;
}

.skeleton-short {
    width: 70%;
    height: 50px;
}

.skeleton-panel {
    width: clamp(100px, 18vw, 200px);
    height: clamp(250px, 45vh, 500px);
    position: relative;
}

.skeleton-mark {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    position: relative;
}

/* Content reveal state */
.content-reveal {
    opacity: 0;
    transition: opacity 0.4s ease-in-out 0.1s;
}

.content-reveal.revealed {
    opacity: 1;
}

.skeleton.dissolved {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    pointer-events: none;
}

/* Hero skeleton positioning */
#section-hero .skeleton-hero {
    display: block;
    margin: 0 auto;
}

/* Vignette skeletons */
.vignette-content .skeleton {
    position: relative;
    display: block;
}

/* Statement skeletons */
.statement-content .skeleton {
    position: relative;
    display: block;
}

/* Gallery skeletons */
.gallery-content .skeleton-panel {
    display: block;
}

/* Coda skeleton */
.coda-content .skeleton-mark {
    display: block;
}

/* --- Aurora Green Flash on Reveal --- */
.content-reveal.flash {
    text-shadow: 0 0 20px rgba(45, 255, 179, 0.4);
    transition: text-shadow 0.6s ease-out, opacity 0.4s ease-in-out 0.1s;
}

.content-reveal.flash-done {
    text-shadow: none;
    transition: text-shadow 1s ease-out;
}

/* --- Responsive: Mobile --- */
@media (max-width: 768px) {
    .mark-1,
    .mark-2 {
        display: none;
    }

    .corner-mark {
        display: none;
    }

    .gallery-content {
        gap: 12px;
    }

    .gallery-panel {
        width: clamp(80px, 25vw, 140px);
        height: clamp(200px, 40vh, 350px);
    }

    .vignette-content,
    .statement-content {
        width: 85%;
        margin: 0 auto;
    }

    #scroll-progress {
        right: 6px;
    }

    .skyline-strip {
        height: 50px;
    }
}
