/* SPDX-License-Identifier: GPL-3.0-or-later */

/* Colour tokens. Light is the default; dark is applied either when the system asks for it (and the
   user hasn't overridden) or when the theme toggle sets data-theme="dark". The brand gradient is
   the twin-keys icon's indigo -> cyan. */
:root {
  --brand-1: #4f46e5;
  --brand-2: #06b6d4;
  --primary: #3b5bdb;
  --primary-ink: #ffffff;

  --bg: #fcfcff;
  --surface: #ffffff;
  --surface-alt: #f3f5fb;
  --border: #e2e6f0;
  --ink: #1b1e27;
  --ink-soft: #51566a;
  --ink-faint: #8a8fa3;
  --on-brand: #ffffff;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 1080px;
  --gutter: 16px;
  --shadow: 0 1px 2px rgba(16, 20, 40, 0.06), 0 8px 24px rgba(16, 20, 40, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #212329;
    --surface: #282b33;
    --surface-alt: #2d313a;
    --border: #3a3f4b;
    --ink: #eef0f5;
    --ink-soft: #c2c6d1;
    --ink-faint: #8c92a2;
    --primary: #9db2ff;
    --primary-ink: #0a1a66;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  --bg: #212329;
  --surface: #282b33;
  --surface-alt: #2d313a;
  --border: #3a3f4b;
  --ink: #eef0f5;
  --ink-soft: #c2c6d1;
  --ink-faint: #8c92a2;
  --primary: #9db2ff;
  --primary-ink: #0a1a66;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 0.4em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); }
p { margin: 0 0 1rem; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.container.narrow { max-width: 760px; }
.center { text-align: center; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--primary);
  color: var(--primary-ink);
  padding: 10px 16px;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 100;
}
.skip-link:focus { left: 0; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 64px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand-name { font-size: 1.15rem; letter-spacing: -0.02em; }
.main-nav { display: flex; gap: 20px; margin-left: 8px; }
.main-nav a { color: var(--ink-soft); font-weight: 500; }
.main-nav a[aria-current="page"] { color: var(--ink); }
.header-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.lang-switch { display: flex; gap: 4px; font-size: 0.82rem; font-weight: 600; }
.lang-switch a {
  color: var(--ink-faint);
  padding: 4px 7px;
  border-radius: var(--radius-sm);
}
.lang-switch a.active { color: var(--primary-ink); background: var(--primary); }
.lang-switch a:hover { text-decoration: none; background: var(--surface-alt); }
.lang-switch a.active:hover { background: var(--primary); }

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
  color: var(--ink-soft);
}
.theme-toggle:hover { color: var(--ink); }
.theme-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 32%, var(--brand-2), var(--brand-1));
}

/* Hero */
.hero {
  position: relative;
  padding: clamp(56px, 10vw, 110px) 0 clamp(40px, 7vw, 80px);
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: -40% 0 auto 0;
  height: 460px;
  background: radial-gradient(60% 100% at 50% 0%, color-mix(in srgb, var(--brand-1) 22%, transparent), transparent 70%);
  pointer-events: none;
}
.eyebrow {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 14px;
}
.hero h1 { background: linear-gradient(120deg, var(--brand-1), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--ink-soft); max-width: 640px; margin-left: auto; margin-right: auto; }
.hero-actions { display: flex; gap: 12px; justify-content: center; margin-top: 28px; flex-wrap: wrap; }
.center-actions { justify-content: center; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }

/* Sections */
.section { padding: clamp(44px, 7vw, 76px) 0; }
.section-alt { background: var(--surface-alt); }
.section-title { text-align: center; margin: 0 0 clamp(26px, 4vw, 44px); }
.page-head { padding: clamp(40px, 6vw, 64px) 0 0; }
.page-head h1 { margin-bottom: 0.2em; }

/* Grids & cards */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; }
.card h3 { font-size: 1.15rem; }
.card p { color: var(--ink-soft); margin-bottom: 0; }
.card-link { display: block; color: inherit; }
.card-link:hover { border-color: var(--primary); text-decoration: none; transform: translateY(-2px); transition: transform 0.15s ease, border-color 0.15s ease; }
.card-cta { display: inline-block; margin-top: 12px; color: var(--primary); font-weight: 600; }
.card-disabled { opacity: 0.72; }

.feature-list, .download-list { list-style: none; margin: 14px 0 0; padding: 0; }
.feature-list li { position: relative; padding-left: 26px; margin-bottom: 10px; color: var(--ink-soft); }
.feature-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.5em;
  width: 10px; height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2));
}
.download-list li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.download-list li:last-child { border-bottom: 0; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  padding: 3px 9px;
  border-radius: 999px;
}

.pill-row { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 0; margin: 24px 0 0; }
.pill { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 8px 18px; font-weight: 600; }
.pill-muted { color: var(--ink-faint); }

.notice {
  background: color-mix(in srgb, var(--primary) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, var(--border));
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: var(--ink-soft);
}

.code {
  background: #0f1117;
  color: #e6e8ef;
  border-radius: var(--radius);
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 0.9rem;
  line-height: 1.55;
}
.code code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; white-space: pre; }

/* CTA band */
.cta-band {
  background: linear-gradient(120deg, var(--brand-1), var(--brand-2));
  color: var(--on-brand);
  padding: clamp(48px, 7vw, 80px) 0;
}
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255, 255, 255, 0.9); }
.cta-band .btn-primary { background: #fff; color: var(--brand-1); margin-top: 10px; }

/* Docs prose */
.breadcrumb { margin-bottom: 8px; }
.breadcrumb a { color: var(--ink-faint); font-weight: 600; }
.prose { color: var(--ink); }
.prose h2 { margin: 1.8em 0 0.5em; }
.prose h3 { margin: 1.4em 0 0.4em; }
.prose p, .prose li { color: var(--ink-soft); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose code { background: var(--surface-alt); padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }
.prose pre { background: #0f1117; color: #e6e8ef; padding: 16px; border-radius: var(--radius); overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose a { font-weight: 600; }
.prose table { border-collapse: collapse; width: 100%; margin: 1em 0; }
.prose th, .prose td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface-alt); padding: 40px 0 28px; margin-top: 20px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 28px; justify-content: space-between; }
.footer-brand { max-width: 320px; }
.footer-brand img { vertical-align: middle; }
.footer-brand strong { margin-left: 8px; }
.footer-brand p { color: var(--ink-soft); margin: 8px 0 0; }
.footer-links { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.footer-links a { color: var(--ink-soft); font-weight: 500; }
.footer-links .muted { color: var(--ink-faint); }
.footer-legal { color: var(--ink-faint); font-size: 0.85rem; margin: 24px 0 0; text-align: center; }

@media (max-width: 860px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .main-nav { display: none; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; gap: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .card-link:hover { transform: none; }
  * { scroll-behavior: auto; }
}
