/* ==========================================================================
   MedLink — reset, typography, layout primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Anchors land below the sticky masthead rather than under it. */
  scroll-padding-top: 5.5rem;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--text);
  font-size: var(--t-body);
  line-height: 1.72;
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Browsers give <figure> 40px side margins; on a phone that is a fifth of
   the screen. The hero field and the count figure both use it. */
figure { margin: 0; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--display);
  font-weight: 460;
  color: var(--ink);
  line-height: 1.08;
  letter-spacing: -0.015em;
  font-variation-settings: "SOFT" 0, "WONK" 0;
  text-wrap: balance;
}

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

p { margin: 0 0 1.15em; }
p:last-child { margin-bottom: 0; }

a { color: var(--sage-deep); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

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

ul { margin: 0; padding: 0; list-style: none; }

::selection { background: var(--wash); color: var(--ink); }

/* Focus: visible everywhere, and never only on colour. */
:focus-visible {
  outline: 2px solid var(--sage);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, -110%);
  z-index: 300;
  background: var(--band);
  color: var(--paper);
  padding: 0.7rem 1.3rem;
  font-size: var(--t-small);
  border-radius: 0 0 var(--radius) var(--radius);
  text-decoration: none;
}
.skip-link:focus-visible { transform: translate(-50%, 0); color: var(--paper); }

/* ---- layout primitives --------------------------------------------------- */

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

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

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

/* Small-caps section label. The one piece of styling carried straight over
   from the brief, and the thing that ties the two documents together. */
.label {
  display: block;
  margin: 0 0 1.4rem;
  font-family: var(--text);
  font-size: var(--t-label);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--sage);
}

.lead {
  font-size: var(--t-lead);
  line-height: 1.6;
  color: var(--ink-soft);
}

.note {
  font-size: var(--t-small);
  color: var(--ink-faint);
  line-height: 1.6;
}

.rule {
  height: 1px;
  border: 0;
  margin: 0;
  background: var(--rule);
}

/* A sentence given the weight of a conclusion. Used sparingly — twice. */
.pull {
  font-family: var(--display);
  font-size: clamp(1.45rem, 1.1rem + 1.6vw, 2.35rem);
  line-height: 1.2;
  letter-spacing: -0.018em;
  color: var(--ink);
  margin: 0;
  text-wrap: balance;
}

/* ---- spacing utilities --------------------------------------------------- */
/* These exist so the HTML carries no inline style attributes, which in turn
   lets the site ship a Content-Security-Policy without 'unsafe-inline'. */

.mt-xs { margin-top: 0.6rem; }
.mt-s  { margin-top: 1.2rem; }
.mt-m  { margin-top: 1.35rem; }
.mt-l  { margin-top: 2.4rem; }
.mt-xl { margin-top: 2.8rem; }
.mb-xs { margin-bottom: 0.4rem; }
.mb-s  { margin-bottom: 1.2rem; }

/* ---- sub-page typography ------------------------------------------------- */

.page-title { font-size: var(--t-h2); max-width: 22ch; }
.sub-head   { font-size: var(--t-h3); margin-top: 2.6rem; margin-bottom: 0.8rem; }
.rule--spaced { margin: 2.6rem 0 1.4rem; }

/* ---- scroll-reveal ------------------------------------------------------- */
/* Applied by main.js only when JS runs and motion is allowed, so the page is
   never left invisible if either is absent. */

.js-motion [data-reveal] {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity var(--slow) var(--ease), transform var(--slow) var(--ease);
}
.js-motion [data-reveal].is-in {
  opacity: 1;
  transform: none;
}
