/* BSD Mirror - Main Stylesheet */
/* BSD-themed palette: Orange / Red / Dark Navy */

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

:root {
    /* Colors - Light theme (warm BSD) */
    --bg-primary: #FFFBF5;
    --bg-secondary: #F5F0E8;
    --bg-tertiary: #EDE6D9;
    --text-primary: #1A1A2E;
    --text-secondary: #4A4E69;
    --text-muted: #8D8DA0;
    --accent-primary: #E85D04;
    --accent-secondary: #D62828;
    --accent-gradient: linear-gradient(135deg, #E85D04 0%, #D62828 100%);
    --border-color: #E0D8CC;
    --card-bg: #FFFFFF;
    --card-shadow: 0 4px 6px -1px rgba(26, 26, 46, 0.06), 0 2px 4px -2px rgba(26, 26, 46, 0.04);
    --card-hover-shadow: 0 20px 25px -5px rgba(26, 26, 46, 0.08), 0 8px 10px -6px rgba(26, 26, 46, 0.04);

    /* BSD distribution identity colors */
    --freebsd-color: #AB2B28;
    --netbsd-color: #FF6600;
    --openbsd-color: #F2CA30;

    /* Status colors */
    --status-healthy: #22c55e;
    --status-syncing: #F59E0B;
    --status-error: #EF4444;

    /* Terminal style */
    --terminal-bg: #1A1A2E;
    --terminal-text: #E8B059;
    --terminal-prompt: #22c55e;

    /* Spacing */
    --container-max: 1200px;
    --header-height: 72px;

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 300ms ease;

    /* Border radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

/* Dark theme */
[data-theme="dark"] {
    --bg-primary: #0D0D1A;
    --bg-secondary: #1A1A2E;
    --bg-tertiary: #2A2A40;
    --text-primary: #E8E8F0;
    --text-secondary: #A0A0B8;
    --text-muted: #606078;
    --accent-primary: #F48C06;
    --accent-secondary: #EF4444;
    --accent-gradient: linear-gradient(135deg, #F48C06 0%, #EF4444 100%);
    --border-color: #2A2A40;
    --card-bg: #1A1A2E;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --card-hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --terminal-bg: #0D0D1A;
    --terminal-text: #F48C06;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color var(--transition-base), color var(--transition-base);
}

/* Background gradient effect - warm BSD glow */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 100vh;
    background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(232, 93, 4, 0.1), transparent);
    pointer-events: none;
    z-index: -1;
}

[data-theme="dark"] .background-gradient {
    background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(244, 140, 6, 0.07), transparent);
}

/* Container */
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 251, 245, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
    display: flex;
    align-items: center;
}

[data-theme="dark"] .header {
    background: rgba(13, 13, 26, 0.85);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.logo-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-icon svg {
    width: 32px;
    height: 32px;
    display: block;
}

.logo-text {
    letter-spacing: -0.01em;
}

.nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9375rem;
    white-space: nowrap;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: color var(--transition-fast), background-color var(--transition-fast);
}

.nav-link:hover {
    color: var(--accent-primary);
    background-color: var(--bg-tertiary);
}

.nav-admin {
    color: var(--accent-primary);
    font-weight: 600;
}

.theme-toggle {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-primary);
    font-size: 1rem;
}

.theme-toggle:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
}

/* Hero Section */
.hero {
    padding: 80px 0 60px;
    text-align: center;
}

.hero-title {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.gradient-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 48px;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    max-width: 800px;
    margin: 0 auto;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-base);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-hover-shadow);
}

.stat-card.loading .stat-value {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.stat-icon {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 32px;
    height: 32px;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-top: 4px;
}

/* Section titles */
.section-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 12px;
    text-align: center;
}

.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 40px;
    font-size: 1rem;
}

/* Mirrors Section */
.mirrors {
    padding: 60px 0;
}

.mirrors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 24px;
}

.mirror-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-base);
}

.mirror-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}

/* Per-BSD identity border colors */
.mirror-card[data-mirror="freebsd"] {
    border-left-color: var(--freebsd-color);
}

.mirror-card[data-mirror="freebsd"]:hover {
    border-color: var(--freebsd-color);
    border-left-color: var(--freebsd-color);
}

.mirror-card[data-mirror="netbsd"] {
    border-left-color: var(--netbsd-color);
}

.mirror-card[data-mirror="netbsd"]:hover {
    border-color: var(--netbsd-color);
    border-left-color: var(--netbsd-color);
}

.mirror-card[data-mirror="openbsd"] {
    border-left-color: var(--openbsd-color);
}

.mirror-card[data-mirror="openbsd"]:hover {
    border-color: var(--openbsd-color);
    border-left-color: var(--openbsd-color);
}

.mirror-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.mirror-logo {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
}

.mirror-name {
    font-size: 1.25rem;
    font-weight: 600;
}

.mirror-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-dot.healthy {
    background: var(--status-healthy);
    box-shadow: 0 0 8px var(--status-healthy);
}

.status-dot.syncing {
    background: var(--status-syncing);
    animation: pulse 1.5s infinite;
}

.status-dot.error {
    background: var(--status-error);
}

.mirror-description {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin-bottom: 20px;
}

.mirror-details {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    font-weight: 500;
    font-family: var(--font-mono);
    font-size: 0.9375rem;
}

.mirror-actions {
    display: flex;
    gap: 12px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.9375rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(232, 93, 4, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-arrow {
    transition: transform var(--transition-fast);
}

.btn:hover .btn-arrow {
    transform: translateX(4px);
}

/* Status Section */
.status {
    padding: 60px 0;
    background: var(--bg-secondary);
}

.status-overview {
    margin-bottom: 40px;
}

.status-card {
    display: flex;
    align-items: center;
    gap: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 500px;
    margin: 0 auto;
}

.status-indicator {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-indicator.healthy {
    background: rgba(34, 197, 94, 0.15);
}

.status-indicator.healthy::before {
    content: '';
    width: 20px;
    height: 20px;
    background: var(--status-healthy);
    border-radius: 50%;
}

.pulse {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--status-healthy);
    opacity: 0.3;
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(1.2); opacity: 0; }
}

.status-info h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.status-info p {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.access-methods h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-align: center;
}

.method-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    max-width: 700px;
    margin: 0 auto;
}

.method-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
}

.method-icon {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.method-icon svg {
    width: 36px;
    height: 36px;
}

.method-card h4 {
    font-size: 1.125rem;
    margin-bottom: 12px;
}

/* Terminal-style URL blocks */
.method-url {
    display: block;
    background: var(--terminal-bg);
    color: var(--terminal-text);
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: 0.875rem;
    margin-bottom: 12px;
    word-break: break-all;
    text-align: left;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.method-url::before {
    content: '$ ';
    color: var(--terminal-prompt);
    font-weight: 500;
}

.method-card p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* About Section */
.about {
    padding: 60px 0;
}

.about-content {
    max-width: 700px;
    margin: 0 auto;
}

.about-text p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.about-text h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Footer */
.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-content p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--accent-primary);
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--terminal-bg);
    color: var(--terminal-text);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: var(--font-mono);
    opacity: 0;
    transition: all var(--transition-base);
    z-index: 1000;
    border: 1px solid rgba(232, 93, 4, 0.3);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .nav {
        display: none;
    }

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

    .hero-stats {
        grid-template-columns: 1fr;
    }

    .mirror-actions {
        flex-direction: column;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}
