/* ==========================================================================
   Base — reset, document defaults, typography, layout primitives, utilities
   ========================================================================== */

/* ---- Reset ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1rem);
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-16);
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, p, ul, ol, figure, blockquote, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
[hidden] { display: none !important; }

/* ---- Direction ------------------------------------------------------------
   --dir is the sign of "forward" on the x axis: 1 in LTR, -1 in RTL. Components multiply
   a horizontal nudge by it (translate: calc(var(--dir) * 3px) 0) so it follows the reading direction. */
:root { --dir: 1; }
[dir="rtl"] { --dir: -1; }
[dir="ltr"] { --dir: 1; }

/* ---- Focus --------------------------------------------------------------
   The visible ring is a box-shadow (it follows the element's radius). The transparent
   outline is what forced-colours mode (Windows High Contrast) draws, because that mode
   removes box-shadows. */
:focus { outline: 2px solid transparent; outline-offset: 2px; }
:focus-visible { box-shadow: var(--focus); border-radius: var(--r-8); }
/* <main tabindex="-1"> only receives focus from the skip link: no ring around the whole page */
main:focus-visible { box-shadow: none; }

/* ---- Typography -------------------------------------------------------- */
.h1 { font-size: var(--fs-h1); line-height: 1.2; font-weight: 400; color: var(--ink); }
.h2 { font-size: var(--fs-h2); line-height: 1.22; font-weight: 700; color: var(--navy); }
.h3 { font-size: var(--fs-h3); line-height: 1.35; font-weight: 700; color: var(--navy); }
.lead { font-size: var(--fs-18); line-height: 1.55; color: var(--text); }
.text-sm { font-size: var(--fs-14); line-height: 1.45; }
.text-xs { font-size: var(--fs-12); line-height: 1.35; }
.muted { color: var(--text-muted); }
.text-center { text-align: center; }
/* Latin fragments, e-mails, numbers inside Arabic text keep their own direction */
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }

/* ---- Layout primitives --------------------------------------------------
   .container reads --container: use a modifier for a named track, or set --container
   on the block in the page stylesheet for a one-off width. */
.container { width: min(100% - 2 * var(--gutter), var(--container)); margin-inline: auto; }
.container--wide { width: min(100% - 2 * var(--gutter), var(--container-wide)); }
.container--mid { width: min(100% - 2 * var(--gutter), var(--container-mid)); }
.container--narrow { width: min(100% - 2 * var(--gutter), var(--container-narrow)); }
.container--77 { width: min(100% - 2 * var(--gutter), var(--container-77)); }
.container--80 { width: min(100% - 2 * var(--gutter), var(--container-80)); }

.section { padding-block: var(--section-y); }
.section--cool { background: var(--tint-cool); }
.section--warm { background: var(--tint-warm); }

.stack { display: flex; flex-direction: column; gap: var(--stack-gap, var(--sp-4)); }
.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--cluster-gap, var(--sp-3));
}
.grid { display: grid; gap: var(--grid-gap, var(--sp-8)); }
.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)); }
@media (max-width: 64rem) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 40rem) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Utilities --------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  inset-block-start: .5rem;
  inset-inline-start: .5rem;
  z-index: 200;
  padding: .625rem 1rem;
  border-radius: var(--r-8);
  background: var(--navy);
  color: var(--text-on-dark);
  font-weight: 700;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

/* icons: <svg class="icon" aria-hidden="true"><use href="#i-name"></use></svg> — sized by font-size */
.icon { width: 1em; height: 1em; flex: none; fill: currentColor; }
/* the icon sprite the build puts at the top of <body> */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* an image or video that fills its positioned parent, behind the parent's content and scrim:
   <header class="photo-hero"><img class="media-cover" src="…" alt=""> … */
.media-cover {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* a real checkbox / radio / file input stretched invisibly over its styled label:
   <label class="switch"><input class="cover-input" type="checkbox"> … */
.cover-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
/* below-the-fold sections of long pages: layout and paint are skipped until they come near
   <section class="section cv-auto"> */
.cv-auto { content-visibility: auto; contain-intrinsic-size: auto 600px; }

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