/* ─────────────────────────────────────────────
   Design tokens — dark is the default theme
   ───────────────────────────────────────────── */
:root,
:root[data-theme="dark"] {
    --bg: #0d0f12;
    --surface: #14171c;
    --text: #e7e9ea;
    --text-muted: #99a1ab;
    --border: #232830;
    --accent: #6cb6ff;
    --accent-hover: #93c9ff;
    --focus-ring: rgba(108, 182, 255, 0.14);
}

:root[data-theme="light"] {
    --bg: #ffffff;
    --surface: #ffffff;
    --text: #1a1d21;
    --text-muted: #5f6672;
    --border: #e6e8eb;
    --accent: #0b6bcb;
    --accent-hover: #095299;
    --focus-ring: rgba(11, 107, 203, 0.12);
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 17px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background 0.2s ease, color 0.2s ease;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
}

::selection {
    background: var(--accent);
    color: var(--bg);
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 3px;
}

/* ── Inline SVG icons ── */
.icon {
    width: 1em;
    height: 1em;
    fill: currentColor;
    display: inline-block;
    vertical-align: -0.125em;
    flex-shrink: 0;
}

.icon-stroke {
    width: 1em;
    height: 1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: inline-block;
    vertical-align: -0.125em;
}

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

.header-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 28px;
}

.nav a {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-muted);
}

.nav a:hover {
    color: var(--text);
    text-decoration: none;
}

.nav a.active {
    color: var(--text);
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s ease;
}

.theme-toggle:hover {
    color: var(--text);
}

/* ── Content container ── */
.container {
    max-width: 880px;
    margin: 0 auto;
    padding: 56px 24px 96px;
}

.page-title {
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

.page-intro {
    color: var(--text-muted);
    font-size: 16px;
    margin-bottom: 36px;
    max-width: 60ch;
}

/* ── Loading / error / empty states ── */
.loading-indicator {
    padding: 24px 0;
    font-size: 15px;
    color: var(--text-muted);
}

.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -2px;
    margin-right: 8px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-message {
    background: rgba(255, 82, 82, 0.08);
    border-left: 3px solid #ff5252;
    padding: 14px 16px;
    color: #ff8a8a;
    border-radius: 6px;
    margin: 16px 0;
    font-size: 15px;
}

.empty-message {
    padding: 24px 0;
    color: var(--text-muted);
    font-style: italic;
}

/* ── Responsive header ── */
@media (max-width: 600px) {
    .header-inner {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px 18px;
        padding: 14px 20px;
    }

    .nav {
        gap: 16px;
    }

    .container {
        padding: 40px 20px 72px;
    }
}

/* ── Accessibility: honour reduced-motion preference ── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
