/* =====================================================
   continu.st — midnight broadcast stylesheet
   F-pattern as choreography. Wave-forms as ligament.
   Magnetic. Surreal. Sustained.
   ===================================================== */

:root {
    /* Palette */
    --trench:        #06091A;
    --compass:       #0E1638;
    --cobalt-tide:   #1A2E6F;
    --beacon:        #3D5BC7;
    --phosphor:      #7DA0FF;
    --foam:          #E6ECFF;
    --distress:      #FF4D8D;
    --lighthouse:    #FFD96B;
    --static-bloom:  #16FFD0;

    /* Layout */
    --masthead-h: 38vh;
    --spine-w: 18vw;

    /* Vertical rhythm: 12 / 36 / 96 / 240 */
    --r-1: 12px;
    --r-2: 36px;
    --r-3: 96px;
    --r-4: 240px;

    /* Type */
    --font-primary: "Commissioner", "Inter", system-ui, sans-serif;
    --font-accent:  "Space Grotesk", "Space", "Commissioner", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--trench);
    color: var(--foam);
    font-family: var(--font-primary);
    font-weight: 360;
    font-size: 17px;
    line-height: 1.62;
    letter-spacing: -0.005em;
    overflow-x: hidden;
    scroll-behavior: smooth;
    min-height: 100%;
}

body {
    position: relative;
    background:
        radial-gradient(ellipse at 18% 6%, rgba(61,91,199,0.08) 0%, transparent 55%),
        radial-gradient(ellipse at 88% 78%, rgba(26,46,111,0.18) 0%, transparent 60%),
        var(--trench);
    cursor: crosshair;
}

/* =====================================================
   CURSOR WAKE CANVAS
   ===================================================== */
#cursor-wake {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
    mix-blend-mode: screen;
}

/* =====================================================
   OCEAN STAGE (off-F residue)
   ===================================================== */
.ocean-stage {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.ocean-bands { position: absolute; inset: 0; }

.band {
    position: absolute;
    left: -50%;
    width: 240vw;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        var(--phosphor) 30%,
        var(--beacon) 50%,
        var(--phosphor) 70%,
        transparent 100%
    );
    opacity: 0.025;
}

.band-1 { top: 8%;  animation: drift 12s linear infinite; opacity: 0.04; }
.band-2 { top: 22%; animation: drift 19s linear infinite reverse; opacity: 0.03; }
.band-3 { top: 38%; animation: drift 31s linear infinite; opacity: 0.025; }
.band-4 { top: 51%; animation: drift 47s linear infinite reverse; opacity: 0.02; }
.band-5 { top: 64%; animation: drift 73s linear infinite; opacity: 0.035; }
.band-6 { top: 78%; animation: drift 23s linear infinite reverse; opacity: 0.03; }
.band-7 { top: 92%; animation: drift 41s linear infinite; opacity: 0.025; }

@keyframes drift {
    from { transform: translateX(-25%); }
    to   { transform: translateX(25%); }
}

/* Drifter stage (surreal objects) */
.drifter-stage {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.drifter {
    position: absolute;
    width: 96px;
    height: 96px;
    opacity: 0;
    pointer-events: none;
    filter: url(#none);
}

/* Glitch tear element */
.glitch-tear {
    position: absolute;
    left: 0;
    width: 100vw;
    height: 0;
    background: linear-gradient(90deg, var(--distress), var(--static-bloom));
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    mix-blend-mode: screen;
    filter: blur(0.3px);
}

.glitch-tear.active {
    animation: glitchTear 120ms steps(2, end) forwards;
}

@keyframes glitchTear {
    0%   { opacity: 0;    transform: translateX(0)     scaleY(1); height: 6px; }
    25%  { opacity: 0.95; transform: translateX(28px)  scaleY(1.6); height: 12px; }
    50%  { opacity: 0.7;  transform: translateX(-22px) scaleY(0.8); height: 14px; }
    75%  { opacity: 0.6;  transform: translateX(18px)  scaleY(1.2); height: 8px; }
    100% { opacity: 0;    transform: translateX(0)     scaleY(1); height: 6px; }
}

/* =====================================================
   MASTHEAD (long stroke of the F)
   ===================================================== */
.masthead {
    position: relative;
    width: 100vw;
    height: var(--masthead-h);
    background: var(--compass);
    background-image:
        radial-gradient(ellipse at 70% 30%, rgba(61,91,199,0.22) 0%, transparent 55%),
        linear-gradient(180deg, rgba(14,22,56,0.92) 0%, rgba(14,22,56,1) 100%);
    border-bottom: 1px solid rgba(125,160,255,0.12);
    z-index: 5;
    overflow: hidden;
    display: grid;
    grid-template-rows: auto 1fr 92px;
    padding: var(--r-2) var(--r-3) 0;
}

.masthead::before {
    content: "";
    position: absolute;
    left: -10%;
    top: 50%;
    width: 240vw;
    height: 240px;
    background:
        repeating-linear-gradient(
            0deg,
            transparent 0,
            transparent 28px,
            rgba(125,160,255,0.04) 28px,
            rgba(125,160,255,0.04) 29px
        );
    transform: translateY(-50%) rotate(-0.6deg);
    pointer-events: none;
    opacity: 0.6;
}

.masthead-marker {
    display: flex;
    align-items: center;
    gap: var(--r-1);
    color: var(--phosphor);
    z-index: 2;
}

.masthead-marker .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--distress);
    box-shadow: 0 0 14px var(--distress), 0 0 28px rgba(255,77,141,0.4);
    animation: dotPulse 1.4s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.9; transform: scale(1); }
    50%      { opacity: 0.4; transform: scale(0.8); }
}

.microcopy {
    font-family: var(--font-primary);
    font-weight: 460;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--phosphor);
}

/* Wordmark — kinetic sine wave */
.wordmark {
    align-self: center;
    font-family: var(--font-primary);
    font-variation-settings: "wght" var(--wm-weight, 220);
    font-weight: 220;
    font-size: clamp(4rem, 14vw, 12rem);
    line-height: 0.96;
    letter-spacing: -0.04em;
    color: var(--foam);
    user-select: none;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    transition: font-variation-settings 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
    mix-blend-mode: screen;
    text-shadow:
        0 0 40px rgba(61,91,199,0.35),
        0 0 80px rgba(125,160,255,0.18);
}

.wm-letter {
    display: inline-block;
    transform: translateY(0);
    will-change: transform;
    animation: sineWave 2400ms ease-in-out infinite;
    animation-delay: calc(var(--i) * 120ms);
}

.wm-letter:nth-child(8) { /* the "." */
    color: var(--lighthouse);
    text-shadow: 0 0 18px var(--lighthouse);
}

@keyframes sineWave {
    0%, 100% { transform: translateY(0) rotate(0); }
    25%      { transform: translateY(-14px) rotate(-1deg); }
    50%      { transform: translateY(0) rotate(0); }
    75%      { transform: translateY(14px) rotate(1deg); }
}

/* Masthead nav */
.masthead-nav {
    align-self: end;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--r-2);
    height: 92px;
    z-index: 2;
}

.nav-token {
    color: var(--foam);
    text-decoration: none;
    font-weight: 460;
    font-size: 14px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    padding: var(--r-1) calc(var(--r-1) * 1.2);
    transition: color 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
                transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
                text-shadow 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform;
    position: relative;
}

.nav-token:hover {
    color: var(--phosphor);
    text-shadow: 0 0 12px var(--phosphor);
}

.nav-token:hover::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -4px;
    width: 28px;
    height: 1px;
    background: var(--phosphor);
    transform: translateX(-50%);
    box-shadow: 0 0 8px var(--phosphor);
}

.nav-dash {
    color: var(--phosphor);
    opacity: 0.45;
    font-size: 16px;
    will-change: transform;
    display: inline-block;
    animation: tremble 60s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes tremble {
    0%, 100% { transform: translate(0, 0); }
    25%      { transform: translate(0.5px, -0.5px); }
    50%      { transform: translate(-0.5px, 0.5px); }
    75%      { transform: translate(0.5px, 0.5px); }
}

/* =====================================================
   SPINE (left vertical column of frequencies)
   ===================================================== */
.spine {
    position: fixed;
    top: var(--masthead-h);
    left: 0;
    width: var(--spine-w);
    height: calc(100vh - var(--masthead-h));
    background: var(--compass);
    background-image:
        linear-gradient(180deg, rgba(14,22,56,0.98) 0%, rgba(6,9,26,0.98) 100%);
    border-right: 1px solid rgba(125,160,255,0.12);
    padding: var(--r-2) var(--r-1) var(--r-2) var(--r-2);
    overflow-y: auto;
    z-index: 4;
    display: flex;
    flex-direction: column;
    gap: var(--r-2);
}

.spine::-webkit-scrollbar { width: 0; }
.spine { scrollbar-width: none; }

.spine-header,
.spine-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--r-1);
    padding: 0 var(--r-1) 0 0;
}

.spine-counter {
    color: var(--lighthouse);
    text-shadow: 0 0 8px rgba(255,217,107,0.4);
}

.spine-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--r-2);
    flex: 1;
}

.spine-item {
    display: grid;
    grid-template-columns: 28px 1fr;
    grid-template-rows: auto auto;
    gap: 6px var(--r-1);
    align-items: start;
    padding: var(--r-1) 4px var(--r-1) 0;
    cursor: pointer;
    border-left: 1px solid transparent;
    padding-left: var(--r-1);
    margin-left: -1px;
    transition: border-color 380ms cubic-bezier(0.65, 0, 0.35, 1),
                background 380ms cubic-bezier(0.65, 0, 0.35, 1);
    position: relative;
}

.spine-item:hover {
    border-left-color: rgba(125,160,255,0.4);
}

.spine-item.active {
    border-left-color: var(--lighthouse);
    background: linear-gradient(90deg, rgba(255,217,107,0.06), transparent);
}

.spine-item.active::before {
    content: "";
    position: absolute;
    left: -1px;
    top: 50%;
    width: 1px;
    height: 60%;
    background: var(--lighthouse);
    transform: translateY(-50%);
    box-shadow: 0 0 10px var(--lighthouse);
}

.ep-num {
    grid-row: 1 / 3;
    align-self: start;
    font-weight: 880;
    font-variation-settings: "wght" 880;
    font-variant-numeric: tabular-nums;
    font-size: 13px;
    line-height: 28px;
    height: 28px;
    width: 28px;
    text-align: center;
    background: var(--cobalt-tide);
    color: var(--foam);
    border-radius: 14px;
    letter-spacing: 0.04em;
    transition: background 380ms cubic-bezier(0.65, 0, 0.35, 1);
}

.spine-item.active .ep-num {
    background: var(--beacon);
    color: var(--foam);
    box-shadow: 0 0 12px rgba(61,91,199,0.6);
}

.ep-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.ep-time {
    color: var(--phosphor);
    opacity: 0.7;
    font-size: 10px;
}

.ep-title {
    font-weight: 380;
    font-variation-settings: "wght" 380;
    font-size: 13.5px;
    line-height: 1.3;
    color: var(--foam);
    letter-spacing: -0.005em;
    transition: font-variation-settings 380ms cubic-bezier(0.65, 0, 0.35, 1),
                color 380ms cubic-bezier(0.65, 0, 0.35, 1);
    overflow: hidden;
    text-overflow: ellipsis;
}

.spine-item.active .ep-title {
    font-weight: 620;
    font-variation-settings: "wght" 620;
    color: var(--phosphor);
    text-shadow: 0 0 8px rgba(125,160,255,0.4);
}

.ep-wave {
    grid-column: 2;
    width: 64px;
    height: 18px;
    margin-top: 2px;
    overflow: visible;
}

.ep-wave path {
    fill: none;
    stroke: var(--phosphor);
    stroke-width: 1.4;
    stroke-linecap: round;
    opacity: 0.7;
    transition: stroke 380ms ease, opacity 380ms ease;
}

.spine-item.active .ep-wave path {
    stroke: var(--lighthouse);
    opacity: 1;
    filter: drop-shadow(0 0 4px rgba(255,217,107,0.6));
    animation: waveDraw 2s ease-in-out infinite;
}

@keyframes waveDraw {
    0%, 100% { stroke-dashoffset: 0; }
    50%      { stroke-dashoffset: 12; }
}

/* =====================================================
   ACTIVE EPISODE RIBBON (bleeds from spine)
   ===================================================== */
.active-ribbon {
    position: fixed;
    top: var(--masthead-h);
    left: var(--spine-w);
    width: 240px;
    height: 0;
    background: linear-gradient(
        90deg,
        rgba(26,46,111,0.55) 0%,
        rgba(26,46,111,0.18) 50%,
        transparent 100%
    );
    pointer-events: none;
    z-index: 3;
    transition: top 480ms cubic-bezier(0.65, 0, 0.35, 1),
                height 480ms cubic-bezier(0.65, 0, 0.35, 1);
    mix-blend-mode: screen;
}

/* =====================================================
   BROADCAST MAIN
   ===================================================== */
.broadcast {
    position: relative;
    margin-left: var(--spine-w);
    padding: var(--r-3) var(--r-3) var(--r-4);
    z-index: 2;
}

.episode {
    position: relative;
    padding: var(--r-3) 0 var(--r-3);
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    gap: var(--r-2);
    min-height: 80vh;
}

.episode.full-screen {
    min-height: 100vh;
    padding: var(--r-4) 0;
}

.episode + .episode {
    border-top: 1px solid rgba(125,160,255,0.06);
}

.ep-header {
    display: flex;
    flex-direction: column;
    gap: var(--r-2);
    max-width: 92ch;
}

.ep-tag {
    color: var(--phosphor);
    opacity: 0.9;
}

.ep-headline {
    font-family: var(--font-primary);
    font-variation-settings: "wght" 720;
    font-weight: 720;
    font-size: clamp(2.6rem, 5.4vw, 4.8rem);
    line-height: 0.96;
    letter-spacing: -0.022em;
    color: var(--foam);
    max-width: 18ch;
    transition: font-variation-settings 380ms cubic-bezier(0.65, 0, 0.35, 1);
}

.episode.is-active .ep-headline {
    font-variation-settings: "wght" 800;
    text-shadow: 0 0 32px rgba(61,91,199,0.4);
}

.ep-body {
    max-width: 68ch;
}

.ep-lead {
    font-weight: 360;
    font-size: clamp(17px, 1.4vw, 20px);
    line-height: 1.62;
    letter-spacing: -0.005em;
    color: var(--foam);
}

.ep-lead em {
    font-style: italic;
    font-variation-settings: "wght" 500, "slnt" -7;
    color: var(--phosphor);
}

.highlight {
    background: linear-gradient(180deg, transparent 60%, rgba(255,217,107,0.28) 60%);
    color: var(--lighthouse);
    padding: 0 4px;
    font-weight: 540;
}

/* CTA pulse */
.cta-pulse {
    display: inline-block;
    color: var(--phosphor);
    cursor: pointer;
    margin-left: 6px;
    padding: 2px 8px;
    border: 1px solid rgba(125,160,255,0.4);
    border-radius: 18px;
    transition: color 380ms cubic-bezier(0.65, 0, 0.35, 1),
                border-color 380ms cubic-bezier(0.65, 0, 0.35, 1),
                background 380ms cubic-bezier(0.65, 0, 0.35, 1),
                box-shadow 380ms cubic-bezier(0.65, 0, 0.35, 1);
}

.cta-pulse:hover {
    color: var(--distress);
    border-color: var(--distress);
    background: rgba(255,77,141,0.08);
    box-shadow: 0 0 24px rgba(255,77,141,0.4);
}

/* =====================================================
   PULL-QUOTE (short stroke of the F)
   ===================================================== */
.pullquote {
    position: relative;
    margin: var(--r-3) 0;
    padding: var(--r-2) var(--r-3);
    height: 16vh;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 8px;
    border-left: 2px solid var(--cobalt-tide);
    border-right: 1px dashed rgba(125,160,255,0.1);
    cursor: pointer;
    overflow: hidden;
    background: linear-gradient(
        90deg,
        rgba(26,46,111,0.18) 0%,
        rgba(14,22,56,0.0) 80%
    );
}

.pq-line {
    font-family: var(--font-primary);
    font-style: italic;
    font-variation-settings: "wght" 280, "slnt" -7;
    font-weight: 280;
    font-size: clamp(1.6rem, 3vw, 2.6rem);
    line-height: 1.18;
    letter-spacing: -0.01em;
    color: var(--foam);
    display: block;
}

.pq-line-1 {
    color: var(--phosphor);
}

.pq-line-2.mirror {
    transform: scaleY(-1);
    filter: blur(0.6px);
    color: var(--foam);
    opacity: 0.68;
    transition: transform 540ms cubic-bezier(0.65, 0, 0.35, 1),
                filter 540ms cubic-bezier(0.65, 0, 0.35, 1),
                opacity 540ms cubic-bezier(0.65, 0, 0.35, 1),
                color 540ms cubic-bezier(0.65, 0, 0.35, 1);
    font-family: var(--font-accent);
    will-change: transform;
}

.pullquote:hover .pq-line-2.mirror {
    transform: scaleY(1);
    filter: blur(0);
    opacity: 1;
    color: var(--phosphor);
}

.pullquote::after {
    content: "↻ resolves under attention";
    position: absolute;
    right: var(--r-2);
    bottom: 8px;
    font-size: 10px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--phosphor);
    opacity: 0.4;
    transition: opacity 380ms ease;
}

.pullquote:hover::after { opacity: 0; }

/* =====================================================
   WAVE DIVIDER
   ===================================================== */
.wave-divider {
    position: relative;
    width: 100%;
    height: 80px;
    margin-top: var(--r-2);
    overflow: visible;
    mix-blend-mode: screen;
}

.wave-divider.tall { height: 120px; }

.wave-divider svg {
    width: 240vw;
    height: 100%;
    display: block;
    margin-left: -50%;
}

.wave-divider .harm {
    stroke-linecap: round;
    fill: none;
}

.wave-divider .h1 {
    stroke: var(--phosphor);
    stroke-width: 1.4;
    opacity: 0.55;
    stroke-dasharray: 8 8;
    animation: dashDrift 18s linear infinite;
}

.wave-divider .h2 {
    stroke: var(--beacon);
    stroke-width: 1.0;
    opacity: 0.4;
    stroke-dasharray: 14 4;
    animation: dashDrift 27s linear infinite reverse;
}

.wave-divider .h3 {
    stroke: var(--lighthouse);
    stroke-width: 0.6;
    opacity: 0.25;
    stroke-dasharray: 4 16;
    animation: dashDrift 41s linear infinite;
}

@keyframes dashDrift {
    from { stroke-dashoffset: 0; }
    to   { stroke-dashoffset: -240; }
}

/* =====================================================
   FOOTER
   ===================================================== */
.broadcast-footer {
    margin-top: var(--r-4);
    padding: var(--r-2) 0;
    border-top: 1px solid rgba(125,160,255,0.12);
}

.footer-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--r-2);
    flex-wrap: wrap;
    color: var(--phosphor);
    opacity: 0.7;
}

#footer-clock {
    color: var(--lighthouse);
    font-variant-numeric: tabular-nums;
}

/* =====================================================
   DRIFTERS (SVG surreal objects)
   ===================================================== */
.drifter svg {
    width: 100%;
    height: 100%;
    overflow: visible;
}

.drifter .stroke-primary {
    stroke: var(--phosphor);
    stroke-width: 1.4;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.drifter .fill-tide {
    fill: rgba(26,46,111,0.4);
    stroke: var(--phosphor);
    stroke-width: 1;
}

.drifter .fill-mercury {
    fill: var(--distress);
    opacity: 0.85;
}

.drifter .fill-light {
    fill: var(--lighthouse);
    opacity: 0.85;
}

.drifter .fill-bloom {
    fill: var(--static-bloom);
    opacity: 0.6;
}

/* RGB channel split layered ghosts */
.drifter .ghost-r,
.drifter .ghost-b {
    position: absolute;
    inset: 0;
    pointer-events: none;
    mix-blend-mode: screen;
}

.drifter .ghost-r { color: var(--distress); transform: translate(1.4px, 0); opacity: 0.65; }
.drifter .ghost-b { color: var(--static-bloom); transform: translate(-1.8px, 0); opacity: 0.55; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
    :root {
        --masthead-h: 32vh;
        --spine-w: 0;
    }
    .spine { display: none; }
    .broadcast { margin-left: 0; padding: var(--r-2); }
    .active-ribbon { display: none; }
    .masthead { padding: var(--r-2) var(--r-2) 0; }
    .pullquote { padding: var(--r-2); }
    .episode { padding: var(--r-2) 0; }
    .episode.full-screen { padding: var(--r-3) 0; }
}
