/* ExamDoc's public website: one stylesheet for every page.
 *
 * Colours are the tokens below, redefined for dark mode; each text and
 * background pair meets WCAG AA (4.5:1 for text, 3:1 for the focus ring and
 * borders that carry meaning). System fonts only: the site loads nothing
 * from another address. */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --bg-alt: #f2f5fa;
  --surface: #ffffff;
  --text: #1b2130;
  --muted: #4a5468;
  --border: #c5cedd;
  --link: #1a4596;
  --link-hover: #0f2d66;
  --brand: #1f4fa8;
  --button-bg: #1f4fa8;
  --button-bg-hover: #173d84;
  --button-text: #ffffff;
  --button-secondary-text: #1a4596;
  --focus: #b3420b;
  --note-bg: #fff7e6;
  --note-border: #8a5a00;
  --header-bg: #ffffff;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --measure: 42rem;
  --wide: 72rem;
  --gutter: 1rem;
  --radius: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151d;
    --bg-alt: #181e2a;
    --surface: #1c2331;
    --text: #e8ecf3;
    --muted: #b6bfce;
    --border: #3e4a60;
    --link: #a9c1ff;
    --link-hover: #d3e0ff;
    --brand: #a9c1ff;
    --button-bg: #a9c1ff;
    --button-bg-hover: #d3e0ff;
    --button-text: #0d1830;
    --button-secondary-text: #a9c1ff;
    --focus: #ffb86b;
    --note-bg: #2a2416;
    --note-border: #d9a441;
    --header-bg: #11151d;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

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

/* Links and focus */

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--link-hover);
  text-decoration-thickness: 2px;
}

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

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: -100%;
  z-index: 10;
  padding: 0.5rem 1rem;
  background: var(--surface);
  color: var(--link);
  border: 2px solid var(--link);
  border-radius: var(--radius);
  font-weight: 600;
}

.skip-link:focus {
  top: 0.5rem;
}

/* Layout */

.container {
  width: 100%;
  max-width: var(--wide);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

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

/* A page-width container whose text keeps a readable line length, aligned
   with the header rather than centred. */
.container.prose {
  max-width: var(--wide);
}

.container.prose > * {
  max-width: var(--measure);
}

main {
  display: block;
  padding-bottom: 3rem;
}

main:focus {
  outline: none;
}

section {
  padding: 2rem 0 0;
}

.band {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-top: 2.5rem;
  padding: 2rem 0 2.5rem;
}

/* Header */

.site-header {
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.25rem;
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.brand img {
  width: 2rem;
  height: 2rem;
}

.site-nav {
  flex: 1 1 auto;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav li + li {
  margin-top: 0;
}

.site-nav a {
  display: inline-block;
  padding: 0.25rem 0;
  color: var(--text);
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.site-nav a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--border);
}

.site-nav a[aria-current="page"] {
  font-weight: 600;
  border-bottom-color: var(--brand);
}

/* Headings and text */

h1,
h2,
h3 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: clamp(1.9rem, 1.4rem + 2.4vw, 2.75rem);
  letter-spacing: -0.01em;
  margin-top: 2.5rem;
}

h2 {
  font-size: clamp(1.4rem, 1.2rem + 1vw, 1.75rem);
  margin-top: 2rem;
}

h3 {
  font-size: 1.15rem;
  margin-top: 1.5rem;
}

section > .container > h2:first-child,
.band h2:first-child {
  margin-top: 0;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.4rem;
}

li + li {
  margin-top: 0.35rem;
}

.lead {
  font-size: 1.2rem;
  color: var(--muted);
  max-width: var(--measure);
}

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

.updated {
  color: var(--muted);
  font-size: 0.95rem;
}

strong {
  font-weight: 650;
}

code {
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.95em;
}

/* Buttons (links styled as buttons) */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.5rem 0;
}

.button {
  display: inline-block;
  padding: 0.65rem 1.25rem;
  border: 2px solid var(--button-bg);
  border-radius: var(--radius);
  background: var(--button-bg);
  color: var(--button-text);
  font-weight: 600;
  text-decoration: none;
  text-align: center;
}

.button:hover {
  background: var(--button-bg-hover);
  border-color: var(--button-bg-hover);
  color: var(--button-text);
  text-decoration: none;
}

.button.secondary {
  background: transparent;
  color: var(--button-secondary-text);
}

.button.secondary:hover {
  background: var(--bg-alt);
  color: var(--link-hover);
}

.site-header .button {
  padding: 0.4rem 0.9rem;
}

/* Cards */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
}

.cards > li {
  margin: 0;
}

.cards.four {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}

.card {
  height: 100%;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card h2,
.card h3 {
  margin-top: 0;
  font-size: 1.15rem;
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

/* Notes */

.note {
  max-width: var(--measure);
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--note-bg);
  border-left: 4px solid var(--note-border);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.note > :last-child {
  margin-bottom: 0;
}

/* Lists of facts: a term, then what it means */

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

.facts dt {
  font-weight: 650;
  margin-top: 1rem;
}

.facts dd {
  margin: 0.25rem 0 0;
}

/* Numbered steps */

.steps {
  max-width: var(--measure);
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.steps > li {
  position: relative;
  padding-left: 2.75rem;
  margin-top: 1rem;
}

.steps > li::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 2px solid var(--brand);
  color: var(--brand);
  font-weight: 700;
  line-height: 1.75rem;
  text-align: center;
}

/* On-page contents */

.contents {
  max-width: var(--measure);
  margin: 1.5rem 0 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-alt);
}

.contents h2 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
}

.contents ul {
  margin: 0;
}

/* Footer */

.site-footer {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  font-size: 0.95rem;
}

.site-footer nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.site-footer li + li {
  margin-top: 0;
}

.site-footer p {
  color: var(--muted);
  margin: 0;
}

/* Wider screens */

@media (min-width: 48rem) {
  :root {
    --gutter: 1.5rem;
  }

  .site-nav {
    flex: 0 1 auto;
  }
}

/* Windows high contrast: keep the shapes that tints alone would show */

@media (forced-colors: active) {
  .button,
  .card,
  .note,
  .contents {
    border: 2px solid CanvasText;
  }

  .site-nav a[aria-current="page"] {
    border-bottom-color: Highlight;
  }

  :focus-visible {
    outline-color: Highlight;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .site-header nav,
  .skip-link,
  .actions {
    display: none;
  }

  .site-footer {
    background: none;
  }
}
