/* MasqproT.com — The Masquerade Protocol */
/* Palette: #0b0c1e, #c9a84c, #f2ece0, #8b1a2b, #7a7e93, #4a6741 */

:root {
    --midnight: #0b0c1e;
    --gold: #c9a84c;
    --parchment: #f2ece0;
    --crimson: #8b1a2b;
    --silver: #7a7e93;
    --absinthe: #4a6741;
    --ease-theatrical: cubic-bezier(0.25, 0.1, 0.25, 1);
}

/* ========================================
   RESET & BASE
   ======================================== */

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--midnight);
    color: var(--parchment);
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    line-height: 1.75;
    overflow-x: hidden;
}

/* ========================================
   HIDDEN SVG SPRITE
   ======================================== */

.svg-sprite {
    position: absolute;
    width: 0;
    height: 0;
    overflow: hidden;
}

/* ========================================
   NOISE TEXTURE OVERLAY
   ======================================== */

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.03;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='1'/%3E%3C/svg%3E");
    background-repeat: repeat;
    background-size: 256px 256px;
}

/* ========================================
   NAVIGATION
   ======================================== */

.nav-mask-btn {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    background: none;
    border: 1px solid rgba(201, 168, 76, 0.3);
    cursor: pointer;
    padding: 0.5rem;
    width: 52px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.4s var(--ease-theatrical);
}

.nav-mask-btn:hover {
    border-color: var(--gold);
}

.nav-mask-icon {
    width: 32px;
    height: 24px;
}

/* Nav curtain overlay */
.nav-curtain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.6s var(--ease-theatrical);
}

.nav-curtain.open {
    pointer-events: all;
    opacity: 1;
}

.nav-curtain-left,
.nav-curtain-right {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    background: var(--midnight);
    transition: transform 1.2s var(--ease-theatrical);
}

.nav-curtain-left {
    left: 0;
    transform: translateX(-100%);
    border-right: 1px solid rgba(201, 168, 76, 0.1);
}

.nav-curtain-right {
    right: 0;
    transform: translateX(100%);
    border-left: 1px solid rgba(201, 168, 76, 0.1);
}

.nav-curtain.open .nav-curtain-left {
    transform: translateX(0);
}

.nav-curtain.open .nav-curtain-right {
    transform: translateX(0);
}

.nav-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    text-align: center;
    opacity: 0;
    transition: opacity 0.6s var(--ease-theatrical) 0.8s;
}

.nav-curtain.open .nav-content {
    opacity: 1;
}

.nav-close {
    position: absolute;
    top: -3rem;
    right: -2rem;
    background: none;
    border: none;
    color: var(--gold);
    font-size: 2rem;
    cursor: pointer;
    font-family: 'Cormorant Garamond', serif;
    transition: color 0.3s;
}

.nav-close:hover {
    color: var(--parchment);
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--parchment);
    text-decoration: none;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-style: italic;
    font-size: 1.3rem;
    letter-spacing: 0.05em;
    opacity: 0.6;
    transition: opacity 0.4s var(--ease-theatrical), color 0.4s;
}

.nav-link:hover {
    opacity: 1;
    color: var(--gold);
}

.nav-link-mask {
    width: 24px;
    height: 18px;
    flex-shrink: 0;
}

/* ========================================
   ACT SECTIONS (Base)
   ======================================== */

.act {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6rem 2rem;
    overflow: hidden;
}

.act-content {
    position: relative;
    z-index: 5;
    max-width: 780px;
    width: 100%;
    opacity: 0;
    transform: translateY(30px);
    filter: blur(4px);
    transition: opacity 1.5s var(--ease-theatrical),
                transform 1.5s var(--ease-theatrical),
                filter 1.5s var(--ease-theatrical);
}

.act-content.visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

/* Act Labels */
.act-label {
    font-family: 'Overpass Mono', monospace;
    font-weight: 300;
    font-size: 0.65rem;
    letter-spacing: 0.4em;
    color: var(--gold);
    display: block;
    margin-bottom: 1.5rem;
}

.act-title {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-style: italic;
    font-size: clamp(2rem, 4vw, 3.5rem);
    letter-spacing: 0.05em;
    color: var(--parchment);
    margin-bottom: 2rem;
}

/* ========================================
   CURTAIN BACKGROUNDS
   ======================================== */

.curtain-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background: radial-gradient(ellipse at 50% 30%,
        rgba(201, 168, 76, 0.04) 0%,
        transparent 60%);
}

.curtain-bg.crimson-glow {
    background:
        radial-gradient(ellipse at 30% 50%, rgba(139, 26, 43, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 40%, rgba(139, 26, 43, 0.06) 0%, transparent 50%);
}

.curtain-bg.forest-glow {
    background:
        radial-gradient(ellipse at 40% 60%, rgba(74, 103, 65, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 60% 30%, rgba(74, 103, 65, 0.05) 0%, transparent 50%);
}

.curtain-bg.crimson-dominant {
    background:
        radial-gradient(ellipse at 50% 50%, rgba(139, 26, 43, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 30% 30%, rgba(201, 168, 76, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 70%, rgba(139, 26, 43, 0.1) 0%, transparent 50%);
}

/* ========================================
   AMBIENT EFFECTS (Fog & Candlelight)
   ======================================== */

.ambient-glow {
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    mix-blend-mode: screen;
}

.glow-warm {
    background: radial-gradient(circle, rgba(201, 168, 76, 0.08) 0%, transparent 70%);
    top: 20%;
    left: 40%;
    animation: glowDrift 25s ease-in-out infinite alternate;
}

.glow-crimson {
    background: radial-gradient(circle, rgba(139, 26, 43, 0.06) 0%, transparent 70%);
    top: 30%;
    right: 20%;
    animation: glowDrift 30s ease-in-out infinite alternate-reverse;
}

.glow-warm-intense {
    background: radial-gradient(circle, rgba(201, 168, 76, 0.1) 0%, transparent 60%);
    top: 25%;
    left: 35%;
    width: 500px;
    height: 500px;
    animation: glowPulse 20s ease-in-out infinite;
}

@keyframes glowDrift {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -20px) scale(1.1); }
    100% { transform: translate(-20px, 15px) scale(0.95); }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.6; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.15); }
}

.ambient-fog {
    position: absolute;
    width: 150%;
    height: 100%;
    top: 0;
    left: -25%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.4;
}

.fog-drift {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(122, 126, 147, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 40%, rgba(122, 126, 147, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 70%, rgba(201, 168, 76, 0.03) 0%, transparent 40%);
    animation: fogDrift 35s linear infinite;
}

.fog-drift-slow {
    background:
        radial-gradient(ellipse at 30% 40%, rgba(122, 126, 147, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 60%, rgba(122, 126, 147, 0.04) 0%, transparent 50%);
    animation: fogDrift 40s linear infinite;
}

.fog-drift-reverse {
    background:
        radial-gradient(ellipse at 25% 55%, rgba(122, 126, 147, 0.05) 0%, transparent 50%),
        radial-gradient(ellipse at 75% 35%, rgba(74, 103, 65, 0.04) 0%, transparent 50%);
    animation: fogDrift 35s linear infinite reverse;
}

@keyframes fogDrift {
    0% { transform: translateX(0); }
    100% { transform: translateX(25%); }
}

/* ========================================
   ACT I — The Invitation
   ======================================== */

#act1 {
    background-color: var(--midnight);
}

.act1-content {
    text-align: center;
    filter: none;
    opacity: 1;
    transform: none;
}

.mask-hero-svg {
    display: block;
    width: 240px;
    height: 180px;
    margin: 0 auto 2.5rem;
}

.mask-draw-path {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 3s var(--ease-theatrical);
}

.mask-draw-path.drawn {
    stroke-dashoffset: 0;
}

.filigree-path {
    stroke-dasharray: 300;
    stroke-dashoffset: 300;
}

.mask-draw-dot {
    transition: opacity 1s var(--ease-theatrical) 2.5s;
}

.mask-draw-dot.shown {
    opacity: 0.7;
}

/* Hero title — letter by letter */
.hero-title {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-style: italic;
    font-size: clamp(3rem, 8vw, 6rem);
    letter-spacing: 0.05em;
    color: var(--parchment);
    text-align: center;
}

.hero-letter {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.5s var(--ease-theatrical);
    transition-delay: calc(2s + var(--i) * 0.15s);
}

.hero-title.animating .hero-letter {
    opacity: 1;
}

.hero-sub {
    font-family: 'Overpass Mono', monospace;
    font-weight: 300;
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--gold);
    text-align: center;
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 1.5s var(--ease-theatrical) 3.5s;
}

.hero-sub.visible {
    opacity: 0.6;
}

/* ========================================
   FRIEZE DIVIDERS
   ======================================== */

.frieze-divider {
    position: relative;
    z-index: 10;
    height: 20px;
    overflow: hidden;
    opacity: 0.5;
}

/* ========================================
   ACT II — The Grand Hall
   ======================================== */

.watermark-mask {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 70%;
    max-width: 600px;
    height: auto;
    opacity: 0.05;
    z-index: 1;
    pointer-events: none;
}

.grand-hall-text {
    text-align: center;
}

.protocol-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.15rem;
    line-height: 1.9;
    color: rgba(242, 236, 224, 0.65);
    max-width: 600px;
    margin: 0 auto;
}

.metadata-text {
    font-family: 'Overpass Mono', monospace;
    font-weight: 300;
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    color: var(--silver);
    line-height: 2.2;
}

.meta-line {
    display: block;
}

.protocol-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem 0;
    gap: 1rem;
}

.protocol-divider::before,
.protocol-divider::after {
    content: '';
    width: 80px;
    height: 1px;
    background: var(--gold);
    opacity: 0.3;
}

.diamond-ornament {
    width: 8px;
    height: 8px;
    background: var(--gold);
    transform: rotate(45deg);
    opacity: 0.5;
    flex-shrink: 0;
}

/* Filigree borders */
.filigree-border {
    margin: 2rem 0;
    overflow: hidden;
}

.filigree-svg {
    width: 100%;
    height: 30px;
}

.filigree-draw {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 2.5s var(--ease-theatrical);
}

.filigree-border.animated .filigree-draw {
    stroke-dashoffset: 0;
}

/* ========================================
   ACT III — The Dance
   ======================================== */

.dance-blocks {
    display: flex;
    flex-direction: column;
    gap: 4rem;
    margin-top: 2rem;
}

.dance-block {
    max-width: 520px;
    position: relative;
}

.dance-block.align-left {
    align-self: flex-start;
    margin-right: auto;
}

.dance-block.align-right {
    align-self: flex-end;
    margin-left: auto;
    text-align: right;
}

.dance-block.align-right .dance-mask-icon {
    margin-left: auto;
}

.dance-mask-icon {
    width: 50px;
    height: auto;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.dance-mask-icon svg {
    width: 100%;
    height: auto;
}

.dance-block-title {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-style: italic;
    font-size: 1.4rem;
    color: var(--parchment);
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.dance-block-text {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 400;
    font-size: 1.05rem;
    line-height: 1.85;
    color: rgba(242, 236, 224, 0.55);
}

/* Floating feathers */
.floating-feather {
    position: absolute;
    width: 30px;
    height: 80px;
    opacity: 0.12;
    pointer-events: none;
    z-index: 2;
}

.feather-1 {
    top: 15%;
    right: 12%;
    animation: featherFloat1 28s ease-in-out infinite;
}

.feather-2 {
    top: 55%;
    left: 8%;
    animation: featherFloat2 32s ease-in-out infinite;
    transform: rotate(15deg);
}

.feather-3 {
    top: 75%;
    right: 25%;
    animation: featherFloat3 25s ease-in-out infinite;
    transform: rotate(-10deg);
}

@keyframes featherFloat1 {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(-15px, 20px) rotate(5deg); }
    50% { transform: translate(10px, -10px) rotate(-3deg); }
    75% { transform: translate(-8px, 15px) rotate(7deg); }
}

@keyframes featherFloat2 {
    0%, 100% { transform: translate(0, 0) rotate(15deg); }
    33% { transform: translate(20px, -15px) rotate(20deg); }
    66% { transform: translate(-10px, 10px) rotate(10deg); }
}

@keyframes featherFloat3 {
    0%, 100% { transform: translate(0, 0) rotate(-10deg); }
    40% { transform: translate(12px, 18px) rotate(-5deg); }
    70% { transform: translate(-8px, -12px) rotate(-15deg); }
}

/* ========================================
   ACT IV — The Mirror Room
   ======================================== */

.mirror-shards-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
    gap: 1.2rem;
    margin-top: 2rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.mirror-shard {
    position: relative;
    padding: 1.8rem;
    background: rgba(242, 236, 224, 0.02);
    border: 1px solid rgba(201, 168, 76, 0.12);
    transition: border-color 0.5s var(--ease-theatrical),
                box-shadow 0.5s var(--ease-theatrical);
    overflow: hidden;
}

.mirror-shard:hover {
    border-color: rgba(139, 26, 43, 0.5);
    box-shadow: 0 0 20px rgba(139, 26, 43, 0.15);
}

/* Irregular polygon shapes via clip-path */
.shard-1 {
    clip-path: polygon(5% 0%, 95% 3%, 100% 92%, 8% 100%);
    grid-column: 1 / 2;
    grid-row: 1 / 2;
}

.shard-2 {
    clip-path: polygon(3% 5%, 100% 0%, 97% 95%, 0% 100%);
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.shard-3 {
    clip-path: polygon(0% 2%, 92% 0%, 100% 100%, 6% 95%);
    grid-column: 1 / 3;
    grid-row: 2 / 3;
}

.shard-4 {
    clip-path: polygon(8% 0%, 100% 5%, 95% 98%, 0% 100%);
    grid-column: 1 / 2;
    grid-row: 3 / 4;
}

.shard-5 {
    clip-path: polygon(0% 3%, 97% 0%, 100% 95%, 4% 100%);
    grid-column: 2 / 3;
    grid-row: 3 / 4;
}

.shard-content p {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 1rem;
    line-height: 1.75;
    color: rgba(242, 236, 224, 0.6);
    font-style: italic;
}

.shard-reflection {
    position: absolute;
    bottom: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    transform: scaleY(-1);
    opacity: 0.06;
    background: linear-gradient(to bottom, rgba(242, 236, 224, 0.1), transparent);
    pointer-events: none;
}

@media (max-width: 640px) {
    .mirror-shards-container {
        grid-template-columns: 1fr;
    }
    .shard-1, .shard-2, .shard-3, .shard-4, .shard-5 {
        grid-column: 1 / 2;
    }
    .shard-3 {
        grid-row: auto;
    }
}

/* ========================================
   ACT V — The Unmasking
   ======================================== */

.act5-content {
    text-align: center;
    max-width: 700px;
}

/* Filigree frame */
.filigree-frame {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 700px;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

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

.frame-draw {
    stroke-dasharray: 800;
    stroke-dashoffset: 800;
    transition: stroke-dashoffset 3s var(--ease-theatrical);
}

.filigree-frame.animated .frame-draw {
    stroke-dashoffset: 0;
}

/* Splitting mask */
.splitting-mask {
    position: relative;
    width: 180px;
    height: 200px;
    margin: 0 auto 2rem;
    z-index: 6;
}

.mask-half {
    position: absolute;
    top: 0;
    width: 50%;
    height: 100%;
    overflow: hidden;
    transition: transform 2s var(--ease-theatrical),
                opacity 2s var(--ease-theatrical);
}

.mask-left {
    left: 0;
    transform-origin: left center;
}

.mask-right {
    right: 0;
    transform-origin: right center;
}

.splitting-mask.split .mask-left {
    transform: translateX(-60px) rotate(-8deg);
    opacity: 0.3;
}

.splitting-mask.split .mask-right {
    transform: translateX(60px) rotate(8deg);
    opacity: 0.3;
}

.split-mask-svg {
    width: 180px;
    height: 200px;
}

.mask-left .split-mask-svg {
    position: absolute;
    right: 0;
}

.mask-right .split-mask-svg {
    position: absolute;
    left: -100%;
}

/* Revealed content */
.revealed-content {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 2s var(--ease-theatrical) 1s,
                transform 2s var(--ease-theatrical) 1s;
}

.revealed-content.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-title {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    color: var(--crimson);
    margin-bottom: 2rem;
    letter-spacing: 0.05em;
}

.protocol-rules {
    margin-bottom: 3rem;
}

.rule {
    font-family: 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 1.15rem;
    line-height: 1.9;
    color: rgba(242, 236, 224, 0.65);
    margin-bottom: 1rem;
}

.rule-num {
    font-family: 'Playfair Display', serif;
    font-style: italic;
    color: var(--crimson);
    margin-right: 0.5rem;
    font-weight: 700;
}

.closing-seal {
    margin-top: 3rem;
}

.seal-svg {
    width: 60px;
    height: 60px;
    margin: 0 auto 1rem;
    display: block;
}

.closing-text {
    font-family: 'Playfair Display', serif;
    font-weight: 800;
    font-style: italic;
    font-size: 1.1rem;
    color: var(--parchment);
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.closing-meta {
    font-family: 'Overpass Mono', monospace;
    font-weight: 300;
    font-size: 0.6rem;
    letter-spacing: 0.3em;
    color: var(--silver);
    text-transform: uppercase;
}

/* ========================================
   CURTAIN-RISE SECTION TRANSITIONS
   ======================================== */

.act {
    clip-path: inset(0 0 0 0);
    transition: clip-path 1.5s var(--ease-theatrical);
}

.act.curtain-lifting {
    clip-path: inset(0 0 0 0);
}

/* ========================================
   PARALLAX
   ======================================== */

.parallax-fg {
    will-change: transform;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .act {
        padding: 4rem 1.5rem;
    }

    .dance-block.align-left,
    .dance-block.align-right {
        max-width: 100%;
        text-align: left;
    }

    .dance-block.align-right .dance-mask-icon {
        margin-left: 0;
    }

    .nav-content {
        width: 80%;
    }

    .splitting-mask {
        width: 140px;
        height: 160px;
    }

    .split-mask-svg {
        width: 140px;
        height: 160px;
    }

    .filigree-frame {
        display: none;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .act-title {
        font-size: 1.8rem;
    }

    .reveal-title {
        font-size: 2rem;
    }

    .mask-hero-svg {
        width: 180px;
        height: 135px;
    }
}
