/* ── Tokens ─────────────────────────────────────────────────── */
:root {
  --bg:          #eef4f8;
  --bg-subtle:   #e4eff6;
  --surface:     #ffffff;
  --surface-alt: rgba(229, 243, 251, 0.9);

  --text:        #0f1f2a;
  --text-muted:  #5a6c78;
  --text-dim:    #8fa4b0;

  --brand:       #0a84c6;
  --brand-mid:   #20a5de;
  --brand-soft:  rgba(10, 132, 198, 0.09);
  --brand-glow:  rgba(10, 132, 198, 0.28);

  --border:      rgba(15, 31, 42, 0.09);
  --border-mid:  rgba(15, 31, 42, 0.15);

  --header-scrolled-bg: rgba(238, 244, 248, 0.9);

  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-xl:   32px;
  --container:   1040px;
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);

  --grain-opacity: 0.045;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #07101c;
    --bg-subtle:   #0b1828;
    --surface:     #0f2035;
    --surface-alt: #152942;

    --text:        #deeefa;
    --text-muted:  #6899b8;
    --text-dim:    #2e5472;

    --brand:       #20a5de;
    --brand-mid:   #3ab8ec;
    --brand-soft:  rgba(32, 165, 222, 0.1);
    --brand-glow:  rgba(32, 165, 222, 0.22);

    --border:      rgba(10, 132, 198, 0.15);
    --border-mid:  rgba(10, 132, 198, 0.28);

    --header-scrolled-bg: rgba(7, 16, 28, 0.92);
  }
}

/* ── Font ────────────────────────────────────────────────────── */
@font-face {
  font-family: 'DMSans';
  font-style: normal;
  font-display: swap;
  src: url('/fonts/DMSans-Regular.ttf') format('truetype');
}

/* ── Reset & base ────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 17.5px; }

body {
  font-family: 'Plus Jakarta Sans', 'DMSans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Grain texture — opacity controlled per-page via --grain-opacity */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='280' height='280' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

a { color: inherit; }
img { max-width: 100%; display: block; -webkit-user-drag: none; user-drag: none; }

/* ── Shell ───────────────────────────────────────────────────── */
.shell {
  width: min(calc(100% - 48px), var(--container));
  margin: 0 auto;
  position: relative;
  z-index: 2;
}

/* ── Header ──────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 240ms var(--ease),
              border-color 240ms var(--ease),
              backdrop-filter 240ms var(--ease);
}

.site-header.scrolled {
  background: var(--header-scrolled-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--text);
  flex-shrink: 0;
}

.brand:hover { text-decoration: none; }

.brand-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-sm);
  padding: 4px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0;
}

.header-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.87rem;
  font-weight: 500;
  padding: 7px 13px;
  border-radius: 999px;
  transition: color 150ms, background 150ms;
}

.header-nav a:hover { color: var(--text); background: var(--bg-subtle); text-decoration: none; }
.header-nav a[aria-current="page"] { color: var(--brand); font-weight: 600; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  border-radius: 999px;
  transition: transform 150ms var(--ease),
              box-shadow 150ms var(--ease),
              background 150ms,
              opacity 150ms;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--brand);
  color: #fff;
  padding: 10px 20px;
}

.btn-primary:hover {
  background: var(--brand-mid);
  box-shadow: 0 4px 18px var(--brand-glow);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 9px 18px;
  border: 1px solid var(--border-mid);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

/* ── Footer primitives ───────────────────────────────────────── */
.footer-copy { font-size: 0.8rem; color: var(--text-dim); }

.footer-links a {
  text-decoration: none;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 5px 10px;
  border-radius: 999px;
  transition: color 140ms, background 140ms;
}

.footer-links a:hover { color: var(--text-muted); background: var(--bg-subtle); }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 640px) {
  .shell { width: min(calc(100% - 32px), var(--container)); }
}
