/* ==========================================================================
   MRCOG Academy — Reset, elements, typography, layout primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--surface-page);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  font-weight: var(--fw-regular);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 var(--sp-3);
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--text-primary);
  text-wrap: balance;
}

h1 { font-size: clamp(2.125rem, 4.6vw, var(--fs-5xl)); }
h2 { font-size: clamp(1.75rem, 3.4vw, var(--fs-3xl)); }
h3 { font-size: clamp(1.3rem, 2.2vw, var(--fs-xl)); }
h4 { font-size: var(--fs-lg); line-height: var(--lh-snug); }
h5 { font-size: var(--fs-base); line-height: var(--lh-snug); }
h6 {
  font-family: var(--font-body);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}

p { margin: 0 0 var(--sp-4); }
p:last-child { margin-bottom: 0; }

a {
  color: var(--plum-600);
  text-decoration-color: color-mix(in srgb, var(--plum-600) 35%, transparent);
  text-underline-offset: 3px;
  transition: color var(--t-fast) var(--ease-out);
}
a:hover { color: var(--plum-800); }

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

small { font-size: var(--fs-sm); }

ul, ol { margin: 0 0 var(--sp-4); padding-left: 1.25rem; }
li { margin-bottom: var(--sp-2); }
li:last-child { margin-bottom: 0; }

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

hr {
  border: 0;
  border-top: 1px solid var(--border-subtle);
  margin: var(--sp-7) 0;
}

figure { margin: 0; }

blockquote {
  margin: 0;
  padding-left: var(--sp-5);
  border-left: 3px solid var(--gold-400);
  color: var(--text-secondary);
  font-style: italic;
}

code, kbd, samp {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

::selection {
  background: var(--plum-200);
  color: var(--plum-900);
}

/* ---------- Focus visibility ---------- */
:focus-visible {
  outline: 2px solid var(--plum-600);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}
.on-dark :focus-visible,
.site-footer :focus-visible,
.announce :focus-visible { outline-color: var(--gold-400); }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -60px;
  z-index: 999;
  background: var(--plum-700);
  color: var(--white);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transition: top var(--t-base) var(--ease-out);
}
.skip-link:focus { top: var(--sp-3); color: var(--white); }

/* ---------- Utility: screen reader only ---------- */
.sr-only {
  position: absolute;
  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-max);
  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--sunken { background: var(--surface-sunken); }
.section--ivory { background: var(--ivory-dim); }
.section--soft { background: var(--surface-accent-soft); }
.section--inverse {
  background: var(--grad-plum-deep);
  color: var(--text-on-dark);
}
.section--inverse h1,
.section--inverse h2,
.section--inverse h3,
.section--inverse h4 { color: var(--white); }
.section--inverse p { color: var(--text-on-dark-muted); }

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

.grid { display: grid; gap: var(--sp-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)); }
.grid-sidebar { grid-template-columns: minmax(0, 1fr) 340px; gap: var(--sp-8); }
.grid-sidebar-left { grid-template-columns: 300px minmax(0, 1fr); gap: var(--sp-8); }

.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  align-items: center;
}
.cluster--between { justify-content: space-between; }
.cluster--end { justify-content: flex-end; }
.cluster--tight { gap: var(--sp-2); }

.flow-divider {
  height: 1px;
  background: var(--border-subtle);
  margin-block: var(--sp-6);
  border: 0;
}

/* ---------- Section headings ---------- */
.section-head {
  max-width: 720px;
  margin-bottom: var(--sp-8);
}
.section-head--center {
  margin-inline: auto;
  text-align: center;
}
.section-head p {
  font-size: var(--fs-md);
  color: var(--text-secondary);
  line-height: var(--lh-relaxed);
}
.section--inverse .section-head p { color: var(--text-on-dark-muted); }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: var(--fs-2xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--gold-700);
  margin-bottom: var(--sp-3);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--gold-500);
}
.eyebrow--center { justify-content: center; }
.section--inverse .eyebrow { color: var(--gold-400); }
.section--inverse .eyebrow::before { background: var(--gold-500); }

.lede {
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--text-secondary);
}

/* ---------- Text helpers ---------- */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-2xs); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-5 { margin-bottom: var(--sp-5); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }
.mb-9 { margin-bottom: var(--sp-9); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }
.full-width { width: 100%; }

/* Hero visual column wrapper — positioning context for floating cards */
.hero-visual { position: relative; min-width: 0; }

/* ---------- Reduced motion ---------- */
@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;
    scroll-behavior: auto !important;
  }
}

/* ---------- Print ---------- */
@media print {
  .site-header, .site-footer, .announce, .mobile-nav-toggle { display: none !important; }
  body { background: #fff; }
}
