/* ==========================================================================
   aiRA — Global: reset, base typography, layout primitives, buttons,
   section primitives, navbar + footer skin.
   Load order: tokens.css -> global.css -> components.css -> pages/*.css
   ========================================================================== */

/* ---- Reset ------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 24px);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  margin: 0;
  /* clip, not hidden: hidden breaks position:sticky on ancestors */
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1, 'calt' 1;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; }
p, ul, ol, figure, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
table { border-collapse: collapse; width: 100%; }
hr { border: 0; border-top: 1px solid var(--border); margin: 0; }
/* The hidden attribute always wins, even against later display rules. */
[hidden] { display: none !important; }

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-xs);
}

::selection { background: var(--indigo-200); color: var(--indigo-900); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: var(--sp-4); top: var(--sp-4); z-index: 1000;
  transform: translateY(-200%);
  background: var(--surface); color: var(--ink);
  padding: 10px 16px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-md);
  font-size: var(--t-body-sm); font-weight: 600;
}
.skip-link:focus { transform: translateY(0); }

/* ---- Layout primitives -------------------------------------------------
   Three nested wrappers on every section:
     section.section > .padding-global > .container > content
   ---------------------------------------------------------------------- */

.padding-global { padding-inline: var(--pad-x); }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
}
.container--narrow { max-width: var(--container-narrow); }

/* .section carries its own vertical rhythm by default. The base export's
   equivalent deliberately had none, which meant hunting overrides on every
   page; that is fixed here. Override per-section only when a section needs
   to break rhythm. */
.section {
  position: relative;
  padding-block: var(--section-pad);
}
.section--tight { padding-block: var(--sp-16); }
.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }

@media (max-width: 991px) {
  :root { --section-pad: var(--sp-20); }
  .section--tight { padding-block: var(--sp-12); }
}
@media (max-width: 768px) {
  :root { --section-pad: 56px; }
  .section--tight { padding-block: var(--sp-10); }
}

/* Dark section surface. Opt in per section; the navbar syncs to it via
   the data-nav-dark attribute (see js/components.js). */
.section--inv {
  background: var(--surface-inv);
  color: var(--ink-inv);
}
.section--inv .eyebrow { color: var(--indigo-300); }
.section--inv .section-heading { color: var(--ink-inv); }
.section--inv .section-sub { color: var(--ink-inv-2); }

/* ---- Section typography ------------------------------------------------ */

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  font-weight: 500;
  letter-spacing: var(--tr-mono);
  text-transform: uppercase;
  color: var(--brand-ink);
  margin-bottom: var(--sp-4);
}
.eyebrow .sparkle { width: 10px; height: 10px; flex: none; }

.section-heading {
  font-size: var(--t-display-2);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: var(--tr-display);
  color: var(--ink);
  max-width: 46rem;
  margin-bottom: var(--sp-4);
  text-wrap: balance;
}
/* The second phrase of a heading mutes rather than turning brand blue.
   A coloured half-headline is the loudest template tell there is; the
   brand lives in the sparkle, the rules and the approval grammar instead. */
.section-heading em {
  font-style: normal;
  color: var(--ink-3);
}
.section--inv .section-heading em { color: var(--ink-inv-3); }

.section-sub {
  font-size: var(--t-body-lg);
  line-height: var(--lh-body);
  color: var(--ink-2);
  max-width: 40rem;
  text-wrap: pretty;
}

.section-head { margin-bottom: var(--sp-12); }
.section-head--center {
  text-align: center;
  margin-inline: auto;
  max-width: 44rem;
}
.section-head--center .section-heading,
.section-head--center .section-sub { margin-inline: auto; }

/* Split head: eyebrow + heading left, supporting copy right, baselines
   aligned. Asymmetric on purpose; stacked-and-centred is what every
   generated page does. */
.section-head--split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--sp-5) var(--sp-20);
  align-items: end;
}
.section-head--split .section-heading { margin-bottom: 0; }
.section-head--split .section-sub { margin-bottom: 0.5em; }

@media (max-width: 991px) {
  .section-head--split { grid-template-columns: 1fr; align-items: start; }
  .section-head--split .section-sub { margin-bottom: 0; }
}
@media (max-width: 768px) {
  .section-head { margin-bottom: var(--sp-8); }
}

/* ---- Buttons -----------------------------------------------------------
   Trailing arrows nudge outward on hover; the gap grows rather than the
   arrow translating, so the label never shifts.
   ---------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-sans);
  font-size: var(--t-body-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
  padding: 13px 20px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease),
              gap var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}
.btn svg { width: 15px; height: 15px; flex: none; }
.btn:hover { gap: 11px; }
.btn:active { transform: translateY(1px); }

.btn--primary {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 1px 2px rgba(11, 16, 32, 0.10),
              0 8px 20px -12px rgba(82, 108, 246, 0.60);
}
.btn--primary:hover { background: var(--brand-hover); }
.btn--primary:active { background: var(--brand-press); }

.btn--secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-xs);
}
.btn--secondary:hover { border-color: var(--slate-300); background: var(--slate-50); }

.btn--ghost {
  background: transparent;
  color: var(--brand-ink);
  padding-inline: 4px;
}
.btn--ghost:hover { color: var(--brand-hover); }

.btn--lg { font-size: var(--t-body); padding: 15px 24px; }
.btn--sm { font-size: var(--t-caption); padding: 9px 14px; }

.section--inv .btn--secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-inv);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: none;
}
.section--inv .btn--secondary:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.30);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}

/* Framed primary: a hairline box hugging the button, radius matched so the
   two curves stay concentric. */
.btn-frame {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: calc(var(--r-sm) + 4px);
  background: var(--hairline);
}

/* ---- Navbar ------------------------------------------------------------ */

/* The placeholder both reserves height for the injected markup and is the
   sticky element itself, so the header behaves as the template's
   sticky top-0 despite living inside an injection wrapper. */
#navbar-placeholder {
  min-height: var(--nav-h);
  position: sticky;
  top: 0;
  z-index: 998;
}

/* Slim full-width header (shadcn header-three), transparent at the top of
   the page. Once scrolled past 50px (hysteresis in js/components.js
   releases it below 25px) it gains a hairline bottom border and a surface:
   near-opaque as the fallback, half-transparent glass where
   backdrop-filter is supported, per the template. */
.nav {
  border-bottom: 1px solid transparent;
  /* Flat background-color, never a gradient: WebKit cannot interpolate
     between two gradient values and flickers mid-swap on theme sync. */
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.nav--scrolled {
  border-bottom-color: var(--border);
  background-color: var(--nav-surface);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav--scrolled {
    background-color: var(--nav-surface-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
  }
}
.nav-no-init-transition, .nav-no-init-transition * { transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .nav { transition: none; }
}

/* One width system: the nav inner, hero frame and footer card all fill the
   standard .container rather than keeping their source templates' own
   max-widths, so every section edge lines up down the page. */
.nav__inner {
  display: flex;
  align-items: center;
  gap: var(--sp-6);
  height: var(--nav-h);
}

.nav__logo {
  display: flex;
  align-items: center;
  flex: none;
  padding: 8px 10px;
  margin-left: -10px;
  border-radius: var(--r-sm);
  transition: background var(--dur-fast) var(--ease);
}
.nav__logo:hover { background: var(--slate-100); }
.nav.nav-dark .nav__logo:hover { background: rgba(255, 255, 255, 0.08); }
.nav__logo img { height: 24px; width: auto; }
.nav__logo-dark { display: none; }
.nav.nav-dark .nav__logo-light { display: none; }
.nav.nav-dark .nav__logo-dark { display: block; }

.nav__menu {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  margin-left: var(--sp-4);
  flex: 1;
}
.nav__links { display: flex; align-items: center; gap: 2px; }

.nav__link,
.nav__toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: var(--t-body-sm);
  font-weight: 550;
  color: var(--ink-2);
  padding: 8px 12px;
  border-radius: var(--r-sm);
  transition: color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.nav__link:hover,
.nav__toggle:hover { color: var(--ink); background: var(--slate-100); }
.nav__link[aria-current="page"] { color: var(--ink); }

.nav__chev {
  width: 13px; height: 13px;
  color: var(--ink-faint);
  transition: transform var(--dur-fast) var(--ease);
}
.nav__dd[data-open="true"] .nav__chev { transform: rotate(180deg); }
.nav__dd[data-open="true"] .nav__toggle { color: var(--ink); background: var(--slate-100); }

.nav__actions { display: flex; align-items: center; gap: var(--sp-3); margin-left: auto; }

/* Dropdown mega-menu (header-three): a muted lip wrapping a bordered card
   of rich links (icon tile, label, description), a plain role column, and
   a plain-text footer whose link routes to the finder. */
.nav__dd { position: relative; }
.nav__panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              visibility var(--dur-fast) var(--ease);
}
.nav__dd[data-open="true"] .nav__panel {
  opacity: 1; visibility: visible; transform: translateY(0);
}

.nav__panel-grid { display: flex; align-items: stretch; gap: 4px; }

.nav__panel-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(232px, 1fr));
  gap: 2px;
  padding: var(--sp-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--r-lg) - 4px);
  box-shadow: var(--shadow-sm);
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--r-sm);
  transition: background var(--dur-fast) var(--ease);
}
.nav__item:hover { background: var(--slate-50); }
.nav__item-icon {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
}
.nav__item-icon svg { width: 16px; height: 16px; }
.nav__item-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.nav__item-label {
  font-size: var(--t-body-sm);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.25;
}
.nav__item-desc {
  font-size: var(--t-caption);
  color: var(--ink-3);
  line-height: 1.35;
}

.nav__aside {
  min-width: 200px;
  padding: var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav__col-title {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  font-weight: 500;
  letter-spacing: var(--tr-mono);
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 0 8px var(--sp-2);
}
.nav__mini {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: var(--t-body-sm);
  font-weight: 500;
  color: var(--ink-2);
  padding: 7px 8px;
  border-radius: var(--r-xs);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.nav__mini:hover { color: var(--ink); background: var(--slate-100); }
.nav__mini svg { width: 15px; height: 15px; color: var(--ink-faint); flex: none; }

.nav__panel-foot {
  margin: 0;
  padding: var(--sp-3) var(--sp-3) var(--sp-2);
  font-size: var(--t-body-sm);
  color: var(--ink-3);
}
.nav__panel-foot a { font-weight: 600; color: var(--ink); }
.nav__panel-foot a:hover { text-decoration: underline; }

/* Mobile trigger */
.nav__burger {
  display: none;
  width: 36px; height: 36px;
  margin-left: auto;
  align-items: center; justify-content: center;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  color: var(--ink);
}
.nav__burger:hover { background: var(--slate-50); }
.nav__burger svg { width: 20px; height: 20px; }
.nav__burger .nav__burger-close { display: none; }
.nav.is-open .nav__burger .nav__burger-close { display: block; }
.nav.is-open .nav__burger .nav__burger-open { display: none; }

/* Navbar over a dark section */
.nav.nav-dark.nav--scrolled {
  background-color: var(--nav-surface-inv);
  border-bottom-color: rgba(255, 255, 255, 0.12);
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .nav.nav-dark.nav--scrolled { background-color: var(--nav-surface-inv-glass); }
}
.nav.nav-dark .nav__link,
.nav.nav-dark .nav__toggle { color: var(--ink-inv-2); }
.nav.nav-dark .nav__link:hover,
.nav.nav-dark .nav__toggle:hover {
  color: var(--ink-inv); background: rgba(255, 255, 255, 0.08);
}
.nav.nav-dark .nav__burger {
  color: var(--ink-inv);
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.20);
}
.nav.nav-dark .btn--secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--ink-inv);
  border-color: rgba(255, 255, 255, 0.20);
}

@media (max-width: 991px) {
  .nav__burger { display: inline-flex; }
  .nav__menu {
    position: fixed;
    inset: var(--nav-h) 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: var(--sp-5) var(--pad-x) var(--sp-10);
    max-height: calc(100dvh - var(--nav-h));
    overflow-y: auto;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--dur) var(--ease),
                transform var(--dur) var(--ease),
                visibility var(--dur) var(--ease);
  }
  .nav__menu.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
  .nav__links { flex-direction: column; align-items: stretch; gap: 2px; }
  .nav__link, .nav__toggle {
    justify-content: space-between;
    font-size: var(--t-body-lg);
    padding: 12px 4px;
  }
  .nav__actions { margin: var(--sp-5) 0 0; flex-direction: column; align-items: stretch; }
  .nav__actions .btn { width: 100%; }

  /* Dropdowns become inline accordions on mobile */
  .nav__panel {
    position: static;
    opacity: 1; visibility: visible; transform: none;
    display: none;
    box-shadow: none;
    border-radius: var(--r-md);
    margin: 2px 0 var(--sp-2);
    transition: none;
  }
  .nav__dd[data-open="true"] .nav__panel { display: block; }
  .nav__panel-grid { flex-direction: column; }
  .nav__panel-card { grid-template-columns: 1fr; box-shadow: none; }
  .nav__aside { padding: var(--sp-3) var(--sp-2); }
  body.nav-locked { overflow: hidden; }
}

/* ---- Footer --------------------------------------------------------------
   Flat and flush with the site grid: no border, no glow, content aligned
   to the same container edge as the header. The gradient divider above the
   legal line is the only hairline it carries.
   ---------------------------------------------------------------------- */

.footer { margin-top: var(--section-pad); }

.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.1fr);
  gap: var(--sp-10);
  padding-block: var(--sp-10);
}

.footer__logo { display: inline-flex; margin-bottom: var(--sp-4); }
.footer__logo img { height: 26px; width: auto; }

.footer__tagline {
  font-size: var(--t-body-sm);
  line-height: 1.65;
  color: var(--ink-3);
  max-width: 22rem;
  margin-bottom: var(--sp-5);
}

.footer__cols {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-8) var(--sp-6);
}

.footer__col-title {
  font-family: var(--font-mono);
  font-size: var(--t-mono);
  font-weight: 500;
  letter-spacing: var(--tr-mono);
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: var(--sp-4);
}
.footer__col-list { display: grid; gap: 10px; }
.footer__col-list a {
  font-size: var(--t-body-sm);
  color: var(--ink-3);
  transition: color var(--dur-fast) var(--ease);
}
.footer__col-list a:hover { color: var(--ink); }

.footer__divider {
  height: 1px;
  background: linear-gradient(to right,
    transparent, var(--border-strong), transparent);
}

.footer__bottom {
  display: flex;
  justify-content: center;
  padding-block: var(--sp-5);
}
.footer__legal {
  font-size: var(--t-caption);
  color: var(--ink-3);
  text-align: center;
}

@media (max-width: 991px) {
  .footer__grid { grid-template-columns: 1fr; gap: var(--sp-8); }
}
@media (max-width: 768px) {
  .footer__cols { grid-template-columns: 1fr 1fr; }
}
