/* ============================================
   MasqueradeProtocol.com - Styles
   Crystalline Sci-Fi Operations Theater
   ============================================ */

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

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

body {
    background-color: #0A0F1A;
    color: #E0F7FA;
    font-family: 'Quicksand', sans-serif;
    font-weight: 500;
    font-size: 17px;
    line-height: 1.72;
    overflow-x: hidden;
}

/* --- Typography --- */
.section-heading {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(48px, 6vw, 96px);
    color: #00E5FF;
    letter-spacing: -0.03em;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.3), 0 0 60px rgba(0, 229, 255, 0.1);
    margin-bottom: 40px;
}

.panel-label,
.card-label {
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #FFB74D;
}

.panel-mono,
.card-mono {
    font-family: 'Ubuntu Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    color: #80DEEA;
    letter-spacing: 0.05em;
}

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

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

/* --- Scene Base --- */
.scene {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* ============================================
   SCENE 1: Crystal Genesis
   ============================================ */
.scene-genesis {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0A0F1A;
    position: relative;
}

#crystal-mesh-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.genesis-content {
    position: relative;
    z-index: 2;
    text-align: center;
    opacity: 0;
    transform: scale(0.9);
    transition: opacity 1.2s ease, transform 1.2s ease;
}

.genesis-content.revealed {
    opacity: 1;
    transform: scale(1);
}

.genesis-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: clamp(36px, 8vw, 120px);
    color: #00E5FF;
    letter-spacing: -0.03em;
    text-shadow:
        0 0 20px rgba(0, 229, 255, 0.4),
        0 0 60px rgba(0, 229, 255, 0.2),
        0 0 120px rgba(0, 229, 255, 0.1);
    margin-bottom: 24px;
}

.genesis-tagline {
    font-family: 'Varela Round', sans-serif;
    font-weight: 400;
    font-size: clamp(14px, 2vw, 24px);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #FFB74D;
    text-shadow: 0 0 15px rgba(255, 183, 77, 0.3);
}

.scroll-indicator {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    width: 2px;
    height: 60px;
    background: rgba(0, 229, 255, 0.15);
    border-radius: 1px;
    overflow: hidden;
}

.scroll-indicator-line {
    width: 100%;
    height: 20px;
    background: #00E5FF;
    border-radius: 1px;
    animation: scroll-pulse 2s ease-in-out infinite;
}

@keyframes scroll-pulse {
    0% { transform: translateY(-20px); opacity: 0; }
    50% { opacity: 1; }
    100% { transform: translateY(60px); opacity: 0; }
}

/* ============================================
   SCENE 2: Protocol Manifest
   ============================================ */
.scene-manifest {
    min-height: 100vh;
    padding: 80px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.manifest-layout {
    display: flex;
    width: 96%;
    max-width: 1440px;
    margin: 0 auto;
    gap: 0;
    align-items: flex-start;
}

.primary-zone {
    width: 62%;
    padding: 0 40px;
}

.data-conduit {
    width: 4%;
    min-height: 500px;
    position: relative;
    background: linear-gradient(180deg, transparent, rgba(0, 229, 255, 0.05), transparent);
}

.data-conduit::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 1px;
    height: 100%;
    background: linear-gradient(180deg,
        transparent,
        #00E5FF,
        transparent
    );
    opacity: 0.4;
    animation: conduit-flicker 3s ease-in-out infinite;
}

@keyframes conduit-flicker {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.6; }
}

.secondary-zone {
    width: 34%;
    padding-top: 80px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Radar Chart */
.radar-chart-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    margin-bottom: 32px;
}

#radar-chart {
    width: 100%;
    height: 100%;
}

.radar-labels {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.radar-label {
    position: absolute;
    font-family: 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: #80DEEA;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    white-space: nowrap;
}

.radar-label[data-axis="0"] { top: 2%; left: 50%; transform: translateX(-50%); }
.radar-label[data-axis="1"] { top: 32%; right: 0; }
.radar-label[data-axis="2"] { bottom: 10%; right: 8%; }
.radar-label[data-axis="3"] { bottom: 10%; left: 8%; }
.radar-label[data-axis="4"] { top: 32%; left: 0; }

.manifest-description {
    font-family: 'Quicksand', sans-serif;
    font-size: 17px;
    color: #E0F7FA;
    line-height: 1.72;
    max-width: 480px;
}

/* Crystal Panels */
.crystal-panel {
    position: relative;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #141E30;
    border: 1px solid transparent;
    background-image: conic-gradient(from var(--border-angle, 0deg), #00E5FF, #FFB74D, #00BCD4, #00E5FF);
    background-origin: border-box;
    background-clip: padding-box, border-box;
    animation: rotate-border 4s linear infinite;
    transition: border-width 0.2s ease;
}

.crystal-panel::before {
    content: '';
    position: absolute;
    inset: 1px;
    background: #141E30;
    z-index: 0;
}

.crystal-panel > * {
    position: relative;
    z-index: 1;
}

.panel-1 {
    clip-path: polygon(0 0, 100% 0, 95% 100%, 5% 95%);
    transform: perspective(800px) rotateY(-3deg);
}

.panel-2 {
    clip-path: polygon(3% 0, 97% 5%, 100% 100%, 0 97%);
    transform: perspective(800px) rotateY(-3deg) translateX(15px);
}

.panel-3 {
    clip-path: polygon(0 3%, 100% 0, 98% 95%, 2% 100%);
    transform: perspective(800px) rotateY(-3deg) translateX(-10px);
}

.panel-value {
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    font-size: 32px;
    color: #00E5FF;
    text-shadow: 0 0 15px rgba(0, 229, 255, 0.3);
}

/* Fracture Lines */
.fracture-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 5;
    pointer-events: none;
}

.fracture-stroke {
    stroke: #00E5FF;
    stroke-width: 1;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    opacity: 0.5;
    transition: stroke-dashoffset 2s ease;
}

.fracture-line.animated .fracture-stroke {
    stroke-dashoffset: 0;
}

/* ============================================
   SCENE 3: Identity Lattice
   ============================================ */
.scene-lattice {
    min-height: 150vh;
    position: relative;
    padding: 80px 0;
}

.lattice-layout {
    position: relative;
    width: 96%;
    max-width: 1440px;
    margin: 0 auto;
}

.lattice-graph-container {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    z-index: 1;
}

#network-graph {
    width: 100%;
    height: 100%;
}

.lattice-content {
    position: relative;
    z-index: 2;
    padding-top: 30vh;
}

.lattice-content .section-heading {
    margin-bottom: 60px;
}

.lattice-text-block {
    background: rgba(20, 30, 48, 0.85);
    backdrop-filter: blur(8px);
    padding: 32px 40px;
    margin-bottom: 40px;
    max-width: 520px;
    border-left: 2px solid #00E5FF;
    clip-path: polygon(0 0, 100% 0, 98% 100%, 0 100%);
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 0.8s ease, transform 0.8s ease;
}

.lattice-text-block.visible {
    opacity: 1;
    transform: translateX(0);
}

.lattice-text-block p {
    color: #E0F7FA;
    font-size: 17px;
    line-height: 1.72;
}

/* ============================================
   SCENE 4: Signal Stream
   ============================================ */
.scene-signal {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.signal-heading {
    position: relative;
    z-index: 3;
    margin-bottom: 40px;
}

.signal-stream-container {
    position: relative;
    width: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    overflow: hidden;
}

.ticker-band {
    width: 100%;
    height: 40px;
    font-family: 'Ubuntu Mono', monospace;
    font-size: 15px;
    letter-spacing: 0.05em;
    color: #80DEEA;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
    line-height: 40px;
    opacity: 0.35;
    transition: opacity 0.3s ease;
}

.ticker-band:hover {
    opacity: 1;
}

.ticker-band .ticker-content {
    display: inline-block;
    animation: ticker-scroll-left 30s linear infinite;
    will-change: transform;
}

.ticker-band[data-direction="right"] .ticker-content {
    animation-name: ticker-scroll-right;
}

.ticker-band[data-speed="fast"] .ticker-content {
    animation-duration: 20s;
}

.ticker-band[data-speed="slow"] .ticker-content {
    animation-duration: 45s;
}

.ticker-band .decrypted {
    color: #FFB74D;
    background: rgba(255, 183, 77, 0.1);
    border-radius: 2px;
    padding: 0 2px;
}

@keyframes ticker-scroll-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

@keyframes ticker-scroll-right {
    0% { transform: translateX(-50%); }
    100% { transform: translateX(0); }
}

.signal-overlay {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
}

.signal-caption {
    font-family: 'Varela Round', sans-serif;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: #FFB74D;
    opacity: 0.7;
    animation: caption-pulse 2s ease-in-out infinite;
}

@keyframes caption-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.9; }
}

/* ============================================
   SCENE 5: Crystalline Archive
   ============================================ */
.scene-archive {
    min-height: 100vh;
    padding: 80px 0 120px;
}

.archive-layout {
    width: 96%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 40px;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 20px;
}

.archive-card {
    position: relative;
    background: #141E30;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid rgba(0, 229, 255, 0.2);
    transition: border-color 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(30px) scale(0.95);
    transition: opacity 0.6s ease, transform 0.6s ease, border-color 0.3s ease;
}

.archive-card.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.archive-card:hover {
    border-color: #00E5FF;
    transform: translateY(-4px) scale(1.01);
}

/* Unique clip-path silhouettes for each card */
.card-shape-1 { clip-path: polygon(0 0, 100% 0, 95% 100%, 5% 95%); }
.card-shape-2 { clip-path: polygon(3% 0, 100% 3%, 97% 100%, 0 97%); }
.card-shape-3 { clip-path: polygon(0 5%, 95% 0, 100% 95%, 5% 100%); }
.card-shape-4 { clip-path: polygon(2% 0, 100% 2%, 98% 98%, 0 100%); }
.card-shape-5 { clip-path: polygon(0 0, 97% 3%, 100% 100%, 3% 97%); }
.card-shape-6 { clip-path: polygon(4% 0, 100% 0, 96% 96%, 0 100%); }
.card-shape-7 { clip-path: polygon(0 2%, 98% 0, 100% 98%, 2% 100%); }
.card-shape-8 { clip-path: polygon(0 0, 100% 4%, 97% 100%, 3% 96%); }
.card-shape-9 { clip-path: polygon(3% 3%, 97% 0, 100% 97%, 0 100%); }

.archive-card canvas,
.archive-card .mini-spectrum {
    width: 100%;
    height: 120px;
    display: block;
}

.mini-spectrum {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    padding: 0 4px;
}

.mini-spectrum .bar {
    flex: 1;
    background: linear-gradient(180deg, #00E5FF, #00BCD4);
    border-radius: 1px 1px 0 0;
    transition: height 0.15s ease;
}

/* --- Animated Border for Interactive Elements --- */
.crystal-panel,
.archive-card {
    position: relative;
}

.crystal-panel::after,
.archive-card::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--border-angle, 0deg), #00E5FF, #FFB74D, #E040FB, #00BCD4, #00E5FF);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    animation: rotate-border 4s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.crystal-panel:hover::after,
.archive-card:hover::after {
    animation-duration: 2s;
    padding: 2px;
}

/* --- Protocol Active Indicator (Magenta) --- */
.panel-1 .panel-value {
    color: #E040FB;
    text-shadow: 0 0 15px rgba(224, 64, 251, 0.4);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
    .manifest-layout {
        flex-direction: column;
    }

    .primary-zone {
        width: 100%;
        padding: 0 24px;
    }

    .data-conduit {
        display: none;
    }

    .secondary-zone {
        width: 100%;
        padding-top: 40px;
        padding-left: 24px;
        padding-right: 24px;
    }

    .archive-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .archive-grid {
        grid-template-columns: 1fr;
    }

    .lattice-text-block {
        max-width: 100%;
    }
}

/* --- Frequency Spectrum Bars --- */
.spectrum-bar {
    flex: 1;
    background: linear-gradient(180deg, #00E5FF, rgba(0, 188, 212, 0.4));
    border-radius: 1px 1px 0 0;
    min-height: 4px;
}

/* --- Additional Design Palette Colors --- */
/* Deep slate text on light panels: #1A2332 */
.archive-card .card-label-sub {
    color: #1A2332;
}

.lattice-text-block {
    color: #1A2332;
}

/* Facet highlight for hover states: #1C2A42 */
.crystal-panel:hover::before {
    background: #1C2A42;
}

.archive-card:hover {
    background: #1C2A42;
}

/* Text muted - timestamps, metadata: #607D8B */
.card-mono {
    color: #607D8B;
}

/* Danger/decrypt warning: #FF5252 */
.ticker-band .decrypted-error {
    color: #FF5252;
}

.signal-overlay .warning-text {
    color: #FF5252;
}

/* --- Selection Color --- */
::selection {
    background: rgba(0, 229, 255, 0.3);
    color: #E0F7FA;
}
