/* Course site prototype — warm, minimal, hairline rules.
   Spirit borrowed from the lecture engine's house style, tokens re-derived
   independently (no import from platform/css/platform.css). System fonts
   only: no external font requests, nothing to fail to load. */

:root {
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

  --paper: #f6f1e6;
  --surface: #fffdf8;
  --surface-2: #ece3cf;
  --line: #cdbfa0;
  --ink: #211d17;
  --muted: #675c49;
  --rust: #9c4a2e;
  --pine: #3f6a4f;
  --red: #8f3a35;
  --rust-soft: color-mix(in srgb, var(--rust) 12%, transparent);
  --pine-soft: color-mix(in srgb, var(--pine) 12%, transparent);
  --radius: 4px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { background: var(--paper); }
body {
  margin: 0;
  /* dvh, not vh: on a phone `100vh` is the tall viewport with the address
     bar retracted, so a vh-sized page hides its own last rows under the
     browser chrome until you scroll. The vh line is the fallback for
     engines without dvh. */
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--pine); outline-offset: 2px; }

.tabular { font-variant-numeric: tabular-nums; }

/* Skip link */
.skip-link { position: fixed; z-index: 50; top: -60px; left: 12px; padding: 10px 16px; background: var(--surface); border: 1px solid var(--pine); border-radius: var(--radius); text-decoration: none; }
.skip-link:focus { top: 12px; }

/* Site chrome */
.site-header { border-bottom: 1px solid var(--line); }
.site-nav { max-width: 1100px; margin: 0 auto; padding: 18px clamp(18px, 4vw, 48px); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.site-wordmark { text-decoration: none; font-weight: 700; letter-spacing: -0.01em; font-size: 1rem; }
.site-wordmark span { color: var(--rust); margin-right: 6px; }
.site-links { display: flex; gap: 4px; flex-wrap: wrap; }
.site-links a { padding: 8px 12px; border-radius: var(--radius); text-decoration: none; color: var(--muted); font-size: 0.88rem; }
.site-links a:hover, .site-links a[aria-current="page"] { color: var(--ink); background: var(--surface-2); }

.site-main { max-width: 1100px; margin: 0 auto; padding: 0 clamp(18px, 4vw, 48px) 72px; }

.site-footer { border-top: 1px solid var(--line); margin-top: 40px; }
.site-footer-inner { max-width: 1100px; margin: 0 auto; padding: 22px clamp(18px, 4vw, 48px); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--muted); font: 0.78rem var(--mono); }

/* Hero */
.hero { padding: 44px 0 32px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
.eyebrow { margin: 0 0 8px; color: var(--rust); font: 700 0.72rem var(--mono); text-transform: uppercase; letter-spacing: 0.1em; }
.hero h1 { margin: 0 0 10px; font-size: clamp(1.5rem, 2.4vw, 2rem); font-weight: 700; letter-spacing: -0.01em; }
.hero h1 small { display: block; margin-top: 4px; font-weight: 450; font-size: 0.55em; color: var(--muted); }
.hero p.lede { max-width: 62ch; color: var(--muted); }
.hero-meta { display: flex; flex-wrap: wrap; gap: 10px 22px; margin-top: 18px; font: 0.8rem var(--mono); color: var(--muted); }
.hero-meta strong { color: var(--ink); }
.hero-notice { margin-top: 20px; padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--pine); border-radius: var(--radius); background: var(--surface); font-size: 0.86rem; color: var(--muted); }

/* Section heading */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 1.15rem; font-weight: 700; letter-spacing: -0.005em; }
.section-head .count { color: var(--muted); font: 0.78rem var(--mono); }
section.block { margin-bottom: 44px; }

/* Week list */
.week-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.week-card { position: relative; padding: 14px 15px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: inherit; display: block; transition: border-color .15s, background .15s; }
a.week-card:hover { border-color: var(--rust); background: linear-gradient(150deg, var(--rust-soft), var(--surface)); }
.week-card .week-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.week-num { font: 700 0.72rem var(--mono); color: var(--rust); }
.week-status { font: 700 0.6rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.week-status.is-ready { color: var(--pine); }
.week-card h3 { margin: 0 0 10px; font-size: 0.95rem; font-weight: 650; line-height: 1.3; }
.week-card time { display: block; color: var(--muted); font: 0.72rem var(--mono); }
.week-card.is-planned { opacity: 0.6; cursor: default; }
.week-card .go { position: absolute; right: 14px; bottom: 12px; color: var(--rust); font-size: 0.85rem; }

/* Assignments table */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.assignments { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 620px; }
table.assignments th, table.assignments td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.assignments thead th { font: 700 0.68rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); background: var(--surface-2); }
table.assignments caption { caption-side: top; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); color: var(--muted); font: 0.68rem var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
table.assignments tbody tr:last-child td { border-bottom: none; }
table.assignments td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
table.assignments td.title strong { display: block; margin-bottom: 3px; }
table.assignments td.title span { color: var(--muted); font-size: 0.85em; }
.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font: 700 0.65rem var(--mono); text-transform: uppercase; letter-spacing: 0.04em; border: 1px solid var(--line); }
.pill-open { color: var(--pine); border-color: color-mix(in srgb, var(--pine) 50%, var(--line)); background: var(--pine-soft); }
.pill-upcoming { color: var(--muted); }
.pill-closed { color: var(--red); border-color: color-mix(in srgb, var(--red) 45%, var(--line)); }
.assign-link { display: inline-block; margin-top: 2px; font-size: 0.82rem; text-decoration: underline; text-underline-offset: 2px; color: var(--pine); }
.assign-link[aria-disabled="true"] { color: var(--muted); pointer-events: none; text-decoration: none; }

/* Showcase */
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.filter-bar:last-of-type { margin-bottom: 16px; }
.filter-label { font: 700 0.68rem var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-right: 2px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font: 0.78rem var(--mono); cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.filter-chip:hover { border-color: var(--rust); color: var(--ink); }
.filter-chip.is-active { border-color: var(--pine); color: var(--ink); background: var(--pine-soft); }
.filter-chip-count { color: var(--muted); font-size: 0.85em; }
.filter-chip.is-active .filter-chip-count { color: inherit; }

.showcase-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; align-items: start; }
.project-card { padding: 16px 17px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; }
.project-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.project-code { font: 700 0.78rem var(--mono); color: var(--rust); font-variant-numeric: tabular-nums; }
.project-custom-badge { font: 700 0.6rem var(--mono); text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); padding: 1px 5px; margin-left: 4px; }
.project-difficulty { font: 0.72rem var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.project-card h3 { margin: 0 0 6px; font-size: 1rem; font-weight: 650; line-height: 1.3; }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 10px; font: 0.72rem var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.project-card p.summary { margin: 0 0 12px; color: var(--muted); font-size: 0.88rem; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tag { padding: 3px 8px; border: 1px solid var(--line); border-radius: var(--radius); font: 0.68rem var(--mono); color: var(--muted); background: var(--surface-2); }
.project-attribution { margin: 0 0 10px; font-size: 0.78rem; color: var(--pine); }
.project-issues { margin: 0 0 10px; font-size: 0.82rem; }
.project-issues summary { cursor: pointer; color: var(--rust); font: 0.78rem var(--mono); list-style: none; }
.project-issues summary::-webkit-details-marker { display: none; }
.project-issues summary::before { content: "+ "; }
.project-issues[open] summary::before { content: "\2212 "; }
.project-issues p { margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.project-links { margin: auto 0 0; padding-top: 10px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.82rem; }
.project-links a { color: var(--rust); text-decoration: underline; text-underline-offset: 2px; }
.project-links--empty { color: var(--muted); font-style: italic; }

/* Notices / placeholder banners */
.notice { padding: 12px 14px; border: 1px solid var(--line); border-left: 3px solid var(--rust); border-radius: var(--radius); background: var(--surface); font-size: 0.86rem; color: var(--muted); margin-bottom: 22px; }
.notice strong { color: var(--ink); }

.empty-state { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

.error-state { padding: 14px; border: 1px solid var(--red); border-radius: var(--radius); background: color-mix(in srgb, var(--red) 8%, var(--surface)); color: var(--red); font-size: 0.88rem; }

/* Utility */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------------------------------------------------------------------------
   Phone

   Two separate gates, on purpose:

   * `pointer: coarse` — a finger, at any width. Only ever adds invisible
     padding so a control clears 44×44 CSS px. No type size, colour, border
     or spacing of the desktop layout is touched, and a mouse never matches.
   * `max-width` — layout, which is a question of room, not input device.
--------------------------------------------------------------------------- */

@media (hover: none) and (pointer: coarse) {
  .site-wordmark,
  .site-links a,
  .assign-link,
  .project-links a { display: inline-flex; align-items: center; min-height: 44px; }
  /* A filter chip is 29px tall. Growing it to 44 turned a hairline pill
     into a lozenge and changed the look of the whole bar, so the hit area
     grows instead of the chip: an invisible 8px skirt inside the button,
     plus a row gap wide enough that two rows of skirt meet without
     overlapping. The chip itself is pixel-identical to the desktop one. */
  .filter-bar { gap: 20px 8px; margin-bottom: 20px; }
  .filter-chip { position: relative; }
  .filter-chip::after { content: ""; position: absolute; inset: -9px -2px; }
  /* A `summary` was a 15px-tall line of text — the hardest thing on the
     page to hit. Keep it block-level (Safari drops the toggle on some
     other display values) and grow it with padding. */
  .project-issues summary { display: block; padding: 15px 0; }
  .project-issues[open] summary { padding-bottom: 4px; }
  .project-issues p { margin-top: 0; }
}

/* The assignments table has five columns and a 620px natural width. Inside
   a 390px phone that meant a horizontal scroller with Points and Status
   parked off-screen, and an Assignment column wrapping two words to a line.
   Below 620px each row becomes one block instead; the two numeric cells
   carry their column header (the `data-label` written by js/assignments.js)
   so nothing is lost with the `thead` gone. Tablet and desktop are above
   this breakpoint and keep the real table. */
@media (max-width: 620px) {
  .table-wrap { overflow-x: visible; border: none; background: none; border-radius: 0; }
  table.assignments { display: block; min-width: 0; font-size: 0.9rem; }
  table.assignments thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.assignments tbody { display: block; }
  table.assignments tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "week   status"
      "title  title"
      "rule   rule"
      "due    points";
    gap: 6px 12px;
    align-items: baseline;
    margin-bottom: 10px;
    padding: 13px 14px 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }
  table.assignments td { display: block; padding: 0; border-bottom: none; }
  table.assignments tbody tr:last-child { margin-bottom: 0; }
  table.assignments td:nth-child(1) { grid-area: week; color: var(--rust); font-weight: 700; }
  table.assignments td:nth-child(2) { grid-area: title; }
  table.assignments td:nth-child(3) { grid-area: due; }
  table.assignments td:nth-child(4) { grid-area: points; text-align: right; }
  table.assignments td:nth-child(5) { grid-area: status; justify-self: end; }
  table.assignments td[data-label]::before {
    content: attr(data-label) " ";
    color: var(--muted);
    font: 700 0.68rem var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  /* One continuous hairline under the description. Drawn as a grid item of
     its own rather than as a border on the two cells below, which the
     column gap would have cut in half. */
  table.assignments tr::before { content: ""; grid-area: rule; height: 1px; margin-top: 3px; background: var(--line); }
  table.assignments td:nth-child(3),
  table.assignments td:nth-child(4) { font-size: 0.82rem; white-space: normal; }
  /* In the real table the blurb and the form link share a cell and run on
     together, which reads fine beside a Status column. Stacked, "Submission
     closed" looked like the last words of the blurb, so they separate. */
  table.assignments td.title strong { font-size: 0.95rem; }
  table.assignments td.title span { display: block; }
  table.assignments td.title .assign-link { margin-top: 4px; }
}
