/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   FRAGMENT ZERO — THE DIGITAL ARCHIVE
   Terminal/CRT aesthetic. Pure phosphor green.
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* ── RESET ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --phosphor: #00ff41;
    --phosphor-dim: #00cc33;
    --phosphor-dark: #009922;
    --phosphor-glow: rgba(0, 255, 65, 0.12);
    --amber: #ffb000;
    --red: #ff3333;
    --cyan: #00d4ff;
    --bg: #050505;
    --bg-panel: #0a0a0a;
    --bg-card: #0d0d0d;
    --border: #1a1a1a;
    --border-hover: #2a2a2a;
    --text: #999;
    --text-bright: #ccc;
    --mono: 'JetBrains Mono', 'Share Tech Mono', 'Fira Code', 'Courier New', monospace;
}

html { font-size: 14px; scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--phosphor);
    font-family: var(--mono);
    line-height: 1.7;
    overflow-x: hidden;
}

/* ── CRT SCANLINES ── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.12) 0px,
        rgba(0, 0, 0, 0.12) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 10000;
}

/* CRT vignette */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.5) 100%);
    pointer-events: none;
    z-index: 9999;
}

/* ── CRT BOOT FLASH ── */
.crt-boot {
    position: fixed;
    inset: 0;
    background: var(--phosphor);
    z-index: 99999;
    animation: crt-on 0.6s ease-out forwards;
}
@keyframes crt-on {
    0% { opacity: 1; }
    10% { opacity: 0.8; }
    20% { opacity: 0; }
    30% { opacity: 0.15; }
    40% { opacity: 0; }
    100% { opacity: 0; pointer-events: none; }
}

/* ── ANIMATIONS ── */
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
@keyframes glow-pulse {
    0%, 100% { text-shadow: 0 0 4px var(--phosphor), 0 0 8px rgba(0,255,65,0.2); }
    50% { text-shadow: 0 0 10px var(--phosphor), 0 0 25px rgba(0,255,65,0.4), 0 0 40px rgba(0,255,65,0.1); }
}
@keyframes flicker {
    0%, 100% { opacity: 1; }
    92% { opacity: 1; } 93% { opacity: 0.85; } 94% { opacity: 1; }
    96% { opacity: 0.92; } 97% { opacity: 1; }
}
@keyframes slide-up {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.cursor { animation: blink 1s step-end infinite; color: var(--phosphor); }
.glow { animation: glow-pulse 3s ease-in-out infinite; }
.live { color: var(--red); font-weight: 700; }
.prompt { color: var(--amber); }
.path { color: var(--cyan); }
.cmd { color: var(--phosphor); }
.dim { color: var(--text); }
.accent { color: var(--phosphor); font-weight: 700; }

/* ── LINKS ── */
a { color: var(--phosphor-dim); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--phosphor); text-decoration: underline; }

/* ── NAVIGATION ── */
.nav {
    border-bottom: 1px solid var(--border);
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.8rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.nav-logo {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--phosphor) !important;
    text-decoration: none !important;
    text-shadow: 0 0 8px rgba(0,255,65,0.3);
}
.nav-bracket { color: var(--text); font-weight: 300; }
.nav-links { display: flex; gap: 1.5rem; }
.nav-link { font-size: 0.75rem; color: var(--text) !important; letter-spacing: 0.1em; }
.nav-link:hover { color: var(--phosphor) !important; }

/* ── TERMINAL CHROME ── */
.terminal-bar {
    background: #111;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid var(--border);
}
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }
.terminal-title {
    color: #555;
    font-size: 0.7rem;
    margin-left: auto;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}
.terminal-body { padding: 1.5rem; }

/* ── CONTAINER ── */
.container { max-width: 1400px; margin: 0 auto; padding: 2rem; }
.section-header {
    font-size: 0.8rem;
    padding: 0.8rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

/* ── HERO / BOOT SEQUENCE ── */
.hero { padding: 2rem; max-width: 1400px; margin: 0 auto; }
.hero-terminal {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-card);
}
.boot-sequence { font-size: 0.8rem; }
.boot-line {
    padding: 0.15rem 0;
    animation: slide-up 0.3s ease-out both;
}
.boot-line:nth-child(1) { animation-delay: 0.1s; }
.boot-line:nth-child(2) { animation-delay: 0.3s; }
.boot-line:nth-child(3) { animation-delay: 0.5s; }
.boot-line:nth-child(4) { animation-delay: 0.7s; }
.boot-line:nth-child(5) { animation-delay: 1.0s; }
.boot-line:nth-child(6) { animation-delay: 1.2s; }
.boot-line:nth-child(7) { animation-delay: 1.4s; }
.boot-line:nth-child(8) { animation-delay: 1.6s; }
.boot-line:nth-child(9) { animation-delay: 1.8s; }

/* ── EPISODE CARDS ── */
.episodes-grid { display: grid; gap: 2.5rem; }
.episode-card {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-card);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.episode-card:hover {
    border-color: var(--phosphor-dark);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.05), inset 0 0 20px rgba(0, 255, 65, 0.02);
}
@media (max-width: 950px) {
    .episode-card { grid-template-columns: 1fr; }
}

.episode-video-wrap { display: flex; flex-direction: column; }
.episode-video { position: relative; }
.episode-video iframe { width: 100%; aspect-ratio: 16/9; display: block; border: none; }

.episode-meta {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    flex: 1;
}
.episode-title {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    margin-bottom: 0.4rem;
}
.episode-title a { color: var(--phosphor); }
.episode-title a:hover { text-shadow: 0 0 6px rgba(0,255,65,0.3); }
.episode-info {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
    font-size: 0.7rem;
    color: var(--text);
}
.episode-date { color: var(--text); }
.episode-langs { color: var(--cyan); }
.read-link {
    color: var(--amber) !important;
    font-size: 0.7rem;
}

/* ── TRANSCRIPT PANEL ── */
.transcript-panel {
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
    background: var(--bg-panel);
}
@media (max-width: 950px) {
    .transcript-panel { border-left: none; border-top: 1px solid var(--border); }
}

.lang-tabs {
    display: flex;
    overflow-x: auto;
    background: #0e0e0e;
    border-bottom: 1px solid var(--border);
}
.lang-tab {
    padding: 0.5rem 1rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    color: var(--text);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
}
.lang-tab:hover { color: var(--phosphor); }
.lang-tab.active {
    color: var(--phosphor);
    border-bottom-color: var(--phosphor);
    background: rgba(0,255,65,0.04);
}

.transcript-body {
    flex: 1;
    overflow-y: auto;
    padding: 0.8rem;
    max-height: 480px;
    font-size: 0.78rem;
}
.transcript-body::-webkit-scrollbar { width: 4px; }
.transcript-body::-webkit-scrollbar-track { background: var(--bg); }
.transcript-body::-webkit-scrollbar-thumb { background: #222; border-radius: 2px; }

.t-line {
    display: flex;
    gap: 0.8rem;
    padding: 0.3rem 0.5rem;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s;
}
.t-line:hover { background: rgba(0,255,65,0.06); }
.t-line.active { background: rgba(0,255,65,0.1); }
.t-ts { color: var(--amber); font-size: 0.68rem; white-space: nowrap; min-width: 55px; opacity: 0.8; }
.t-txt { color: var(--text); }
.t-line.active .t-txt { color: var(--phosphor); }
.transcript-loading { color: var(--text); font-size: 0.75rem; padding: 1.5rem; }

/* ── SHORTS GRID ── */
.shorts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.short-card {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-card);
}
.short-card iframe { width: 100%; aspect-ratio: 9/16; max-height: 350px; display: block; border: none; }
.short-title { padding: 0.5rem; font-size: 0.65rem; color: var(--text); }

/* ── WATCH PAGE ── */
.watch-layout {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-card);
}
@media (max-width: 1000px) { .watch-layout { grid-template-columns: 1fr; } }
.watch-video iframe { width: 100%; aspect-ratio: 16/9; display: block; border: none; }
.watch-transcript {
    display: flex; flex-direction: column;
    border-left: 1px solid var(--border);
    background: var(--bg-panel);
}
.watch-transcript .transcript-body { max-height: 70vh; }
.watch-meta { padding: 1.5rem 0; }
.watch-meta .episode-title { font-size: 1.3rem; margin-bottom: 0.5rem; }

/* ── ARTICLE PAGE ── */
.article-layout {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 2rem;
    margin-top: 1rem;
}
@media (max-width: 1000px) { .article-layout { grid-template-columns: 1fr; } }

.article-main {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-card);
}
.article-body { padding: 2rem; }
.article-title {
    font-size: 1.4rem;
    color: var(--phosphor);
    text-shadow: 0 0 8px rgba(0,255,65,0.2);
    margin-bottom: 1rem;
    line-height: 1.3;
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    font-size: 0.7rem;
    color: var(--text);
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.article-content {
    color: var(--text-bright);
    font-size: 0.85rem;
    line-height: 1.9;
}
.article-content p { margin-bottom: 1.2rem; }
.article-content figure.article-img {
    margin: 2rem -0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.article-content figure.article-img img {
    width: 100%;
    display: block;
    filter: contrast(1.05) brightness(0.95);
}

/* Sidebar */
.article-sidebar {
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    background: var(--bg-card);
    position: sticky;
    top: 60px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}
.sidebar-body { padding: 1rem; }
.sidebar-video iframe { width: 100%; aspect-ratio: 16/9; border: none; border-radius: 4px; }
.sidebar-link {
    display: block;
    padding: 0.6rem;
    font-size: 0.75rem;
    color: var(--amber) !important;
    margin: 0.5rem 0;
}
.sidebar-heading {
    font-size: 0.7rem;
    color: var(--text);
    letter-spacing: 0.2em;
    margin: 1rem 0 0.5rem;
}
.sidebar-img {
    width: 100%;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
    filter: contrast(1.05);
}

/* ── FOOTER ── */
.footer {
    border-top: 1px solid var(--border);
    margin-top: 4rem;
    background: var(--bg-panel);
}
.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    text-align: center;
}
.footer-ascii {
    font-size: 0.45rem;
    color: #1a1a1a;
    line-height: 1.2;
    white-space: pre;
    margin-bottom: 1rem;
    overflow: hidden;
}
.footer-links { font-size: 0.75rem; margin-bottom: 1rem; }
.footer-links a { color: var(--phosphor-dim); }
.footer-sep { color: #333; margin: 0 0.5rem; }
.footer-copy { color: #333; }
.footer-status { font-size: 0.65rem; color: #333; margin-top: 1rem; }

/* ── SELECTION ── */
::selection { background: var(--phosphor); color: var(--bg); }
