/* ============================================
   lossless.dev — Holographic City of Data
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --deep-bg: #070b1e;
    --primary-bg: #0d1b3a;
    --module-light: #1a2744;
    --module-dark: #0a0e27;
    --accent-cyan: #00e5ff;
    --accent-violet: #b388ff;
    --accent-rose: #ff6ec7;
    --accent-gold: #ffd740;
    --text-body: #e0e6f0;
    --text-muted: #7b8ba8;
    --signal-green: #69f0ae;
    --holo-gradient: linear-gradient(135deg, #00e5ff 0%, #b388ff 33%, #ff6ec7 66%, #ffd740 100%);
    --spring-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
    --mouse-x: 50%;
    --mouse-y: 50%;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--deep-bg);
    color: var(--text-body);
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    line-height: 1.7;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* --- Typography --- */
h1, h2, h3, .block-label, .signal-text {
    font-family: 'Bebas Neue', sans-serif;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mono, code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 0.85rem;
    line-height: 1.5;
}

/* --- SKYLINE (Hero) --- */
#skyline {
    position: relative;
    width: 100%;
    height: 100vh;
    background: var(--deep-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.city-grid {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) rotateX(45deg) rotateZ(45deg);
    transform-style: preserve-3d;
    width: 600px;
    height: 600px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    opacity: 0.6;
}

.building {
    position: relative;
    background: var(--module-dark);
    border-top: 1px solid var(--accent-cyan);
    transform-origin: bottom;
    transform: scaleY(0);
    animation: buildUp 800ms ease-out forwards;
}

.building::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--holo-gradient);
    opacity: 0.8;
}

/* Building sizes and delays */
.b1  { animation-delay: 0ms; height: 80px; }
.b2  { animation-delay: 60ms; height: 120px; }
.b3  { animation-delay: 120ms; height: 60px; }
.b4  { animation-delay: 180ms; height: 150px; }
.b5  { animation-delay: 240ms; height: 90px; }
.b6  { animation-delay: 300ms; height: 110px; }
.b7  { animation-delay: 360ms; height: 70px; }
.b8  { animation-delay: 420ms; height: 140px; }
.b9  { animation-delay: 480ms; height: 100px; }
.b10 { animation-delay: 540ms; height: 130px; }
.b11 { animation-delay: 600ms; height: 85px; }
.b12 { animation-delay: 660ms; height: 105px; }
.b13 { animation-delay: 720ms; height: 95px; }
.b14 { animation-delay: 780ms; height: 125px; }
.b15 { animation-delay: 840ms; height: 75px; }
.b16 { animation-delay: 900ms; height: 115px; }
.b17 { animation-delay: 960ms; height: 88px; }
.b18 { animation-delay: 1020ms; height: 135px; }

.b1  { background: #0a0e27; }
.b2  { background: #1a2744; }
.b3  { background: #0d1b3a; }
.b4  { background: #0a0e27; }
.b5  { background: #1a2744; }
.b6  { background: #0a0e27; }
.b7  { background: #0d1b3a; }
.b8  { background: #1a2744; }
.b9  { background: #0a0e27; }
.b10 { background: #0d1b3a; }
.b11 { background: #1a2744; }
.b12 { background: #0a0e27; }
.b13 { background: #0d1b3a; }
.b14 { background: #1a2744; }
.b15 { background: #0a0e27; }
.b16 { background: #0d1b3a; }
.b17 { background: #1a2744; }
.b18 { background: #0a0e27; }

@keyframes buildUp {
    from { transform: scaleY(0); }
    to   { transform: scaleY(1); }
}

/* Hero Text */
.hero-text {
    position: relative;
    z-index: 10;
    text-align: center;
    opacity: 0;
    animation: fadeIn 400ms ease forwards;
    animation-delay: 2500ms;
}

#hero-title {
    font-size: clamp(4rem, 15vw, 12rem);
    background: var(--holo-gradient);
    background-size: 200% 200%;
    background-position: var(--mouse-x) var(--mouse-y);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1;
    margin-bottom: 0.2em;
}

.hero-subtitle {
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 1.1rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    opacity: 0;
    animation: fadeIn 400ms ease forwards;
    animation-delay: 2700ms;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* --- Section Headers --- */
.section-header {
    font-size: clamp(2rem, 5vw, 4rem);
    background: var(--holo-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
    padding: 3rem 1rem 2rem;
}

/* --- MODULAR BLOCKS GRID --- */
.modular-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem 3rem;
}

.block {
    position: relative;
    padding: 2rem;
    overflow: hidden;
    transition: transform 300ms ease, filter 300ms ease;
    /* scroll reveal */
    opacity: 0;
    transform: translateY(40px);
}

.block.visible {
    opacity: 1;
    transform: translateY(0);
    transition: opacity 500ms var(--spring-ease), transform 500ms var(--spring-ease);
}

.block-2x1 { grid-column: span 2; }
.block-1x2 { grid-row: span 2; }
.block-2x2 { grid-column: span 2; grid-row: span 2; }

.bg-dark  { background: var(--module-dark); }
.bg-light { background: var(--module-light); }
.bg-deep  { background: #080c20; }

/* Block hover holographic sweep */
.block::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 1px;
    background: var(--holo-gradient);
    opacity: 0;
    transition: none;
}

.block:hover {
    transform: scale(1.015);
    box-shadow: inset 0 0 0 1px rgba(0, 229, 255, 0.3);
}

.block:hover::after {
    opacity: 0.6;
    animation: sweepLine 600ms ease forwards;
}

@keyframes sweepLine {
    from { top: -1px; }
    to   { top: 100%; }
}

.block-label {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: var(--accent-cyan);
    margin-bottom: 0.5rem;
}

.block-text {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

.block-text.mono {
    color: var(--signal-green);
}

/* --- Isometric Icons --- */
.iso-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    position: relative;
}

/* Compression Tower */
.compression-tower {
    display: flex;
    flex-direction: column-reverse;
    gap: 3px;
    width: 40px;
    height: 80px;
}

.tower-base {
    width: 100%;
    height: 10px;
    background: var(--module-light);
    border: 1px solid rgba(0, 229, 255, 0.2);
}

.tower-band {
    width: 100%;
    height: 12px;
    animation: shimmerBand 3s ease-in-out infinite;
}

.band-cyan   { background: var(--accent-cyan); opacity: 0.8; animation-delay: 0s; }
.band-violet { background: var(--accent-violet); opacity: 0.8; animation-delay: 0.75s; }
.band-rose   { background: var(--accent-rose); opacity: 0.8; animation-delay: 1.5s; }
.band-gold   { background: var(--accent-gold); opacity: 0.8; animation-delay: 2.25s; }

@keyframes shimmerBand {
    0%, 100% { opacity: 0.8; }
    50%      { opacity: 0.4; }
}

/* Data Vault */
.data-vault {
    width: 70px;
    height: 50px;
}

.vault-body {
    width: 70px;
    height: 50px;
    background: var(--module-dark);
    border: 1px solid rgba(179, 136, 255, 0.3);
    position: relative;
}

.vault-door {
    position: absolute;
    top: 10px;
    left: 20px;
    width: 30px;
    height: 30px;
    background: var(--holo-gradient);
    opacity: 0.5;
    border-radius: 2px;
    animation: vaultGlow 4s ease-in-out infinite;
}

@keyframes vaultGlow {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 0.7; }
}

/* Pipeline Bridge */
.pipeline-bridge {
    width: 100%;
    height: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.bridge-span {
    width: 100%;
    height: 4px;
    background: var(--module-light);
    border-top: 1px solid var(--accent-cyan);
    border-bottom: 1px solid var(--accent-cyan);
    position: relative;
}

.bridge-dots {
    display: flex;
    gap: 12px;
    margin-top: 8px;
}

.bridge-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--signal-green);
    animation: flowDot 2s ease-in-out infinite;
}

.bridge-dots .dot:nth-child(1) { animation-delay: 0s; }
.bridge-dots .dot:nth-child(2) { animation-delay: 0.3s; }
.bridge-dots .dot:nth-child(3) { animation-delay: 0.6s; }
.bridge-dots .dot:nth-child(4) { animation-delay: 0.9s; }
.bridge-dots .dot:nth-child(5) { animation-delay: 1.2s; }

@keyframes flowDot {
    0%, 100% { opacity: 0.3; transform: translateX(0); }
    50%      { opacity: 1; transform: translateX(6px); }
}

/* Codec Crystal */
.codec-crystal {
    width: 60px;
    height: 60px;
    background: conic-gradient(from 0deg, var(--accent-cyan), var(--accent-violet), var(--accent-rose), var(--accent-gold), var(--accent-cyan));
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    opacity: 0.7;
}

/* Integrity Shield */
.integrity-shield {
    width: 50px;
    height: 50px;
    background: var(--holo-gradient);
    clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
    animation: shieldRotate 20s linear infinite;
    opacity: 0.6;
}

@keyframes shieldRotate {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* --- Data Metrics --- */
.data-metric {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-bottom: 1rem;
}

.metric-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(3rem, 6vw, 5rem);
    background: var(--holo-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.metric-unit {
    font-family: 'Inter', sans-serif;
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* --- Code Snippets --- */
.code-snippet {
    padding: 1rem;
    background: rgba(7, 11, 30, 0.6);
    border-left: 2px solid transparent;
    transition: border-color 300ms ease;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.code-snippet:hover {
    border-left-color: var(--signal-green);
}

.code-snippet code {
    color: var(--text-body);
    display: block;
}

/* --- DATA RIVER --- */
#data-river {
    position: relative;
    height: 120px;
    overflow: hidden;
    margin: 2rem 0;
}

#data-river::before,
#data-river::after {
    content: '';
    position: absolute;
    top: 0;
    width: 120px;
    height: 100%;
    z-index: 2;
}

#data-river::before {
    left: 0;
    background: linear-gradient(to right, var(--deep-bg), transparent);
}

#data-river::after {
    right: 0;
    background: linear-gradient(to left, var(--deep-bg), transparent);
}

.river-particles {
    position: absolute;
    inset: 0;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--holo-gradient);
    box-shadow: 0 0 6px rgba(0, 229, 255, 0.4), 0 0 12px rgba(179, 136, 255, 0.2);
    animation: flowParticle linear infinite;
}

@keyframes flowParticle {
    from { left: -20px; }
    to   { left: calc(100% + 20px); }
}

/* --- ARCHIVE GRID --- */
.archive-grid .block {
    padding: 1.5rem;
}

.archive-grid .block:hover {
    transform: scale(1.02);
}

/* --- THE SIGNAL (Footer) --- */
#signal {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    position: relative;
}

.signal-line {
    width: 100%;
    max-width: 600px;
    height: 1px;
    background: var(--holo-gradient);
    margin-bottom: 1.5rem;
    animation: signalPulse 3s ease-in-out infinite;
}

@keyframes signalPulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}

.signal-text {
    font-size: 1.2rem;
    letter-spacing: 0.3em;
    color: var(--text-muted);
}

/* --- Conic gradient border for buttons (applied to interactive elements) --- */
.holo-border {
    position: relative;
}

.holo-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    background: conic-gradient(from var(--conic-angle, 0deg), var(--accent-cyan), var(--accent-violet), var(--accent-rose), var(--accent-gold), var(--accent-cyan));
    z-index: -1;
    border-radius: inherit;
    animation: rotateConic 4s linear infinite;
}

@keyframes rotateConic {
    to { --conic-angle: 360deg; }
}

/* --- Mobile (< 640px) --- */
@media (max-width: 640px) {
    .modular-grid {
        grid-template-columns: 1fr;
    }

    .block-2x1, .block-1x2, .block-2x2 {
        grid-column: span 1;
        grid-row: span 1;
    }

    .block {
        border-bottom: 2px solid;
        border-image: var(--holo-gradient) 1;
    }

    .city-grid {
        width: 300px;
        height: 300px;
        transform: translateX(-50%) rotateX(45deg) rotateZ(45deg) scale(0.7);
    }
}
