/* ============================================================
   KALVARO DESIGN SYSTEM: BASE
   Reset, typography, layout primitives, accessibility utilities.
   ============================================================ */

/* ---------- Fonts ----------
   Manrope, self-hosted as WOFF2 (latin subset). No third-party requests,
   so there is no font-related consent or privacy question, and no
   render-blocking call to an external domain. */
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/manrope-400.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/manrope-500.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/manrope-600.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/manrope-700.woff2") format("woff2"); }
@font-face { font-family: "Manrope"; font-style: normal; font-weight: 800; font-display: swap; src: url("../assets/fonts/manrope-800.woff2") format("woff2"); }

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* The header is sticky at 76px. Without this, tabbing or jumping to an
     anchor parks the target directly underneath it (WCAG 2.4.11). */
  scroll-padding-top: 96px;
}

body, h1, h2, h3, h4, h5, h6, p, figure, blockquote, dl, dd, ul, ol {
  margin: 0;
}

ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

body {
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  line-height: var(--lh-loose);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;   /* no horizontal scrolling, ever */
}

img, picture, svg, video { display: block; max-width: 100%; height: auto; }

/* The `hidden` attribute must win over any component `display` rule.
   Without this, a `.alert` or `.card` marked `hidden` still renders,
   because a class selector outranks the user-agent `[hidden]` rule. */
[hidden] { display: none !important; }

input, button, textarea, select { font: inherit; color: inherit; }

button { background: none; border: none; padding: 0; cursor: pointer; }

a { color: var(--color-action-text); text-underline-offset: 3px; }
a:hover { color: var(--color-action-pressed); }

table { border-collapse: collapse; width: 100%; }

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

/* ---------- Focus ----------
   Never remove an outline without replacing it. 3px emerald ring, 2px offset. */
:focus-visible {
  /* A transparent outline keeps the indicator present in Windows High Contrast
     mode, where box-shadow is discarded. The visible ring is the two-colour
     shadow, which shows on light, navy and emerald surfaces alike. */
  outline: 3px solid transparent;
  outline-offset: var(--focus-offset);
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  line-height: var(--lh-snug);
  color: var(--color-text);
  text-wrap: balance;
}

h1 { font-size: var(--text-h1); line-height: var(--lh-tight); }
h2 { font-size: var(--text-h2); }
h3 { font-size: var(--text-h3); }
h4 { font-size: var(--text-h4); font-weight: var(--fw-semibold); letter-spacing: -0.01em; }

p { max-width: var(--measure); text-wrap: pretty; }

.display {
  font-size: var(--text-display);
  font-weight: var(--fw-black);
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.lead {
  font-size: var(--text-lead);
  line-height: var(--lh-loose);
  color: var(--color-text-secondary);
}

.small { font-size: var(--text-small); }

.muted { color: var(--color-text-secondary); }
.faint { color: var(--color-text-muted); }

/* Emerald accent word inside a heading. Uses the AA-safe emerald on light
   surfaces and the brand emerald on navy, where contrast is ample. */
.accent { color: var(--color-action-text); }
.on-dark .accent, .section--navy .accent, .hero .accent, .page-hero .accent { color: var(--k-emerald-500); }

/* ---------- Eyebrow ---------- */
.eyebrow {
  display: block;
  font-size: var(--text-eyebrow);
  font-weight: var(--fw-bold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-action-text);
  line-height: var(--lh-snug);
  margin-bottom: var(--space-4);
}
.on-dark .eyebrow, .section--navy .eyebrow, .hero .eyebrow, .page-hero .eyebrow { color: var(--k-emerald-500); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.container--narrow { max-width: 800px; }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2.5rem, 1.5rem + 4vw, 4rem); }
.section--surface { background: var(--color-surface); }
.section--inset   { background: var(--color-surface-inset); }

.section--navy {
  background: var(--color-surface-inverse);
  color: var(--color-text-inverse);
}
.section--navy h1, .section--navy h2, .section--navy h3, .section--navy h4 {
  color: var(--color-text-inverse);
}
.section--navy p, .section--navy .lead { color: var(--color-text-inverse-secondary); }

.section-head {
  max-width: 720px;
  margin-inline: auto;
  text-align: center;
  margin-bottom: var(--space-10);
}
.section-head p { margin-inline: auto; }
.section-head--left { margin-inline: 0; text-align: left; }

.stack > * + * { margin-top: var(--space-5); }
.stack-sm > * + * { margin-top: var(--space-3); }
.stack-lg > * + * { margin-top: var(--space-8); }

.grid { display: grid; gap: var(--space-7); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

@media (max-width: 1023px) {
  .grid-4, .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
  .grid-3, .grid-4, .grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .grid-2, .grid-3, .grid-4, .grid-6 { grid-template-columns: minmax(0, 1fr); }
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
}

.divider {
  border: 0;
  border-top: 1px solid var(--color-border);
  margin-block: var(--space-9);
}

/* ---------- Accessibility utilities ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: var(--space-5);
  z-index: var(--z-toast);
  padding: var(--space-4) var(--space-6);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: var(--fw-bold);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  transition: top var(--dur-micro) var(--ease);
}
.skip-link:focus { top: var(--space-4); }
