:root {
    color-scheme: light dark;
    --bg: #f5f5f5;
    --card-bg: rgba(255, 255, 255, 0.82);
    --text: #1f2933;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.15);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: linear-gradient(135deg, #c7d2fe, #bfdbfe, #bbf7d0);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    padding: 3.5rem 1.5rem 2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    position: relative;
}

.site-nav {
    position: absolute;
    top: 1.4rem;
    right: clamp(1rem, 4vw, 2rem);
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
}

.site-nav a {
    text-decoration: none;
    font-weight: 500;
    color: rgba(31, 41, 51, 0.75);
    padding-bottom: 0.2rem;
    border-bottom: 2px solid transparent;
    transition: color 150ms ease, border-color 150ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible,
.site-nav a[aria-current="page"] {
    color: var(--text);
    border-color: var(--accent);
}

.lang-toggle {
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.65);
    color: var(--text);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 999px;
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.lang-toggle:hover,
.lang-toggle:focus-visible {
    background: var(--accent);
    color: white;
    border-color: transparent;
}

@media (max-width: 640px) {
    .site-nav {
        position: static;
        order: -1;
        margin-bottom: 0.5rem;
    }
}

header h1 {
    margin: 0;
    font-size: clamp(2.3rem, 5vw, 3.3rem);
    letter-spacing: -0.02em;
}

header p {
    margin: 0;
    max-width: 68ch;
    font-size: 1.1rem;
    line-height: 1.75;
}

main {
    width: min(1100px, 94vw);
    margin: 0 auto 3rem;
    display: grid;
    gap: 1.8rem;
}

section {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 18px 38px rgba(31, 41, 51, 0.14);
}

h2 {
    margin-top: 0;
    font-size: 1.55rem;
}

p {
    line-height: 1.7;
}

.card-grid {
    display: grid;
    gap: 1.35rem;
}

@media (min-width: 900px) {
    .card-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.card {
    background: rgba(37, 99, 235, 0.1);
    border-radius: 18px;
    padding: 1.4rem 1.6rem 1.6rem;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 18px;
    border: 1px solid rgba(37, 99, 235, 0.22);
    pointer-events: none;
}

.card h3 {
    margin: 0 0 0.6rem;
    font-size: 1.2rem;
}

.meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.6rem;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
    color: rgba(31, 41, 51, 0.75);
}

ul {
    margin: 0;
    padding-left: 1.15rem;
}

li + li {
    margin-top: 0.5rem;
}

.cta {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 1.35rem;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

footer {
    text-align: center;
    padding: 1.8rem 1.5rem 2.5rem;
    font-size: 0.95rem;
}

/* Sub-grid container for grouped items like games */
.sub-grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .sub-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.sub-card {
    background: rgba(37, 99, 235, 0.08);
    border: 1px solid rgba(37, 99, 235, 0.18);
    border-radius: 14px;
    padding: 1rem 1.1rem 1.2rem;
}
.sub-card h4 { margin: 0 0 0.4rem; font-size: 1.05rem; }

/* removed game cards from projects; no special hiding needed */

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0f172a;
        --card-bg: rgba(15, 23, 42, 0.85);
        --text: #e2e8f0;
        --accent: #60a5fa;
        --accent-soft: rgba(96, 165, 250, 0.24);
    }

    body {
        background: radial-gradient(circle at 15% 15%, #1e293b, #0f172a 55%, #020617);
    }

    .site-nav a {
        color: rgba(226, 232, 240, 0.7);
    }

    .site-nav a:hover,
    .site-nav a:focus-visible,
    .site-nav a[aria-current="page"] {
        color: var(--text);
    }

    .card {
        background: rgba(96, 165, 250, 0.14);
    }

    .meta {
        color: rgba(226, 232, 240, 0.72);
    }
}

/* Explicit theme overrides take precedence over system preference */
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f5f5f5;
    --card-bg: rgba(255, 255, 255, 0.82);
    --text: #1f2933;
    --accent: #2563eb;
    --accent-soft: rgba(37, 99, 235, 0.15);
}

:root[data-theme="light"] body { background: linear-gradient(135deg, #c7d2fe, #bfdbfe, #bbf7d0); }
:root[data-theme="light"] .site-nav a { color: rgba(31, 41, 51, 0.75); }
:root[data-theme="light"] .site-nav a:hover,
:root[data-theme="light"] .site-nav a:focus-visible,
:root[data-theme="light"] .site-nav a[aria-current="page"] { color: var(--text); }
:root[data-theme="light"] .card { background: rgba(37, 99, 235, 0.1); }
:root[data-theme="light"] .meta { color: rgba(31, 41, 51, 0.75); }

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f172a;
    --card-bg: rgba(15, 23, 42, 0.85);
    --text: #e2e8f0;
    --accent: #60a5fa;
    --accent-soft: rgba(96, 165, 250, 0.24);
}

:root[data-theme="dark"] body { background: radial-gradient(circle at 15% 15%, #1e293b, #0f172a 55%, #020617); }
:root[data-theme="dark"] .site-nav a { color: rgba(226, 232, 240, 0.7); }
:root[data-theme="dark"] .site-nav a:hover,
:root[data-theme="dark"] .site-nav a:focus-visible,
:root[data-theme="dark"] .site-nav a[aria-current="page"] { color: var(--text); }
:root[data-theme="dark"] .card { background: rgba(96, 165, 250, 0.14); }
:root[data-theme="dark"] .meta { color: rgba(226, 232, 240, 0.72); }
