/* ============================================================
   Meridian — Reset, typography, layout primitives
   ============================================================ */

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

html {
  /* Light-only by design. Stops the browser dark-styling native
     form controls when the OS is in dark mode. */
  color-scheme: light;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6rem; /* clears the sticky nav on anchor jumps */
}

body {
  font-family: var(--font-body);
  font-size: var(--body);
  line-height: 1.6;
  color: var(--ink);
  background: var(--offwhite);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }

/* ---- Typography ------------------------------------------- */
h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  color: var(--ink);
}

h1 { font-size: var(--h1); letter-spacing: -0.03em; }
h2 { font-size: var(--h2); }
h3 { font-size: var(--h3); line-height: 1.25; letter-spacing: -0.01em; }

p { text-wrap: pretty; }

.kicker {
  display: block;
  font-family: var(--font-body);
  font-size: var(--kicker);
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  /* The eyebrow lost its leading rule, so the tracking does that work now. */
  letter-spacing: .1em;
  color: var(--warmgrey);
  margin-bottom: 1rem;
}
/* No rule, no dash. The eyebrow carries itself on case and tracking. */

.lead {
  font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
  line-height: 1.6;
  color: var(--warmgrey);
  max-width: 56ch;
}

.muted { color: var(--warmgrey); }

/* Measure guard — long-form copy never runs wider than this */
.measure { max-width: 62ch; }

a { color: inherit; }

/* Inline text links. Teal is a fill, never the text colour, so the
   link reads in --ink and carries a teal underline. */
.link {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--teal), var(--teal));
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 100% 2px;
  padding-bottom: 1px;
  transition: background-size var(--dur) var(--ease);
}
.link:hover { background-size: 100% 100%; background-image: linear-gradient(rgba(143,184,255,.28), rgba(143,184,255,.28)); }

/* ---- Focus ------------------------------------------------- */
:focus-visible {
  outline: none;
  box-shadow: var(--focus);
  border-radius: var(--radius-sm);
}
.on-ink :focus-visible { box-shadow: var(--focus-on-ink); }

.skip-link {
  position: absolute;
  left: 1rem;
  top: -100%;
  z-index: 200;
  background: var(--ink);
  color: var(--offwhite);
  padding: .75rem 1.25rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top var(--dur) var(--ease);
}
.skip-link:focus { top: 1rem; }

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

/* ---- Layout primitives ------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}
.wrap--wide { max-width: 1440px; }

.section { padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * .62); }

.section--ink {
  background: var(--ink);
  color: var(--ink-soft);
}
.section--ink h1,
.section--ink h2,
.section--ink h3 { color: var(--offwhite); }
.section--ink .kicker { color: rgba(245,242,236,.62); }
.section--ink .lead { color: rgba(245,242,236,.74); }

.section--sunk { background: var(--surface-sunk); }

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

.flow > * + * { margin-top: 1rem; }
.flow-lg > * + * { margin-top: 1.5rem; }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: center;
}

/* Section head: kicker + h2 + optional lead, with an optional
   right-hand link on wide screens */
.sec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: var(--gap);
  margin-bottom: clamp(2rem, 4vw, 3.25rem);
}
.sec-head__text { max-width: 46ch; }
.sec-head h2 + .lead { margin-top: 1rem; }

.hr { height: 1px; background: var(--line); border: 0; }
.section--ink .hr { background: rgba(245,242,236,.16); }

/* ---- Responsive -------------------------------------------- */
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  html { scroll-padding-top: 5rem; }
}

/* ---- Reduced motion ---------------------------------------- */
@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;
  }
}
