/* CSE 461 Autumn 2026 course website styles.
   Layout: one centered reading column, plain site header + nav, footer.
   All colors are tokens below; each has a light and a dark value.
   Light is the default; theme.js sets data-theme="dark" when toggled.
   Contrast checked against WCAG 2.2 AA (text >= 4.5:1, UI/focus >= 3:1). */

:root {
  /* Color */
  --bg: #fcfbfe;          /* page background */
  --fg: #1d1a24;          /* body text (≈16:1 on bg) */
  --muted: #564f68;       /* secondary text (≈7.5:1 on bg) */
  --accent: #4b2e83;      /* UW purple: links, headings rule (≈10:1 on bg) */
  --accent-soft: #ece6f7; /* tinted panels */
  --line: #d9d2e6;        /* borders */
  --surface: #f4f1f9;     /* table headers, header band */
  --holiday: #f7f0df;     /* "no class" cells (always also labeled in text) */
  --now: #e3f0e6;         /* current week row (always also labeled in text) */
  --now-fg: #1f5130;
  --gold: #85754d;        /* UW gold, darkened so it passes 3:1 as a decorative rule */
  /* Calendar event tints (meaning is always also given in text) */
  --ev-lecture: #dcebf7;
  --ev-section: #e1f0dc;
  --ev-oh: #f8f1d4;
  --ev-out: #f8e8da;
  --ev-due: #f6dde0;
  --ev-exam: #e9e0f6;
  --ev-holiday: #eceaf0;
  --ev-note: #f1eef6;

  /* Type */
  --font-display: "Encode Sans", "Segoe UI", system-ui, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

/* Light is the default. Dark mode is opt-in via the header toggle (theme.js). */
:root[data-theme="dark"] {
  --bg: #15121b;
  --fg: #ece8f4;
  --muted: #b6aec9;
  --accent: #c9b8f2;
  --accent-soft: #262035;
  --line: #3b344d;
  --surface: #1e1a27;
  --holiday: #2c2618;
  --now: #1a3222;
  --now-fg: #b7e6c4;
  --gold: #cbb98a;
  --ev-lecture: #1c2d3d;
  --ev-section: #1d3323;
  --ev-oh: #37301b;
  --ev-out: #3a2a1c;
  --ev-due: #3e2227;
  --ev-exam: #2f2445;
  --ev-holiday: #2a2731;
  --ev-note: #241f2e;
  color-scheme: dark;
}

/* ---------- Base ---------- */
html { scroll-padding-top: 1rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1.0625rem;       /* 17px */
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.25;
  text-wrap: balance;
  color: var(--fg);
}
h1 { font-size: 1.9rem; font-weight: 700; margin: 0 0 0.5rem; }
h2 {
  font-size: 1.35rem; font-weight: 650;
  margin: 2.25rem 0 0.75rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--line);
}
h3 { font-size: 1.1rem; font-weight: 650; margin: 1.5rem 0 0.5rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
li + li { margin-top: 0.25rem; }
a { color: var(--accent); text-underline-offset: 0.15em; }
a[href^="mailto:"] { white-space: nowrap; }
a:hover { text-decoration-thickness: 2px; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
pre {
  overflow-x: auto;
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.35;
}
pre code { font-size: inherit; }
blockquote {
  margin: 0 0 1rem;
  padding: 0.25rem 0 0.25rem 1rem;
  border-left: 3px solid var(--accent);
}
blockquote > :last-child { margin-bottom: 0; }
.muted { color: var(--muted); }
.lede { font-size: 1.15rem; color: var(--muted); margin-bottom: 1.5rem; }

/* Visible keyboard focus everywhere (WCAG 2.4.7 / 2.4.11) */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute;
  left: 1rem; top: -4rem;
  z-index: 10;
  background: var(--accent);
  color: var(--bg);
  padding: 0.6rem 1rem;
  font-weight: 600;
  border-radius: 4px;
}
.skip-link:focus { top: 1rem; }

/* ---------- Site header + nav ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 3px solid var(--gold);
}
.wrap {
  max-width: 64rem;
  margin: 0 auto;
  padding-inline: 1rem;
}
.site-header .wrap { padding-block: 1rem 0.25rem; }
.course-id {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 0.75rem;
  margin: 0 0 0.5rem;
}
.course-id a {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--fg);
  text-decoration: none;
}
.course-id a:hover { text-decoration: underline; }
.course-id .term {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
}
.theme-toggle {
  margin-left: auto;
  align-self: center;
  min-height: 2.75rem;        /* ≥ 24px target size (WCAG 2.5.8) */
  padding: 0.4rem 0.85rem;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle[hidden] { display: none; }
.theme-toggle .icon { margin-right: 0.35rem; }
.theme-toggle[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.site-nav ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 0.25rem;
}
.site-nav li + li { margin-top: 0; }
.site-nav a {
  display: inline-block;
  min-height: 2.75rem;        /* ≥ 24px target size (WCAG 2.5.8) */
  box-sizing: border-box;
  padding: 0.6rem 0.5rem;
  color: var(--fg);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: var(--accent); border-bottom-color: var(--line); }
.site-nav a[aria-current="page"] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.site-nav .external::after {
  content: " ↗";
  font-weight: 400;
}

/* ---------- Main ---------- */
main { padding-block: 2rem 3rem; }

.panel {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  margin: 0 0 1.5rem;
}
.panel > :last-child { margin-bottom: 0; }
.panel h2 { margin-top: 0; border: 0; padding: 0; font-size: 1.15rem; }

.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4rem 1.25rem;
}
.facts dt { font-weight: 700; }
.facts dd { margin: 0; min-width: 0; }
@media (max-width: 34rem) {
  .facts { grid-template-columns: 1fr; gap: 0.1rem; }
  .facts dd { margin-bottom: 0.6rem; }
}

.announcements { list-style: none; padding: 0; }
.announcements li {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
}
.announcements time {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  display: block;
}

/* ---------- Tables ---------- */
.table-scroll {
  position: relative;
  overflow-x: auto;
  margin: 0 0 1.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.table-scroll:focus-visible { outline-offset: 2px; }
table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}
caption {
  text-align: left;
  font-weight: 700;
  padding: 0.75rem 0.9rem 0.5rem;
  font-family: var(--font-display);
}
th, td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.9rem;
  border-top: 1px solid var(--line);
}
thead th {
  background: var(--surface);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody th { font-weight: 700; }
tfoot td, tfoot th { font-weight: 700; background: var(--surface); }
td.num, th.num { text-align: right; }

/* Schedule calendar */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  color: var(--now-fg);
  margin-top: 0.25rem;
}
.tag {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.cal { min-width: 56rem; table-layout: fixed; font-size: 0.9rem; }
.cal caption { font-size: 1.15rem; }
.cal th.cal-wk { width: 5.5rem; font-size: 0.85rem; }
.cal thead th { text-align: left; }
.cal td { padding: 0.4rem; border-left: 1px solid var(--line); }
.cal td.cal-empty { background: var(--surface); }
.cal td.cal-today { box-shadow: inset 0 0 0 3px var(--accent); }
.cal-date {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}
.cal-date .badge { margin: 0 0 0 0.25rem; color: var(--accent); }
.ev-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; }
.ev-list li + li { margin-top: 0; }
.ev {
  border-radius: 4px;
  padding: 0.35rem 0.45rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.ev > span { display: block; }
.ev-time { font-variant-numeric: tabular-nums; }
.ev-title { font-weight: 600; }
.ev-topic { font-style: italic; }
.ev-lecture { background: var(--ev-lecture); }
.ev-section { background: var(--ev-section); }
.ev-oh { background: var(--ev-oh); }
.ev-out { background: var(--ev-out); }
.ev-due { background: var(--ev-due); }
.ev-exam { background: var(--ev-exam); }
.ev-holiday { background: var(--ev-holiday); }
.ev-note { background: var(--ev-note); font-style: italic; }
.legend { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 0.6rem; margin: 0 0 1rem; }
.legend li + li { margin-top: 0; }
.legend li { padding: 0.15rem 0.6rem; border-radius: 4px; font-size: 0.9rem; }
.cal-error {
  border: 2px solid var(--fg);
  border-radius: 6px;
  padding: 0.75rem 1rem;
}
.jump { font-weight: 600; }

/* Staff */
.staff-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.staff-list li + li { margin-top: 0; }
.staff-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 1rem 1.25rem;
  align-items: start;
}
.staff-card > div { min-width: 0; }
.staff-card h3 { margin-top: 0; }
.staff-card p:last-child { margin-bottom: 0; }
.staff-photo, .staff-initials {
  width: 8rem;
  height: auto;
  max-width: 100%;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  box-sizing: border-box;
}
.staff-initials {
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.25rem;
}
@media (max-width: 30rem) {
  .staff-card { grid-template-columns: 1fr; }
  .staff-photo, .staff-initials { width: 7rem; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.92rem;
  color: var(--muted);
}
.site-footer .wrap { padding-block: 1.25rem 2rem; }
.site-footer p { margin: 0 0 0.4rem; max-width: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
@media print {
  .site-nav, .skip-link, .theme-toggle { display: none; }
  body { background: #fff; color: #000; }
}
