/* StrayCat — modern minimal site styles */
:root {
    --bg: #fbfaf7;
    --bg-card: #ffffff;
    --text: #1a1a1a;
    --text-muted: #6b6b6b;
    --border: #ece9e2;
    --accent: #d97757;
    --accent-hover: #c0613e;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
    --radius: 14px;
    --max-width: 960px;
    --lang-icon-bg: #f0eee8;
}

/* Explicit dark theme (user-selected) */
:root[data-theme="dark"] {
    --bg: #121110;
    --bg-card: #1c1b1a;
    --text: #f0ece4;
    --text-muted: #9a9591;
    --border: #2a2826;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.2);
    --lang-icon-bg: #2a2826;
}

/* OS-preferred dark, unless the user has explicitly forced light */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #121110;
        --bg-card: #1c1b1a;
        --text: #f0ece4;
        --text-muted: #9a9591;
        --border: #2a2826;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 4px 16px rgba(0, 0, 0, 0.2);
        --lang-icon-bg: #2a2826;
    }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
                 system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color .15s ease;
}
a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

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

/* ---------- Header ---------- */
header {
    padding: 24px 0;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: saturate(180%) blur(12px);
    z-index: 10;
}
header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.brand {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}
.brand:hover { text-decoration: none; }
.brand img {
    display: block;
    height: 40px;
    width: auto;
}
nav a {
    color: var(--text-muted);
    margin-left: 32px;
    font-size: 15px;
}
nav a:hover {
    color: var(--text);
    text-decoration: none;
}
/* ---------- Language switcher (dropdown) ---------- */
.lang-switcher {
    position: relative;
    margin-left: 6px;
    display: inline-block;
    vertical-align: middle;
}
.lang-switcher-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: border-color .15s ease, transform .15s ease;
}
.lang-switcher-toggle:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.lang-switcher-toggle .globe-svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.6;
}

.lang-switcher-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 210px;
    margin: 0;
    padding: 8px 0;
    list-style: none;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow);
    z-index: 100;
    opacity: 1;
    transform: translateY(0);
    transition: opacity .12s ease, transform .12s ease;
}
.lang-switcher-menu[hidden] {
    display: none;
}
.lang-switcher-menu li { margin: 0; }
.lang-switcher-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: background .12s ease, color .12s ease;
}
.lang-switcher-menu a:hover {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    text-decoration: none;
}
.lang-switcher-menu a.active {
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    color: var(--accent);
    pointer-events: none;
    cursor: default;
}

.lang-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--lang-icon-bg);
    font-size: 13px;
    line-height: 1;
    flex-shrink: 0;
    overflow: hidden;
}

/* ---------- Theme toggle (light/dark switch) ---------- */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    margin-left: 16px;
    padding: 0;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    vertical-align: middle;
    transition: border-color .15s ease, transform .15s ease;
}
.theme-toggle:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
}
.theme-toggle .theme-icon-sun,
.theme-toggle .theme-icon-moon { display: none; }
:root[data-theme="light"] .theme-toggle .theme-icon-moon { display: block; }
:root[data-theme="dark"]  .theme-toggle .theme-icon-sun  { display: block; }
.lang-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* ---------- Hero ---------- */
.hero {
    padding: 96px 0 64px;
    text-align: center;
}
.hero h1 {
    font-size: clamp(36px, 6vw, 56px);
    line-height: 1.1;
    font-weight: 700;
    margin: 0 0 20px;
    letter-spacing: -0.025em;
}
.hero p {
    font-size: clamp(16px, 2vw, 19px);
    color: var(--text-muted);
    max-width: 560px;
    margin: 0 auto;
}

/* ---------- Sections ---------- */
section {
    padding: 64px 0;
}
section h2 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 32px;
    letter-spacing: -0.015em;
}

/* ---------- Games grid ---------- */
.games {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}
.game-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.game-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
}
.game-card.coming-soon {
    opacity: 0.55;
}
.game-card.coming-soon:hover {
    transform: none;
    border-color: var(--border);
    box-shadow: none;
}
.game-card h3 {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 600;
}
.game-card .tags {
    color: var(--text-muted);
    font-size: 13px;
    margin: 0 0 14px;
}
.game-card .platforms {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0;
}

/* ---------- About / Studio ---------- */
.studio p {
    font-size: 17px;
    color: var(--text-muted);
    max-width: 640px;
    margin: 0;
}

/* ---------- Contact ---------- */
.contact .email {
    font-size: clamp(20px, 3vw, 26px);
    font-weight: 500;
}

/* ---------- Footer ---------- */
footer {
    padding: 40px 0 32px;
    border-top: 1px solid var(--border);
    margin-top: 32px;
    color: var(--text-muted);
    font-size: 14px;
}
footer .container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
footer .footer-links a {
    color: var(--text-muted);
    margin-left: 20px;
}
footer .footer-links a:hover {
    color: var(--text);
}
footer .footer-links a:first-child {
    margin-left: 0;
}

/* ---------- Legal pages ---------- */
.legal {
    padding: 56px 0 32px;
    max-width: 760px;
}
.legal h1 {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 12px;
    letter-spacing: -0.02em;
}
.legal .effective {
    color: var(--text-muted);
    margin: 0 0 48px;
    font-size: 14px;
}
.legal h2 {
    font-size: 21px;
    font-weight: 600;
    margin: 44px 0 14px;
    letter-spacing: -0.01em;
}
.legal h3 {
    font-size: 16px;
    font-weight: 600;
    margin: 24px 0 10px;
}
.legal p, .legal li {
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
}
.legal ul, .legal ol {
    padding-left: 22px;
}
.legal li {
    margin-bottom: 6px;
}
.legal strong { font-weight: 600; }

/* ---------- Mobile nav toggle (hamburger) ---------- */
/* On desktop, .nav-menu-wrap and .nav-content are transparent (display: contents)
   so the 3 anchor links lay out inline next to theme/lang as before.
   On mobile, the wrap becomes a positioning context, the hamburger appears, and
   .nav-content becomes a dropdown anchored to the wrap's right edge — leaving
   theme and lang visible inline in the header. */
.nav-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    background: var(--bg-card);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    line-height: 1;
    vertical-align: middle;
    transition: border-color .15s ease;
}
.nav-toggle:hover { border-color: var(--accent); }
.nav-menu-wrap { display: contents; }
.nav-content   { display: contents; }
.nav-icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .nav-icon-open  { display: none; }
.nav-toggle[aria-expanded="true"] .nav-icon-close { display: block; }

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
    .brand img { height: 28px; }

    .nav-menu-wrap {
        display: inline-block;
        position: relative;
        vertical-align: middle;
    }
    .nav-toggle { display: inline-flex; }

    /* Tighter spacing for the visible icon group on mobile */
    .theme-toggle { margin-left: 8px; }
    .lang-switcher { margin-left: 4px; }

    /* The hamburger dropdown holds ONLY the 3 anchor links */
    .nav-content {
        display: none;
        position: absolute;
        top: calc(100% + 10px);
        right: 0;
        min-width: 160px;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        padding: 6px 0;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: 12px;
        box-shadow: var(--shadow);
        z-index: 100;
    }
    .nav-toggle[aria-expanded="true"] + .nav-content {
        display: flex;
        flex-direction: column;
    }
    .nav-content > a {
        margin: 0;
        padding: 10px 16px;
        color: var(--text);
        font-size: 15px;
    }
    .nav-content > a:hover {
        background: color-mix(in srgb, var(--accent) 10%, transparent);
        text-decoration: none;
    }

    .hero { padding: 72px 0 48px; }
    section { padding: 48px 0; }
    footer .container { flex-direction: column; align-items: flex-start; }
    footer .footer-links a:first-child { margin-left: 0; }
}

/* ---------- RTL overrides (Arabic) ---------- */
[dir="rtl"] nav a { margin-left: 0; margin-right: 32px; }
[dir="rtl"] .theme-toggle { margin-left: 0; margin-right: 16px; }
[dir="rtl"] .lang-switcher { margin-left: 0; margin-right: 6px; }
[dir="rtl"] .lang-switcher-menu { right: auto; left: 0; }
[dir="rtl"] footer .footer-links a { margin-left: 0; margin-right: 20px; }
[dir="rtl"] footer .footer-links a:first-child { margin-right: 0; }
[dir="rtl"] .legal ul, [dir="rtl"] .legal ol { padding-left: 0; padding-right: 22px; }
@media (max-width: 600px) {
    [dir="rtl"] .nav-content { right: auto; left: 0; }
    [dir="rtl"] .theme-toggle { margin-left: 0; margin-right: 8px; }
    [dir="rtl"] .lang-switcher { margin-left: 0; margin-right: 4px; }
}
