/* Shared by every page: the seven colours, header, mobile menu, theme switch, footer, reveal. Loaded last. */
:root {
  --bg: #011130; --surface: #0A1C45; --ink: #EEF2F9; --muted: #A7B6CF; --accent: #7FD3F5; --brand: #4B9CD3; --green: #7EBF6A;
  --line: color-mix(in srgb, var(--ink) 10%, transparent);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #F5F3EE; --surface: #FFFFFF; --ink: #13294B; --muted: #5B6B86; --accent: #2F6FAF; --brand: #4B9CD3; --green: #4F9A3E;
  color-scheme: light;
}

/* header */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 50; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px clamp(18px, 3.4vw, 48px);
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 700; letter-spacing: .01em; color: var(--ink); }
.brand img { width: 34px; height: auto; }
.brand .logo-l { display: none; } :root[data-theme="light"] .brand .logo-l { display: block; } :root[data-theme="light"] .brand .logo-d { display: none; }
.nav-right { display: flex; align-items: center; gap: 22px; }
.menu { display: flex; gap: 26px; font-size: 14px; font-weight: 500; }
.menu a { color: var(--muted); text-decoration: none; position: relative; padding: 6px 0; transition: color .3s var(--ease); }
.menu a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 1.5px; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform .5s var(--ease); }
.menu a:hover { color: var(--ink); }
.menu a:hover::after, .menu a[aria-current="page"]::after { transform: scaleX(1); }
.menu a[aria-current="page"] { color: var(--ink); }
.theme-btn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent); background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; transition: background .3s var(--ease), transform .5s var(--ease); }
.theme-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); transform: rotate(-12deg); }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.theme-btn .sun { display: none; } :root[data-theme="light"] .theme-btn .sun { display: block; } :root[data-theme="light"] .theme-btn .moon { display: none; }
.menu-btn { display: none; width: 40px; height: 40px; border: 0; background: transparent; cursor: pointer; position: relative; }
.menu-btn span { position: absolute; left: 10px; right: 10px; height: 1.6px; background: var(--ink); transition: transform .45s var(--ease), top .45s var(--ease); }
.menu-btn span:first-child { top: 15px; } .menu-btn span:last-child { top: 23px; }
.menu-open .menu-btn span:first-child { top: 19px; transform: rotate(45deg); } .menu-open .menu-btn span:last-child { top: 19px; transform: rotate(-45deg); }

@media (max-width: 900px) {
  .menu-btn { display: block; }
  .menu { position: fixed; inset: 64px 0 auto 0; flex-direction: column; gap: 0; padding: 10px 18px 22px; background: var(--bg); border-bottom: 1px solid var(--line);
    opacity: 0; transform: translateY(-10px); pointer-events: none; transition: opacity .35s var(--ease), transform .45s var(--ease); }
  .menu a { font-size: 20px; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .menu a::after { display: none; }
  .menu-open .menu { opacity: 1; transform: none; pointer-events: auto; }
  .nav-right { gap: 10px; }
}

/* footer */
.site-foot { position: relative; z-index: 2; border-top: 1px solid var(--line); padding: 40px clamp(18px, 3.4vw, 48px) 28px; color: var(--muted); font-size: 13.5px; background: var(--bg); }
.site-foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 24px; }
.site-foot-name { color: var(--ink); font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.site-foot-links { display: flex; flex-wrap: wrap; gap: 20px; }
.site-foot-links a { color: var(--muted); text-decoration: none; transition: color .3s; }
.site-foot-links a:hover { color: var(--ink); }
.site-foot-copy { margin-top: 26px; font-size: 12.5px; opacity: .75; }

/* keyboard focus that matches the palette */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* page to page: a soft cross-fade with a small rise (browsers without support simply navigate) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: vtOut .32s cubic-bezier(0.4, 0, 1, 1) both; }
::view-transition-new(root) { animation: vtIn .55s cubic-bezier(0.22, 1, 0.36, 1) both; }
@keyframes vtOut { to { opacity: 0; } }
@keyframes vtIn { from { opacity: 0; transform: translateY(14px); } }
/* the header stays put during page changes */
.nav { view-transition-name: site-nav; }
::view-transition-group(site-nav) { animation: none; }

/* theme switch: the new colours spread from the button */
html.theme-switching::view-transition-old(root), html.theme-switching::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* the header tucks away while reading down and returns on the way up */
.nav { transition: transform .5s var(--ease), background-color .6s var(--ease), border-color .6s var(--ease); }
html.nav-tucked:not(.menu-open) .nav { transform: translateY(-100%); }

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

/* 2026-11-23 · larger header and footer, per the lab's feedback that the type was hard to read.
   Reference: Harvard, Yale, MIT, Stanford Medicine and UNC School of Medicine menus measure 16-22px at 1440px wide. */
.nav .brand { font-size: 19px; gap: 12px; }
.nav .brand img { width: 44px; }
.nav .menu { font-size: 17px; gap: 28px; }
.site-foot { font-size: 15px; }
.site-foot-name { font-size: 17px; }
.site-foot-copy { font-size: 13.5px; }

/* ---------------------------------------------------------------- 2026-11-23 · type and text colour, anchored on top sites
   Measured at 1440px and 2560px wide (tools/measure-type2.js): Harvard body 18px, Yale 20px, BAIR 18px, MIT 16px; menus 16-20px.
   Their reading text is always the strongest colour (Harvard #1E1E1E on #F3F4F4, 15:1; Yale white on #222, 16:1); grey is kept
   for under 3% of the text (Yale #4A4A4A, 8.9:1). Refactoring UI (Schoger & Wathan): no plain grey text on a coloured background,
   use a tint of the background's hue. Butterick: web body text 15-25px.
   One small type scale for every page: body 18px at 1440 rising to 20px on large monitors, small 16-17px, lead 20-24px,
   card titles 21-24px, menu 18-20px. */
:root {
  --text: #E3E9F4;            /* reading text: 15.3:1 on the navy (Harvard 15.1:1) */
  --muted: #C2CEE6;           /* dates, labels, counts: a light tint of the navy, 11.8:1 (was grey-blue #A7B6CF, 9.1:1) */
  --soft: #A3B5D6;            /* the faintest hints only, 9.0:1 */
  --fs-body: clamp(18px, 1.04vw, 20px);
  --fs-small: clamp(16px, 0.9vw, 17px);
  --fs-lead: clamp(20px, 1.25vw, 24px);
  --fs-h3: clamp(21px, 1.3vw, 24px);
  --fs-nav: clamp(18px, 1.05vw, 20px);
}
:root[data-theme="light"] {
  --text: #1B2C47;            /* 12.6:1 on the paper colour */
  --muted: #3C4B64;           /* 7.9:1 (was #5B6B86, 4.9:1); Yale's secondary grey is 8.9:1 */
  --soft: #55647E;            /* 5.4:1 */
}
body { color: var(--text); }
.nav .brand { font-size: clamp(19px, 1.1vw, 22px); }
.nav .brand img { width: clamp(44px, 2.6vw, 54px); }
.nav .menu { font-size: var(--fs-nav); gap: clamp(26px, 1.8vw, 36px); }
.menu a { color: var(--muted); }
.menu a:hover, .menu a[aria-current="page"] { color: var(--ink); }
.site-foot { font-size: var(--fs-small); color: var(--muted); }
.site-foot-links a { color: var(--muted); }
.site-foot-name { font-size: clamp(17px, 1vw, 19px); }
.site-foot-copy { font-size: 14px; opacity: 1; color: var(--soft); }
@media (max-width: 900px) { .menu a { font-size: 22px; } }

/* ---------------------------------------------------------------- 2026-11-23 · round 3, asked for by the lab: bigger,
   calmer and more formal. Font: Inter (the screen face most recommended by designers; used by GitHub, Mozilla). Sizes one
   step above the largest of the measured sites (Yale body 20px, menu 22px; BAIR logo 100px, Stanford AI Lab 88px).
   Light mode text as on Harvard / Yale / MIT: neutral dark grey on near-white (#222; Yale's secondary grey #4A4A4A),
   headings keep the UNC navy. */
:root {
  --fs-body: clamp(20px, 1.15vw, 22px);
  --fs-small: clamp(17px, 1vw, 19px);
  --fs-lead: clamp(22px, 1.4vw, 26px);
  --fs-h3: clamp(24px, 1.5vw, 28px);
  --fs-nav: clamp(17px, 1.4vw, 22px);
  --fs-label: clamp(16px, 1vw, 18px);
  --logo-h: clamp(64px, 4.6vw, 84px);
}
:root[data-theme="light"] {
  --bg: #FAFAFA; --surface: #FFFFFF;
  --text: #222222;            /* 15.3:1 on #FAFAFA */
  --muted: #4A4A4A;           /* Yale's grey, 8.6:1 */
  --soft: #666666;            /* 5.5:1 */
}
body { font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
.nav { padding-top: 18px; padding-bottom: 18px; }
.nav .brand { font-size: clamp(22px, 1.5vw, 28px); gap: 14px; letter-spacing: -0.01em; }
.nav .brand img { width: auto; height: var(--logo-h); }
.nav .menu { font-size: var(--fs-nav); gap: clamp(18px, 1.9vw, 36px); font-weight: 500; }
.theme-btn { width: 44px; height: 44px; }
@media (max-width: 900px) { .nav { padding-top: 12px; padding-bottom: 12px; } .nav .brand img { height: 52px; } .menu a { font-size: 22px; } }
/* menu words never break; on small laptops (900-1250px) the menu tightens so everything stays on one line */
.menu a { white-space: nowrap; }
@media (min-width: 901px) and (max-width: 1250px) { .nav .menu { gap: 14px; font-size: 16.5px; } .nav-right { gap: 14px; } .nav .brand { font-size: 20px; } }
@media (max-width: 900px) { .nav .brand { font-size: 19px; gap: 10px; } .nav-right { gap: 10px; } }
@media (max-width: 400px) { .nav .brand img { height: 46px; } .nav .brand { font-size: 18px; } }
