/* ===== VARIABLES ===== */
:root {
    --bg: #0f1117;
    --surface: #1a1d27;
    --card: #20243a;
    --border: #2e3350;
    --accent: #6c63ff;
    --accent-hover: #5a52e0;
    --text-primary: #e8eaf6;
    --text-secondary: #9095b8;
    --success: #4caf7d;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
    --font: 'Inter', system-ui, -apple-system, sans-serif;
    --accent-rgb: 108, 99, 255;
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
    --bg: #f5f6fa;
    --surface: #ffffff;
    --card: #eef0f8;
    --border: #d0d3e8;
    --accent: #6c63ff;
    --accent-hover: #5a52e0;
    --text-primary: #1a1d27;
    --text-secondary: #555a7a;
    --success: #2e7d52;
    --shadow: 0 4px 24px rgba(0,0,0,0.12);
    --accent-rgb: 108, 99, 255;
}

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

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ===== SKIP LINK ===== */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: var(--accent);
    color: #fff;
    padding: 0.5rem 1rem;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 1000;
    font-weight: 600;
}
.skip-link:focus { top: 0; }

/* ===== HEADER ===== */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.site-header nav {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.875rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}
.logo:hover { text-decoration: none; color: var(--accent); }

.nav-links {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-links a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: color 0.2s;
}
.nav-links a:hover { color: var(--text-primary); text-decoration: none; }

/* ===== HISTORY NAV BUTTON ===== */
.history-nav-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s, color 0.2s;
}
.history-nav-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.history-nav-btn.active {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--surface);
}

/* ===== THEME BUTTON ===== */
.theme-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 1rem;
    min-height: 44px;
    min-width: 44px;
    transition: border-color 0.2s, color 0.2s;
}
.theme-btn:hover,
.theme-btn:focus-visible {
    border-color: var(--accent);
    color: var(--text-primary);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ===== LANGUAGE SWITCHER ===== */
.lang-switcher { position: relative; }

.lang-switcher button {
    background: var(--card);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    min-height: 44px;
    min-width: 44px;
}
.lang-switcher button:hover,
.lang-switcher button:focus-visible {
    border-color: var(--accent);
    color: var(--text-primary);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

#lang-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    list-style: none;
    min-width: 140px;
    box-shadow: var(--shadow);
    z-index: 200;
}
#lang-menu[hidden] { display: none; }
#lang-menu li a {
    display: block;
    padding: 0.6rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    transition: background 0.15s, color 0.15s;
}
#lang-menu li a:hover { background: var(--border); color: var(--text-primary); text-decoration: none; }
#lang-menu li[aria-selected="true"] a { color: var(--accent); font-weight: 600; }

/* ===== MAIN LAYOUT ===== */
main { flex: 1; max-width: 1100px; margin: 0 auto; width: 100%; padding: 2rem 1.5rem; }

/* ===== BREADCRUMB ===== */
.breadcrumb {
    display: flex;
    list-style: none;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.breadcrumb li + li::before { content: "/"; margin-right: 0.5rem; }
.breadcrumb li[aria-current="page"] { color: var(--text-primary); }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 2rem; }
.page-header h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.2;
    margin-bottom: 0.75rem;
}
.intro {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 680px;
    line-height: 1.7;
}

/* ===== FOOTER ===== */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ===== ACCESSIBILITY ===== */
.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;
}

/* ===== HAMBURGER BUTTON (hidden on desktop) ===== */
#nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.7rem;
    font-size: 1.2rem;
    cursor: pointer;
    min-height: 44px;
    min-width: 44px;
    transition: border-color 0.2s;
}
#nav-toggle:hover { border-color: var(--accent); }

/* ===== FOOTER LINKS ===== */
.footer-links {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

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

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

.btn-secondary {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--card);
    color: var(--text-primary);
    text-decoration: none;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: background 0.2s;
}

.btn-secondary:hover {
    background: var(--border);
}
