/* ============ Theme tokens ============ */
:root {
  --bg: #f7f8fc;
  --bg-alt: #eef1f8;
  --surface: #ffffff;
  --text: #1c2333;
  --text-soft: #5a6478;
  --border: #dde2ee;
  --accent: #5b5ef4;
  --accent-2: #9b5ef4;
  --accent-soft: rgba(91, 94, 244, 0.12);
  --shadow: 0 10px 30px rgba(28, 35, 51, 0.08);
  --radius: 14px;
  --header-h: 64px;
  --max-w: 1080px;
}

/* Dark mode — default follows the OS preference (no JS required) */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1220;
    --bg-alt: #141830;
    --surface: #1a1f36;
    --text: #eef0fb;
    --text-soft: #a4abc4;
    --border: #2a3050;
    --accent: #8b8dff;
    --accent-2: #c08bff;
    --accent-soft: rgba(139, 141, 255, 0.15);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  }
  .theme-toggle .when-light { display: none; }
  .theme-toggle .when-dark { display: inline; }
}

/* Dark mode — or when the footer switch is checked */
:root:has(#theme-switch:checked) {
  --bg: #0f1220;
  --bg-alt: #141830;
  --surface: #1a1f36;
  --text: #eef0fb;
  --text-soft: #a4abc4;
  --border: #2a3050;
  --accent: #8b8dff;
  --accent-2: #c08bff;
  --accent-soft: rgba(139, 141, 255, 0.15);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
:root:has(#theme-switch:checked) .theme-toggle .when-light { display: none; }
:root:has(#theme-switch:checked) .theme-toggle .when-dark { display: inline; }

/* Dark mode — attribute-based fallback (set by common.js), no :has() needed */
:root[data-theme="dark"] {
  --bg: #0f1220;
  --bg-alt: #141830;
  --surface: #1a1f36;
  --text: #eef0fb;
  --text-soft: #a4abc4;
  --border: #2a3050;
  --accent: #8b8dff;
  --accent-2: #c08bff;
  --accent-soft: rgba(139, 141, 255, 0.15);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
:root[data-theme="dark"] .theme-toggle .when-light { display: none; }
:root[data-theme="dark"] .theme-toggle .when-dark { display: inline; }

/* Light mode — explicit choice wins over OS preference (kept after the media query above) */
@media (prefers-color-scheme: dark) {
  :root[data-theme="light"] {
    --bg: #f7f8fc;
    --bg-alt: #eef1f8;
    --surface: #ffffff;
    --text: #1c2333;
    --text-soft: #5a6478;
    --border: #dde2ee;
    --accent: #5b5ef4;
    --accent-2: #9b5ef4;
    --accent-soft: rgba(91, 94, 244, 0.12);
    --shadow: 0 10px 30px rgba(28, 35, 51, 0.08);
  }
}
:root[data-theme="light"] .theme-toggle .when-light { display: inline; }
:root[data-theme="light"] .theme-toggle .when-dark { display: none; }

/* ============ Base ============ */
* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.25s ease, color 0.25s ease;
}

.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 20px;
}

.container.narrow { max-width: 560px; }

h1, h2, h3 { line-height: 1.2; margin: 0 0 0.5em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3.5vw, 2.2rem); }

p { margin: 0 0 1em; }
code {
  background: var(--accent-soft);
  padding: 0.1em 0.4em;
  border-radius: 6px;
  font-size: 0.9em;
}

/* ============ Header ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--header-h);
  background: color-mix(in srgb, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-mark { color: var(--accent); }

.links {
  display: flex;
  gap: 20px;
  margin-left: auto;
}

.links a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.15s ease;
}
.links a:hover { color: var(--accent); }
.links a.active { color: var(--accent); font-weight: 700; }

/* ============ Buttons ============ */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-soft);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }

.btn.small { padding: 8px 14px; font-size: 0.85rem; }

/* ============ Hero ============ */
.hero {
  padding: 96px 0 72px;
  background:
    radial-gradient(600px 300px at 80% -10%, var(--accent-soft), transparent 70%),
    radial-gradient(500px 260px at 10% 0%, var(--accent-soft), transparent 70%);
}

.eyebrow {
  display: inline-block;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.grad {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  max-width: 560px;
  color: var(--text-soft);
  font-size: 1.1rem;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 24px 0 40px;
}

.hero-stats {
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  color: var(--text-soft);
  font-size: 0.95rem;
}
.hero-stats strong {
  display: block;
  font-size: 1.5rem;
  color: var(--text);
}

/* ============ Sections ============ */
.section { padding: 72px 0; }
.section.alt { background: var(--bg-alt); }

.section-sub { color: var(--text-soft); margin-bottom: 32px; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
}

.card h3 { margin-bottom: 8px; font-size: 1.05rem; }
.card p { margin: 0; color: var(--text-soft); font-size: 0.95rem; }

/* Cards that are links */
a.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
}
a.card-link h3 { color: var(--accent); }
a.card-link:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

.card-icon { font-size: 1.6rem; margin-bottom: 12px; }

/* ============ Checklist ============ */
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 560px;
  display: grid;
  gap: 12px;
}
.checklist li {
  position: relative;
  padding-left: 34px;
  color: var(--text-soft);
}
.checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 700;
}

/* ============ Form ============ */
.contact-form {
  display: grid;
  gap: 16px;
  margin-top: 8px;
}
.contact-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: 0.9rem;
}

.contact-form input,
.contact-form textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  resize: vertical;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.form-note {
  min-height: 1.4em;
  color: var(--accent);
  font-size: 0.9rem;
}

/* ============ Theme switch (pure CSS toggle) ============ */
.theme-switch {
  position: fixed;
  top: -100px;
  left: -100px;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
  pointer-events: none;
}
.theme-toggle { display: inline-flex; align-items: center; gap: 6px; }
.theme-toggle .when-dark { display: none; }
:root:has(#theme-switch:checked) .theme-toggle .when-light { display: none; }
:root:has(#theme-switch:checked) .theme-toggle .when-dark { display: inline; }
.theme-switch:focus-visible + .theme-toggle {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ============ Footer ============ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  background: var(--surface);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  color: var(--text-soft);
  font-size: 0.9rem;
}

/* ============ Small screens ============ */
@media (max-width: 640px) {
  .links { display: none; }
  .hero { padding: 64px 0 56px; }
  .section { padding: 56px 0; }
}

/* ============ Articles ============ */
.page-head {
  padding: 64px 0 40px;
}
.page-head h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.page-head p { color: var(--text-soft); max-width: 560px; }

.article-list {
  display: grid;
  gap: 16px;
  padding-bottom: 72px;
}

.article-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 20px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.article-row:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}

.article-thumb {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  font-size: 1.9rem;
  border-radius: 12px;
  background: var(--accent-soft);
}

.article-row h3 { margin: 0 0 4px; font-size: 1.1rem; }
.article-row p { margin: 0; color: var(--text-soft); font-size: 0.95rem; }

.article-meta {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-top: 6px;
}
.article-meta .tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
}

/* Article page */
.article-body {
  max-width: 720px;
  margin: 0 auto;
  padding: 56px 20px 80px;
}

.back-link {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 24px;
}
.back-link:hover { text-decoration: underline; }

.article-body h2 { margin-top: 1.6em; }
.article-body p { color: var(--text-soft); }
.article-body strong { color: var(--text); }

.article-body blockquote {
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  margin: 1.4em 0;
  padding: 14px 18px;
  border-radius: 0 10px 10px 0;
  color: var(--text);
}

.article-body ul, .article-body ol { color: var(--text-soft); padding-left: 1.4em; }

.article-body pre {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.5;
}

/* ============ Benchmarks ============ */
.bench-wrap {
  padding-bottom: 72px;
}

.bench-buttons {
  display: grid;
  gap: 20px;
  width: min(760px, 100%);
  margin: 0 0 44px;
}
.bench-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: none;
  border-radius: 26px;
  background: transparent;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.bench-btn img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 26px;
}

.bench-btn svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 26px;
}

/* Logo-only square button (game cover art, no text strip) */
.bench-btn.logo-btn {
  width: auto;
  max-width: 280px;
  border-radius: 50%;
}
.bench-btn.logo-btn img {
  border-radius: 50%;
}
.bench-btn:hover {
  transform: translateY(-4px);
  box-shadow: 0 18px 44px var(--accent-soft);
}
.bench-btn:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.bench-note {
  margin-top: 24px;
  color: var(--text-soft);
  font-size: 0.85rem;
}

/* ============ Leaderboard ============ */
.leaderboard {
  display: grid;
  gap: 10px;
}
.lb-row {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) minmax(90px, 1fr) minmax(90px, 1fr) auto auto;
  gap: 18px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  box-shadow: var(--shadow);
}
.lb-rank {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.95rem;
  background: var(--accent-soft);
  color: var(--accent);
}
.lb-row.top .lb-rank {
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff;
}
.lb-user { font-weight: 700; font-size: 0.95rem; }
a.lb-user { color: var(--accent); text-decoration: none; }
a.lb-user:hover { text-decoration: underline; }
.lb-cpu, .lb-gpu { color: var(--text-soft); font-size: 0.9rem; }
.lb-fps, .lb-low {
  text-align: right;
  white-space: nowrap;
}
.lb-fps { font-size: 1.35rem; font-weight: 400; font-style: italic; color: var(--text); }
.lb-low { font-size: 1.05rem; font-weight: 800; color: var(--text-soft); }
.lb-fps small, .lb-low small {
  font-size: 0.6em;
  font-weight: 600;
  color: var(--text-soft);
}
@media (max-width: 720px) {
  .lb-row { grid-template-columns: auto 1fr 1fr; row-gap: 8px; }
  .lb-rank { grid-row: 1 / span 3; }
  .lb-user { grid-column: 2 / -1; }
  .lb-fps, .lb-low { text-align: left; }
}

/* Responsive tweaks for subpages */
@media (max-width: 640px) {
  .article-row { grid-template-columns: 1fr; }
  .article-thumb { width: 56px; height: 56px; font-size: 1.5rem; }
}
