/* ==========================================================================
   DigiCov - Base: reset, typography, layout primitives, motion utilities
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchor targets clear the fixed header instead of hiding beneath it */
  scroll-padding-top: calc(var(--header-h) + var(--s-6));
  /* Reveal transforms translate elements horizontally before they animate in,
     which would otherwise widen the document on narrow screens. `clip` trims
     that without turning html into a scroll container, so position: sticky
     keeps working (which `hidden` would break). */
  overflow-x: clip;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: var(--lh-relaxed);
  color: var(--text-body);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* No overflow-x here on purpose. html already carries overflow-x: clip, and
     because that is not 'visible' the overflow no longer propagates from body
     to the viewport - which would make BODY a scroll container and break every
     position: sticky element on the site. */
}

/* Locks scroll behind the mobile nav without the page jumping */
body.is-locked { overflow: hidden; }

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

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

a { color: inherit; text-decoration: none; }

ul, ol { list-style: none; padding: 0; }

:where(h1, h2, h3, h4, h5, h6) {
  font-family: var(--font-display);
  color: var(--text-strong);
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: var(--tr-heading);
  text-wrap: balance;
}

p { text-wrap: pretty; }

/* Visible focus is never removed - only restyled to match the brand. */
:focus-visible {
  outline: 2px solid var(--c-orange);
  outline-offset: 3px;
  border-radius: var(--r-4);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--c-orange); color: var(--c-white); }

/* --------------------------------------------------------------------------
   Accessibility helpers
   -------------------------------------------------------------------------- */

.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;
}

.skip-link {
  position: absolute;
  top: var(--s-3);
  left: var(--s-3);
  z-index: calc(var(--z-header) + 1);
  padding: var(--s-3) var(--s-5, 1.25rem);
  background: var(--c-charcoal);
  color: var(--c-white);
  border-radius: var(--r-8);
  font-weight: 600;
  font-size: var(--fs-sm);
  transform: translateY(-200%);
  transition: transform var(--d-base) var(--ease-out);
}
.skip-link:focus { transform: translateY(0); }

/* --------------------------------------------------------------------------
   Layout primitives
   -------------------------------------------------------------------------- */

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

.section    { padding-block: var(--section-y); }
.section--tight { padding-block: var(--section-y-tight); }
.section--alt   { background: var(--surface-alt); }

/* Inverted sections carry their own text colours so children need no overrides */
.section--dark {
  background: var(--surface-invert);
  color: var(--text-on-invert-mut);
  position: relative;
  overflow: hidden;
}
.section--dark :where(h1, h2, h3, h4) { color: var(--text-on-invert); }

.grid { display: grid; gap: var(--s-6); }
.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: 960px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .grid--2, .grid--3, .grid--4 { grid-template-columns: minmax(0, 1fr); }
}

.stack > * + * { margin-top: var(--s-4); }

/* --------------------------------------------------------------------------
   Typography classes
   -------------------------------------------------------------------------- */

.display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: 800;
  line-height: var(--lh-tight);
  letter-spacing: var(--tr-display);
  color: var(--text-strong);
}

.h1 { font-size: var(--fs-h1); font-weight: 800; letter-spacing: var(--tr-display); line-height: var(--lh-tight); }
.h2 { font-size: var(--fs-h2); font-weight: 700; }
.h3 { font-size: var(--fs-h3); font-weight: 700; letter-spacing: var(--tr-tight); }
.h4 { font-size: var(--fs-h4); font-weight: 600; letter-spacing: var(--tr-tight); }

.lead {
  font-size: var(--fs-lead);
  line-height: var(--lh-normal);
  color: var(--text-body);
}
.section--dark .lead { color: var(--text-on-invert-mut); }

.muted { color: var(--text-muted); }
.small { font-size: var(--fs-sm); }

/* The eyebrow label that opens most sections */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  font-family: var(--font-display);
  font-size: var(--fs-eyebrow);
  font-weight: 700;
  letter-spacing: var(--tr-wide);
  text-transform: uppercase;
  color: var(--c-coral);
}
.eyebrow::before {
  content: '';
  width: 22px;
  height: 2px;
  border-radius: var(--r-full);
  background: var(--grad-brand);
}

/* Gradient-filled text, used sparingly on one phrase per page */
.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Section intro block */
.section-head { max-width: 62ch; margin-bottom: var(--s-12); }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head .h2 { margin-top: var(--s-4); }
.section-head .lead { margin-top: var(--s-4); }

/* --------------------------------------------------------------------------
   Motion: scroll reveal
   Elements marked [data-reveal] start displaced and are released by main.js
   adding .is-visible. Staggering is driven by an inline --i index.
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 22px, 0);
  transition:
    opacity   var(--d-slower) var(--ease-out),
    transform var(--d-slower) var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
  will-change: opacity, transform;
}
[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}
[data-reveal="left"]  { transform: translate3d(-28px, 0, 0); }
[data-reveal="right"] { transform: translate3d(28px, 0, 0); }
[data-reveal="scale"] { transform: scale(0.96); }

/* No JS? Nothing should ever stay invisible. */
.no-js [data-reveal] { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* --------------------------------------------------------------------------
   Motion: cross-document view transitions
   Progressive enhancement - browsers without support simply navigate.
   -------------------------------------------------------------------------- */

@view-transition { navigation: auto; }

::view-transition-old(root) {
  animation: vt-out 260ms var(--ease-in-out) both;
}
::view-transition-new(root) {
  animation: vt-in 420ms var(--ease-out) both;
}

@keyframes vt-out {
  to { opacity: 0; transform: translateY(-8px); }
}
@keyframes vt-in {
  from { opacity: 0; transform: translateY(14px); }
}

/* The header persists across navigations rather than cross-fading with the page */
.site-header { view-transition-name: site-header; }
::view-transition-old(site-header),
::view-transition-new(site-header) { animation: none; }

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) { animation: none; }
}
