/* ==========================================================================
   ADA BIOTECH — Fonts, reset, base typography, layout primitives, motion
   ========================================================================== */

/* --------------------------------------------------------------------------
   Self-hosted fonts. font-display: swap keeps text visible during load
   (avoids FOIT); the fonts ship from the same origin so there is no
   third-party connection to negotiate.
   -------------------------------------------------------------------------- */

@font-face {
  font-family: "DM Sans";
  src: url("../fonts/DMSans-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../fonts/DMSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../fonts/DMSans-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../fonts/DMSans-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../fonts/DMSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../fonts/DMSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../fonts/DMSans-ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("../fonts/DMSans-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Comfortaa";
  src: url("../fonts/Comfortaa-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Comfortaa";
  src: url("../fonts/Comfortaa-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Comfortaa";
  src: url("../fonts/Comfortaa-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Comfortaa";
  src: url("../fonts/Comfortaa-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fredoka";
  src: url("../fonts/Fredoka-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("../fonts/Fredoka-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("../fonts/Fredoka-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fredoka";
  src: url("../fonts/Fredoka-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

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

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

* {
  margin: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Keep anchored sections clear of the fixed header */
  scroll-padding-top: 7rem;
}

body {
  min-height: 100dvh;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-relaxed);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

img {
  height: auto;
}

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

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

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

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

/* URLs, IDs and user-supplied content reflow instead of overflowing */
.break-anywhere {
  overflow-wrap: anywhere;
  min-width: 0;
}

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

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--text-4xl); line-height: var(--leading-tight); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

p {
  text-wrap: pretty;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--duration-micro) var(--ease-out),
              opacity var(--duration-micro) var(--ease-out);
}

strong, b { font-weight: var(--weight-bold); }

/* Tabular figures for stats and data so digits do not jitter */
.tnum {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* --------------------------------------------------------------------------
   Focus — never removed, always visible against light and dark surfaces
   -------------------------------------------------------------------------- */

:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Only suppress the ring for pointer users who did not tab here */
:focus:not(:focus-visible) {
  outline: none;
}

.skip-link {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: var(--z-modal);
  padding: var(--space-3) var(--space-5);
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-pill);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform var(--duration-micro) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

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

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

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

.container--wide   { max-width: var(--container-wide); }
.container--narrow { max-width: var(--container-narrow); }

.section {
  padding-block: var(--section-y);
}

.section--tight  { padding-block: var(--section-y-tight); }
.section--flush-top    { padding-block-start: 0; }
.section--flush-bottom { padding-block-end: 4em; }

.section--dark {
  background-color: var(--color-surface-inverse);
  color: var(--color-text-inverse);
}

.section--light { background-color: var(--color-bg-alt); }
.section--sunken { background-color: var(--color-surface-sunken); }

.stack > * + * { margin-block-start: var(--flow, var(--space-4)); }

.grid {
  display: grid;
  gap: var(--grid-gap, var(--space-5));
}

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

.measure        { max-width: var(--measure); }
.measure-narrow { max-width: var(--measure-narrow); }

.text-center { text-align: center; }

/* Wide content — tables, code, diagrams — scrolls inside its own box so the
   page body never scrolls horizontally. */
.scroll-x {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

/* --------------------------------------------------------------------------
   Motion — scroll reveal

   Only opacity and transform are animated, so reveals stay on the compositor
   and never trigger layout (no CLS).
   -------------------------------------------------------------------------- */

[data-reveal] {
  opacity: 0;
  transform: translate3d(0, var(--reveal-shift), 0);
  transition:
    opacity var(--duration-section) var(--ease-out),
    transform var(--duration-section) var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

[data-reveal="fade"]  { transform: none; }
[data-reveal="left"]  { transform: translate3d(calc(var(--reveal-shift) * -1), 0, 0); }
[data-reveal="right"] { transform: translate3d(var(--reveal-shift), 0, 0); }
[data-reveal="scale"] { transform: scale(0.97); }

/*
  On narrow screens the sideways variants fall back to the vertical one.
  A horizontal offset on a full-width element widens the document while the
  element waits to be revealed, which can flash a horizontal scrollbar; and
  side-to-side motion reads poorly on a phone regardless.
*/
@media (max-width: 47.99rem) {
  [data-reveal="left"],
  [data-reveal="right"] {
    transform: translate3d(0, var(--reveal-shift), 0);
  }
}

/* Hero content settles a little more slowly than body sections */
[data-reveal-speed="hero"] {
  --reveal-shift: 32px;
  transition-duration: var(--duration-hero);
}

[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* No JavaScript: nothing is ever left invisible */
.no-js [data-reveal],
.no-js [data-reveal-group] > * {
  opacity: 1;
  transform: none;
}

/* Children stagger in sequence; the index is set inline by the JS */
[data-reveal-group] > * {
  opacity: 0;
  transform: translate3d(0, var(--reveal-shift), 0);
  transition:
    opacity var(--duration-section) var(--ease-out),
    transform var(--duration-section) var(--ease-out);
  transition-delay: calc(var(--reveal-index, 0) * var(--stagger-step));
}

[data-reveal-group].is-revealed > * {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Reduced motion

   Content appears immediately and completely. Transitions collapse to ~0
   rather than being removed outright, so JS that waits on transitionend
   still resolves.
   -------------------------------------------------------------------------- */

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

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }

  [data-reveal],
  [data-reveal-group] > * {
    opacity: 1 !important;
    transform: none !important;
  }

  .marquee__track {
    animation: none !important;
    transform: none !important;
  }
}
