/* ASUR — base, tokens, nav, hero
   Layout concept: a 12-column editorial grid; each offering is a full-viewport
   chapter opened by a mono kicker "(0n)" and a wide Unbounded headline. */

:root {
  /* Light theme (default tokens) */
  --bg: #f4f6fb;
  --bg-2: #eaeef7;
  --surface: #ffffff;
  --surface-2: #f7f9fd;
  --fg: #0a0f1f;
  --muted: #4a546b;
  --faint: #7a849b;
  --line: rgba(10, 18, 48, 0.12);
  --line-strong: rgba(10, 18, 48, 0.24);
  --accent: #0a2cff;
  --accent-ink: #0a2cff;
  --accent-soft: rgba(10, 44, 255, 0.08);
  --on-accent: #ffffff;
  --sky: #42aaff;

  --dot-0: #42aaff;
  --dot-1: #3592ff;
  --dot-2: #1f66ff;
  --dot-3: #0a2cff;
  --dot-4: #06115e;
  --mark-glow: none;
  --particle-dust: rgba(10, 30, 90, 0.28);

  --crit: #c81e3a;
  --crit-bg: rgba(200, 30, 58, 0.1);
  --high: #9a4700;
  --high-bg: rgba(220, 110, 0, 0.12);
  --med: #7a6200;
  --med-bg: rgba(200, 160, 0, 0.14);
  --ok: #0f7a4a;

  --screen-bg: #0b1020;
  --screen-fg: #dfe6f7;

  --f-display: "Unbounded", "Arial Black", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --gutter: max(20px, env(safe-area-inset-left, 0px));
  --gutter-r: max(20px, env(safe-area-inset-right, 0px));
  --maxw: 1360px;
  --nav-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --radius: 14px;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #05070d;
    --bg-2: #080c17;
    --surface: #0b1122;
    --surface-2: #0e1528;
    --fg: #eef1f8;
    --muted: #9aa4bd;
    --faint: #6d7791;
    --line: rgba(200, 215, 255, 0.11);
    --line-strong: rgba(200, 215, 255, 0.24);
    --accent: #2f55ff;
    --accent-ink: #86a0ff;
    --accent-soft: rgba(70, 110, 255, 0.12);
    --on-accent: #ffffff;
    --dot-0: #8fd2ff;
    --dot-1: #5aaeff;
    --dot-2: #3a82ff;
    --dot-3: #2a56ff;
    --dot-4: #3b4dff;
    --mark-glow: drop-shadow(0 0 6px rgba(60, 90, 255, 0.55));
    --particle-dust: rgba(150, 180, 255, 0.22);
    --crit: #ff6b81;
    --crit-bg: rgba(255, 80, 110, 0.14);
    --high: #ffad5c;
    --high-bg: rgba(255, 150, 60, 0.14);
    --med: #f1d36b;
    --med-bg: rgba(240, 200, 80, 0.13);
    --ok: #4fd69a;
    --screen-bg: #070b16;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #05070d;
  --bg-2: #080c17;
  --surface: #0b1122;
  --surface-2: #0e1528;
  --fg: #eef1f8;
  --muted: #9aa4bd;
  --faint: #6d7791;
  --line: rgba(200, 215, 255, 0.11);
  --line-strong: rgba(200, 215, 255, 0.24);
  --accent: #2f55ff;
  --accent-ink: #86a0ff;
  --accent-soft: rgba(70, 110, 255, 0.12);
  --on-accent: #ffffff;
  --dot-0: #8fd2ff;
  --dot-1: #5aaeff;
  --dot-2: #3a82ff;
  --dot-3: #2a56ff;
  --dot-4: #3b4dff;
  --mark-glow: drop-shadow(0 0 6px rgba(60, 90, 255, 0.55));
  --particle-dust: rgba(150, 180, 255, 0.22);
  --crit: #ff6b81;
  --crit-bg: rgba(255, 80, 110, 0.14);
  --high: #ffad5c;
  --high-bg: rgba(255, 150, 60, 0.14);
  --med: #f1d36b;
  --med-bg: rgba(240, 200, 80, 0.13);
  --ok: #4fd69a;
  --screen-bg: #070b16;
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.5s var(--ease), color 0.5s var(--ease);
}
img, svg { max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; border-radius: 4px; }

.mono { font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }

.skip {
  position: fixed; top: 10px; left: 10px; z-index: 200;
  padding: 10px 14px; background: var(--fg); color: var(--bg); border-radius: 8px;
  transform: translateY(-160%); transition: transform 0.2s;
}
.skip:focus { transform: none; }

.progress { position: fixed; inset: 0 0 auto; height: 2px; z-index: 120; pointer-events: none; }
.progress span { display: block; height: 100%; width: 100%; background: var(--accent-ink); transform-origin: 0 50%; transform: scaleX(var(--p, 0)); }

/* ---------- Mark & wordmark ---------- */
.mark { width: 30px; height: 26px; display: block; filter: var(--mark-glow); flex: none; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.wordmark { display: block; width: 92px; height: auto; flex: none; fill: currentColor; }

/* ---------- Buttons ---------- */
.btn {
  --mx: 0px; --my: 0px;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 0 20px; border-radius: 999px;
  font-family: var(--f-body); font-weight: 600; font-size: 0.95rem; text-decoration: none;
  border: 1px solid transparent; cursor: pointer;
  transform: translate(var(--mx), var(--my));
  transition: transform 0.35s var(--ease), background-color 0.25s, color 0.25s, border-color 0.25s;
}
.btn-solid { background: var(--accent); color: var(--on-accent); }
.btn-solid:hover { background: var(--fg); color: var(--bg); }
.btn-line { border-color: var(--line-strong); background: transparent; }
.btn-line:hover { border-color: var(--fg); background: var(--fg); color: var(--bg); }
.btn-lg { min-height: 54px; padding: 0 30px; font-size: 1rem; }

/* ---------- Nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 100;
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) var(--gutter-r) 0 var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  transition: background-color 0.4s, border-color 0.4s, backdrop-filter 0.4s;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border-bottom-color: var(--line);
}
.nav-links { display: flex; gap: 6px; padding: 5px; border: 1px solid var(--line); border-radius: 999px; background: color-mix(in srgb, var(--surface) 55%, transparent); }
.nav-links a {
  position: relative; text-decoration: none; font-size: 0.875rem; font-weight: 500;
  padding: 7px 14px; border-radius: 999px; color: var(--muted); transition: color 0.25s, background-color 0.25s;
}
.nav-links a:hover { color: var(--fg); }
.nav-links a.active { color: var(--fg); background: var(--accent-soft); }
.nav-links a.active::before {
  content: ""; position: absolute; left: 50%; bottom: 2px; width: 4px; height: 4px; margin-left: -2px;
  border-radius: 50%; background: var(--accent-ink);
}
.nav-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle, .menu-toggle {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong);
  background: transparent; display: grid; place-items: center; cursor: pointer;
  transition: border-color 0.25s, background-color 0.25s;
}
.theme-toggle:hover, .menu-toggle:hover { border-color: var(--fg); }
.theme-toggle svg { width: 19px; height: 19px; grid-area: 1 / 1; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; transition: transform 0.5s var(--ease), opacity 0.3s; }
.theme-toggle .i-moon { fill: currentColor; stroke: none; }
/* show the icon for the theme you would switch TO */
.theme-toggle .i-sun { opacity: 0; transform: rotate(-90deg) scale(0.6); }
.theme-toggle.is-dark .i-sun { opacity: 1; transform: none; }
.theme-toggle.is-dark .i-moon { opacity: 0; transform: rotate(90deg) scale(0.6); }

.menu-toggle { display: none; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
.menu-toggle span { display: block; width: 18px; height: 1.6px; background: currentColor; transition: transform 0.35s var(--ease); }
.menu-toggle[aria-expanded="true"] span:first-child { transform: translateY(3.8px) rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: translateY(-3.8px) rotate(-45deg); }

.mobile-menu {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  padding: calc(var(--nav-h) + env(safe-area-inset-top, 0px) + 24px) var(--gutter-r) 40px var(--gutter);
  display: flex; flex-direction: column; justify-content: space-between;
  animation: menuIn 0.45s var(--ease);
}
.mobile-menu nav { display: flex; flex-direction: column; }
.mobile-menu nav a {
  display: flex; align-items: baseline; gap: 16px; padding: 18px 0; border-bottom: 1px solid var(--line);
  font-family: var(--f-display); font-size: clamp(1.5rem, 7vw, 2.4rem); font-weight: 500; text-decoration: none;
}
.mobile-menu nav a .mono { color: var(--accent-ink); }
.mobile-meta { color: var(--muted); }
@keyframes menuIn { from { opacity: 0; clip-path: inset(0 0 100% 0); } to { opacity: 1; clip-path: inset(0); } }

@media (max-width: 960px) {
  .nav-links, .nav-cta { display: none; }
  .menu-toggle { display: flex; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: 100vh; min-height: 100svh;
  display: grid; place-items: center; overflow: hidden; isolation: isolate;
}
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; display: block; }
.hero::after {
  content: ""; position: absolute; inset: auto 0 0; height: 12%; z-index: -1; pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--bg));
}
/* hero.js measures the mark and sets --title-y / --meta-y so the wordmark sits
   across the A's legs (desktop) or just under its feet (phones), leaving the apex clear. */
.hero-inner { position: absolute; inset: 0; pointer-events: none; will-change: transform, opacity; }
/* The hero wordmark is the official ASUR logotype (img/asur-wordmark.svg), inlined so it follows the theme. */
.hero-title {
  position: absolute; left: 0; right: 0; top: var(--title-y, 62%); translate: 0 -50%;
  display: flex; justify-content: center; margin: 0; line-height: 0;
  color: var(--fg);
}
.hero-wordmark {
  display: block; width: clamp(17rem, min(52vw, 86vh), 54rem); height: auto;
  fill: currentColor; overflow: visible;
  filter: drop-shadow(0 0 22px color-mix(in srgb, var(--bg) 80%, transparent)) drop-shadow(0 0 2px color-mix(in srgb, var(--bg) 60%, transparent));
}
@media (max-width: 699px) { .hero-wordmark { width: min(74vw, 22rem); } }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.hero-meta {
  position: absolute; left: var(--gutter); right: var(--gutter-r); bottom: max(32px, env(safe-area-inset-bottom, 0px));
  display: flex; justify-content: space-between; gap: 16px; color: var(--muted);
}
.hero-meta .sep { font-style: normal; color: var(--accent-ink); margin-inline: 4px; }
@media (max-width: 699px) {
  .hero-meta { top: var(--meta-y, 78%); bottom: auto; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
}
.scroll-cue {
  position: absolute; left: 50%; bottom: max(28px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%); display: grid; justify-items: center; gap: 10px;
  text-decoration: none; color: var(--muted);
}
.scroll-cue i { display: block; width: 1px; height: 46px; background: var(--line-strong); position: relative; overflow: hidden; }
.scroll-cue i::after { content: ""; position: absolute; inset: 0; background: var(--accent-ink); animation: cue 2.2s var(--ease) infinite; }
@keyframes cue { 0% { transform: translateY(-100%); } 60%, 100% { transform: translateY(100%); } }

/* intro sequence */
.js .hero-title, .js .hero-meta, .js .scroll-cue { animation: heroIn 1.4s var(--ease) both; }
.js .hero-title { animation-delay: 0.35s; }
.js .hero-meta { animation-delay: 0.7s; }
.js .scroll-cue { animation-name: fadeIn; animation-delay: 1s; }
@keyframes heroIn { from { opacity: 0; transform: translateY(24px); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Reveals ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity 1s var(--ease), transform 1s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }
.split .w { display: inline-block; overflow: hidden; vertical-align: top; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.split .wi { display: inline-block; transform: translateY(105%); transition: transform 1.1s var(--ease); transition-delay: calc(var(--i) * 45ms); }
.split.in .wi { transform: none; }

/* ---------- Cursor (pointer: fine only) ---------- */
.cursor { display: none; }
@media (pointer: fine) {
  .has-cursor .cursor { display: block; position: fixed; inset: 0; pointer-events: none; z-index: 300; }
  .c-dot, .c-ring { position: absolute; left: 0; top: 0; border-radius: 50%; will-change: transform; }
  .c-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--accent-ink); }
  .c-ring {
    width: 36px; height: 36px; margin: -18px 0 0 -18px; border: 1px solid var(--line-strong);
    transition: width 0.3s var(--ease), height 0.3s var(--ease), margin 0.3s var(--ease), background-color 0.3s, border-color 0.3s;
  }
  .cursor.hover .c-ring { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: var(--accent-soft); border-color: var(--accent-ink); }
  .cursor.hidden { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .js .reveal { opacity: 1; transform: none; }
  .split .wi { transform: none; }
  .scroll-cue i::after { display: none; }
}
@media (pointer: fine) {
  .has-cursor, .has-cursor a, .has-cursor button, .has-cursor .svc { cursor: none; }
  .has-cursor input, .has-cursor textarea, .has-cursor select { cursor: auto; }
}
