/* K2O Base Styles — extracted from inline <style> blocks */
/* Shared across all site pages: reset, backgrounds, navigation, theme toggle, light theme */

/* ==========================================================================
   1. RESET
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Screen-reader only (visually hidden labels) */
.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;
}

/* Skip to main content link */
.skip-link {
    position: absolute;
    top: -50px;
    left: 16px;
    z-index: 10000;
    padding: 8px 16px;
    background: #00ff88;
    color: #0a0e14;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 6px 6px;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}
body.light-theme .skip-link {
    background: #00884d;
    color: #ffffff;
}

/* ==========================================================================
   2. BODY
   ========================================================================== */

body {
    background: #0a0e14;
    color: #e6edf3;
    font-family: 'JetBrains Mono', monospace;
    line-height: 1.6;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ==========================================================================
   3. MATRIX BACKGROUND (z-index: -2, lowest layer)
   ========================================================================== */

.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.035;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: #00ff88;
}

.matrix-column {
    position: absolute;
    width: 20px;
    white-space: pre;
    text-align: center;
    animation: matrix-fall 12s linear infinite;
}

.matrix-column:nth-child(odd)  { animation-duration: 14s; }
.matrix-column:nth-child(3n)   { animation-duration: 10s; animation-delay: -2s; }
.matrix-column:nth-child(5n)   { animation-duration: 16s; animation-delay: -5s; }

@keyframes matrix-fall {
    0%   { transform: translateY(-100vh); }
    100% { transform: translateY(100vh); }
}

/* ==========================================================================
   4. TERMINAL BACKGROUND (z-index: -1)
   ========================================================================== */

.terminal-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
    opacity: 0.12;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
}

.terminal-line {
    position: absolute;
    white-space: nowrap;
    font-size: 0.8rem;
    will-change: transform;
}

.terminal-line.success { color: #00ff88; }
.terminal-line.error   { color: #ff4757; }
.terminal-line.warning { color: #ffa502; }
.terminal-line.info    { color: #58a6ff; }
.terminal-line.process { color: #7bed9f; }
.terminal-line.system  { color: #ff6b6b; }

/* ==========================================================================
   5. NAVIGATION — Navbar
   ========================================================================== */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1010;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    background: rgba(13, 17, 23, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #30363d;
    padding: 15px 20px;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 30px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
    margin: 0;
}

.nav-link {
    position: relative;
    display: inline-block;
    padding: 8px 12px;
    border-radius: 6px;
    color: #c9d1d9;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
}

.nav-link:hover {
    background: rgba(88, 166, 255, 0.1);
    color: #58a6ff;
}

.nav-link.active {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
}

.nav-link.active::before {
    content: '> ';
    color: #00ff88;
    font-weight: 700;
}

/* ==========================================================================
   6. NAVIGATION — Dropdown Menus
   ========================================================================== */

.nav-item.has-dropdown > .nav-link::after {
    content: ' \25BC';  /* ▼ */
    margin-left: 5px;
    font-size: 0.7em;
    transition: transform 0.3s ease;
}

.nav-item.has-dropdown:hover > .nav-link::after {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1001;
    min-width: 280px;
    list-style: none;
    margin: 0;
    padding: 8px 0;
    background: rgba(13, 17, 23, 0.98);
    backdrop-filter: blur(10px);
    border: 1px solid #30363d;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
}

.nav-item.has-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    margin: 0;
    padding: 0;
}

.dropdown-item .nav-link {
    display: block;
    padding: 12px 20px;
    border-radius: 0;
    font-size: 0.85rem;
}

.dropdown-item .nav-link::before {
    content: none;
}

.dropdown-item .nav-link:hover {
    background: rgba(88, 166, 255, 0.1);
}

/* ==========================================================================
   7. NAVIGATION — Language Switcher
   ========================================================================== */

.lang-switcher {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(22, 27, 34, 0.6);
    border: 1px solid #30363d;
    border-radius: 6px;
    padding: 4px 8px;
}

.lang-btn {
    display: inline-block;
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    background: none;
    color: #8b949e;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.lang-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    color: #c9d1d9;
}

.lang-btn.active {
    background: rgba(0, 255, 136, 0.1);
    color: #00ff88;
    text-shadow: 0 0 5px rgba(0, 255, 136, 0.3);
}

.lang-separator {
    color: #30363d;
    font-weight: 300;
}

/* ==========================================================================
   8. NAVIGATION — Home Button
   ========================================================================== */

.home-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 20px;
    padding: 8px 12px;
    background: rgba(22, 27, 34, 0.6);
    border: 1px solid #30363d;
    border-radius: 6px;
    font-size: 1.2rem;
    text-decoration: none;
    cursor: pointer;
}

.home-btn:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: #58a6ff;
}

/* ==========================================================================
   9. NAVIGATION — Theme Toggle
   ========================================================================== */

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: rgba(22, 27, 34, 0.6);
    border: 1px solid #30363d;
    border-radius: 6px;
    font-size: 1.2rem;
    cursor: pointer;
}

.theme-toggle:hover {
    background: rgba(88, 166, 255, 0.1);
    border-color: #58a6ff;
}

/* ==========================================================================
   10. NAVIGATION — Mobile Hamburger Toggle
   ========================================================================== */

.nav-mobile-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    cursor: pointer;
}

.nav-mobile-toggle span {
    width: 28px;
    height: 3px;
    background: #e6edf3;
    border-radius: 3px;
    transition: 0.3s;
}

.nav-mobile-toggle:hover span {
    background: #58a6ff;
}

/* ==========================================================================
   11. LIGHT THEME — Base Overrides
   ========================================================================== */

body.light-theme {
    background: #f5f7fa;
    color: #1a1f2e;
}

/* --- Matrix & Terminal backgrounds --- */

body.light-theme .matrix-bg {
    opacity: 0.02;
    color: #00cc77;
}

body.light-theme .terminal-bg {
    opacity: 0.06;
}

body.light-theme .terminal-line.success { color: #00cc77; }
body.light-theme .terminal-line.error   { color: #cc3344; }
body.light-theme .terminal-line.warning { color: #dd8800; }
body.light-theme .terminal-line.info    { color: #0066dd; }
body.light-theme .terminal-line.process { color: #00aa77; }
body.light-theme .terminal-line.system  { color: #dd4444; }

/* --- Navbar --- */

body.light-theme .navbar {
    background: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid #d0d7de;
}

body.light-theme .nav-link {
    color: #24292f;
}

body.light-theme .nav-link:hover {
    background: rgba(9, 105, 218, 0.1);
    color: #0969da;
}

body.light-theme .nav-link.active {
    background: rgba(0, 136, 77, 0.1);
    color: #00884d;
}

body.light-theme .nav-link.active::before {
    color: #00884d;
}

body.light-theme .dropdown-menu {
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid #d0d7de;
}

/* --- Home button & theme toggle --- */

body.light-theme .home-btn {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid #d0d7de;
}

body.light-theme .home-btn:hover {
    background: rgba(9, 105, 218, 0.1);
    border-color: #0969da;
}

body.light-theme .theme-toggle {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid #d0d7de;
}

body.light-theme .theme-toggle:hover {
    background: rgba(9, 105, 218, 0.1);
    border-color: #0969da;
}

/* --- Language switcher --- */

body.light-theme .lang-switcher {
    background: rgba(240, 243, 246, 0.8);
    border: 1px solid #d0d7de;
}

body.light-theme .lang-btn {
    color: #57606a;
}

body.light-theme .lang-btn:hover {
    background: rgba(9, 105, 218, 0.1);
    color: #24292f;
}

body.light-theme .lang-btn.active {
    background: rgba(0, 136, 77, 0.1);
    color: #00884d;
    text-shadow: none;
}

body.light-theme .lang-separator {
    color: #8b949e;
}

/* ==========================================================================
   12. RESPONSIVE — Tablet (max-width: 1200px)
   ========================================================================== */

@media (max-width: 1200px) {
    .navbar {
        gap: 15px;
        padding: 12px 15px;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .home-btn,
    .theme-toggle {
        padding: 6px 10px;
        font-size: 1.1rem;
    }
}

/* ==========================================================================
   13. RESPONSIVE — Mobile (max-width: 768px)
   ========================================================================== */

@media (max-width: 768px) {
    .nav-mobile-toggle {
        display: flex;
    }

    .navbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 10px 15px;
        justify-content: space-between;
    }

    .navbar-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 6px;
        padding: 15px;
        background: rgba(13, 17, 23, 0.99);
        -webkit-backdrop-filter: blur(30px);
        backdrop-filter: blur(30px);
        border-bottom: 1px solid #30363d;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    }

    .navbar-nav.active {
        display: flex !important;
        opacity: 1;
        visibility: visible;
    }

    .dropdown-menu {
        position: static;
        display: none;
        margin-left: 20px;
        background: rgba(22, 27, 34, 0.8);
        border: none;
        opacity: 0;
        visibility: hidden;
        transform: none;
    }

    .nav-item.has-dropdown:hover .dropdown-menu,
    .nav-item.has-dropdown.mobile-open .dropdown-menu {
        display: block;
        opacity: 1;
        visibility: visible;
        transform: none;
    }

    /* Light theme mobile navbar */
    body.light-theme .navbar-nav {
        background: rgba(255, 255, 255, 0.99);
        border-bottom: 1px solid #d0d7de;
    }
}

/* ==========================================================================
   BREADCRUMBS
   ========================================================================== */

.breadcrumb {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px 0;
    font-size: 0.85rem;
    position: relative;
    z-index: 1;
}

.breadcrumb ol {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
    margin: 0;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    color: #8b949e;
}

.breadcrumb li + li::before {
    content: '/';
    margin-right: 4px;
    color: #484f58;
}

.breadcrumb a {
    color: #58a6ff;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb [aria-current="page"] {
    color: #c9d1d9;
}

body.light-theme .breadcrumb li {
    color: #57606a;
}

body.light-theme .breadcrumb li + li::before {
    color: #afb8c1;
}

body.light-theme .breadcrumb a {
    color: #0969da;
}

body.light-theme .breadcrumb [aria-current="page"] {
    color: #24292f;
}
