/* ============================================
   MasqueradeProtocol.com - Styles
   Palette: Triadic Neon (Magenta/Cyan/Gold)
   Aesthetic: Vaporwave Masquerade
   ============================================ */

/* CSS Custom Properties Registration */
@property --accent-hue {
    syntax: '<number>';
    initial-value: 330;
    inherits: true;
}

@property --ring-scale {
    syntax: '<number>';
    initial-value: 1;
    inherits: false;
}

/* ---- Root Variables ---- */
:root {
    --deep-bg: #0D0221;
    --surface-bg: #1A0533;
    --neon-magenta: #FF2D95;
    --neon-cyan: #00F5D4;
    --neon-gold: #FFD700;
    --text-primary: #E8E0F0;
    --text-secondary: #B8A9D4;
    --glass-purple: rgba(138, 43, 226, 0.15);

    --accent-color: var(--neon-magenta);
    --accent-hue: 330;
    --ring-scale: 1;
}

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

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

body {
    background: var(--deep-bg);
    color: var(--text-primary);
    font-family: 'Quicksand', sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Bubbles Container ---- */
#bubbles-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    mix-blend-mode: screen;
    pointer-events: none;
    will-change: transform, opacity, border-radius;
}

.bubble-hero {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-width: 1px;
    border-style: solid;
    background: radial-gradient(circle at 30% 30%, transparent 0%, var(--glass-purple) 100%);
}

.bubble-accent {
    border: none;
}

/* ---- Concentric Rings ---- */
#concentric-rings {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ring {
    position: absolute;
    border: 1.5px solid var(--accent-color);
    border-radius: 24px;
    transition: border-radius 1.2s cubic-bezier(0.23, 1, 0.32, 1),
                transform 1.2s cubic-bezier(0.23, 1, 0.32, 1),
                opacity 1.2s cubic-bezier(0.23, 1, 0.32, 1),
                border-color 1.2s ease;
    will-change: transform, opacity, border-radius;
}

.ring-1 {
    width: 62%;
    height: 70%;
    opacity: 0.4;
    animation: ringPulse1 6s ease-in-out infinite;
}

.ring-2 {
    width: 70%;
    height: 78%;
    opacity: 0.3;
    animation: ringPulse2 6s ease-in-out infinite 0.4s;
}

.ring-3 {
    width: 78%;
    height: 86%;
    opacity: 0.2;
    animation: ringPulse3 6s ease-in-out infinite 0.8s;
}

.ring-4 {
    width: 86%;
    height: 92%;
    opacity: 0.1;
    animation: ringPulse4 6s ease-in-out infinite 1.2s;
}

.ring-5 {
    width: 94%;
    height: 98%;
    opacity: 0.05;
    animation: ringPulse5 6s ease-in-out infinite 1.6s;
}

@keyframes ringPulse1 {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

@keyframes ringPulse2 {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes ringPulse3 {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes ringPulse4 {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes ringPulse5 {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}

/* ---- Mask Layers (Sections) ---- */
.mask-layer {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
    contain: layout paint;
    overflow: hidden;
}

.mask-content {
    position: relative;
    width: 60%;
    max-width: 720px;
    text-align: center;
    z-index: 5;
    padding: 4rem 2rem;
}

.mask-content-wide {
    width: 75%;
    max-width: 900px;
}

/* ---- Mask 1: Hero ---- */
#mask-1 {
    background: var(--deep-bg);
}

.hero-title {
    position: relative;
    font-size: clamp(48px, 8vw, 96px);
    line-height: 1.1;
    letter-spacing: 0.02em;
    margin-bottom: 1.5rem;
    height: 1.2em;
    overflow: hidden;
}

.title-handwritten {
    font-family: 'Caveat', cursive;
    font-weight: 700;
    display: block;
    color: var(--neon-magenta);
    filter: drop-shadow(0 0 10px var(--neon-magenta)) drop-shadow(0 0 40px var(--neon-magenta));
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    transition: opacity 0.8s ease, clip-path 1s ease;
    clip-path: inset(0 0 0 0);
}

.title-geometric {
    font-family: 'Quicksand', sans-serif;
    font-weight: 700;
    display: block;
    color: var(--neon-magenta);
    filter: drop-shadow(0 0 10px var(--neon-magenta)) drop-shadow(0 0 40px var(--neon-magenta));
    position: absolute;
    width: 100%;
    left: 0;
    top: 0;
    transition: opacity 0.8s ease, clip-path 1s ease;
    clip-path: inset(0 0 0 100%);
}

.hero-title.unmasking .title-handwritten {
    clip-path: inset(0 100% 0 0);
}

.hero-title.unmasking .title-geometric {
    clip-path: inset(0 0 0 0);
}

.hero-subtitle {
    font-family: 'Sacramento', cursive;
    font-size: clamp(28px, 4vw, 56px);
    color: var(--neon-cyan);
    filter: drop-shadow(0 0 8px var(--neon-cyan)) drop-shadow(0 0 30px var(--neon-cyan));
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.2s ease 0.5s, transform 1.2s ease 0.5s;
}

.hero-subtitle.visible {
    opacity: 1;
    transform: translateY(0);
}

.scroll-indicator {
    margin-top: 3rem;
    opacity: 0;
    transition: opacity 1s ease 1.5s;
}

.scroll-indicator.visible {
    opacity: 1;
}

.chevron {
    color: var(--neon-magenta);
    animation: chevronBounce 2s ease-in-out infinite, chevronColorCycle 6s linear infinite;
    filter: drop-shadow(0 0 6px currentColor);
}

@keyframes chevronBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(10px); }
}

@keyframes chevronColorCycle {
    0%, 100% { color: var(--neon-magenta); }
    33% { color: var(--neon-cyan); }
    66% { color: var(--neon-gold); }
}

/* ---- Mask 1 initial fade-in ---- */
#mask-1 .mask-content {
    opacity: 0;
    transition: opacity 1.5s ease;
}

#mask-1 .mask-content.fade-in {
    opacity: 1;
}

/* ---- Mask 2: The Invitation ---- */
#mask-2 {
    background: linear-gradient(180deg, var(--deep-bg) 0%, var(--surface-bg) 50%, var(--deep-bg) 100%);
}

.invitation-text {
    text-align: left;
}

.invitation-text .body-text {
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    font-size: 18px;
    line-height: 1.7;
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.invitation-text .body-text.visible {
    opacity: 1;
    transform: translateY(0);
}

.accent-quote {
    font-family: 'Sacramento', cursive;
    font-size: clamp(32px, 5vw, 48px);
    color: var(--neon-magenta);
    filter: drop-shadow(0 0 8px var(--neon-magenta)) drop-shadow(0 0 30px var(--neon-magenta));
    text-align: center;
    margin-top: 2rem;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1s ease, transform 1s ease;
}

.accent-quote.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Glow Words ---- */
.glow-word {
    font-weight: 600;
}

.glow-word.cyan {
    color: var(--neon-cyan);
    text-shadow: 0 0 8px var(--neon-cyan), 0 0 20px rgba(0, 245, 212, 0.4);
}

.glow-word.magenta {
    color: var(--neon-magenta);
    text-shadow: 0 0 8px var(--neon-magenta), 0 0 20px rgba(255, 45, 149, 0.4);
}

.glow-word.gold {
    color: var(--neon-gold);
    text-shadow: 0 0 8px var(--neon-gold), 0 0 20px rgba(255, 215, 0, 0.4);
}

/* ---- Mask 3: The Reveal ---- */
#mask-3 {
    background: linear-gradient(180deg, var(--deep-bg) 0%, #1E0840 50%, var(--deep-bg) 100%);
}

.reveal-title {
    font-family: 'Caveat', cursive;
    font-size: clamp(36px, 6vw, 72px);
    line-height: 1.1;
    letter-spacing: 0.02em;
    color: var(--neon-gold);
    filter: drop-shadow(0 0 10px var(--neon-gold)) drop-shadow(0 0 40px var(--neon-gold));
    margin-bottom: 2rem;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 1s ease, transform 1s ease;
}

.reveal-title.visible {
    opacity: 1;
    transform: scale(1);
}

#mask-3 .body-text.large {
    font-size: clamp(18px, 2.2vw, 22px);
    line-height: 1.8;
    margin-bottom: 1.5rem;
    text-align: left;
    color: var(--text-primary);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

#mask-3 .body-text.large.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Mask Silhouettes ---- */
.mask-silhouette {
    position: absolute;
    pointer-events: none;
    z-index: 1;
}

.mask-svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    filter: drop-shadow(0 0 10px currentColor) drop-shadow(0 0 30px currentColor);
    animation: maskRotate 30s linear infinite;
}

.mask-colombina {
    width: clamp(120px, 15vw, 200px);
    top: 10%;
    right: -5%;
    color: var(--neon-gold);
    opacity: 0;
    transition: opacity 1s ease;
}

.mask-colombina.visible {
    opacity: 0.6;
}

.mask-bauta {
    width: clamp(100px, 12vw, 160px);
    bottom: 10%;
    left: -5%;
    color: var(--neon-gold);
    opacity: 0;
    transition: opacity 1s ease;
}

.mask-bauta.visible {
    opacity: 0.5;
}

.mask-plague {
    width: clamp(80px, 10vw, 140px);
    color: var(--neon-magenta);
    margin: 0 auto 2rem;
    position: relative;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 1.5s ease, transform 1.5s ease;
}

.mask-plague.visible {
    opacity: 0.7;
    transform: scale(1);
}

@keyframes maskRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---- Mask 4: The Protocol ---- */
#mask-4 {
    background: linear-gradient(180deg, var(--deep-bg) 0%, var(--surface-bg) 40%, var(--deep-bg) 100%);
    position: relative;
}

.protocol-block {
    text-align: left;
    position: relative;
    z-index: 5;
}

.protocol-line {
    font-family: 'Space Mono', monospace;
    font-size: clamp(14px, 1.5vw, 15px);
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    opacity: 0;
    transform: translateX(-20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.protocol-line.visible {
    opacity: 1;
    transform: translateX(0);
}

/* ---- Grid Floor ---- */
.grid-floor {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 40%;
    background:
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent calc(100% / 20 - 1px),
            rgba(0, 245, 212, 0.1) calc(100% / 20 - 1px),
            rgba(0, 245, 212, 0.1) calc(100% / 20)
        ),
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent calc(100% / 10 - 1px),
            rgba(0, 245, 212, 0.1) calc(100% / 10 - 1px),
            rgba(0, 245, 212, 0.1) calc(100% / 10)
        );
    transform: perspective(500px) rotateX(55deg);
    transform-origin: bottom center;
    opacity: 0.4;
    pointer-events: none;
    z-index: 1;
    mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 100%);
}

/* ---- Mask 5: The Exit ---- */
#mask-5 {
    background: var(--deep-bg);
}

.exit-point {
    text-align: center;
}

.exit-text {
    font-family: 'Sacramento', cursive;
    font-size: clamp(32px, 5vw, 56px);
    color: var(--neon-magenta);
    filter: drop-shadow(0 0 10px var(--neon-magenta)) drop-shadow(0 0 40px var(--neon-magenta));
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 2s ease, transform 2s ease;
}

.exit-text.visible {
    opacity: 1;
    transform: scale(1);
}

/* ---- Ring State Morphing ---- */
.rings-contracted .ring {
    transform: scale(0.7);
}

.rings-expanded .ring {
    transform: scale(1.1);
}

.rings-dissolved .ring {
    border-radius: 50%;
    opacity: 0.03;
    transform: scale(1.3);
}

.rings-collapsed .ring {
    transform: scale(0.05);
    opacity: 0;
    border-radius: 50%;
}

.rings-magenta .ring {
    border-color: var(--neon-magenta);
}

.rings-cyan .ring {
    border-color: var(--neon-cyan);
}

.rings-gold .ring {
    border-color: var(--neon-gold);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .mask-content {
        width: 90vw;
        padding: 3rem 1.5rem;
    }

    .mask-content-wide {
        width: 90vw;
    }

    .hero-title {
        font-size: clamp(36px, 10vw, 64px);
    }

    .mask-colombina {
        right: 2%;
        width: 100px;
    }

    .mask-bauta {
        left: 2%;
        width: 80px;
    }

    .protocol-line {
        font-size: 13px;
    }

    .ring-4, .ring-5 {
        display: none;
    }
}

@media (max-width: 480px) {
    .mask-content {
        padding: 2rem 1rem;
    }

    .hero-title {
        font-size: clamp(28px, 12vw, 48px);
    }

    .hero-subtitle {
        font-size: 24px;
    }

    .ring-3, .ring-4, .ring-5 {
        display: none;
    }
}

/* ---- Utility ---- */
::selection {
    background: var(--neon-magenta);
    color: var(--deep-bg);
}

/* Smooth scroll snap for full-screen sections (optional enhancement) */
html {
    scroll-snap-type: y proximity;
}

.mask-layer {
    scroll-snap-align: start;
}
