/* ============================================================
   PRAXIS — core design system
   Light / dark with system default + manual toggle.
   Enterprise, trustworthy, premium. Indigo accent.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:ital,wght@0,300..800;1,400..600&family=Newsreader:ital,opsz,wght@0,6..72,300..500;1,6..72,300..500&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ---------- LIGHT (default) ---------- */
:root {
  --bg-0: oklch(0.992 0.002 255);
  --bg-1: oklch(1 0 0);
  --bg-2: oklch(0.975 0.004 255);
  --bg-3: oklch(0.955 0.006 255);
  --bg-inset: oklch(0.97 0.004 255);

  --line-1: oklch(0.92 0.006 255);
  --line-2: oklch(0.87 0.008 255);
  --line-3: oklch(0.80 0.01 255);

  --fg-0: oklch(0.23 0.012 262);
  --fg-1: oklch(0.42 0.012 262);
  --fg-2: oklch(0.55 0.012 262);
  --fg-3: oklch(0.66 0.01 262);
  --fg-4: oklch(0.76 0.008 262);

  --acc:      oklch(0.52 0.17 262);
  --acc-2:    oklch(0.47 0.18 262);
  --acc-fg:   oklch(0.99 0.005 262);
  --acc-soft: oklch(0.52 0.17 262 / 0.08);
  --acc-line: oklch(0.52 0.17 262 / 0.22);
  --acc-glow: oklch(0.52 0.17 262 / 0.14);

  --ok:   oklch(0.55 0.13 155);
  --ok-soft: oklch(0.55 0.13 155 / 0.10);
  --warn: oklch(0.66 0.14 70);
  --err:  oklch(0.58 0.19 25);

  --shadow-sm: 0 1px 2px oklch(0.4 0.02 262 / 0.06), 0 1px 1px oklch(0.4 0.02 262 / 0.04);
  --shadow-md: 0 4px 12px oklch(0.4 0.02 262 / 0.07), 0 2px 4px oklch(0.4 0.02 262 / 0.05);
  --shadow-lg: 0 24px 48px -16px oklch(0.35 0.03 262 / 0.18), 0 8px 20px -8px oklch(0.35 0.03 262 / 0.10);
  --shadow-xl: 0 48px 90px -30px oklch(0.32 0.04 262 / 0.30), 0 18px 40px -16px oklch(0.32 0.04 262 / 0.16);

  --grid-line: oklch(0.55 0.02 262 / 0.06);

  color-scheme: light;
}

/* ---------- DARK ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-0: oklch(0.165 0.012 264);
    --bg-1: oklch(0.195 0.013 264);
    --bg-2: oklch(0.225 0.015 264);
    --bg-3: oklch(0.27 0.016 264);
    --bg-inset: oklch(0.18 0.012 264);

    --line-1: oklch(0.29 0.014 264);
    --line-2: oklch(0.35 0.016 264);
    --line-3: oklch(0.44 0.018 264);

    --fg-0: oklch(0.97 0.004 264);
    --fg-1: oklch(0.79 0.01 264);
    --fg-2: oklch(0.63 0.012 264);
    --fg-3: oklch(0.50 0.012 264);
    --fg-4: oklch(0.40 0.012 264);

    --acc:      oklch(0.72 0.15 264);
    --acc-2:    oklch(0.78 0.13 264);
    --acc-fg:   oklch(0.17 0.04 264);
    --acc-soft: oklch(0.72 0.15 264 / 0.13);
    --acc-line: oklch(0.72 0.15 264 / 0.30);
    --acc-glow: oklch(0.72 0.15 264 / 0.22);

    --ok:   oklch(0.78 0.14 158);
    --ok-soft: oklch(0.78 0.14 158 / 0.13);
    --warn: oklch(0.80 0.13 75);
    --err:  oklch(0.68 0.18 25);

    --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.40);
    --shadow-md: 0 6px 18px oklch(0 0 0 / 0.45);
    --shadow-lg: 0 30px 60px -20px oklch(0 0 0 / 0.65);
    --shadow-xl: 0 60px 110px -34px oklch(0 0 0 / 0.78), 0 24px 50px -20px oklch(0 0 0 / 0.55);

    --grid-line: oklch(0.85 0.02 264 / 0.05);

    color-scheme: dark;
  }
}

/* explicit dark override */
:root[data-theme="dark"] {
  --bg-0: oklch(0.165 0.012 264);
  --bg-1: oklch(0.195 0.013 264);
  --bg-2: oklch(0.225 0.015 264);
  --bg-3: oklch(0.27 0.016 264);
  --bg-inset: oklch(0.18 0.012 264);

  --line-1: oklch(0.29 0.014 264);
  --line-2: oklch(0.35 0.016 264);
  --line-3: oklch(0.44 0.018 264);

  --fg-0: oklch(0.97 0.004 264);
  --fg-1: oklch(0.79 0.01 264);
  --fg-2: oklch(0.63 0.012 264);
  --fg-3: oklch(0.50 0.012 264);
  --fg-4: oklch(0.40 0.012 264);

  --acc:      oklch(0.72 0.15 264);
  --acc-2:    oklch(0.78 0.13 264);
  --acc-fg:   oklch(0.17 0.04 264);
  --acc-soft: oklch(0.72 0.15 264 / 0.13);
  --acc-line: oklch(0.72 0.15 264 / 0.30);
  --acc-glow: oklch(0.72 0.15 264 / 0.22);

  --ok:   oklch(0.78 0.14 158);
  --ok-soft: oklch(0.78 0.14 158 / 0.13);
  --warn: oklch(0.80 0.13 75);
  --err:  oklch(0.68 0.18 25);

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.40);
  --shadow-md: 0 6px 18px oklch(0 0 0 / 0.45);
  --shadow-lg: 0 30px 60px -20px oklch(0 0 0 / 0.65);
  --shadow-xl: 0 60px 110px -34px oklch(0 0 0 / 0.78), 0 24px 50px -20px oklch(0 0 0 / 0.55);

  --grid-line: oklch(0.85 0.02 264 / 0.05);

  color-scheme: dark;
}

/* ---------- shared tokens ---------- */
:root {
  --f-sans: 'Hanken Grotesk', ui-sans-serif, system-ui, sans-serif;
  --f-serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --f-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  --r-1: 6px; --r-2: 9px; --r-3: 13px; --r-4: 18px; --r-5: 26px; --r-pill: 999px;
  --ease: cubic-bezier(0.22, 0.68, 0.12, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --maxw: 1240px;
  --gx: clamp(20px, 5vw, 56px);
}

/* ---------- reset / base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; scroll-behavior: smooth; }
body {
  font-family: var(--f-sans);
  background: var(--bg-0);
  color: var(--fg-0);
  font-size: 16px; line-height: 1.55;
  letter-spacing: -0.006em;
  font-feature-settings: "ss01";
  transition: background-color 0.4s var(--ease);
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
img, svg { display: block; }
::selection { background: var(--acc); color: var(--acc-fg); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 3px; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: var(--line-3); }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gx); }
.wrap-tight { max-width: 980px; margin: 0 auto; padding: 0 var(--gx); }

/* ---------- type utilities ---------- */
.mono { font-family: var(--f-mono); font-feature-settings: "tnum"; letter-spacing: -0.01em; }
.serif { font-family: var(--f-serif); }
.eyebrow {
  font-family: var(--f-mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--acc);
  display: inline-flex; align-items: center; gap: 9px;
}
.eyebrow .n { color: var(--fg-3); }
.muted { color: var(--fg-2); }
.serif-em { font-family: var(--f-serif); font-style: italic; font-weight: 400; letter-spacing: 0; }

h1, h2, h3, h4 { letter-spacing: -0.025em; line-height: 1.05; font-weight: 600; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-2);
  font-size: 14px; font-weight: 600; letter-spacing: -0.01em;
  border: 1px solid transparent; background: transparent; color: var(--fg-0);
  transition: all 0.16s var(--ease); white-space: nowrap;
}
.btn .arr { transition: transform 0.18s var(--ease); }
.btn:hover .arr { transform: translateX(3px); }
.btn.lg { padding: 13px 22px; font-size: 15px; border-radius: var(--r-3); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.primary { background: var(--acc); color: var(--acc-fg); box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--acc-2); box-shadow: 0 0 0 4px var(--acc-soft), var(--shadow-md); }
.btn.outline { border-color: var(--line-2); color: var(--fg-0); background: var(--bg-1); }
.btn.outline:hover { border-color: var(--line-3); background: var(--bg-2); }
.btn.ghost { color: var(--fg-1); }
.btn.ghost:hover { color: var(--fg-0); background: var(--bg-2); }

/* ---------- pill / tag / chip ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 13px 6px 11px; border-radius: var(--r-pill);
  background: var(--bg-1); border: 1px solid var(--line-2);
  font-size: 13px; color: var(--fg-1); font-weight: 500; box-shadow: var(--shadow-sm);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--acc); animation: pulse 2.4s ease-in-out infinite; }
.pill b { color: var(--fg-0); font-weight: 600; }

.tag {
  font-family: var(--f-mono); font-size: 10.5px; font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.07em;
  padding: 3px 8px; border-radius: var(--r-1);
  border: 1px solid var(--line-2); color: var(--fg-2); background: var(--bg-2);
}
.tag.acc { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
.tag.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.3; } }
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }
.blink-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--acc); box-shadow: 0 0 10px var(--acc-glow); animation: blink 1.4s ease-in-out infinite; }

/* ---------- brand / logo ---------- */
.brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 600; font-size: 17px; letter-spacing: -0.03em; color: var(--fg-0); }
.brand .mark {
  position: relative; width: 28px; height: 28px; border-radius: 8px;
  background: var(--acc); display: grid; place-items: center; flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}
.brand .mark::after {
  content: ''; width: 11px; height: 11px; background: var(--acc-fg);
  border-radius: 2.5px; transform: rotate(45deg);
}
.brand .mark.sm { width: 23px; height: 23px; border-radius: 6px; }
.brand .mark.sm::after { width: 9px; height: 9px; }

/* ---------- theme toggle ---------- */
.theme-toggle {
  display: inline-flex; align-items: center; padding: 3px;
  border-radius: var(--r-pill); border: 1px solid var(--line-2); background: var(--bg-2);
}
.theme-toggle button {
  width: 30px; height: 26px; display: grid; place-items: center;
  border-radius: var(--r-pill); color: var(--fg-3); transition: all 0.16s var(--ease);
}
.theme-toggle button svg { width: 15px; height: 15px; }
.theme-toggle button[aria-pressed="true"] { background: var(--bg-1); color: var(--fg-0); box-shadow: var(--shadow-sm); }

/* ---------- top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in oklch, var(--bg-0) 78%, transparent);
  backdrop-filter: blur(18px) saturate(1.4);
  border-bottom: 1px solid var(--line-1);
}
.nav-inner { display: flex; align-items: center; height: 64px; gap: 28px; }
.nav-links { display: flex; gap: 4px; }
.nav-links a { padding: 7px 13px; border-radius: var(--r-2); font-size: 14px; color: var(--fg-1); font-weight: 500; transition: all 0.14s var(--ease); }
.nav-links a:hover { color: var(--fg-0); background: var(--bg-2); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
@media (max-width: 880px) { .nav-links { display: none; } }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line-1); padding: 80px 0 40px; background: var(--bg-0); }
.foot-grid { display: grid; grid-template-columns: 2.2fr 1fr 1fr 1fr 1fr; gap: 40px; }
@media (max-width: 880px) { .foot-grid { grid-template-columns: 1fr 1fr; gap: 32px; } }
.foot-brand p { margin-top: 16px; max-width: 34ch; font-size: 14px; color: var(--fg-2); line-height: 1.6; }
.foot-status { margin-top: 20px; display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-1); font-family: var(--f-mono); }
.foot-status .d { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.foot-col h5 { font-family: var(--f-mono); font-size: 11px; color: var(--fg-3); letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 16px; font-weight: 500; }
.foot-col a { display: block; padding: 5px 0; font-size: 14px; color: var(--fg-1); transition: color 0.14s; }
.foot-col a:hover { color: var(--acc); }
.foot-bar { margin-top: 64px; padding-top: 26px; border-top: 1px solid var(--line-1); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px; font-family: var(--f-mono); font-size: 12px; color: var(--fg-3); }

/* ---------- scroll reveal ---------- */
[data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity 0.7s var(--ease-out), transform 0.7s var(--ease-out); }
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal][data-delay="1"] { transition-delay: 0.08s; }
[data-reveal][data-delay="2"] { transition-delay: 0.16s; }
[data-reveal][data-delay="3"] { transition-delay: 0.24s; }
[data-reveal][data-delay="4"] { transition-delay: 0.32s; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
/* Deterministic safety net — forces content visible even if a transition stalls
   (backgrounded tab, throttled embed) or IntersectionObserver never fires. */
html.reveal-fallback [data-reveal] { opacity: 1 !important; transform: none !important; transition: none !important; }

/* ---------- grid backdrop ---------- */
.grid-bg {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 25%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 25%, transparent 75%);
}

/* Blazor NavLink active state */
.nav-links a.active { color: var(--fg-0); background: var(--bg-2); }
