/* ========================================
   MasqproT.com — Masquerade Protocol
   Cyberpunk × 18th-century Masquerade
   ======================================== */

/* --- CSS Custom Properties (Animated Border) --- */
@property --border-angle {
    syntax: '<angle>';
    inherits: false;
    initial-value: 0deg;
}

/* --- Root Variables --- */
:root {
    --frost-primary: #e8edf2;
    --void-deep: #0b0e1a;
    --frost-accent: #a8b8d8;
    --botanical: #c4a882;
    --candlelight: #e8c87a;
    --lavender: #9b8ec4;
    --text-primary: #2a2a35;
    --text-secondary: #6b7080;

    --frost-primary-70: rgba(232, 237, 242, 0.7);
    --frost-primary-60: rgba(232, 237, 242, 0.6);
    --frost-accent-25: rgba(168, 184, 216, 0.25);
    --frost-accent-10: rgba(168, 184, 216, 0.1);
}

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

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

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--text-primary);
    background-color: var(--void-deep);
    overflow-x: hidden;
    min-height: 100vh;
}

/* --- Particle Canvas --- */
#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
}

/* --- Navigation Trigger --- */
.nav-trigger {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 50px;
    height: 50px;
    z-index: 1000;
    cursor: pointer;
    border-radius: 50%;
    background: rgba(232, 237, 242, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--frost-accent-25);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.4s ease, background 0.4s ease, opacity 0.6s ease;
    opacity: 0;
}

.nav-trigger.visible {
    opacity: 1;
}

.nav-trigger:hover {
    transform: scale(1.1);
    background: rgba(232, 237, 242, 0.2);
}

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

/* --- Radial Navigation Menu --- */
.radial-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 999;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

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

.radial-overlay {
    position: absolute;
    inset: 0;
    background: rgba(11, 14, 26, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.radial-menu {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 300px;
    height: 300px;
}

.radial-item {
    position: absolute;
    top: 0;
    right: 0;
    display: block;
    padding: 10px 20px;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--frost-primary);
    text-decoration: none;
    background: rgba(232, 237, 242, 0.08);
    border: 1px solid var(--frost-accent-25);
    border-radius: 24px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform: translate(0, 0) scale(0);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease, background 0.3s ease;
    opacity: 0;
    white-space: nowrap;
}

.radial-nav.open .radial-item {
    opacity: 1;
}

.radial-nav.open .radial-item[data-index="0"] {
    transform: translate(-50px, 60px) scale(1);
    transition-delay: 0.05s;
}
.radial-nav.open .radial-item[data-index="1"] {
    transform: translate(-120px, 110px) scale(1);
    transition-delay: 0.1s;
}
.radial-nav.open .radial-item[data-index="2"] {
    transform: translate(-160px, 170px) scale(1);
    transition-delay: 0.15s;
}
.radial-nav.open .radial-item[data-index="3"] {
    transform: translate(-150px, 230px) scale(1);
    transition-delay: 0.2s;
}
.radial-nav.open .radial-item[data-index="4"] {
    transform: translate(-100px, 280px) scale(1);
    transition-delay: 0.25s;
}

.radial-item:hover {
    background: rgba(232, 237, 242, 0.18);
    color: var(--candlelight);
}

/* --- Hero Section --- */
.hero-section {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    overflow: hidden;
}

.hero-mask-container {
    width: clamp(280px, 60vw, 600px);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Stroke draw animation */
.mask-stroke {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawStroke 3s ease forwards;
}

.mask-stroke-1 { animation-delay: 0s; }
.mask-stroke-2 { animation-delay: 0.4s; }
.mask-stroke-3 { animation-delay: 0.6s; }
.mask-stroke-4 { animation-delay: 0.8s; }
.mask-stroke-5 { animation-delay: 1.0s; }
.mask-stroke-6 { animation-delay: 1.2s; }
.mask-stroke-7 { animation-delay: 1.4s; }
.mask-stroke-8 { animation-delay: 1.6s; }
.mask-stroke-9 { animation-delay: 1.8s; }

@keyframes drawStroke {
    to {
        stroke-dashoffset: 0;
    }
}

.hero-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 300;
    font-size: clamp(3rem, 6vw, 6rem);
    color: var(--frost-primary);
    text-align: center;
    margin-top: 2rem;
    opacity: 0;
    animation: fadeInUp 1.5s ease forwards;
    animation-delay: 2.5s;
    letter-spacing: 0em;
}

.hero-subtitle {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--frost-accent);
    margin-top: 0.75rem;
    opacity: 0;
    animation: fadeInUp 1.5s ease forwards;
    animation-delay: 3s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Content Sections --- */
.content-section {
    position: relative;
    z-index: 1;
    min-height: 60vh;
    display: flex;
    align-items: center;
    padding: 10vh 5vw;
    margin-top: 30vh;
}

.content-section:first-of-type {
    margin-top: 20vh;
}

.panel-left {
    justify-content: flex-start;
    padding-left: 10vw;
}

.panel-right {
    justify-content: flex-end;
    padding-right: 10vw;
}

/* --- Frosted Glass Panel --- */
.frost-panel {
    position: relative;
    max-width: 560px;
    padding: 3rem 2.5rem;
    border-radius: 24px;
    background: var(--frost-primary-70);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 2px solid transparent;
    background-origin: border-box;
    background-clip: padding-box, border-box;
    background-image:
        linear-gradient(var(--frost-primary-70), var(--frost-primary-70)),
        conic-gradient(from var(--border-angle), #a8b8d8, #9b8ec4, #e8c87a, #a8b8d8);
    box-shadow: inset 0 0 40px rgba(232, 237, 242, 0.15);
    animation: borderRotate 8s linear infinite;
}

@keyframes borderRotate {
    to {
        --border-angle: 360deg;
    }
}

/* Mask watermark */
.mask-watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 140px;
    opacity: 0.04;
    background: radial-gradient(ellipse at 35% 45%, var(--lavender) 0%, transparent 50%),
                radial-gradient(ellipse at 65% 45%, var(--lavender) 0%, transparent 50%);
    border-radius: 50%;
    pointer-events: none;
}

/* Panel ornament SVG */
.panel-ornament {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: center;
}

.section-divider {
    width: 160px;
    height: 16px;
}

/* Section headings */
.section-heading {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: clamp(1.8rem, 3.5vw, 2.8rem);
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    text-align: center;
}

.mask-bracket {
    color: var(--lavender);
    font-weight: 300;
    opacity: 0.6;
}

.frost-panel p {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-align: center;
}

.frost-panel p:last-child {
    margin-bottom: 0;
}

.whisper {
    font-style: italic;
    color: var(--botanical) !important;
    opacity: 0.85;
}

/* --- Reveal Animation --- */
.reveal-panel {
    opacity: 0;
    transform: translateY(60px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* --- Progressive de-frosting --- */
.content-section:nth-of-type(3) .frost-panel {
    background-image:
        linear-gradient(var(--frost-primary-60), var(--frost-primary-60)),
        conic-gradient(from var(--border-angle), #a8b8d8, #9b8ec4, #e8c87a, #a8b8d8);
}

/* --- Terminal Section (The Unmasking) --- */
.terminal-section {
    position: relative;
    z-index: 1;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10vh 5vw;
    margin-top: 30vh;
    margin-bottom: 10vh;
}

.terminal-content {
    text-align: center;
    max-width: 600px;
}

.ivy-border {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
}

.terminal-ivy {
    width: min(500px, 80vw);
    height: auto;
}

.terminal-heading {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 600;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--frost-primary);
    margin-bottom: 1rem;
}

.terminal-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: 1.125rem;
    line-height: 1.85;
    color: var(--frost-accent);
    margin-bottom: 2.5rem;
}

.terminal-prompt {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 14px 24px;
    border-radius: 24px;
    background: rgba(232, 237, 242, 0.06);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--frost-accent-25);
    box-shadow: 0 0 30px rgba(232, 200, 122, 0.08);
}

.prompt-symbol {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 500;
    font-size: 0.875rem;
    letter-spacing: 0.08em;
    color: var(--candlelight);
    white-space: nowrap;
}

.protocol-input {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 400;
    font-size: 0.875rem;
    letter-spacing: 0.05em;
    color: var(--frost-primary);
    background: transparent;
    border: none;
    outline: none;
    width: clamp(140px, 30vw, 280px);
    caret-color: var(--candlelight);
}

.protocol-input::placeholder {
    color: rgba(168, 184, 216, 0.4);
    font-style: italic;
}

.cursor-blink {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.875rem;
    color: var(--candlelight);
    animation: blink 1s step-end infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* --- Scroll-based hero mask shrink (JS controlled) --- */
.hero-mask-container.shrunk {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 50px;
    z-index: 1001;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .panel-left,
    .panel-right {
        justify-content: center;
        padding-left: 5vw;
        padding-right: 5vw;
    }

    .frost-panel {
        max-width: 100%;
        padding: 2rem 1.5rem;
    }

    .content-section {
        margin-top: 20vh;
    }

    .terminal-section {
        margin-top: 20vh;
    }

    .radial-nav.open .radial-item[data-index="0"] {
        transform: translate(-20px, 60px) scale(1);
    }
    .radial-nav.open .radial-item[data-index="1"] {
        transform: translate(-40px, 110px) scale(1);
    }
    .radial-nav.open .radial-item[data-index="2"] {
        transform: translate(-50px, 160px) scale(1);
    }
    .radial-nav.open .radial-item[data-index="3"] {
        transform: translate(-40px, 210px) scale(1);
    }
    .radial-nav.open .radial-item[data-index="4"] {
        transform: translate(-20px, 260px) scale(1);
    }
}
