/* ============================================
   MasqproT.com - Cinematic Masquerade
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --primary-black: #0a0a0e;
    --ceremonial-gold: #c9a84c;
    --parchment-ivory: #e8e0d4;
    --mask-white: #f5f2ed;
    --blood-accent: #8b2020;
    --shadow-violet: #1e1428;
    --dark-surface: #1a1a1e;
    --spot-x: 50%;
    --spot-y: 50%;
    --diagonal-angle: -7deg;
    --diagonal-counter: 7deg;
}

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

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

body {
    background: var(--primary-black);
    color: var(--parchment-ivory);
    font-family: 'DM Sans', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    overflow-x: hidden;
    cursor: none;
}

::selection {
    background: var(--ceremonial-gold);
    color: var(--primary-black);
}

/* --- Custom Cursor --- */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 8px;
    height: 8px;
    background: var(--ceremonial-gold);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(calc(var(--spot-x) - 4px), calc(var(--spot-y) - 4px));
    z-index: 10001;
    mix-blend-mode: difference;
    transition: transform 0.05s linear;
}

/* --- Spotlight Overlay --- */
#spotlight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: radial-gradient(
        circle 250px at var(--spot-x) var(--spot-y),
        transparent 0%,
        transparent 60%,
        rgba(10, 10, 14, 0.18) 100%
    );
    transition: opacity 0.3s ease;
}

/* --- Navigation --- */
#nav-mask {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
}

#nav-toggle {
    background: none;
    border: 1px solid rgba(201, 168, 76, 0.3);
    padding: 8px 12px;
    cursor: none;
    transition: border-color 0.3s ease, transform 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

#nav-toggle:hover {
    border-color: var(--blood-accent);
    transform: scale(1.05);
}

#nav-toggle svg {
    display: block;
}

#radial-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#radial-menu.open {
    opacity: 1;
    pointer-events: auto;
}

.radial-link {
    position: absolute;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Stint Ultra Condensed', serif;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ceremonial-gold);
    text-decoration: none;
    border: 1px solid rgba(201, 168, 76, 0.4);
    border-radius: 50%;
    background: rgba(10, 10, 14, 0.9);
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                color 0.3s ease,
                border-color 0.3s ease,
                background 0.3s ease;
    cursor: none;
}

#radial-menu.open .radial-link {
    transform: translate(-50%, -50%) scale(1);
}

.radial-link:hover {
    color: var(--primary-black);
    background: var(--blood-accent);
    border-color: var(--blood-accent);
}

/* Radial positions (clock-face arrangement) */
#radial-menu.open .radial-link[data-angle="0"] {
    top: -80px;
    left: 0;
    transition-delay: 0s;
}
#radial-menu.open .radial-link[data-angle="1"] {
    top: -25px;
    left: 76px;
    transition-delay: 0.06s;
}
#radial-menu.open .radial-link[data-angle="2"] {
    top: 65px;
    left: 47px;
    transition-delay: 0.12s;
}
#radial-menu.open .radial-link[data-angle="3"] {
    top: 65px;
    left: -47px;
    transition-delay: 0.18s;
}
#radial-menu.open .radial-link[data-angle="4"] {
    top: -25px;
    left: -76px;
    transition-delay: 0.24s;
}

/* --- Typography --- */
.logotype {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(3rem, 7vw, 9rem);
    letter-spacing: 0.5em;
    text-transform: uppercase;
    color: var(--ceremonial-gold);
    text-align: center;
    white-space: nowrap;
    padding-right: 0.5em;
}

.logo-char {
    display: inline-block;
    opacity: 0;
    transform: translateY(30px);
    animation: charReveal 0.6s ease-out forwards;
}

@keyframes charReveal {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kinetic-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2.5rem, 6vw, 7rem);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--parchment-ivory);
    line-height: 1.1;
    padding-right: 0.3em;
}

.k-char {
    display: inline-block;
    opacity: 0;
    transform: translate(0, 20px) rotate(5deg);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.k-char.revealed {
    opacity: 1;
    transform: translate(0, 0) rotate(0deg);
}

.accent-heading {
    font-family: 'Stint Ultra Condensed', serif;
    font-size: 0.85rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--ceremonial-gold);
    margin-bottom: 1rem;
}

.body-text {
    font-family: 'DM Sans', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--parchment-ivory);
    max-width: 520px;
    margin-bottom: 1.5rem;
}

/* --- Slit of Light --- */
.slit-light {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 70vh;
    background: var(--ceremonial-gold);
    transform: translate(-50%, -50%);
    box-shadow: 0 0 30px rgba(201, 168, 76, 0.5),
                0 0 80px rgba(201, 168, 76, 0.2);
    animation: slitAppear 0.8s 1.2s ease-out forwards;
    opacity: 0;
}

@keyframes slitAppear {
    0% {
        opacity: 0;
        width: 0;
    }
    50% {
        opacity: 1;
        width: 3px;
    }
    100% {
        opacity: 1;
        width: 3px;
    }
}

/* --- Acts / Sections --- */
.act {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* ACT I: Opening */
.act-opening {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-black);
    z-index: 10;
}

.logotype-container {
    position: relative;
    z-index: 2;
    opacity: 0;
    animation: logoReveal 1.2s 2.2s ease-out forwards;
}

@keyframes logoReveal {
    0% {
        opacity: 0;
        clip-path: inset(0 50% 0 50%);
    }
    100% {
        opacity: 1;
        clip-path: inset(0 0 0 0);
    }
}

.logo-char:nth-child(1) { animation-delay: 2.4s; }
.logo-char:nth-child(2) { animation-delay: 2.5s; }
.logo-char:nth-child(3) { animation-delay: 2.6s; }
.logo-char:nth-child(4) { animation-delay: 2.7s; }
.logo-char:nth-child(5) { animation-delay: 2.8s; }
.logo-char:nth-child(6) { animation-delay: 2.9s; }
.logo-char:nth-child(7) { animation-delay: 3.0s; }
.logo-char:nth-child(8) { animation-delay: 3.1s; }

.slit-transition {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 2px;
    height: 0;
    background: var(--ceremonial-gold);
    transform: translateX(-50%);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
    animation: slitGrow 1s 3.5s ease-out forwards;
}

@keyframes slitGrow {
    to {
        height: 120px;
    }
}

/* --- Diagonal Sections --- */
.diagonal-section {
    transform: skewY(var(--diagonal-angle));
    margin-top: -80px;
    padding: 160px 0 200px;
    position: relative;
}

.diagonal-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -10%;
    width: 120%;
    height: 100%;
    background: var(--shadow-violet);
    z-index: -1;
}

.diagonal-wrapper {
    transform: skewY(var(--diagonal-counter));
}

.diagonal-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
    position: relative;
}

/* --- ACT II: Intrigue --- */
.act-intrigue {
    z-index: 20;
    box-shadow: 0 -30px 60px rgba(10, 10, 14, 0.8);
}

.act-intrigue::before {
    background: var(--shadow-violet);
}

.intrigue-headline {
    position: relative;
    text-align: right;
    padding-right: 10%;
    margin-bottom: 3rem;
}

.intrigue-body {
    max-width: 480px;
    position: relative;
    padding-left: 5%;
}

.diagonal-stroke {
    position: absolute;
    top: -20px;
    left: -40px;
    width: 200px;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--ceremonial-gold), transparent);
    transform: rotate(-7deg);
}

/* --- ACT III: Procession (Horizontal Gallery) --- */
.act-procession {
    min-height: 100vh;
    background: var(--primary-black);
    z-index: 15;
    padding: 100px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.procession-header {
    text-align: center;
    margin-bottom: 60px;
}

.mask-gallery {
    display: flex;
    width: 100%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.mask-gallery::-webkit-scrollbar {
    display: none;
}

.mask-panel {
    min-width: 100vw;
    height: 60vh;
    scroll-snap-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--shadow-violet);
    position: relative;
}

.mask-panel::after {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 2px;
    height: 40%;
    background: var(--ceremonial-gold);
    transform: translateY(-50%);
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
    opacity: 0.6;
}

.mask-panel:first-child::after {
    display: none;
}

/* --- CSS Masks --- */
.css-mask {
    width: 350px;
    height: 400px;
    position: relative;
    animation: maskRotate 30s infinite linear;
}

@keyframes maskRotate {
    0% { transform: rotate(0deg); }
    25% { transform: rotate(5deg); }
    50% { transform: rotate(0deg); }
    75% { transform: rotate(-5deg); }
    100% { transform: rotate(0deg); }
}

/* Venetian Mask */
.mask-venetian .mask-face {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 280px;
    height: 180px;
    transform: translate(-50%, -50%);
    border-radius: 50% 50% 40% 40%;
    border: 2px solid var(--ceremonial-gold);
    background: linear-gradient(180deg, rgba(201, 168, 76, 0.08) 0%, transparent 100%);
}

.mask-venetian .mask-eye {
    position: absolute;
    top: 45%;
    width: 55px;
    height: 30px;
    border: 1.5px solid var(--ceremonial-gold);
    border-radius: 50%;
    transform: translateY(-50%);
}

.mask-venetian .mask-eye-left {
    left: 27%;
}

.mask-venetian .mask-eye-right {
    right: 27%;
}

.mask-venetian .mask-ornament {
    position: absolute;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 60px;
    border: 1px solid var(--ceremonial-gold);
    border-radius: 0;
    transform: translateX(-50%) rotate(45deg);
    opacity: 0.6;
}

/* Commedia Mask */
.mask-commedia .mask-face {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 240px;
    height: 200px;
    transform: translate(-50%, -50%);
    clip-path: polygon(20% 0%, 80% 0%, 100% 40%, 85% 100%, 15% 100%, 0% 40%);
    border: 2px solid var(--ceremonial-gold);
    background: linear-gradient(135deg, rgba(201, 168, 76, 0.06) 0%, transparent 60%);
}

.mask-commedia .mask-face::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: polygon(20% 0%, 80% 0%, 100% 40%, 85% 100%, 15% 100%, 0% 40%);
    border: 2px solid var(--ceremonial-gold);
}

.mask-commedia .mask-eye {
    position: absolute;
    top: 38%;
    width: 40px;
    height: 22px;
    border: 1.5px solid var(--ceremonial-gold);
    clip-path: polygon(0% 50%, 50% 0%, 100% 50%, 50% 100%);
}

.mask-commedia .mask-eye-left {
    left: 28%;
}

.mask-commedia .mask-eye-right {
    right: 28%;
}

.mask-commedia .mask-nose {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 30px;
    height: 60px;
    transform: translate(-50%, -20%);
    border-left: 1.5px solid var(--ceremonial-gold);
    border-right: 1.5px solid var(--ceremonial-gold);
    border-bottom: 1.5px solid var(--ceremonial-gold);
    border-radius: 0 0 50% 50%;
}

/* Phantom Mask (half-mask with dissolution) */
.mask-phantom .mask-face {
    position: absolute;
    top: 50%;
    left: 35%;
    width: 160px;
    height: 200px;
    transform: translateY(-50%);
    border-radius: 50% 0 0 40%;
    border: 2px solid var(--ceremonial-gold);
    border-right: none;
    background: linear-gradient(90deg, rgba(201, 168, 76, 0.08), transparent);
}

.mask-phantom .mask-eye-left {
    position: absolute;
    top: 42%;
    left: 38%;
    width: 45px;
    height: 25px;
    border: 1.5px solid var(--ceremonial-gold);
    border-radius: 50%;
}

.mask-fragment {
    position: absolute;
    border: 1px solid var(--ceremonial-gold);
    opacity: 0.5;
    animation: fragmentDrift 8s infinite ease-in-out;
}

.mask-fragment-1 {
    top: 35%;
    right: 25%;
    width: 30px;
    height: 30px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    animation-delay: 0s;
}

.mask-fragment-2 {
    top: 50%;
    right: 20%;
    width: 20px;
    height: 25px;
    clip-path: polygon(0% 0%, 100% 50%, 0% 100%);
    animation-delay: 2s;
}

.mask-fragment-3 {
    top: 30%;
    right: 15%;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    animation-delay: 4s;
}

.mask-fragment-4 {
    top: 55%;
    right: 30%;
    width: 25px;
    height: 20px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 80%);
    animation-delay: 6s;
}

@keyframes fragmentDrift {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
        opacity: 0.5;
    }
    50% {
        transform: translate(15px, -10px) rotate(15deg);
        opacity: 0.8;
    }
}

/* Geometric Mask */
.mask-geometric .mask-face {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    transform: translate(-50%, -50%);
    clip-path: polygon(50% 5%, 95% 30%, 95% 70%, 50% 95%, 5% 70%, 5% 30%);
    border: 2px solid var(--ceremonial-gold);
    background: rgba(201, 168, 76, 0.04);
}

.mask-geometric .mask-face::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    clip-path: polygon(50% 5%, 95% 30%, 95% 70%, 50% 95%, 5% 70%, 5% 30%);
    border: 2px solid var(--ceremonial-gold);
}

.mask-triangle {
    position: absolute;
    border: 1px solid var(--ceremonial-gold);
    opacity: 0.4;
}

.mask-tri-1 {
    top: 30%;
    left: 35%;
    width: 80px;
    height: 80px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.mask-tri-2 {
    top: 35%;
    left: 50%;
    width: 60px;
    height: 60px;
    clip-path: polygon(50% 100%, 0% 0%, 100% 0%);
    opacity: 0.3;
}

.mask-tri-3 {
    top: 55%;
    left: 42%;
    width: 40px;
    height: 40px;
    clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
    opacity: 0.2;
}

.slit-divider {
    width: 2px;
    height: 80px;
    background: var(--ceremonial-gold);
    margin: 40px auto 0;
    box-shadow: 0 0 20px rgba(201, 168, 76, 0.4);
    opacity: 0;
    animation: slitFadeIn 0.6s ease-out forwards;
}

/* --- ACT IV: Revelation (Z-pattern) --- */
.act-revelation {
    z-index: 25;
    box-shadow: 0 -30px 60px rgba(10, 10, 14, 0.8);
}

.act-revelation::before {
    background: linear-gradient(180deg, var(--shadow-violet), #120d1a);
}

.z-block {
    margin-bottom: 80px;
    position: relative;
}

.z-block-left {
    text-align: left;
    padding-right: 40%;
}

.z-block-right {
    text-align: right;
    padding-left: 40%;
    margin-left: auto;
}

.z-block-right .body-text {
    margin-left: auto;
}

/* --- ACT V: Departure (Inverted) --- */
.act-departure {
    min-height: 100vh;
    background: var(--ceremonial-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 30;
    position: relative;
}

.departure-content {
    text-align: center;
    padding: 5%;
}

.departure-title {
    color: var(--primary-black);
    margin-bottom: 3rem;
}

.departure-title .k-char {
    color: var(--primary-black);
}

.departure-message {
    margin-bottom: 3rem;
}

.departure-message .accent-heading {
    color: var(--primary-black);
    font-size: 1rem;
    letter-spacing: 0.3em;
}

.departure-slit {
    width: 2px;
    height: 0;
    background: var(--primary-black);
    margin: 0 auto;
    box-shadow: 0 0 15px rgba(10, 10, 14, 0.3);
    transition: height 1.5s ease-in-out;
}

.departure-slit.active {
    height: 120px;
}

/* --- Wax Seals --- */
.wax-seal {
    position: absolute;
    bottom: 40px;
    z-index: 5;
    opacity: 0;
    transform: scale(1.2) rotate(-5deg);
    transition: opacity 0.6s ease, transform 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.wax-seal.visible {
    opacity: 1;
    transform: scale(1) rotate(0deg);
}

.seal-act2 {
    right: 10%;
}

.seal-act4 {
    left: 10%;
}

.seal-act5 {
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) scale(1.2) rotate(-5deg);
}

.seal-act5.visible {
    transform: translateX(-50%) scale(1) rotate(0deg);
}

.seal-crack {
    opacity: 0;
    transition: opacity 0.4s ease 0.5s;
}

.wax-seal.visible .seal-crack {
    opacity: 1;
}

/* --- Filigree --- */
.filigree {
    position: absolute;
    bottom: -20px;
    left: 0;
    width: 100%;
    height: 100px;
    overflow: visible;
    pointer-events: none;
}

.filigree-path {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 2s ease-in-out;
}

.filigree.drawn .filigree-path {
    stroke-dashoffset: 0;
}

/* --- Slit Fade In --- */
@keyframes slitFadeIn {
    from {
        opacity: 0;
        height: 0;
    }
    to {
        opacity: 0.7;
        height: 80px;
    }
}

/* --- Particle Dissolution --- */
.logo-char.dissolving {
    animation: particleDissolve 1.5s ease-out forwards;
}

@keyframes particleDissolve {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
    50% {
        opacity: 0.6;
        transform: translateY(-20px) scale(0.8) rotate(15deg);
        filter: blur(1px);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0.3) rotate(45deg);
        filter: blur(3px);
    }
}

.logo-char.reassembling {
    animation: particleReassemble 1.2s ease-in-out forwards;
}

@keyframes particleReassemble {
    0% {
        opacity: 0;
        transform: translateY(-60px) scale(0.3) rotate(45deg);
        filter: blur(3px);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
        filter: blur(0);
    }
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .logotype {
        font-size: clamp(2rem, 8vw, 4rem);
        letter-spacing: 0.3em;
        padding-right: 0.3em;
    }

    .kinetic-text {
        font-size: clamp(1.8rem, 6vw, 3.5rem);
        letter-spacing: 0.15em;
        padding-right: 0.15em;
    }

    .diagonal-section {
        padding: 120px 0 160px;
    }

    .intrigue-headline {
        text-align: left;
        padding-right: 0;
    }

    .intrigue-body {
        padding-left: 0;
    }

    .z-block-left {
        padding-right: 10%;
    }

    .z-block-right {
        padding-left: 10%;
    }

    .css-mask {
        width: 250px;
        height: 300px;
    }

    .mask-venetian .mask-face {
        width: 200px;
        height: 130px;
    }

    .mask-commedia .mask-face {
        width: 180px;
        height: 150px;
    }

    .mask-phantom .mask-face {
        width: 120px;
        height: 150px;
    }

    .mask-geometric .mask-face {
        width: 180px;
        height: 180px;
    }

    #nav-mask {
        top: 16px;
        right: 16px;
    }

    body::after {
        display: none;
    }

    body {
        cursor: auto;
    }

    #spotlight-overlay {
        display: none;
    }
}

@media (max-width: 480px) {
    .logotype {
        font-size: clamp(1.5rem, 10vw, 2.5rem);
        letter-spacing: 0.2em;
        padding-right: 0.2em;
    }

    .kinetic-text {
        font-size: clamp(1.5rem, 8vw, 2.5rem);
        letter-spacing: 0.1em;
        padding-right: 0.1em;
    }

    .body-text {
        font-size: 1rem;
    }

    .mask-panel {
        height: 50vh;
    }

    .css-mask {
        width: 180px;
        height: 220px;
    }
}
