/* ============================================
   xity.one — Memphis-Flavored Command Center
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-gunmetal: #1a1c2e;
    --warm-slate: #2b2d42;
    --bright-chrome: #c0c0d0;
    --hot-coral: #ff6b8a;
    --electric-teal: #00bcd4;
    --signal-gold: #ffd166;
    --pale-steel: #d8d8e8;
    --graphite: #3d3d50;
    --soft-fog: #eef0f5;
    --muted-chrome: #8888a0;
    --chrome-gradient: linear-gradient(135deg, #c0c0d0 0%, #7a7a90 50%, #c0c0d0 100%);
}

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: 'Cormorant Garamond', Georgia, serif;
    background: var(--deep-gunmetal);
    color: var(--pale-steel);
    overflow-x: hidden;
}

/* --- Scan Lines --- */
.scan-lines {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(192, 192, 208, 0.06) 0px,
        rgba(192, 192, 208, 0.06) 1px,
        transparent 1px,
        transparent 4px
    );
    z-index: 1;
}

/* --- Typography --- */
.spread-headline {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2.8rem, 6vw, 5.5rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--bright-chrome);
}

.body-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 400;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    line-height: 1.65;
    color: var(--pale-steel);
    margin-bottom: 1.5rem;
}

.mono-accent {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--electric-teal);
}

/* --- Spreads --- */
.spread {
    width: 100vw;
    height: 100vh;
    position: relative;
    scroll-snap-align: start;
    overflow: hidden;
    background: var(--deep-gunmetal);
}

/* --- Navigation --- */
#spread-nav {
    position: fixed;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.nav-icon {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.nav-icon svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: var(--hot-coral);
    stroke-width: 1.5;
    transition: all 0.3s ease;
}

.nav-icon.active svg {
    fill: url(#chrome-grad);
    stroke: var(--bright-chrome);
    fill: var(--bright-chrome);
    filter: drop-shadow(0 0 4px rgba(192, 192, 208, 0.4));
}

.nav-icon:hover svg {
    stroke: var(--signal-gold);
}

/* --- Corner Brackets --- */
.corner-brackets {
    position: relative;
    padding: 24px;
}

.cb {
    position: absolute;
    width: 20px;
    height: 20px;
    border-color: var(--bright-chrome);
    border-style: solid;
    border-width: 0;
    transition: transform 0.6s ease-out;
}

.cb-tl { top: 0; left: 0; border-top-width: 2px; border-left-width: 2px; }
.cb-tr { top: 0; right: 0; border-top-width: 2px; border-right-width: 2px; }
.cb-bl { bottom: 0; left: 0; border-bottom-width: 2px; border-left-width: 2px; }
.cb-br { bottom: 0; right: 0; border-bottom-width: 2px; border-right-width: 2px; }

.cb.animate-in {
    transform: translate(0, 0) !important;
}

/* --- Spread 1: Control Surface --- */
.spread-1-grid {
    display: grid;
    grid-template-columns: 3fr 9fr;
    height: 100%;
    position: relative;
    z-index: 2;
}

.totem-column {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.memphis-totem {
    height: 70vh;
    max-width: 120px;
}

.totem-shape {
    fill: none;
    stroke: var(--electric-teal);
    stroke-width: 2;
    stroke-dasharray: 500;
    stroke-dashoffset: 500;
    transition: stroke-dashoffset 1s ease-out, fill 0.5s ease 1s;
}

.totem-shape.drawn {
    stroke-dashoffset: 0;
}

.totem-shape.filled {
    fill: var(--warm-slate);
    stroke: var(--bright-chrome);
}

.hero-content {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 80px 40px 40px;
}

.hero-content .corner-brackets {
    width: 100%;
    max-width: 800px;
}

.hero-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(4rem, 10vw, 9rem);
    letter-spacing: -0.02em;
    line-height: 1.05;
    color: var(--bright-chrome);
    margin-bottom: 24px;
}

.hero-title .word {
    display: inline-block;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.hero-title .word.visible {
    opacity: 1;
}

.hero-title .dot {
    color: var(--hot-coral);
}

.hero-tagline {
    margin-bottom: 40px;
    opacity: 0;
    transition: opacity 0.8s ease 1.2s;
}

.hero-tagline.visible {
    opacity: 1;
}

/* --- Data Tickers --- */
.data-ticker {
    display: flex;
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(192, 192, 208, 0.15);
    margin-top: 24px;
    flex-wrap: wrap;
}

.data-ticker .mono-accent {
    color: var(--muted-chrome);
    font-size: 0.7rem;
}

/* --- Spread 2: Dossier --- */
.spread-2-grid {
    display: grid;
    grid-template-columns: 5fr 7fr;
    height: 100%;
    position: relative;
    z-index: 2;
}

.dossier-canvas-col {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 30px 60px 70px;
}

.dossier-canvas-col .corner-brackets {
    width: 100%;
    height: 80%;
}

#terrazzo-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: var(--warm-slate);
}

.dossier-text-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 80px 60px 40px;
}

.dossier-text-col .spread-headline {
    margin-bottom: 32px;
    font-size: clamp(2rem, 4vw, 3.5rem);
}

.fade-paragraph {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-paragraph.visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Pullquote --- */
.pullquote {
    margin: 32px 0;
    background: rgba(238, 240, 245, 0.03);
}

.pullquote-text {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.3rem, 2vw, 1.8rem);
    line-height: 1.4;
    color: var(--hot-coral);
}

/* --- Spread 3: Schematic --- */
.spread-3-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 80px;
}

.schematic-title {
    margin-bottom: 20px;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
}

#schematic-svg {
    width: 100%;
    max-width: 1200px;
    height: auto;
    max-height: 70vh;
}

.schematic-path {
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    transition: stroke-dashoffset 1.5s ease-out;
}

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

.sub-path {
    stroke-width: 1.5;
}

.squiggle-deco {
    stroke-width: 2.5;
}

.path-coral { stroke: var(--hot-coral); }
.path-teal { stroke: var(--electric-teal); }
.path-gold { stroke: var(--signal-gold); }

.schematic-node {
    opacity: 0;
    transition: opacity 0.5s ease;
}

.schematic-node.visible {
    opacity: 1;
}

.node-center { fill: var(--bright-chrome); }
.node-coral { fill: var(--hot-coral); }
.node-teal { fill: var(--electric-teal); }
.node-gold { fill: var(--signal-gold); }

.schematic-label {
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    fill: var(--muted-chrome);
    text-anchor: middle;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.schematic-label.visible {
    opacity: 1;
}

/* --- Spread 4: Archive --- */
.spread-4-grid {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 60px 80px;
}

.archive-title {
    margin-bottom: 32px;
    font-size: clamp(1.8rem, 3vw, 2.8rem);
}

.archive-panels {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr 1fr;
    gap: 16px;
}

.archive-panel {
    position: relative;
    border: 1px solid var(--bright-chrome);
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.5s ease, transform 0.3s ease;
    cursor: pointer;
}

.archive-panel.visible {
    opacity: 1;
}

.archive-panel::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    transition: width 0.3s ease;
}

.panel-coral::after { background: var(--hot-coral); }
.panel-teal::after { background: var(--electric-teal); }

.archive-panel:hover::after {
    width: 100%;
}

.archive-panel:hover {
    transform: perspective(800px) rotateY(3deg) rotateX(-2deg);
    border-color: var(--bright-chrome);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.panel-large {
    grid-column: span 2;
}

.archive-canvas {
    width: 100%;
    height: 100%;
    display: block;
    background: var(--warm-slate);
}

.panel-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 16px;
    background: linear-gradient(transparent, rgba(26, 28, 46, 0.9));
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

/* --- Spread 5: Signal --- */
#spread-5 {
    background: linear-gradient(180deg, var(--deep-gunmetal) 0%, #22243a 100%);
}

.spread-5-content {
    position: relative;
    z-index: 2;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

#signal-squiggle {
    position: absolute;
    width: 90%;
    max-width: 800px;
    height: auto;
    opacity: 0.3;
}

.signal-path {
    fill: none;
    stroke: var(--hot-coral);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-dasharray: 2000;
    stroke-dashoffset: 2000;
}

.signal-path.animate {
    animation: drawSquiggle 4s linear infinite;
}

@keyframes drawSquiggle {
    0% { stroke-dashoffset: 2000; }
    50% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -2000; }
}

.signal-statement {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 4rem);
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: var(--bright-chrome);
    text-align: center;
    max-width: 700px;
    position: relative;
    z-index: 3;
    min-height: 3em;
}

.signal-statement .typed-cursor {
    display: inline-block;
    width: 3px;
    height: 1em;
    background: var(--hot-coral);
    margin-left: 4px;
    animation: cursorBlink 0.8s infinite;
    vertical-align: text-bottom;
}

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

#spread-5 .data-ticker {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    justify-content: center;
}

/* --- Chrome Spheres --- */
.chrome-sphere {
    position: fixed;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #e0e0ef, #7a7a90 60%, #2b2d42);
    pointer-events: none;
    z-index: 999;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.chrome-sphere.visible {
    opacity: 0.6;
}

.sphere-1 { width: 30px; height: 30px; top: 20vh; right: 40px; }
.sphere-2 { width: 20px; height: 20px; top: 60vh; right: 60px; }
.sphere-3 { width: 24px; height: 24px; top: 80vh; left: 60px; }

/* --- Custom Cursor for interactive elements --- */
.nav-icon,
.archive-panel {
    cursor: crosshair;
}

/* --- Responsive --- */
@media (max-width: 768px) {
    .spread-1-grid {
        grid-template-columns: 1fr;
    }
    .totem-column {
        display: none;
    }
    .hero-content {
        padding: 40px 20px;
    }
    .spread-2-grid {
        grid-template-columns: 1fr;
    }
    .dossier-canvas-col {
        display: none;
    }
    .dossier-text-col {
        padding: 40px 20px;
    }
    .spread-3-content {
        padding: 40px 20px;
    }
    .spread-4-grid {
        padding: 40px 20px;
    }
    .archive-panels {
        grid-template-columns: 1fr 1fr;
    }
    .panel-large {
        grid-column: span 2;
    }
    #spread-nav {
        left: 10px;
    }
    .nav-icon {
        width: 24px;
        height: 24px;
    }
}
