/* ============================================
   gabs.cx - Surreal Noir Broadcast
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
    --midnight-plum: #1A0F1E;
    --bruised-violet: #2A1B30;
    --parchment-cream: #F2E8DC;
    --warm-stone: #B8A99A;
    --antique-brass: #C4A77D;
    --muted-amethyst: #7B6B8D;
    --deep-garnet: #8B2252;
    --twilight-mauve: #3D2644;
}

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

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

body {
    background-color: var(--midnight-plum);
    color: var(--parchment-cream);
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-weight: 300;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.75;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* --- Progress Bar --- */
.progress-bar {
    position: fixed;
    top: 0;
    right: 16px;
    width: 2px;
    height: 0%;
    background-color: var(--antique-brass);
    z-index: 1000;
    transition: height 0.1s linear;
    opacity: 0.7;
}

.progress-bar.pulsing {
    animation: pulse-bar 3s ease-in-out infinite;
}

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

/* --- Floating Words --- */
.floating-words {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

.float-word {
    position: absolute;
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    color: var(--muted-amethyst);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    white-space: nowrap;
    will-change: transform;
}

/* --- Broadcast Frames (Sections) --- */
.broadcast-frame {
    position: relative;
    min-height: 100vh;
    width: 100%;
    overflow: hidden;
}

.frame-bg-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.frame-content-layer {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

/* --- Frame 1: Signal Acquisition --- */
.frame-signal {
    background-color: var(--midnight-plum);
}

.signal-center {
    width: 100%;
    text-align: center;
    padding: 2rem;
}

.site-title {
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: clamp(4rem, 10vw, 8rem);
    color: var(--parchment-cream);
    letter-spacing: -0.03em;
    line-height: 0.95;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 1.5s cubic-bezier(0.16, 1, 0.3, 1), transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.site-title.visible {
    opacity: 1;
    transform: translateY(0);
}

.site-subtitle {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--muted-amethyst);
    margin-top: 1.5rem;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.site-subtitle.visible {
    opacity: 1;
}

.site-subtitle span {
    display: inline-block;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.6s ease;
}

/* --- Diagonal Cuts --- */
.diagonal-cut-top {
    position: absolute;
    top: -40px;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: 3;
    background: linear-gradient(to right, var(--deep-garnet), var(--antique-brass));
    clip-path: polygon(0 0, 100% 40px, 100% 48px, 0 8px);
    opacity: 0.6;
}

.diagonal-cut-top.double-cut {
    height: 100px;
    top: -50px;
}

.diagonal-cut-top.double-cut::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    width: 100%;
    height: 80px;
    background: linear-gradient(to left, var(--deep-garnet), var(--antique-brass));
    clip-path: polygon(0 40px, 100% 0, 100% 8px, 0 48px);
    opacity: 0.5;
}

.diagonal-cut-top.cut-aggressive {
    height: 120px;
    top: -60px;
    clip-path: polygon(0 0, 100% 80px, 100% 88px, 0 8px);
}

/* --- Glitch Bands --- */
.glitch-band {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    z-index: 4;
    background: repeating-linear-gradient(0deg, #8B2252 0px, #8B2252 1px, transparent 1px, transparent 3px);
    opacity: 0.7;
}

.glitch-double {
    height: 8px;
}

.glitch-double::after {
    content: '';
    position: absolute;
    top: 12px;
    left: 0;
    width: 100%;
    height: 5px;
    background: repeating-linear-gradient(0deg, #8B2252 0px, #8B2252 1px, transparent 1px, transparent 3px);
    opacity: 0.5;
}

/* --- Frame 2: First Transmission --- */
.frame-transmission {
    background-color: var(--bruised-violet);
}

.ghost-letter {
    position: absolute;
    top: 50%;
    left: -5%;
    transform: translateY(-50%);
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 35vw;
    color: var(--twilight-mauve);
    opacity: 0.07;
    line-height: 1;
    user-select: none;
    pointer-events: none;
}

/* --- Content Grid --- */
.content-grid {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 6rem 2rem;
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 1rem;
}

.content-right .text-block {
    grid-column: 5 / 9;
    position: relative;
}

.content-left .text-block {
    grid-column: 2 / 6;
    position: relative;
}

.content-dual {
    align-items: start;
}

.content-dual .text-col-left {
    grid-column: 2 / 5;
}

.content-dual .text-col-right {
    grid-column: 6 / 9;
}

/* --- Prose Paragraphs --- */
.prose-para {
    color: var(--warm-stone);
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease, transform 0.4s ease;
    max-width: 38ch;
    margin-bottom: 1.5rem;
    font-weight: 300;
}

.prose-para.in-view {
    opacity: 0.85;
    transform: scale(1);
}

.deep-text {
    font-weight: 400;
}

.deep-text.in-view {
    opacity: 1;
}

/* --- Slash Marks --- */
.slash-marks {
    position: absolute;
    left: -40px;
    top: 0;
    opacity: 0;
    transition: opacity 0.3s ease 0.2s;
}

.slash-marks.in-view {
    opacity: 1;
}

/* --- Frame 3: Interference --- */
.frame-interference {
    background-color: var(--midnight-plum);
}

.atmosphere-band {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    height: 200px;
    transform: translateY(-50%);
    background: linear-gradient(to right, var(--deep-garnet), var(--antique-brass));
    opacity: 0.08;
}

/* --- Pull Quote --- */
.pull-quote {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 2.5rem;
}

.quote-border {
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 0;
    background-color: var(--antique-brass);
    transition: height 0.8s ease;
}

.pull-quote.in-view .quote-border {
    height: 100%;
}

.quote-text {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--parchment-cream);
    line-height: 1.3;
    letter-spacing: -0.02em;
    opacity: 0;
    transform: translateY(-30px);
    transition: opacity 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), transform 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pull-quote.in-view .quote-text {
    opacity: 1;
    transform: translateY(0);
}

/* --- Frame 4: Deep Signal --- */
.frame-deep {
    background: radial-gradient(ellipse at center, var(--bruised-violet), var(--midnight-plum));
}

.vignette-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 30%, var(--midnight-plum) 100%);
    pointer-events: none;
}

.skyline-strip {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 70px;
    opacity: 0.4;
}

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

/* --- Frame 5: Signal Loss --- */
.frame-loss {
    background-color: var(--midnight-plum);
}

.final-sentence {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(1.5rem, 4vw, 3rem);
    color: var(--parchment-cream);
    letter-spacing: -0.02em;
    line-height: 1.2;
    max-width: 20ch;
    margin: 0 auto 1.5rem;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 1s ease, transform 1s ease;
}

.final-sentence.in-view {
    opacity: 1;
    transform: translateY(0);
}

.final-timestamp {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--muted-amethyst);
    opacity: 0;
    transition: opacity 1s ease 0.3s;
}

.final-timestamp.in-view {
    opacity: 1;
}

.final-sentence.fading,
.final-timestamp.fading {
    opacity: 0;
    transition: opacity 4s ease;
}

/* --- Section Title Styles (for potential use) --- */
.section-title {
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: clamp(2rem, 4vw, 3.5rem);
    color: var(--parchment-cream);
    letter-spacing: -0.03em;
    line-height: 0.95;
}

/* --- Metadata/Accent Text --- */
.meta-text {
    font-family: 'Space Mono', monospace;
    font-weight: 400;
    font-size: 12px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted-amethyst);
}

/* --- Float Word Animations --- */
@keyframes drift-right {
    0% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(40px) translateY(-15px); }
    50% { transform: translateX(80px) translateY(5px); }
    75% { transform: translateX(50px) translateY(20px); }
    100% { transform: translateX(0) translateY(0); }
}

@keyframes drift-left {
    0% { transform: translateX(0) translateY(0); }
    25% { transform: translateX(-50px) translateY(10px); }
    50% { transform: translateX(-90px) translateY(-8px); }
    75% { transform: translateX(-40px) translateY(-20px); }
    100% { transform: translateX(0) translateY(0); }
}

.float-word:nth-child(odd) {
    animation: drift-right 50s ease-in-out infinite;
}

.float-word:nth-child(even) {
    animation: drift-left 45s ease-in-out infinite;
}

.float-word:nth-child(3n) {
    animation-duration: 60s;
}

.float-word:nth-child(4n) {
    animation-duration: 40s;
}

.float-word.decelerating {
    animation-play-state: paused;
    transition: opacity 6s ease;
    opacity: 0 !important;
}

/* --- Progress bar final flash --- */
.progress-bar.flash {
    opacity: 1;
    background-color: var(--antique-brass);
    transition: opacity 2s ease;
}

.progress-bar.flash-out {
    opacity: 0;
    transition: opacity 2s ease 0.5s;
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
    .content-grid {
        grid-template-columns: 1fr;
        padding: 4rem 1.5rem;
    }

    .content-right .text-block,
    .content-left .text-block,
    .content-dual .text-col-left,
    .content-dual .text-col-right {
        grid-column: 1 / -1;
    }

    .ghost-letter {
        font-size: 50vw;
    }

    .slash-marks {
        display: none;
    }

    .float-word {
        display: none;
    }

    .floating-words .float-word:nth-child(-n+5) {
        display: block;
    }
}

@media (max-width: 480px) {
    .pull-quote {
        padding-left: 1rem;
    }

    .content-grid {
        padding: 3rem 1rem;
    }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
    .float-word,
    .site-title,
    .site-subtitle,
    .prose-para,
    .quote-text,
    .quote-border,
    .final-sentence,
    .final-timestamp {
        animation: none !important;
        transition: none !important;
        opacity: 1 !important;
        transform: none !important;
    }

    .quote-border {
        height: 100% !important;
    }

    .prose-para {
        opacity: 0.85 !important;
    }

    .deep-text {
        opacity: 1 !important;
    }
}
