/* === FONTS === */
@font-face {
    font-family: 'Press Start 2P';
    src: url('../fonts/PressStart2P-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'VT323';
    src: url('../fonts/VT323-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

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

:root {
    --phosphor: #33ff57;
    --phosphor-dim: #1a9932;
    --phosphor-glow: #33ff5744;
    --amber: #ffaa00;
    --amber-dim: #996600;
    --crt-bg: #050808;
    --crt-dark: #020505;
    --scanline: rgba(0, 0, 0, 0.3);
    --pixel-blue: #5599ff;
    --pixel-red: #ff4455;
    --pixel-purple: #aa44ff;
    --sidebar-width: 220px;
}

html {
    font-size: 16px;
    background: #000;
}

body {
    font-family: 'VT323', monospace;
    background: var(--crt-bg);
    color: var(--phosphor);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

a {
    color: var(--phosphor);
    text-decoration: none;
}

a:hover {
    color: var(--amber);
    text-shadow: 0 0 8px rgba(255, 170, 0, 0.3);
}

/* === CRT EFFECTS === */
.crt-overlay {
    position: fixed;
    inset: 0;
    z-index: 100;
    pointer-events: none;
    overflow: hidden;
}

.crt-overlay::before {
    content: '';
    position: absolute;
    top: -10%;
    left: 0;
    right: 0;
    height: 110%;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        var(--scanline) 2px,
        var(--scanline) 4px
    );
    animation: scanlineScroll 8s linear infinite;
}

@keyframes scanlineScroll {
    0%   { transform: translateY(0); }
    100% { transform: translateY(100px); }
}

.crt-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 8, 0);
    animation: flicker 4s infinite alternate;
}

@keyframes flicker {
    0% { opacity: 0; }
    5% { opacity: 0.02; }
    50% { opacity: 0; }
    95% { opacity: 0.03; }
    100% { opacity: 0; }
}

.vignette {
    position: fixed;
    inset: 0;
    z-index: 99;
    pointer-events: none;
    background: radial-gradient(
        ellipse at center,
        transparent 50%,
        rgba(0, 0, 0, 0.4) 80%,
        rgba(0, 0, 0, 0.8) 100%
    );
}

.screen-curve {
    position: fixed;
    inset: 0;
    z-index: 98;
    pointer-events: none;
    border-radius: 20px;
    box-shadow:
        inset 0 0 80px rgba(0, 0, 0, 0.5),
        inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.noise {
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    z-index: 97;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    animation: noiseShift 2s steps(5) infinite;
}

@keyframes noiseShift {
    0% { transform: translate(0, 0); }
    20% { transform: translate(-5%, -5%); }
    40% { transform: translate(3%, -3%); }
    60% { transform: translate(-3%, 5%); }
    80% { transform: translate(5%, 2%); }
    100% { transform: translate(0, 0); }
}

.pixel-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    opacity: 0.04;
    background-image:
        linear-gradient(var(--phosphor-dim) 1px, transparent 1px),
        linear-gradient(90deg, var(--phosphor-dim) 1px, transparent 1px);
    background-size: 24px 24px;
}

.glitch-layer {
    position: fixed;
    inset: 0;
    z-index: 96;
    pointer-events: none;
    opacity: 0;
    animation: glitchTrigger 12s ease-in-out infinite;
}

.glitch-layer::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        transparent 0%,
        rgba(51, 255, 87, 0.03) 50%,
        transparent 51%,
        transparent 100%
    );
    background-size: 100% 4px;
    animation: glitchShift 1s steps(3) infinite;
}

@keyframes glitchTrigger {
    0%, 93% { opacity: 0; }
    94% { opacity: 1; }
    95% { opacity: 0; }
    96% { opacity: 1; }
    97%, 100% { opacity: 0; }
}

@keyframes glitchShift {
    0% { transform: translateX(0); }
    33% { transform: translateX(-2px); }
    66% { transform: translateX(2px); }
    100% { transform: translateX(0); }
}

.h-scan {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    z-index: 95;
    pointer-events: none;
    background: linear-gradient(
        90deg,
        transparent,
        var(--phosphor-glow),
        rgba(51, 255, 87, 0.12),
        var(--phosphor-glow),
        transparent
    );
    animation: hScan 6s linear infinite;
    opacity: 0.7;
}

@keyframes hScan {
    0%   { transform: translateY(-3px); }
    100% { transform: translateY(100vh); }
}

/* === PARTICLES === */
.particles {
    position: fixed;
    inset: 0;
    z-index: 5;
    pointer-events: none;
    overflow: hidden;
}

.particle {
    position: absolute;
    width: 3px;
    height: 3px;
    background: var(--phosphor);
    opacity: 0;
    animation: particleFloat linear infinite;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(100vh) translateX(0);
    }
    10% { opacity: 0.4; }
    90% { opacity: 0.4; }
    100% {
        opacity: 0;
        transform: translateY(-10vh) translateX(30px);
    }
}

/* === LAYOUT === */
.page-wrapper {
    display: flex;
    flex: 1;
    position: relative;
    z-index: 10;
}

/* === SIDEBAR === */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50;
    background: rgba(2, 5, 5, 0.95);
    border-right: 1px solid rgba(51, 255, 87, 0.15);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0;
}

.sidebar-logo {
    text-align: center;
    padding: 1rem 1rem 1.5rem;
    border-bottom: 1px solid rgba(51, 255, 87, 0.1);
    margin-bottom: 1rem;
}

.sidebar-logo h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 1.1rem;
    color: var(--phosphor);
    text-shadow: 0 0 10px var(--phosphor-glow), 0 0 30px var(--phosphor-glow);
    letter-spacing: 0.1em;
}

.sidebar-logo .subtitle {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    color: var(--phosphor-dim);
    letter-spacing: 0.25em;
    margin-top: 0.4rem;
    display: block;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    flex: 1;
}

.sidebar-nav li {
    border-bottom: 1px solid rgba(51, 255, 87, 0.05);
}

.sidebar-nav a {
    display: block;
    padding: 0.8rem 1.2rem;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.6rem;
    color: var(--phosphor-dim);
    letter-spacing: 0.1em;
    transition: all 0.2s ease;
    position: relative;
}

.sidebar-nav a::before {
    content: '>';
    margin-right: 0.6rem;
    color: var(--phosphor-dim);
    transition: color 0.2s ease;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    color: var(--phosphor);
    background: rgba(51, 255, 87, 0.05);
    text-shadow: 0 0 8px var(--phosphor-glow);
}

.sidebar-nav a:hover::before,
.sidebar-nav a.active::before {
    color: var(--amber);
}

.sidebar-nav a.active {
    border-left: 2px solid var(--phosphor);
}

.sidebar-footer {
    padding: 1rem 1.2rem;
    border-top: 1px solid rgba(51, 255, 87, 0.1);
    font-size: 0.85rem;
    color: var(--phosphor-dim);
    text-align: center;
}

/* Mobile toggle */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 60;
    background: rgba(2, 5, 5, 0.95);
    border: 1px solid rgba(51, 255, 87, 0.3);
    color: var(--phosphor);
    font-family: 'Press Start 2P', monospace;
    font-size: 0.7rem;
    padding: 0.5rem 0.7rem;
    cursor: pointer;
}

.sidebar-toggle:hover {
    border-color: var(--phosphor);
    box-shadow: 0 0 10px var(--phosphor-glow);
}

/* === CONTENT === */
.content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2rem 2.5rem;
}

.content-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(51, 255, 87, 0.1);
}

.content-header h1 {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.8rem, 2.5vw, 1.2rem);
    color: var(--phosphor);
    text-shadow: 0 0 10px var(--phosphor-glow);
    letter-spacing: 0.1em;
}

.content-header .subtitle {
    font-family: 'Press Start 2P', monospace;
    font-size: clamp(0.4rem, 1.2vw, 0.55rem);
    color: var(--phosphor-dim);
    letter-spacing: 0.15em;
    margin-top: 0.5rem;
}

/* === TERMINAL BLOCK === */
.terminal {
    max-width: 800px;
    width: 100%;
    margin-bottom: 1.5rem;
    padding: 1.5rem 2rem;
    background: rgba(5, 8, 8, 0.6);
    border: 1px solid rgba(51, 255, 87, 0.1);
    border-radius: 2px;
}

.terminal-header {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.5rem;
    color: var(--phosphor-dim);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(51, 255, 87, 0.1);
    letter-spacing: 0.1em;
}

.terminal-line {
    font-size: 1.4rem;
    line-height: 1.8;
    color: var(--phosphor);
}

.terminal-line .prompt {
    color: var(--amber);
    margin-right: 0.3rem;
}

.terminal-line .highlight {
    color: var(--amber);
    text-shadow: 0 0 8px rgba(255, 170, 0, 0.3);
}

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

.cursor {
    display: inline-block;
    width: 0.7em;
    height: 1.2em;
    background: var(--phosphor);
    vertical-align: text-bottom;
    animation: blink 1s step-end infinite;
    margin-left: 2px;
}

@keyframes blink {
    50% { opacity: 0; }
}

/* === SERVER CARDS === */
.server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.server-card {
    background: rgba(5, 8, 8, 0.6);
    border: 1px solid rgba(51, 255, 87, 0.1);
    padding: 1.2rem 1.5rem;
    position: relative;
}

.server-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(51, 255, 87, 0.05);
}

.server-card-name {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.55rem;
    color: var(--phosphor);
    letter-spacing: 0.05em;
}

.server-status {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    padding: 0.3rem 0.6rem;
    border-radius: 2px;
    letter-spacing: 0.05em;
}

.server-status.online {
    color: var(--phosphor);
    background: rgba(51, 255, 87, 0.1);
    border: 1px solid rgba(51, 255, 87, 0.3);
    text-shadow: 0 0 5px var(--phosphor-glow);
}

.server-status.offline {
    color: var(--pixel-red);
    background: rgba(255, 68, 85, 0.1);
    border: 1px solid rgba(255, 68, 85, 0.3);
}

.server-card-info {
    font-size: 1.2rem;
    line-height: 1.8;
}

.server-card-info dt {
    color: var(--phosphor-dim);
    display: inline;
}

.server-card-info dd {
    color: var(--phosphor);
    display: inline;
    margin-left: 0.3rem;
}

.server-card-info .info-row {
    margin-bottom: 0.3rem;
}

.server-card-info .info-row::before {
    content: '>';
    color: var(--amber);
    margin-right: 0.4rem;
}

/* === NEWS / CONTENT SECTIONS === */
.news-item {
    background: rgba(5, 8, 8, 0.6);
    border: 1px solid rgba(51, 255, 87, 0.1);
    padding: 1.2rem 1.5rem;
    margin-bottom: 1rem;
}

.news-item h3 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.55rem;
    color: var(--amber);
    margin-bottom: 0.8rem;
    letter-spacing: 0.05em;
}

.news-item time {
    font-size: 0.9rem;
    color: var(--phosphor-dim);
}

.news-item p {
    font-size: 1.2rem;
    line-height: 1.6;
    margin-top: 0.5rem;
}

/* Info sections for about/join */
.info-section {
    margin-bottom: 2rem;
}

.info-section h2 {
    font-family: 'Press Start 2P', monospace;
    font-size: 0.65rem;
    color: var(--phosphor);
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
    text-shadow: 0 0 8px var(--phosphor-glow);
}

.info-section p,
.info-section li {
    font-size: 1.3rem;
    line-height: 1.7;
    color: var(--phosphor);
}

.info-section ul {
    list-style: none;
    padding: 0;
}

.info-section ul li::before {
    content: '>';
    color: var(--amber);
    margin-right: 0.5rem;
}

/* Server status mini badges (home page) */
.status-badges {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.status-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    padding: 0.4rem 0.8rem;
    background: rgba(5, 8, 8, 0.6);
    border: 1px solid rgba(51, 255, 87, 0.1);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.online {
    background: var(--phosphor);
    box-shadow: 0 0 6px var(--phosphor-glow);
}

.status-dot.offline {
    background: var(--pixel-red);
    box-shadow: 0 0 6px rgba(255, 68, 85, 0.4);
}

.status-dot.loading {
    background: var(--amber);
    animation: blink 1s step-end infinite;
}

/* === FOOTER === */
.page-footer {
    text-align: center;
    padding: 1.5rem;
    font-size: 1rem;
    color: var(--phosphor-dim);
    border-top: 1px solid rgba(51, 255, 87, 0.05);
    margin-top: 3rem;
}

.footer-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
    font-family: 'Press Start 2P', monospace;
    font-size: 0.45rem;
    letter-spacing: 0.05em;
}

.footer-nav a {
    color: var(--phosphor-dim);
    transition: color 0.2s ease;
}

.footer-nav a:hover {
    color: var(--phosphor);
    text-shadow: 0 0 8px var(--phosphor-glow);
}

/* === NOSCRIPT === */
.noscript-fallback {
    background: rgba(5, 8, 8, 0.6);
    border: 1px solid rgba(255, 170, 0, 0.3);
    padding: 1rem 1.5rem;
    color: var(--amber);
    font-size: 1.2rem;
    margin: 1rem 0;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-toggle {
        display: block;
    }

    .content {
        margin-left: 0;
        padding: 1.5rem 1rem;
        padding-top: 3.5rem;
    }

    .server-grid {
        grid-template-columns: 1fr;
    }
}

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

/* === REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
