/* =========================================================
   Design tokens: change colors/fonts here, everything follows
   ========================================================= */
:root {
  --bg: #f4f3f8;
  --surface: #ffffff;
  --surface-2: #f0eef7;
  --text: #1d1b26;
  --muted: #6b6880;
  --border: rgba(29, 27, 38, 0.08);
  --accent: #564d80;          /* from the old site palette */
  --accent-2: #8d91bf;
  --accent-soft: #e7e5f6;
  --visited: #7c6fd0;
  --land: #d9d6e6;
  --ok: #1f9d55;
  --err: #d64545;
  --shadow: 0 1px 2px rgba(20, 16, 40, 0.04), 0 4px 16px rgba(20, 16, 40, 0.06);
  --shadow-hover: 0 2px 4px rgba(20, 16, 40, 0.06), 0 12px 32px rgba(20, 16, 40, 0.12);
  --radius: 24px;
  --radius-sm: 14px;
  --gap: 16px;
  --page-width: 1480px; /* max content width on big screens */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Saira Condensed", var(--font);
  --font-mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121118; --surface: #1c1a25; --surface-2: #26232f; --text: #ecebf3; --muted: #a29fb6;
    --border: rgba(255, 255, 255, 0.08); --accent: #b3b7ee; --accent-2: #8d91bf; --accent-soft: #2c2840;
    --visited: #9d92f0; --land: #34313f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121118; --surface: #1c1a25; --surface-2: #26232f; --text: #ecebf3; --muted: #a29fb6;
  --border: rgba(255, 255, 255, 0.08); --accent: #b3b7ee; --accent-2: #8d91bf; --accent-soft: #2c2840;
  --visited: #9d92f0; --land: #34313f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3); --shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ========== Base ========== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; letter-spacing: 0.01em; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.25rem; }
p { color: var(--muted); }
:focus-visible { outline: 3px solid var(--accent-2); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { width: min(var(--page-width), 100% - 32px); margin-inline: auto; }
@media (min-width: 1024px) { .wrap { width: min(var(--page-width), 100% - 96px); } }
main { flex: 1; padding-block: 24px 64px; }

/* ========== Header / nav (built by core.js) ========== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(1.6) blur(14px);
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; min-height: 64px; }
.brand { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  text-decoration: none; padding: 8px 14px; border-radius: 999px;
  font-size: 0.92rem; font-weight: 500; color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--text); color: var(--bg); }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); cursor: pointer; font-size: 1rem;
}
.icon-btn:hover { background: var(--surface-2); }
.menu-btn { display: none; }
.lang-switch {
  display: inline-flex; padding: 3px; gap: 2px; flex: none;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface);
}
.lang-switch button {
  border: 0; background: none; color: var(--muted); font: inherit; font-size: 0.78rem; font-weight: 700;
  padding: 6px 9px; border-radius: 999px; cursor: pointer;
}
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { background: var(--accent); color: #fff; }

@media (max-width: 760px) {
  .menu-btn { display: inline-grid; margin-left: auto; }
  .nav {
    position: absolute; top: 64px; left: 0; right: 0; margin: 0;
    flex-direction: column; padding: 8px 16px 16px; background: var(--bg);
    border-bottom: 1px solid var(--border); display: none;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 16px; }
}

.site-footer { border-top: 1px solid var(--border); padding: 24px 0; font-size: 0.88rem; color: var(--muted); }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }
.site-footer a { color: var(--muted); }

/* ========== Cards & shared components ========== */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 0.92rem;
  text-decoration: none; cursor: pointer; transition: transform 0.15s, background 0.2s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.97); }
.btn--primary { background: var(--text); color: var(--bg); border-color: transparent; }
.btn--primary:hover { background: var(--accent); color: #fff; }
.btn[disabled] { opacity: 0.6; cursor: progress; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 0.8rem; font-weight: 500;
  border: 1px solid transparent; cursor: default; font-family: inherit;
}
button.chip { cursor: pointer; font-size: 0.88rem; padding: 7px 14px; }
button.chip:hover { color: var(--text); }
button.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); }
.page-head { margin: 24px 0 28px; }
.page-head p { max-width: 62ch; margin-top: 8px; font-size: 1.05rem; }
.error-box { padding: 16px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--text); }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* fade-in when an element scrolls into view (see core.js reveal()) */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal { opacity: 1; transform: none; }
}
