/*
 * Design tokens and base styles.
 *
 * The palette comes from the college crest: its navy and its crimson, with the gold kept for small
 * accents. Headings are set in Source Serif 4 and text in Source Sans 3, both under the SIL Open Font
 * Licence and served from this site, so nothing is fetched from a font service.
 *
 * Contrast, measured with the WCAG 2.2 formula against the background each colour is used on:
 *   ink on paper 15.77, muted on white 6.39, muted on sunken 5.67, white on navy 13.81,
 *   white on crimson 7.97, crimson on white 7.97, link on white 10.50, focus ring on white 5.90,
 *   success, warning and danger text on their washes 5.71, 6.02 and 6.69.
 *   Non-text: star gold on white 3.64, control border on white 3.46 (WCAG 1.4.11 asks for 3).
 */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/serif-400.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/serif-400-italic.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/serif-600.woff2") format("woff2");
}

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/serif-700.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/sans-400.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/sans-600.woff2") format("woff2");
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/fonts/sans-700.woff2") format("woff2");
}

:root {
  --font-serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --font-sans: "Source Sans 3", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;

  --navy-900: #141d40;
  --navy-800: #1d2a57;
  --navy-600: #2b3b78;
  --navy-wash: #e9ecf5;
  --crimson: #9e1b22;
  --crimson-dark: #7d141a;
  --crimson-wash: #f8e9ea;
  --gold: #c9a227;
  --gold-light: #e3c566;
  --star: #b7791f;
  --star-empty: #d9d6cf;

  --paper: #fbfaf7;
  --surface: #ffffff;
  --sunken: #f3f1ec;
  --ink: #1b1f2a;
  --ink-muted: #5a5f6b;
  --on-dark: #d7dbea;
  --on-dark-muted: #b9bfd6;
  --rule: #e2dfd8;
  --rule-strong: #c9c5bb;
  --control: #858a95;
  --link: var(--navy-600);
  --focus: #2f5bd3;

  --success: #1e6b41;
  --success-wash: #e8f3ec;
  --warning: #7f5200;
  --warning-wash: #fbf1dc;
  --danger: #a11a1a;
  --danger-wash: #fbe9e8;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  --text-xs: 0.8125rem;
  --text-sm: 0.9375rem;
  --text-base: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.625rem;
  --text-display: clamp(2.5rem, 5.2vw, 4rem);

  --radius: 4px;
  --radius-lg: 8px;
  --shadow-raised: 0 1px 2px rgba(20, 29, 64, 0.06), 0 8px 24px rgba(20, 29, 64, 0.08);
  --shadow-menu: 0 2px 4px rgba(20, 29, 64, 0.08), 0 16px 40px rgba(20, 29, 64, 0.16);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --fast: 140ms;
  --medium: 240ms;

  --control-height: 44px;
  --page-width: 1200px;
  --reading-width: 720px;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 88px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  font-feature-settings: "kern", "liga";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main {
  flex: 1 0 auto;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-serif);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-3xl);
}

h2 {
  font-size: var(--text-2xl);
}

h3 {
  font-size: var(--text-lg);
}

h4 {
  font-size: var(--text-base);
}

p {
  margin: 0 0 var(--space-4);
  text-wrap: pretty;
}

a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--fast) var(--ease), text-decoration-color var(--fast) var(--ease);
}

a:hover {
  color: var(--crimson);
}

strong {
  font-weight: 600;
}

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

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: var(--space-6) 0;
}

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

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

[hidden] {
  display: none !important;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
