/* ============================================================
   lossless.dev - Styles
   A surreal meditation on the digital city at 3 AM
   ============================================================ */

/* Color Palette */
:root {
    --color-cyan: #3ABFE8;
    --color-dark-charcoal: #292524;
    --color-dark-bg: #1C1917;
    --color-gray: #A0A0A0;
    --color-orange: #E85D3A;
    --color-dark-almost-black: #0C0A09;
    --color-gold: #D4A853;
    --color-cream: #F5F0EB;
    --color-gray-light: #A8A29E;
}

/* Typography */
:root {
    --font-display: 'Libre Baskerville', serif;
    --font-body: 'IBM Plex Mono', monospace;
    --font-accent: 'Space Grotesk', sans-serif;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background: var(--color-dark-almost-black);
    color: var(--color-cream);
    font-family: var(--font-display);
    font-size: 16px;
    line-height: 1.6;
}

body {
    background: var(--color-dark-almost-black);
    overflow-x: hidden;
    position: relative;
}

/* Texture Overlays */
.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><filter id="noise"><feTurbulence type="fractalNoise" baseFrequency="0.9" numOctaves="4" seed="2" /></filter><rect width="100" height="100" fill="white" filter="url(%23noise)" opacity="0.04"/></svg>');
    pointer-events: none;
    z-index: 100;
    mix-blend-mode: overlay;
    animation: noise-fade-in 0.8s ease-out;
}

@keyframes noise-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.scan-lines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 101;
    animation: scan-lines-pulse 8s ease-in-out infinite;
}

@keyframes scan-lines-pulse {
    0%, 100% {
        opacity: 0.3;
    }
    50% {
        opacity: 0.5;
    }
}

/* Container and Grid */
.page-container {
    max-width: 100%;
    position: relative;
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 2rem;
    padding: 6rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

/* Sections */
section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-dark-almost-black) 0%, var(--color-dark-bg) 100%);
}

section:nth-child(even) {
    background: linear-gradient(135deg, var(--color-dark-bg) 0%, var(--color-dark-charcoal) 100%);
}

/* Hero Section */
.signal-section {
    background: var(--color-dark-almost-black);
    animation: signal-fade-in 1.2s ease-out;
}

@keyframes signal-fade-in {
    0% {
        opacity: 0;
    }
    30% {
        opacity: 0;
    }
    100% {
        opacity: 1;
    }
}

.hero-title-wrapper {
    grid-column: 1 / 9;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.hero-title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 6.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 0.95;
    color: var(--color-cream);
    margin-bottom: 0.5rem;
}

.hero-title-accent {
    color: var(--color-cyan);
    font-weight: 700;
}

.hero-text {
    grid-column: 1 / 9;
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.7;
    letter-spacing: 0.02em;
    color: var(--color-gray-light);
    max-width: 600px;
}

/* Typography and Content */
.section-title {
    grid-column: 1 / 9;
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.1;
    color: var(--color-cream);
    margin-bottom: 2rem;
    position: relative;
}

.section-text {
    grid-column: 1 / 9;
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.1vw, 1.1rem);
    line-height: 1.7;
    letter-spacing: 0.02em;
    color: var(--color-gray-light);
    max-width: 800px;
    margin-bottom: 2rem;
}

.pull-quote {
    grid-column: 1 / 9;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-style: italic;
    font-weight: 400;
    color: var(--color-gold);
    line-height: 1.6;
    margin: 2rem 0;
    padding-left: 2rem;
    border-left: 3px solid var(--color-orange);
}

.pull-quote p {
    margin: 0;
}

/* Glitch Text Effect */
.glitch-text {
    position: relative;
    display: inline-block;
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: var(--color-cyan);
    letter-spacing: 0.05em;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0.7;
}

.glitch-text::before {
    animation: glitch-shift-red 2s infinite;
    color: var(--color-orange);
    z-index: -1;
    clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
}

.glitch-text::after {
    animation: glitch-shift-blue 2s infinite;
    color: var(--color-cyan);
    z-index: -2;
    clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
}

@keyframes glitch-shift-red {
    0%, 100% {
        clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
        transform: translate(0, 0);
    }
    33% {
        clip-path: polygon(0 0, 100% 0, 100% 33%, 0 33%);
        transform: translate(-2px, 2px);
    }
}

@keyframes glitch-shift-blue {
    0%, 100% {
        clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
        transform: translate(0, 0);
    }
    66% {
        clip-path: polygon(0 67%, 100% 67%, 100% 100%, 0 100%);
        transform: translate(2px, -2px);
    }
}

/* Glitch Demo Block */
.glitch-demo {
    grid-column: 1 / 9;
    margin-top: 3rem;
    padding: 3rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--color-gray);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

/* Glitch Block */
.glitch-block {
    grid-column: 1 / 9;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    margin-top: 3rem;
}

.glitch-layer {
    min-height: 250px;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--color-gray);
    animation: glitch-layer-shift 3s ease-in-out infinite;
}

.glitch-layer:nth-child(1) {
    animation-delay: 0s;
}

.glitch-layer:nth-child(2) {
    animation-delay: 0.5s;
    transform: translateY(-4px);
}

.glitch-layer:nth-child(3) {
    animation-delay: 1s;
    transform: translateY(4px);
}

@keyframes glitch-layer-shift {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-3px);
    }
    50% {
        transform: translateX(0);
    }
    75% {
        transform: translateX(3px);
    }
}

/* Glyphs (Decorative Elements) */
.glyph-01, .glyph-02, .glyph-03, .glyph-04, .glyph-05 {
    position: absolute;
    right: 3rem;
    top: 50%;
    transform: translateY(-50%);
    width: 150px;
    height: 150px;
    opacity: 0.1;
    pointer-events: none;
}

.glyph-01 {
    background: radial-gradient(circle, var(--color-cyan), transparent);
    animation: glyph-float 6s ease-in-out infinite;
}

.glyph-02 {
    background: radial-gradient(circle, var(--color-orange), transparent);
    animation: glyph-float 7s ease-in-out infinite 0.5s;
}

.glyph-03 {
    background: radial-gradient(circle, var(--color-gold), transparent);
    animation: glyph-float 8s ease-in-out infinite 1s;
}

.glyph-04 {
    background: radial-gradient(circle, var(--color-cyan), transparent);
    animation: glyph-float 6.5s ease-in-out infinite 1.5s;
}

.glyph-05 {
    background: radial-gradient(circle, var(--color-orange), transparent);
    animation: glyph-float 7.5s ease-in-out infinite 2s;
}

@keyframes glyph-float {
    0%, 100% {
        transform: translateY(-50%) translateX(0);
    }
    50% {
        transform: translateY(-50%) translateX(-30px);
    }
}

/* Terminal Section */
.terminal-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-dark-bg);
    position: relative;
    overflow: hidden;
}

.terminal-container {
    max-width: 900px;
    width: 90%;
    padding: 3rem;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid var(--color-gray);
    border-radius: 2px;
    font-family: var(--font-body);
    font-size: clamp(0.9rem, 1vw, 1.1rem);
    line-height: 1.8;
    letter-spacing: 0.02em;
    color: var(--color-cream);
    position: relative;
}

.terminal-cursor {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    width: 8px;
    height: 20px;
    background: var(--color-gold);
    animation: cursor-blink 1s infinite;
}

@keyframes cursor-blink {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

.terminal-content {
    padding-left: 2rem;
    animation: typewriter-animation 4s steps(80, end);
}

@keyframes typewriter-animation {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.terminal-prompt {
    color: var(--color-cream);
    font-weight: 400;
}

.terminal-line {
    display: block;
    margin: 0.5rem 0;
}

.terminal-value {
    color: var(--color-gold);
    font-weight: 500;
}

.terminal-cursor-blink {
    display: inline-block;
    color: var(--color-gold);
    animation: cursor-blink 1s infinite 4s;
}

/* Scroll Progress Indicator */
.scroll-progress-indicator {
    position: fixed;
    left: 0;
    top: 0;
    width: 2px;
    height: 0%;
    background: var(--color-orange);
    opacity: 0.4;
    z-index: 99;
    transition: height 0.1s ease-out;
}

/* Footer */
.page-footer {
    background: var(--color-dark-almost-black);
    border-top: 1px solid var(--color-gray);
    padding: 3rem;
    text-align: center;
    position: relative;
    z-index: 2;
    min-height: auto;
}

.page-footer p {
    margin: 0.5rem 0;
    font-family: var(--font-accent);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--color-gray);
}

.footer-meta {
    font-family: var(--font-accent);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--color-gold);
}

/* Responsive Design */
@media (max-width: 768px) {
    .section-grid {
        padding: 4rem 1.5rem;
        gap: 1.5rem;
    }

    .hero-title-wrapper,
    .hero-text,
    .section-title,
    .section-text,
    .pull-quote,
    .glitch-demo,
    .glitch-block {
        grid-column: 1 / 13 !important;
    }

    .glitch-block {
        grid-template-columns: 1fr;
    }

    .glyph-01, .glyph-02, .glyph-03, .glyph-04, .glyph-05 {
        width: 100px;
        height: 100px;
        right: 1rem;
    }

    .page-footer {
        padding: 2rem 1.5rem;
    }
}

@media (max-width: 480px) {
    .section-grid {
        padding: 3rem 1rem;
        gap: 1rem;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .glyph-01, .glyph-02, .glyph-03, .glyph-04, .glyph-05 {
        width: 80px;
        height: 80px;
        opacity: 0.05;
        right: 0.5rem;
    }

    .terminal-container {
        padding: 2rem 1.5rem;
        font-size: 0.85rem;
    }

    .terminal-cursor {
        left: 1rem;
        top: 1rem;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .glitch-text::before,
    .glitch-text::after {
        animation: none !important;
        opacity: 0 !important;
    }

    .terminal-content {
        animation: none;
        opacity: 1;
    }

    .terminal-cursor,
    .terminal-cursor-blink {
        animation: none !important;
    }
}
