/* ============================================
   RetroNews VT220 Terminal Styles
   Authentic phosphor CRT aesthetic
   ============================================ */

@font-face {
    font-family: 'Glass TTY VT220';
    src: url('Glass_TTY_VT220.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

:root {
    /* Phosphor green (P1 phosphor) */
    --phosphor: #33ff33;
    --phosphor-dim: #22aa22;
    --phosphor-bright: #66ff66;
    --phosphor-glow: rgba(51, 255, 51, 0.4);
    --phosphor-bg: #001100;
    
    /* Alternative amber (P3 phosphor) - uncomment to use */
    /* --phosphor: #ffb000;
    --phosphor-dim: #996600;
    --phosphor-bright: #ffcc33;
    --phosphor-glow: rgba(255, 176, 0, 0.4);
    --phosphor-bg: #110800; */
    
    --crt-bg: #0a0a0a;
    --terminal-padding: 20px;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Glass TTY VT220', 'Courier New', monospace;
}

/* CRT Monitor Frame */
.crt {
    position: relative;
    width: 100vw;
    height: 100vh;
    background: var(--crt-bg);
    overflow: hidden;
    border-radius: 20px;
}

/* Scanline effect */
.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 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: 100;
}

/* Screen curvature and vignette */
.screen-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
    pointer-events: none;
    z-index: 101;
}

/* Subtle screen flicker */
@keyframes flicker {
    0% { opacity: 0.97; }
    5% { opacity: 0.95; }
    10% { opacity: 0.98; }
    15% { opacity: 0.96; }
    20% { opacity: 0.99; }
    25% { opacity: 0.94; }
    30% { opacity: 0.98; }
    35% { opacity: 0.97; }
    40% { opacity: 0.95; }
    45% { opacity: 0.98; }
    50% { opacity: 0.96; }
    55% { opacity: 0.99; }
    60% { opacity: 0.94; }
    65% { opacity: 0.97; }
    70% { opacity: 0.98; }
    75% { opacity: 0.95; }
    80% { opacity: 0.97; }
    85% { opacity: 0.96; }
    90% { opacity: 0.98; }
    95% { opacity: 0.94; }
    100% { opacity: 0.97; }
}

/* Main terminal container */
.terminal {
    position: relative;
    width: 100%;
    height: 100%;
    padding: var(--terminal-padding);
    display: flex;
    flex-direction: column;
    color: var(--phosphor);
    font-size: 16px;
    line-height: 1.4;
    text-shadow: 
        0 0 5px var(--phosphor-glow),
        0 0 10px var(--phosphor-glow),
        0 0 20px var(--phosphor-glow);
    animation: flicker 0.15s infinite;
    background: 
        radial-gradient(ellipse at center, var(--phosphor-bg) 0%, #000 100%);
}

/* Header styling */
.terminal-header {
    flex-shrink: 0;
    margin-bottom: 10px;
}

/* CSS-based terminal borders that stretch to full width */
.header-border,
.footer-border {
    position: relative;
    height: 1.4em;
    color: var(--phosphor-dim);
}

.header-border::before,
.header-border::after,
.footer-border::before,
.footer-border::after {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
}

/* Corner characters */
.header-border.top::before { content: '╔'; left: 0; }
.header-border.top::after { content: '╗'; right: 0; }
.header-border.bottom::before { content: '╠'; left: 0; }
.header-border.bottom::after { content: '╣'; right: 0; }
.footer-border.top::before { content: '╠'; left: 0; }
.footer-border.top::after { content: '╣'; right: 0; }
.footer-border.bottom::before { content: '╚'; left: 0; }
.footer-border.bottom::after { content: '╝'; right: 0; }

/* The stretching line in the middle */
.header-border,
.footer-border {
    background: linear-gradient(
        to bottom,
        transparent calc(50% - 1px),
        var(--phosphor-dim) calc(50% - 1px),
        var(--phosphor-dim) calc(50% + 1px),
        transparent calc(50% + 1px)
    );
    margin: 0 0.5em;
}

/* Double line effect for that ═ look */
.header-border::after,
.header-border::before,
.footer-border::after,
.footer-border::before {
    background: var(--phosphor-bg);
    padding: 0 2px;
    z-index: 1;
}

.header-content {
    text-align: center;
    padding: 5px 0;
    font-weight: bold;
    letter-spacing: 2px;
}

/* Blinking cursor/elements */
@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.blink {
    animation: blink 1s infinite;
}

.dim {
    color: var(--phosphor-dim);
}

.ok {
    color: var(--phosphor-bright);
}

/* Feed selector nav */
.feed-selector {
    flex-shrink: 0;
    padding: 10px 0;
    border-bottom: 1px dashed var(--phosphor-dim);
    margin-bottom: 10px;
}

.prompt {
    color: var(--phosphor-bright);
}

.feed-btn {
    background: transparent;
    border: 1px solid var(--phosphor-dim);
    color: var(--phosphor-dim);
    font-family: inherit;
    font-size: 14px;
    padding: 4px 12px;
    margin: 0 4px;
    cursor: pointer;
    transition: all 0.1s ease;
    text-shadow: inherit;
}

.feed-btn:hover {
    color: var(--phosphor);
    border-color: var(--phosphor);
    background: rgba(51, 255, 51, 0.1);
}

.feed-btn.active {
    color: var(--phosphor-bright);
    border-color: var(--phosphor-bright);
    background: rgba(51, 255, 51, 0.15);
    box-shadow: 0 0 10px var(--phosphor-glow);
}

/* Main output area */
.terminal-body {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.output {
    height: 100%;
    overflow-y: auto;
    padding-right: 10px;
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.output::-webkit-scrollbar {
    width: 8px;
}

.output::-webkit-scrollbar-track {
    background: var(--phosphor-bg);
    border: 1px solid var(--phosphor-dim);
}

.output::-webkit-scrollbar-thumb {
    background: var(--phosphor-dim);
    border: 1px solid var(--phosphor);
}

.output::-webkit-scrollbar-thumb:hover {
    background: var(--phosphor);
}

/* Boot sequence styling */
.boot-sequence p {
    margin-bottom: 8px;
}

/* News article styling */
.news-item {
    padding: 15px 0;
    border-bottom: 1px dotted var(--phosphor-dim);
    cursor: default;
    transition: background 0.1s ease;
}

.news-item:hover {
    background: rgba(51, 255, 51, 0.05);
}

.news-item.selected {
    background: rgba(51, 255, 51, 0.1);
    border-left: 3px solid var(--phosphor-bright);
    padding-left: 12px;
}

.news-item-number {
    color: var(--phosphor-dim);
    margin-right: 10px;
}

.news-item-title {
    color: var(--phosphor-bright);
    font-weight: bold;
    display: block;
    margin-bottom: 8px;
}

.news-item-meta {
    color: var(--phosphor-dim);
    font-size: 14px;
    margin-bottom: 8px;
}

.news-item-description {
    color: var(--phosphor);
    font-size: 14px;
    line-height: 1.5;
}

.news-item-link {
    display: inline-block;
    margin-top: 8px;
    color: var(--phosphor-dim);
    font-size: 12px;
}

/* Category header */
.category-header {
    padding: 15px 0;
    border-bottom: 2px solid var(--phosphor);
    margin-bottom: 10px;
}

.category-title {
    font-size: 20px;
    letter-spacing: 3px;
    color: var(--phosphor-bright);
}

.category-count {
    color: var(--phosphor-dim);
    font-size: 14px;
}

/* Loading animation */
@keyframes loading-dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60% { content: '...'; }
    80%, 100% { content: '....'; }
}

.loading::after {
    content: '';
    animation: loading-dots 1.5s infinite;
}

/* Error styling */
.error {
    color: #ff3333;
    text-shadow: 
        0 0 5px rgba(255, 51, 51, 0.4),
        0 0 10px rgba(255, 51, 51, 0.4);
    padding: 20px;
    border: 1px dashed #ff3333;
    margin: 20px 0;
}

/* Footer */
.terminal-footer {
    flex-shrink: 0;
    margin-top: 10px;
}

/* footer-line removed - now using CSS-based footer-border */

.footer-content {
    text-align: center;
    padding: 5px 0;
    font-size: 14px;
}

/* ASCII art separator */
.separator {
    color: var(--phosphor-dim);
    text-align: center;
    padding: 10px 0;
    white-space: pre;
}

/* Responsive adjustments */
@media (max-width: 900px) {
    :root {
        --terminal-padding: 15px;
    }
    
    .terminal {
        font-size: 14px;
    }
    
    .header-border,
    .footer-border {
        display: none;
    }
    
    .feed-btn {
        font-size: 12px;
        padding: 3px 8px;
        margin: 2px;
    }
    
    .feed-selector {
        text-align: center;
    }
    
    .prompt {
        display: none;
    }
}

@media (max-width: 600px) {
    .terminal {
        font-size: 12px;
    }
    
    .header-content {
        font-size: 11px;
        letter-spacing: 1px;
    }
    
    .feed-btn {
        font-size: 10px;
        padding: 2px 6px;
    }
}

/* Phosphor afterglow effect for text */
@keyframes afterglow {
    from {
        text-shadow: 
            0 0 5px var(--phosphor-glow),
            0 0 10px var(--phosphor-glow),
            0 0 20px var(--phosphor-glow),
            0 0 40px var(--phosphor-glow);
    }
    to {
        text-shadow: 
            0 0 5px var(--phosphor-glow),
            0 0 10px var(--phosphor-glow),
            0 0 20px var(--phosphor-glow);
    }
}

.news-item-title:hover {
    animation: afterglow 0.3s ease-out;
}

/* Typing effect for new content */
@keyframes typewriter {
    from { width: 0; }
    to { width: 100%; }
}

/* Power on effect */
@keyframes power-on {
    0% {
        transform: scale(1, 0.01);
        filter: brightness(10);
    }
    40% {
        transform: scale(1, 0.01);
        filter: brightness(10);
    }
    60% {
        transform: scale(1, 1);
        filter: brightness(10);
    }
    100% {
        transform: scale(1, 1);
        filter: brightness(1);
    }
}

.crt {
    animation: power-on 0.8s ease-out;
}

/* Subtle RGB shift for that authentic CRT feel */
@keyframes rgb-shift {
    0% { text-shadow: -1px 0 rgba(255,0,0,0.1), 1px 0 rgba(0,255,255,0.1), 0 0 5px var(--phosphor-glow), 0 0 10px var(--phosphor-glow); }
    50% { text-shadow: 1px 0 rgba(255,0,0,0.1), -1px 0 rgba(0,255,255,0.1), 0 0 5px var(--phosphor-glow), 0 0 10px var(--phosphor-glow); }
    100% { text-shadow: -1px 0 rgba(255,0,0,0.1), 1px 0 rgba(0,255,255,0.1), 0 0 5px var(--phosphor-glow), 0 0 10px var(--phosphor-glow); }
}

/* Apply subtle jitter occasionally */
@keyframes jitter {
    0% { transform: translate(0, 0); }
    25% { transform: translate(0.5px, 0); }
    50% { transform: translate(-0.5px, 0.5px); }
    75% { transform: translate(0.5px, -0.5px); }
    100% { transform: translate(0, 0); }
}

.terminal-body {
    animation: jitter 0.1s infinite;
    animation-play-state: paused;
}

.terminal-body:hover {
    animation-play-state: running;
}

