/* ==========================================================================
   ERRORMATIC — BASE STYLESHEET
   Shared across every page: reset, type, header/mega-menu, buttons, footer.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: auto;
  /* Tells the UA to render native controls, scrollbars and form widgets
     in dark mode, matching the theme instead of defaulting to light. */
  color-scheme: dark;
} /* Lenis governs smooth scroll instead */

body {
  margin: 0;
  font-family: var(--f-body);
  font-size: var(--fs-body);
  line-height: var(--lh-normal);
  color: var(--c-text);
  background: var(--c-paper);
  -webkit-font-smoothing: antialiased;
}

img, svg, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

h1, h2, h3, h4, h5 {
  font-family: var(--f-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  margin: 0;
  letter-spacing: -0.02em;
}
h1 { font-size: var(--fs-h1); letter-spacing: -0.03em; }
h2 { font-size: var(--fs-h2); letter-spacing: -0.03em; }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
h5 { font-size: var(--fs-h5); }

p { margin: 0; }

.eyebrow {
  font-family: var(--f-mono);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--c-signal);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-circuit);
  box-shadow: 0 0 8px var(--glow-circuit);
  flex-shrink: 0;
}

/* Focus visibility — accessibility floor */
a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--c-signal);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--c-ink);
  color: var(--c-text);
  padding: var(--sp-2) var(--sp-3);
  z-index: 1000;
  border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.container {
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-pad);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--f-mono);
  font-size: 0.9375rem;
  letter-spacing: 0.02em;
  padding: 0.9rem 1.5rem;
  border-radius: var(--r-pill);
  transition: transform var(--dur-fast) var(--ease-out), background var(--dur-fast), box-shadow var(--dur-fast);
  white-space: nowrap;
}
.btn-primary {
  background: var(--grad-brand);
  color: var(--c-text);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 28px var(--glow-violet), var(--shadow-md); }
.btn-ghost {
  background: transparent;
  color: var(--c-text);
  border: 1px solid var(--c-line);
}
.btn-ghost:hover { border-color: var(--c-signal); color: var(--c-signal); transform: translateY(-2px); box-shadow: 0 0 0 1px var(--c-signal); }
.btn svg { width: 16px; height: 16px; transition: transform var(--dur-fast) var(--ease-out); }
.btn:hover svg { transform: translate(2px, -2px); }

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset-inline: 0;
  top: 0;
  z-index: 500;
  padding-block: var(--sp-3);
  transition: background var(--dur-fast), box-shadow var(--dur-fast), padding-block var(--dur-fast);
}
.site-header.is-scrolled {
  background: rgba(11, 17, 36, 0.88);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  padding-block: var(--sp-2);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
}
/* ---------- Logo ----------
   The logo is an <img> slot pointing at assets/brand/logo.png. To swap it,
   replace that file (keep the name) and it will size itself to the height
   below. Footer uses a slightly smaller size. */
.logo {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}
.logo img {
  height: 40px;
  width: auto;
  max-width: 210px;
  object-fit: contain;
  display: block;
}
.site-footer .logo img { height: 34px; }
@media (max-width: 600px) {
  .logo img { height: 32px; max-width: 160px; }
}

.primary-nav { display: flex; align-items: center; gap: var(--sp-5); }
.primary-nav > ul { display: flex; align-items: center; gap: var(--sp-5); }
.nav-link {
  font-family: var(--f-mono);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: var(--sp-1) 0;
  position: relative;
}
.nav-link::after {
  content: "";
  position: absolute;
  left: 0; bottom: -2px;
  width: 100%; height: 1px;
  background: var(--c-signal);
  box-shadow: 0 0 6px var(--glow-signal);
  transform: scaleX(0);
  transform-origin: right;
  transition: transform var(--dur-fast) var(--ease-out);
}
.nav-link:hover::after, .nav-item.is-open .nav-link::after { transform: scaleX(1); transform-origin: left; }
.nav-link .chev { width: 12px; height: 12px; transition: transform var(--dur-fast); }
.nav-item.is-open .nav-link .chev { transform: rotate(180deg); }

.header-cta { display: flex; align-items: center; gap: var(--sp-4); }

.nav-item { position: relative; }
.mega-menu {
  position: absolute;
  top: calc(100% + var(--sp-4));
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  min-width: 560px;
  background: var(--c-paper-raised);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  padding: var(--sp-4);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-1);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out), visibility var(--dur-fast);
}
.nav-item.is-open .mega-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
.mega-menu a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--r-sm);
  transition: background var(--dur-fast);
}
.mega-menu a:hover { background: var(--c-signal-soft); }
.mega-menu .item-title { font-size: 0.9375rem; font-weight: 600; }
.mega-menu .item-desc { font-size: 0.8125rem; color: var(--c-slate); }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
}
.nav-toggle svg { width: 22px; height: 22px; }

@media (max-width: 960px) {
  .primary-nav {
    position: fixed;
    inset: 0;
    top: 0;
    background: var(--c-paper);
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 6rem var(--container-pad) var(--sp-6);
    transform: translateX(100%);
    transition: transform var(--dur-med) var(--ease-in-out);
    overflow-y: auto;
  }
  .primary-nav.is-open { transform: translateX(0); }
  .primary-nav > ul { flex-direction: column; align-items: flex-start; gap: 0; width: 100%; }
  .nav-item { width: 100%; border-bottom: 1px solid var(--c-line); }
  .nav-link { padding: var(--sp-3) 0; width: 100%; justify-content: space-between; font-size: 1.125rem; }
  .mega-menu {
    position: static;
    transform: none;
    min-width: 0;
    grid-template-columns: 1fr;
    box-shadow: none;
    padding: 0 0 var(--sp-3);
    display: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  .nav-item.is-open .mega-menu { display: grid; }
  .header-cta { margin-top: var(--sp-5); width: 100%; }
  .header-cta .btn-ghost { display: none; }
  .header-cta .btn-primary { width: 100%; justify-content: center; }
  .nav-toggle { display: inline-flex; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--c-ink);
  border-top: 1px solid var(--c-line);
  color: var(--c-text);
  padding-block: var(--sp-8) var(--sp-5);
}
.footer-top {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: var(--sp-6);
  padding-bottom: var(--sp-7);
  border-bottom: 1px solid var(--c-line-on-dark);
}
.footer-brand p { color: var(--c-slate-on-dark); margin-top: var(--sp-3); max-width: 32ch; }
.footer-col h5 { font-family: var(--f-mono); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--c-slate-on-dark); margin-bottom: var(--sp-3); font-weight: 500; }
.footer-col ul { display: flex; flex-direction: column; gap: var(--sp-2); }
.footer-col a { color: var(--c-text); font-size: 0.9375rem; transition: color var(--dur-fast); }
.footer-col a:hover { color: var(--c-signal); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--sp-5);
  font-family: var(--f-mono);
  font-size: 0.8125rem;
  color: var(--c-slate-on-dark);
  flex-wrap: wrap;
  gap: var(--sp-3);
}
.footer-socials { display: flex; gap: var(--sp-3); }
.footer-socials a { color: var(--c-slate-on-dark); }
.footer-socials a:hover { color: var(--c-text); }

@media (max-width: 860px) {
  .footer-top { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
