/* ============================================
   archaic.works - Styles
   Split-screen archaeological scanning interface
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --void-black: #0a0a0f;
    --slab-gray: #1a1a24;
    --nuclear-green: #39FF14;
    --neon-magenta: #FF2D6A;
    --signal-gold: #FFD700;
    --electric-cyan: #00F5FF;
    --pale-signal: #C8C8D0;
    --ash-light: #E0E0E0;
    --concrete-dark: #2a2a35;
    --toxic-orange: #FF6B1A;

    --font-display: 'Orbitron', sans-serif;
    --font-secondary: 'Rajdhani', sans-serif;
    --font-body: 'Exo 2', sans-serif;
    --font-mono: 'Share Tech Mono', monospace;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--void-black);
    color: var(--pale-signal);
    font-family: var(--font-body);
    font-weight: 300;
    font-size: clamp(0.95rem, 1.1vw, 1.15rem);
    line-height: 1.85;
    letter-spacing: 0.02em;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* --- Opening Overlay --- */
#opening-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--void-black);
    z-index: 10000;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s ease;
}

#opening-overlay.fade-out {
    opacity: 0;
}

/* --- Center Divider --- */
#center-divider {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 0;
    background: var(--nuclear-green);
    z-index: 100;
    transition: width 0.2s ease;
    animation: divider-pulse 3s ease-in-out infinite;
}

#center-divider.drawn {
    height: 100%;
    transition: height 0.8s ease-out;
}

#center-divider:hover {
    width: 4px;
}

#center-divider:hover #divider-label {
    opacity: 1;
}

#divider-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--nuclear-green);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

@keyframes divider-pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1.0; }
}

/* --- Split Screen Container --- */
#split-screen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

/* --- Stone Panel (Left) --- */
#stone-panel {
    position: relative;
    background: linear-gradient(180deg, var(--void-black) 0%, var(--slab-gray) 100%);
    overflow-y: auto;
    overflow-x: hidden;
    height: 100vh;
    padding: 0 clamp(2rem, 4vw, 5rem);
    scrollbar-width: thin;
    scrollbar-color: var(--nuclear-green) var(--void-black);
}

#stone-panel::-webkit-scrollbar {
    width: 4px;
}

#stone-panel::-webkit-scrollbar-track {
    background: var(--void-black);
}

#stone-panel::-webkit-scrollbar-thumb {
    background: var(--nuclear-green);
}

/* --- Graffiti Tags (palimpsest backgrounds) --- */
.graffiti-tag {
    position: absolute;
    width: 70vw;
    height: auto;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
}

.graffiti-tag-1 {
    top: 5%;
    left: -10%;
    transform: rotate(8deg);
}

.graffiti-tag-2 {
    top: 35%;
    left: -5%;
    transform: rotate(-5deg);
}

.graffiti-tag-3 {
    top: 65%;
    left: -15%;
    transform: rotate(12deg);
}

/* --- Spray Drift Particles --- */
#spray-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.spray-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

/* --- Strata (Content Sections) --- */
.stratum {
    position: relative;
    z-index: 2;
    padding: 120px 0;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.stratum.visible {
    opacity: 1;
    transform: translateY(0);
}

.stratum-hero {
    padding-top: 20vh;
    padding-bottom: 120px;
}

.stratum-content {
    position: relative;
    background: rgba(42, 42, 53, 0.3);
    border: 1px solid rgba(57, 255, 20, 0.1);
    padding: clamp(2rem, 3vw, 4rem);
    transition: transform 0.15s ease-out;
    will-change: transform;
}

/* --- Scan Line Separator --- */
.scan-line-separator {
    position: relative;
    width: 100%;
    height: 1px;
    margin-top: 120px;
    background: transparent;
    overflow: hidden;
}

.scan-line-separator::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 1px;
    background: var(--nuclear-green);
    opacity: 0.5;
    transition: left 0s;
}

.stratum.visible .scan-line-separator::after {
    animation: scan-sweep 1.2s ease-out forwards;
}

@keyframes scan-sweep {
    0% { left: -100%; }
    100% { left: 0; }
}

/* --- Typography --- */
.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.5rem, 7vw, 6rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(90deg, var(--toxic-orange) 0%, var(--signal-gold) 40%, var(--nuclear-green) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-family: var(--font-secondary);
    font-weight: 600;
    font-size: clamp(1rem, 2vw, 1.5rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ash-light);
    line-height: 1.6;
    max-width: 40ch;
}

.section-heading {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: var(--nuclear-green);
    margin-bottom: 2rem;
    line-height: 1.2;
}

.secondary-heading {
    color: var(--signal-gold);
}

.body-text {
    color: var(--pale-signal);
    margin-bottom: 1.5rem;
    max-width: 55ch;
}

.body-text strong, .body-text em {
    font-weight: 500;
}

.mono-annotation {
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.06em;
    color: rgba(57, 255, 20, 0.7);
    margin-top: 2rem;
}

/* --- Stone Links --- */
.stone-link {
    display: inline-block;
    font-family: var(--font-secondary);
    font-weight: 600;
    font-size: clamp(0.85rem, 1vw, 1rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--electric-cyan);
    text-decoration: none;
    position: relative;
    margin-top: 1rem;
    padding-bottom: 4px;
}

.stone-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--electric-cyan);
    transition: width 0.3s ease;
}

.stone-link:hover::after {
    width: 100%;
}

.stone-link:hover {
    color: var(--electric-cyan);
}

/* --- Character Stagger Animation --- */
.char-animate .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.stratum.visible .char-animate .char {
    opacity: 1;
    transform: translateY(0);
}

/* --- Signal Panel (Right) --- */
#signal-panel {
    position: relative;
    background: var(--slab-gray);
    overflow: hidden;
    height: 100vh;
}

/* --- Scan Lines Background --- */
#scan-lines-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        180deg,
        transparent,
        transparent 3px,
        rgba(57, 255, 20, 0.08) 3px,
        rgba(57, 255, 20, 0.08) 4px
    );
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#scan-lines-bg.active {
    opacity: 1;
}

/* --- Active Scan Line --- */
#active-scan-line {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(57, 255, 20, 0.4);
    z-index: 2;
    pointer-events: none;
    animation: scan-vertical 6s linear infinite;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#active-scan-line.active {
    opacity: 1;
}

@keyframes scan-vertical {
    0% { top: -2px; }
    100% { top: 100%; }
}

/* --- HUD Corner Brackets --- */
.hud-corner {
    position: absolute;
    width: 40px;
    height: 40px;
    z-index: 10;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.hud-corner.active {
    opacity: 1;
    transform: scale(1);
}

.hud-corner::before,
.hud-corner::after {
    content: '';
    position: absolute;
    background: var(--neon-magenta);
}

/* Top-Left */
.hud-corner-tl {
    top: 20px;
    left: 20px;
}
.hud-corner-tl::before {
    top: 0; left: 0; width: 40px; height: 2px;
}
.hud-corner-tl::after {
    top: 0; left: 0; width: 2px; height: 40px;
}

/* Top-Right */
.hud-corner-tr {
    top: 20px;
    right: 20px;
}
.hud-corner-tr::before {
    top: 0; right: 0; width: 40px; height: 2px;
}
.hud-corner-tr::after {
    top: 0; right: 0; width: 2px; height: 40px;
}

/* Bottom-Left */
.hud-corner-bl {
    bottom: 20px;
    left: 20px;
}
.hud-corner-bl::before {
    bottom: 0; left: 0; width: 40px; height: 2px;
}
.hud-corner-bl::after {
    bottom: 0; left: 0; width: 2px; height: 40px;
}

/* Bottom-Right */
.hud-corner-br {
    bottom: 20px;
    right: 20px;
}
.hud-corner-br::before {
    bottom: 0; right: 0; width: 40px; height: 2px;
}
.hud-corner-br::after {
    bottom: 0; right: 0; width: 2px; height: 40px;
}

/* Coordinate Readouts */
.coord-readout {
    position: absolute;
    font-family: var(--font-mono);
    font-size: clamp(0.7rem, 0.9vw, 0.85rem);
    letter-spacing: 0.06em;
    color: rgba(57, 255, 20, 0.7);
    white-space: nowrap;
}

.hud-corner-tl .coord-readout {
    top: 44px;
    left: 0;
}

.hud-corner-tr .coord-readout {
    top: 44px;
    right: 0;
    text-align: right;
}

.hud-corner-bl .coord-readout {
    bottom: 44px;
    left: 0;
}

.hud-corner-br .coord-readout {
    bottom: 44px;
    right: 0;
    text-align: right;
}

/* Signal Bars */
.signal-bars {
    display: inline-flex;
    gap: 3px;
    vertical-align: middle;
    margin-left: 6px;
}

.sig-bar {
    display: inline-block;
    width: 6px;
    height: 10px;
    background: rgba(57, 255, 20, 0.2);
    border: 1px solid rgba(57, 255, 20, 0.4);
}

.sig-bar.active {
    background: var(--nuclear-green);
    border-color: var(--nuclear-green);
    box-shadow: 0 0 4px rgba(57, 255, 20, 0.5);
}

/* --- Targeting Reticle --- */
#targeting-reticle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.4s ease, top 0.6s ease, left 0.6s ease;
}

#targeting-reticle.active {
    opacity: 1;
}

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

.reticle-ring {
    fill: none;
    stroke: var(--nuclear-green);
    stroke-width: 1;
    opacity: 0.3;
}

.ring-inner {
    animation: reticle-pulse 2s ease-in-out infinite;
    transform-origin: center;
}

@keyframes reticle-pulse {
    0%, 100% { transform: scale(0.95); }
    50% { transform: scale(1.05); }
}

.reticle-crosshair {
    stroke: var(--nuclear-green);
    stroke-width: 0.5;
    opacity: 0.2;
}

/* --- Hexagonal Wireframe --- */
#hex-wireframe {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 200px;
    height: 200px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.4s ease;
}

#hex-wireframe.active {
    opacity: 1;
}

.hex-svg {
    width: 100%;
    height: 100%;
    animation: hex-rotate 120s linear infinite;
}

@keyframes hex-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.hex-shape {
    fill: none;
    stroke: var(--electric-cyan);
    stroke-width: 1;
    opacity: 0.5;
}

.radial-line {
    stroke: var(--electric-cyan);
    stroke-width: 0.5;
    opacity: 0.15;
}

/* --- Glyph Fragments --- */
#glyph-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4;
    pointer-events: none;
}

.glyph-fragment {
    position: absolute;
    width: 60px;
    height: 60px;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.glyph-fragment.visible {
    opacity: 0.7;
}

.glyph-1 { top: 15%; left: 70%; }
.glyph-2 { top: 25%; left: 15%; }
.glyph-3 { top: 45%; left: 75%; }
.glyph-4 { top: 60%; left: 20%; }
.glyph-5 { top: 75%; left: 65%; }
.glyph-6 { top: 85%; left: 30%; }

/* --- Data Readouts --- */
#data-readouts {
    position: absolute;
    top: 50%;
    left: 24px;
    transform: translateY(-50%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.readout-line {
    font-family: var(--font-mono);
    font-size: clamp(0.6rem, 0.8vw, 0.75rem);
    letter-spacing: 0.06em;
    color: rgba(57, 255, 20, 0.7);
    writing-mode: vertical-lr;
    text-orientation: mixed;
    transform: rotate(180deg);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.readout-line.active {
    opacity: 1;
}

/* --- Crosshair Follower --- */
#crosshair-follower {
    position: absolute;
    width: 40px;
    height: 40px;
    pointer-events: none;
    z-index: 20;
    transform: translate(-50%, -50%);
    transition: left 0.2s ease-out, top 0.2s ease-out;
    opacity: 0;
    left: 50%;
    top: 50%;
}

#crosshair-follower.active {
    opacity: 1;
}

#crosshair-follower svg {
    width: 100%;
    height: 100%;
}

/* --- Interference Screens (Mobile) --- */
.interference-screen {
    display: none;
}

/* ============================================
   MOBILE LAYOUT (stacked)
   ============================================ */
@media (max-width: 1023px) {
    body {
        overflow-y: auto;
        overflow-x: hidden;
        height: auto;
    }

    #split-screen {
        display: block;
        height: auto;
        overflow: visible;
    }

    #center-divider {
        display: none;
    }

    #stone-panel {
        height: auto;
        overflow: visible;
        padding: 0 clamp(1.5rem, 5vw, 3rem);
    }

    #signal-panel {
        display: none;
    }

    .stratum {
        padding: 60px 0;
    }

    .stratum-hero {
        padding-top: 15vh;
    }

    .scan-line-separator {
        margin-top: 60px;
    }

    .interference-screen {
        display: block;
        width: 100%;
        height: 40vh;
        background: var(--slab-gray);
        position: relative;
        overflow: hidden;
    }

    .interference-screen::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: repeating-linear-gradient(
            180deg,
            transparent,
            transparent 3px,
            rgba(57, 255, 20, 0.06) 3px,
            rgba(57, 255, 20, 0.06) 4px
        );
    }

    .interference-screen::after {
        content: 'SIGNAL PROCESSING';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        font-family: var(--font-mono);
        font-size: 0.75rem;
        letter-spacing: 0.15em;
        color: rgba(57, 255, 20, 0.4);
    }

    .hero-title {
        font-size: clamp(2rem, 10vw, 4rem);
    }
}

/* ============================================
   DESKTOP ENHANCEMENTS
   ============================================ */
@media (min-width: 1024px) {
    /* Tilt card perspective wrapper */
    .tilt-card {
        perspective: 1200px;
    }
}

/* --- Utility: Hidden during load --- */
.initially-hidden {
    opacity: 0;
}
