/* =========================================================
   CA6.DEV — Broadcast CRT redesign
   fonts: VT323 (display), JetBrains Mono (body), Major Mono Display (brand)
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=VT323&family=JetBrains+Mono:wght@400;500;700&family=Major+Mono+Display&display=swap');

/* ---------- tokens ---------- */
:root {
    --bg:            #0a0d10;
    --bg-elev:       #11161b;
    --bg-grid:       #0d1115;
    --phosphor:      #d2c9a5;   /* screen color */
    --phosphor-dim:  #8a8468;
    --ink:           #f4ecc9;
    --tv-blue:       #2594f0;
    --tv-blue-glow:  #4cb0ff;
    --signal-red:    #ff2e4d;
    --signal-green:  #22d36a;
    --plum:          #49343d;   /* speaker grill */
    --line:          #1d252c;
    --shadow:        0 0 0 1px rgba(210, 201, 165, 0.08);
    --scan-opacity:  0.22;
    --vignette:      radial-gradient(ellipse at center,
                      transparent 40%,
                      rgba(0,0,0,0.55) 100%);
}

[data-theme="light"] {
    --bg:            #e8e3d1;
    --bg-elev:       #f1ecd9;
    --bg-grid:       #ded7bf;
    --phosphor:      #1a1410;
    --phosphor-dim:  #554636;
    --ink:           #0a0806;
    --tv-blue:       #0057a8;
    --tv-blue-glow:  #2594f0;
    --signal-red:    #b00020;
    --signal-green:  #1e7a3c;
    --plum:          #49343d;
    --line:          #bcb49a;
    --scan-opacity:  0.08;
    --vignette:      radial-gradient(ellipse at center,
                      transparent 50%,
                      rgba(0,0,0,0.18) 100%);
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    background:
        radial-gradient(circle at 20% 0%, rgba(37,148,240,0.07), transparent 50%),
        radial-gradient(circle at 80% 100%, rgba(255,46,77,0.05), transparent 60%),
        var(--bg);
    color: var(--phosphor);
    line-height: 1.55;
    font-size: 15px;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.4s, color 0.4s;
}

/* Subtle grid background */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(var(--line) 1px, transparent 1px),
        linear-gradient(90deg, var(--line) 1px, transparent 1px);
    background-size: 48px 48px;
    opacity: 0.35;
    mask-image: linear-gradient(180deg, transparent, black 20%, black 80%, transparent);
    z-index: 0;
}

/* CRT scanlines + vignette overlay across whole site */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    background:
        repeating-linear-gradient(
            to bottom,
            rgba(0,0,0,var(--scan-opacity)) 0px,
            rgba(0,0,0,var(--scan-opacity)) 1px,
            transparent 1px,
            transparent 3px
        ),
        var(--vignette);
    mix-blend-mode: multiply;
}

::selection {
    background: var(--tv-blue);
    color: var(--bg);
}

a {
    color: var(--tv-blue-glow);
    text-decoration: none;
    border-bottom: 1px dashed currentColor;
    transition: color 0.15s, background 0.15s;
}
a:hover {
    color: var(--signal-red);
    background: rgba(255,46,77,0.08);
}

img { image-rendering: pixelated; image-rendering: crisp-edges; display: block; max-width: 100%; }

/* ---------- broadcast bar (top) ---------- */
.broadcast-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 16px;
    padding: 8px 20px;
    background: var(--bg-elev);
    border-bottom: 1px solid var(--line);
    font-family: 'VT323', monospace;
    font-size: 18px;
    letter-spacing: 0.06em;
    color: var(--phosphor-dim);
}
.broadcast-bar .live {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--signal-red);
    text-transform: uppercase;
}
.broadcast-bar .live::before {
    content: "";
    width: 10px; height: 10px;
    background: var(--signal-red);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--signal-red);
    animation: pulse 1.2s ease-in-out infinite;
}
.broadcast-bar .ticker {
    overflow: hidden;
    white-space: nowrap;
    color: var(--phosphor);
    opacity: 0.75;
}
.broadcast-bar .ticker span {
    display: inline-block;
    padding-left: 100%;
    animation: ticker 38s linear infinite;
}
.broadcast-bar .ch {
    color: var(--tv-blue-glow);
    font-weight: 700;
}

@keyframes pulse { 50% { opacity: 0.3; } }
@keyframes ticker { to { transform: translateX(-100%); } }

/* ---------- header (brand + channel nav) ---------- */
header.site-head {
    position: relative;
    padding: 44px 24px 28px;
    max-width: 1400px;
    margin: 0 auto;
    z-index: 2;
}

.brand {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: end;
    gap: 18px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 22px;
}

.brand .logo {
    width: 68px;
    height: 68px;
    filter: drop-shadow(0 0 12px rgba(37,148,240,0.35));
}

.brand .wordmark {
    font-family: 'Major Mono Display', 'VT323', monospace;
    font-size: clamp(44px, 9vw, 112px);
    line-height: 0.85;
    color: var(--phosphor);
    letter-spacing: -0.02em;
    text-transform: lowercase;
    margin: 0;
    position: relative;
    /* chromatic aberration */
    text-shadow:
        2px 0 0 rgba(255, 46, 77, 0.55),
        -2px 0 0 rgba(37, 148, 240, 0.55);
}
.brand .wordmark .dot {
    color: var(--tv-blue-glow);
    text-shadow:
        2px 0 0 rgba(255, 46, 77, 0.6),
        -2px 0 0 rgba(37,148,240,0.9),
        0 0 20px rgba(37,148,240,0.5);
}

.brand .meta {
    font-family: 'VT323', monospace;
    font-size: 20px;
    color: var(--phosphor-dim);
    text-align: right;
    line-height: 1.1;
}
.brand .meta b { color: var(--phosphor); font-weight: 400; }

/* channel selector nav */
nav.channels {
    margin-top: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    padding: 4px;
}
nav.channels a, nav.channels button.theme-toggle {
    flex: 1 1 auto;
    font-family: 'VT323', monospace;
    font-size: 20px;
    letter-spacing: 0.04em;
    color: var(--phosphor-dim);
    background: transparent;
    border: 0;
    padding: 10px 14px;
    text-align: center;
    cursor: pointer;
    position: relative;
    text-transform: uppercase;
    transition: color 0.15s, background 0.15s;
    border-bottom: 2px dashed transparent;
}
nav.channels a .num {
    color: var(--tv-blue-glow);
    margin-right: 8px;
    font-weight: 700;
}
nav.channels a:hover, nav.channels button.theme-toggle:hover {
    color: var(--ink);
    background: rgba(37,148,240,0.08);
    border-bottom-color: var(--tv-blue);
}
nav.channels a[aria-current="page"] {
    color: var(--phosphor);
    background: rgba(37,148,240,0.12);
    border-bottom-color: var(--signal-red);
}
nav.channels a[aria-current="page"] .num { color: var(--signal-red); }

nav.channels button.theme-toggle {
    flex: 0 0 auto;
    min-width: 72px;
    color: var(--tv-blue-glow);
}

/* ---------- main ---------- */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    position: relative;
    z-index: 1;
}

/* ---------- hero (home) ---------- */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 48px;
    align-items: end;
    padding: 24px 0 56px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 56px;
}
.hero .tagline {
    font-family: 'VT323', monospace;
    font-size: clamp(28px, 3.2vw, 44px);
    color: var(--phosphor);
    line-height: 1.15;
    margin: 0 0 16px;
}
.hero .tagline em {
    color: var(--tv-blue-glow);
    font-style: normal;
    text-shadow: 0 0 18px rgba(37,148,240,0.35);
}
.hero .tagline s {
    color: var(--phosphor-dim);
    text-decoration-color: var(--signal-red);
    text-decoration-thickness: 2px;
}
.hero .sub {
    font-size: 14px;
    color: var(--phosphor-dim);
    max-width: 48ch;
    margin: 0;
}
.hero .sub strong { color: var(--phosphor); font-weight: 500; }

.hero .crt {
    aspect-ratio: 4/3;
    background:
        radial-gradient(ellipse at center, #2a3f15 0%, #0a1405 80%),
        #000;
    border: 8px solid var(--plum);
    border-radius: 12px 12px 14px 14px / 10px 10px 40px 40px;
    position: relative;
    box-shadow:
        inset 0 0 60px rgba(0,0,0,0.8),
        inset 0 0 180px rgba(37,148,240,0.12),
        0 30px 60px -20px rgba(0,0,0,0.7);
    overflow: hidden;
    font-family: 'VT323', monospace;
    color: #a8ffb0;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    animation: flicker 6s infinite;
}
.hero .crt::before {
    content: "";
    position: absolute; inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        rgba(0,0,0,0.3) 0 1px,
        transparent 1px 3px
    );
    pointer-events: none;
    z-index: 2;
}
.hero .crt::after {
    content: "";
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.9) 100%);
    pointer-events: none;
    z-index: 2;
}
.hero .crt .ch-badge {
    font-size: 22px;
    letter-spacing: 0.1em;
    color: #fff;
    text-shadow: 0 0 8px #fff;
    align-self: flex-start;
    border: 2px solid #fff;
    padding: 2px 10px;
}
.hero .crt .signal {
    font-size: 64px;
    line-height: 1;
    text-shadow: 0 0 14px #a8ffb0;
    animation: typing 2s steps(12) infinite alternate;
}
.hero .crt .sig-meta {
    font-size: 18px;
    opacity: 0.7;
    display: flex;
    justify-content: space-between;
}

/* ---- CRT fade carousel ---- */
.hero .crt .crt-carousel {
    position: absolute;
    inset: 24px;
    z-index: 1;
}
.hero .crt .crt-slide {
    position: absolute;
    inset: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 900ms ease-in-out;
    pointer-events: none;
}
.hero .crt .crt-slide.is-active {
    opacity: 1;
}
.hero .crt .crt-slide img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    image-rendering: pixelated;
    /* phosphor monochrome look */
    filter:
        grayscale(1)
        brightness(0.9)
        contrast(1.15)
        sepia(1)
        hue-rotate(60deg)
        saturate(6)
        drop-shadow(0 0 6px rgba(168,255,176,0.55));
    mix-blend-mode: screen;
    animation: crt-jitter 5s infinite steps(1);
}
.hero .crt .crt-hud {
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 18px;
    z-index: 3;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 18px;
    color: #a8ffb0;
    text-shadow: 0 0 10px #a8ffb0;
    letter-spacing: 0.08em;
    pointer-events: none;
}
.hero .crt .crt-hud-label {
    max-width: 70%;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    animation: typing 2s steps(12) infinite alternate;
}
.hero .crt .crt-hud-idx { opacity: 0.7; }

@keyframes crt-jitter {
    0%, 97%, 100% { transform: translate(0, 0); }
    98% { transform: translate(-1px, 1px); }
    99% { transform: translate(1px, -1px); }
}

@keyframes flicker {
    0%, 96%, 100% { filter: brightness(1); }
    97% { filter: brightness(1.25); }
    98% { filter: brightness(0.85); }
    99% { filter: brightness(1.1); }
}
@keyframes typing {
    from { opacity: 1; }
    to   { opacity: 0.85; }
}

/* ---------- program sections ---------- */
.program {
    margin-bottom: 72px;
    position: relative;
}

.program > header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: baseline;
    gap: 20px;
    margin-bottom: 28px;
    padding-bottom: 12px;
    border-bottom: 1px dashed var(--line);
}
.program .sec-num {
    font-family: 'VT323', monospace;
    font-size: 22px;
    color: var(--tv-blue-glow);
    letter-spacing: 0.1em;
}
.program h2 {
    font-family: 'VT323', monospace;
    font-size: clamp(32px, 4.4vw, 56px);
    color: var(--phosphor);
    margin: 0;
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}
.program h2 .glitch {
    color: var(--signal-red);
    font-style: italic;
}
.program .sec-tag {
    font-family: 'VT323', monospace;
    font-size: 18px;
    color: var(--phosphor-dim);
    text-transform: uppercase;
    border: 1px solid var(--line);
    padding: 2px 10px;
}

.program > p.lede {
    max-width: 72ch;
    color: var(--phosphor);
    opacity: 0.85;
    margin: 0 0 28px;
    font-size: 15px;
}

/* ---------- tape / entry grid ---------- */
.tapes {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
}
@media (min-width: 640px)  { .tapes { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .tapes { grid-template-columns: repeat(3, 1fr); } }

.tape {
    position: relative;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: var(--bg-elev);
    border: 1px solid var(--line);
    overflow: hidden;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.tape:hover {
    transform: translate(-2px, -2px);
    border-color: var(--tv-blue);
    box-shadow: 4px 4px 0 var(--signal-red);
}
.tape a { border: 0; color: inherit; }

.tape .thumb {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: #000;
    border-bottom: 1px solid var(--line);
}
.tape .thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    filter: saturate(0.85) contrast(1.05);
    transition: filter 0.3s, transform 0.3s;
}
.tape:hover .thumb img { filter: saturate(1.15) contrast(1.1); transform: scale(1.03); }

.tape .thumb::after {
    content: "";
    position: absolute; inset: 0;
    background:
        linear-gradient(180deg, transparent 70%, rgba(0,0,0,0.6) 100%),
        repeating-linear-gradient(to bottom, rgba(0,0,0,0.18) 0 1px, transparent 1px 3px);
    pointer-events: none;
}
.tape .rec {
    position: absolute;
    top: 10px; left: 10px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--signal-red);
    letter-spacing: 0.1em;
    display: inline-flex; align-items: center; gap: 6px;
    z-index: 2;
    text-shadow: 0 0 6px rgba(255,46,77,0.6);
}
.tape .rec::before {
    content: "";
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--signal-red);
    box-shadow: 0 0 8px var(--signal-red);
    animation: pulse 1s infinite;
}
.tape .tc {
    position: absolute;
    top: 10px; right: 10px;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: var(--phosphor);
    background: rgba(0,0,0,0.55);
    padding: 0 6px;
    z-index: 2;
}

.tape .body {
    padding: 16px 18px 14px;
}
.tape h3 {
    font-family: 'VT323', monospace;
    font-size: 26px;
    margin: 0 0 6px;
    color: var(--phosphor);
    line-height: 1.05;
    letter-spacing: 0.02em;
}
.tape h3 a { color: inherit; }
.tape:hover h3 { color: var(--tv-blue-glow); }
.tape .desc {
    margin: 0;
    font-size: 13.5px;
    color: var(--phosphor-dim);
    line-height: 1.5;
}

.tape .label-strip {
    border-top: 1px dashed var(--line);
    padding: 8px 18px;
    font-family: 'VT323', monospace;
    font-size: 16px;
    color: var(--phosphor-dim);
    letter-spacing: 0.08em;
    display: flex;
    justify-content: space-between;
    text-transform: uppercase;
}
.tape .label-strip .cat { color: var(--tv-blue-glow); }

/* ---------- about ---------- */
.about-wrap {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 56px;
    align-items: start;
}
@media (max-width: 900px) { .about-wrap { grid-template-columns: 1fr; } }

.about-wrap .prose p {
    font-size: 15.5px;
    color: var(--phosphor);
    margin: 0 0 18px;
    max-width: 62ch;
}
.about-wrap .prose p::first-letter {
    font-family: 'VT323', monospace;
    font-size: 2.2em;
    color: var(--tv-blue-glow);
    line-height: 0.8;
    padding-right: 6px;
    float: left;
}

.about-wrap .prose p:not(:first-of-type)::first-letter {
    font-size: 1em; color: inherit; float: none; padding: 0;
}

.specs {
    background: var(--bg-elev);
    border: 1px solid var(--line);
    padding: 20px;
    font-family: 'VT323', monospace;
    font-size: 19px;
    color: var(--phosphor);
    position: sticky;
    top: 96px;
}
.specs h4 {
    margin: 0 0 12px;
    color: var(--tv-blue-glow);
    font-size: 20px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-bottom: 1px dashed var(--line);
    padding-bottom: 8px;
}
.specs ul { list-style: none; padding: 0; margin: 0; }
.specs li {
    display: grid;
    grid-template-columns: 18px 1fr;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px dotted var(--line);
}
.specs li::before {
    content: ">";
    color: var(--signal-red);
}
.specs .langs {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.specs .langs span {
    font-size: 14px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--phosphor-dim);
    border: 1px solid var(--line);
    padding: 2px 8px;
}

/* ---------- blog list ---------- */
.blog-list {
    list-style: none;
    padding: 0;
    margin: 0;
    border-top: 1px dashed var(--line);
}
.blog-list li {
    border-bottom: 1px dashed var(--line);
}
.blog-list a {
    display: grid;
    grid-template-columns: 140px 1fr auto;
    gap: 24px;
    align-items: baseline;
    padding: 20px 12px;
    border: 0;
    color: var(--phosphor);
    font-family: 'VT323', monospace;
    font-size: 24px;
    letter-spacing: 0.01em;
    transition: background 0.15s, color 0.15s, padding 0.15s;
}
.blog-list a:hover {
    background: rgba(37,148,240,0.08);
    color: var(--tv-blue-glow);
    padding-left: 22px;
}
.blog-list .date {
    color: var(--signal-red);
    font-size: 18px;
    letter-spacing: 0.06em;
}
.blog-list .arrow {
    color: var(--phosphor-dim);
    font-size: 18px;
}
.blog-list a:hover .arrow { color: var(--signal-red); transform: translateX(4px); }
@media (max-width: 700px) {
    .blog-list a { grid-template-columns: 1fr; gap: 2px; font-size: 20px; }
    .blog-list .date { font-size: 15px; }
    .blog-list .arrow { display: none; }
}

/* ---------- contact ---------- */
.contact-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 40px;
}
@media (max-width: 900px) { .contact-wrap { grid-template-columns: 1fr; } }

.contact-wrap .comms {
    font-family: 'VT323', monospace;
    font-size: 22px;
    color: var(--phosphor);
}
.contact-wrap .comms h3 {
    font-size: 28px;
    color: var(--tv-blue-glow);
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.contact-wrap .comms p { font-size: 15px; font-family: 'JetBrains Mono', monospace; color: var(--phosphor-dim); }
.contact-wrap .comms .handle {
    display: inline-block;
    font-size: 32px;
    color: var(--signal-red);
    border: 2px solid var(--signal-red);
    padding: 6px 14px;
    margin-top: 10px;
}

.contact-wrap iframe {
    width: 100%;
    min-height: 980px;
    background: var(--phosphor);
    border: 4px solid var(--plum);
    border-radius: 6px;
    filter: saturate(0.9);
}

/* ---------- footer ---------- */
footer.site-foot {
    position: relative;
    margin-top: 80px;
    border-top: 1px solid var(--line);
    padding: 22px 24px 40px;
    background:
        linear-gradient(90deg, var(--signal-red) 0 12.5%, #ff8e2e 12.5% 25%, #ffd83a 25% 37.5%, #22d36a 37.5% 50%, #2594f0 50% 62.5%, #7b3aff 62.5% 75%, var(--phosphor) 75% 87.5%, var(--plum) 87.5% 100%);
    background-size: 100% 6px;
    background-repeat: no-repeat;
    background-position: top;
}
footer.site-foot .row {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    font-family: 'VT323', monospace;
    font-size: 20px;
    color: var(--phosphor-dim);
    padding-top: 18px;
}
footer.site-foot .row .brandmark {
    color: var(--phosphor);
    letter-spacing: 0.1em;
}
footer.site-foot .row .nosig {
    color: var(--signal-red);
    animation: pulse 2s infinite;
}

/* ---------- utility ---------- */
.sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0);
    white-space: nowrap; border: 0;
}

/* fade-in reveal for programs */
.program { animation: reveal 0.6s ease-out both; }
.program:nth-of-type(1) { animation-delay: 0.05s; }
.program:nth-of-type(2) { animation-delay: 0.18s; }
.program:nth-of-type(3) { animation-delay: 0.30s; }
.program:nth-of-type(4) { animation-delay: 0.42s; }

@keyframes reveal {
    from { opacity: 0; transform: translateY(12px); filter: blur(6px); }
    to   { opacity: 1; transform: none; filter: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
