/* Colours for the four themes in theme.js: Light, Off-white, Parchment, Dark.
 * Off-white and Parchment use the page, ink, link, muted and border colours of
 * the lab's Quarto sites (Morrison-Lab/qwt offwhite.scss). Every text colour
 * here is at least 4.5:1 (WCAG AA) on the page, panel and chip backgrounds of
 * its theme. With no data-theme (scripts off) the page follows the system's
 * light or dark setting. */
:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1d2330;
  --muted: #5b6475;
  --line: #dde2ea;
  --panel: #f5f7fa;
  --accent: #003f87;      /* WWU blue */
  --top-bg: #3a5272;      /* muted slate blue, 8:1 with white */
  --top-fg: #ffffff;
  --chip: #e8eef8;
  --chip-off: #f0f1f3;
  --ok: #1d6b3a;
  --warn: #8a4b00;
  --mark: #ffe58a;
}
html[data-theme="light"], html[data-theme="offwhite"], html[data-theme="parchment"] {
  color-scheme: light;
}
html[data-theme="offwhite"] {
  --bg: #f5f2ea;
  --fg: #2b2a27;
  --muted: #5f666d;
  --line: #dcd8cc;
  --panel: #f8f6f0;
  --accent: #1a64b8;
  --chip: #e9e4d6;
  --chip-off: #eeebe3;
}
html[data-theme="parchment"] {
  --bg: #f1e8d0;
  --fg: #3a2f1f;
  --muted: #6b5a43;
  --line: #d8c9a8;
  --panel: #faf5e8;
  --accent: #8a3b0f;
  --chip: #e6d9b6;
  --chip-off: #ebe2c8;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12161d;
  --fg: #e5e9f0;
  --muted: #9aa4b5;
  --line: #2b3240;
  --panel: #1a2029;
  --accent: #7fb0ff;
  --top-bg: #1c2430;
  --top-fg: #e5e9f0;
  --chip: #1f2c44;
  --chip-off: #222833;
  --ok: #7fd49c;
  --warn: #f0b46a;
  --mark: #4a3f0c;  /* 4.8:1 under dark link text */
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    color-scheme: dark;
    --bg: #12161d;
    --fg: #e5e9f0;
    --muted: #9aa4b5;
    --line: #2b3240;
    --panel: #1a2029;
    --accent: #7fb0ff;
    --top-bg: #1c2430;
    --top-fg: #e5e9f0;
    --chip: #1f2c44;
    --chip-off: #222833;
    --ok: #7fd49c;
    --warn: #f0b46a;
    --mark: #4a3f0c;  /* 4.8:1 under dark link text */
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1000px; margin: 0 auto; padding: 0 16px; }
.top { background: var(--top-bg); color: var(--top-fg); padding: 20px 0 16px; }
.top .wrap { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.top h1 { margin: 0; font-size: 1.6rem; }
.top .sub { margin: 4px 0 0; opacity: .9; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.search { margin: 20px 0 8px; }
.q input {
  width: 100%; font-size: 1.1rem; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--bg); color: var(--fg);
}
.filters {
  display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 12px; align-items: end;
}
.filters > label { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: 2px; }
.filters > label input {
  font: inherit; font-size: .95rem; line-height: normal; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg); color: var(--fg); max-width: 220px;
}
.filter { display: flex; flex-direction: column; font-size: .8rem; color: var(--muted); gap: 2px; }

/* Checkbox dropdowns (multiselect.js), styled like the selects they replace. */
.ms { position: relative; }
.ms-btn {
  display: flex; align-items: center; gap: 8px; width: 200px; max-width: 100%;
  font: inherit; font-size: .95rem; line-height: normal; padding: 6px 8px; text-align: left; cursor: pointer;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg);
}
.ms-btn::after { content: "\25BE"; content: "\25BE" / ""; margin-left: auto; color: var(--muted); }
.ms-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms.ms-on .ms-btn { border-color: var(--accent); }
.ms-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ms-pop {
  position: absolute; left: 0; top: calc(100% + 4px); z-index: 20;
  width: 300px; max-width: calc(100vw - 32px);
  background: var(--bg); color: var(--fg); font-size: .95rem;
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}
.ms-pop[hidden] { display: none; }
.ms-tools { display: flex; gap: 8px; align-items: center; padding: 8px 8px 4px; }
.ms-find {
  flex: 1; min-width: 0; font: inherit; font-size: .9rem; padding: 4px 6px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg); color: var(--fg);
}
.ms-tools .ms-clear { margin-left: auto; padding: 4px; }
.ms-mode { display: flex; gap: 8px; align-items: center; padding: 2px 10px 6px; font-size: .85rem; color: var(--muted); cursor: pointer; }
.ms-list { list-style: none; margin: 0; padding: 0 0 6px; max-height: 300px; overflow-y: auto; }
.ms-list li { display: flex; align-items: flex-start; gap: 8px; padding: 3px 10px; }
.ms-list li[hidden] { display: none; }
.ms-list li:hover { background: var(--panel); }
.ms-list input { margin: 3px 0 0; flex: none; }
.ms-list label { cursor: pointer; flex: 1; }

button.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 8px 4px; font-size: .95rem; }

.status { color: var(--muted); margin: 12px 0; }
.results { list-style: none; padding: 0; margin: 0; }
.course { border-top: 1px solid var(--line); padding: 14px 0; }
.course h2 { font-size: 1.1rem; margin: 0; }
.course h2 button {
  all: unset; cursor: pointer; color: var(--accent);
}
.course h2 button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.course .code { font-weight: 700; }
.meta { color: var(--muted); font-size: .9rem; margin: 2px 0 6px; }
.desc { margin: 4px 0 8px; }
.desc.short { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; padding: 0; list-style: none; }
.chip { background: var(--chip); border-radius: 999px; padding: 2px 10px; font-size: .85rem; }
.chip.off { background: var(--chip-off); color: var(--muted); }
.chip.past { background: var(--chip-off); }
.chip .who { color: var(--muted); }
.chip .who a { color: inherit; }
.page-link { margin-left: 4px; white-space: nowrap; }

/* Course and instructor pages (scraper/pages.py). */
.top .site-name { margin: 0; font-size: 1.3rem; font-weight: 700; }
.top .site-name a { color: var(--top-fg); text-decoration: none; }
.top .site-name a:hover { text-decoration: underline; }
.crumbs { margin: 16px 0 4px; font-size: .9rem; }
.page h1 { font-size: 1.5rem; margin: 4px 0; }
.page h2 { font-size: 1.15rem; margin: 24px 0 6px; }
.page .links { margin: 10px 0; }
.attr { font-size: .78rem; border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 14px; font-size: .9rem; margin: 8px 0; }

.detail { background: var(--panel); border-radius: 8px; padding: 10px 12px; margin-top: 8px; }
.detail h3 { font-size: .95rem; margin: 12px 0 4px; }
.detail h3:first-child { margin-top: 0; }
.table-scroll { overflow-x: auto; }
.past-terms { margin-top: 10px; }
.past-terms summary { cursor: pointer; color: var(--accent); font-size: .95rem; padding: 4px 0; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
td.wrap-ok { white-space: normal; }
th { color: var(--muted); font-weight: 600; }
.full { color: var(--warn); }
.open { color: var(--ok); }
mark { background: var(--mark); color: inherit; border-radius: 2px; }

.more[hidden] { display: none; }
.more { display: block; margin: 16px auto 32px; padding: 8px 18px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel); color: var(--fg); cursor: pointer; font-size: 1rem; }
.foot { color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); margin-top: 24px; padding-top: 12px; padding-bottom: 24px; }

/* Theme picker (theme.js). */
.theme-picker { position: relative; flex: none; }
.theme-button {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border: 0; border-radius: 6px;
  background: transparent; color: var(--top-fg); cursor: pointer;
}
.theme-button:hover, .theme-button[aria-expanded="true"] { background: rgba(255, 255, 255, .15); }
.theme-button:focus-visible { outline: 2px solid var(--top-fg); outline-offset: 2px; }
.theme-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 10;
  min-width: 140px; margin: 0; padding: 4px 0; list-style: none;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
}
.theme-menu[hidden] { display: none; }
.theme-menu button {
  display: block; width: 100%; padding: 6px 14px 6px 28px; border: 0; background: none;
  color: var(--fg); font: inherit; font-size: .95rem; text-align: left; cursor: pointer; position: relative;
}
.theme-menu button:hover { background: var(--panel); }
.theme-menu button:focus-visible { background: var(--panel); outline: 2px solid var(--accent); outline-offset: -2px; }
.theme-menu button[aria-checked="true"]::before { content: "\2713"; position: absolute; left: 10px; }
.no-syllabi { color: var(--muted); font-size: .9rem; margin: 4px 0; }
.reqs { font-size: .95rem; margin: 4px 0; line-height: 1.6; }
.no-reqs { color: var(--muted); font-size: .9rem; margin: 4px 0; }
.req-tree { margin: 8px 0 12px; }
.req-tree summary { cursor: pointer; color: var(--accent); }
.req-tree ul { margin: 2px 0; padding-left: 1.2em; }
.req-tree li { margin: 2px 0; }
.req-tree small, .reqs small { color: var(--muted); }
