/* Layout: one column of stacked panels. Live "next class" up top, then a to-scale Thu/Fri/Sat week grid, then the 12-week semester run, then courses. */
:root {
  --bg: #f3f4f7;
  --surface: #ffffff;
  --ink: #161a2b;
  --muted: #5d6378;
  --line: #dfe2ea;
  --accent: #2b3a8f;
  --inperson: #c9780a;
  --inperson-soft: #fdf1dc;
  --online: #0f7d74;
  --online-soft: #def3f0;
  --c1: #e7ecff; --c1-ink: #2b3a8f;
  --c2: #ffe9e2; --c2-ink: #a23b1c;
  --c3: #e3f4e6; --c3-ink: #1f6b33;
  --c4: #f3e6fb; --c4-ink: #6d2f94;
  --c5: #fff3d6; --c5-ink: #855800;
  --c6: #eceef3; --c6-ink: #3d4357;
  --break: repeating-linear-gradient(135deg, transparent 0 6px, rgba(93,99,120,.08) 6px 12px);
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1220; --surface: #181c2e; --ink: #e9ebf3; --muted: #9aa0b6; --line: #2a2f45;
    --accent: #9fb0ff; --inperson: #f0a53a; --inperson-soft: #3a2a10; --online: #4fd1c1; --online-soft: #10302d;
    --c1: #232b55; --c1-ink: #b9c5ff; --c2: #43231a; --c2-ink: #ffb59d; --c3: #193424; --c3-ink: #9fe0b0;
    --c4: #34204a; --c4-ink: #ddb3fa; --c5: #3a2e10; --c5-ink: #f5d27a; --c6: #262a3b; --c6-ink: #c3c8da;
    --break: repeating-linear-gradient(135deg, transparent 0 6px, rgba(154,160,182,.08) 6px 12px);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] { /* kept for explicit theme toggles */
  --bg: #0f1220; --surface: #181c2e; --ink: #e9ebf3; --muted: #9aa0b6; --line: #2a2f45;
  --accent: #9fb0ff; --inperson: #f0a53a; --inperson-soft: #3a2a10; --online: #4fd1c1; --online-soft: #10302d;
  --c1: #232b55; --c1-ink: #b9c5ff; --c2: #43231a; --c2-ink: #ffb59d; --c3: #193424; --c3-ink: #9fe0b0;
  --c4: #34204a; --c4-ink: #ddb3fa; --c5: #3a2e10; --c5-ink: #f5d27a; --c6: #262a3b; --c6-ink: #c3c8da;
  --break: repeating-linear-gradient(135deg, transparent 0 6px, rgba(154,160,182,.08) 6px 12px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5; }
.wrap { max-width: 1040px; margin: 0 auto; padding-block: 28px 56px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 20px; }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
.eyebrow { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.mono { font-family: var(--mono); }
.tnum { font-variant-numeric: tabular-nums; }

/* header */
header { display: grid; gap: 14px; }
header h1 { font-size: clamp(30px, 6vw, 46px); font-weight: 800; line-height: 1.02; }
header h1 span { color: var(--accent); }
.facts { display: flex; flex-wrap: wrap; gap: 8px; }
.fact { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 13.5px; }
.fact b { font-weight: 600; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; display: grid; gap: 16px; min-width: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.panel-head h2 { font-size: 21px; font-weight: 700; }

/* next class */
.next { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: center; }
.next-main { display: grid; gap: 6px; min-width: 0; }
.next-when { font-family: var(--display); font-weight: 800; font-size: clamp(26px, 5vw, 36px); line-height: 1.05; }
.next-what { font-size: 16px; }
.next-what .mono { color: var(--muted); }
.next-side { display: grid; gap: 10px; justify-items: start; }
.mode { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; padding: 5px 10px; border-radius: 6px; white-space: nowrap; }
.mode::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.mode.inperson { color: var(--inperson); background: var(--inperson-soft); }
.mode.online { color: var(--online); background: var(--online-soft); }
.mode.off { color: var(--muted); background: var(--bg); }
.mode.lg { font-size: 13px; padding: 7px 12px; }
.next-detail { font-size: 14px; color: var(--muted); }
.next-detail b { color: var(--ink); font-weight: 600; }

/* week grid */
.grid-wrap { display: grid; grid-template-columns: 44px repeat(3, minmax(0, 1fr)); gap: 0 8px; }
.day-head { padding-bottom: 8px; display: grid; gap: 2px; }
.day-head .d { font-family: var(--display); font-weight: 700; font-size: 17px; }
.day-head .s { font-size: 12px; color: var(--muted); }
.day-head.today .d { color: var(--accent); }
.day-head.today .d::after { content: " · today"; font-family: var(--mono); font-size: 11px; font-weight: 400; letter-spacing: .04em; }
.axis, .col { position: relative; height: calc(var(--hours) * var(--hr)); --hr: 50px; }
.axis span { position: absolute; right: 6px; transform: translateY(-50%); font-family: var(--mono); font-size: 11px; color: var(--muted); }
.col { border-radius: 10px; background-image: repeating-linear-gradient(to bottom, var(--line) 0 1px, transparent 1px var(--hr)); background-color: var(--bg); }
.col.today { outline: 2px solid var(--accent); outline-offset: 2px; }
.blk { position: absolute; left: 4px; right: 4px; border-radius: 8px; padding: 7px 9px; display: grid; align-content: start; gap: 2px; overflow: hidden; min-width: 0; }
.blk .code { font-family: var(--mono); font-size: 11.5px; font-weight: 500; }
.blk .t { font-weight: 600; font-size: 13.5px; line-height: 1.22; }
.blk .tm { font-family: var(--mono); font-size: 11px; opacity: .85; }
.blk .rm { font-family: var(--mono); font-size: 11px; font-weight: 500; }
.blk.brk { background: var(--break); color: var(--muted); padding: 2px 9px; align-content: center; font-size: 11.5px; font-family: var(--mono); }
.blk.elec { border: 1.5px dashed var(--c6-ink); }
.k1 { background: var(--c1); color: var(--c1-ink); }
.k2 { background: var(--c2); color: var(--c2-ink); }
.k3 { background: var(--c3); color: var(--c3-ink); }
.k4 { background: var(--c4); color: var(--c4-ink); }
.k5 { background: var(--c5); color: var(--c5-ink); }
.k6 { background: var(--c6); color: var(--c6-ink); }

/* semester */
.weeks { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.wk { border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; display: grid; gap: 6px; align-content: start; position: relative; }
.wk .n { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wk .n b { font-family: var(--display); font-size: 16px; font-weight: 700; }
.wk .dates { font-size: 13px; font-variant-numeric: tabular-nums; }
.wk .note { font-size: 11.5px; color: var(--muted); line-height: 1.35; }
.wk.inperson { border-color: var(--inperson); background: var(--inperson-soft); }
.wk.brk { background: var(--break); }
.wk.past { opacity: .5; }
.wk.now { outline: 2px solid var(--accent); outline-offset: 1px; }
.wk.now .n b::after { content: " · now"; font-family: var(--mono); font-size: 11px; font-weight: 400; color: var(--accent); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 13px; color: var(--muted); align-items: center; }

/* courses */
.two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.courses { display: grid; gap: 8px; }
.course { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
.course:last-child { border-bottom: 0; }
.course .sw { align-self: stretch; border-radius: 3px; }
.course .ct { font-weight: 600; }
.course .cs { font-size: 13px; color: var(--muted); }
.course .cr { font-family: var(--mono); font-size: 12.5px; text-align: right; color: var(--muted); }
.course .cr b { color: var(--ink); font-weight: 500; display: block; font-size: 14px; }
.sw.k1 { background: var(--c1-ink); } .sw.k2 { background: var(--c2-ink); } .sw.k3 { background: var(--c3-ink); } .sw.k4 { background: var(--c4-ink); } .sw.k5 { background: var(--c5-ink); }

.electives { display: grid; gap: 6px; }
.electives p { margin: 0; font-size: 13.5px; color: var(--muted); }
.el { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.el:hover { border-color: var(--muted); }
.el input { accent-color: var(--accent); margin: 0; width: 16px; height: 16px; }
.el input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.el .en { font-size: 14px; }
.el .en span { font-family: var(--mono); font-size: 12px; color: var(--muted); display: block; }
.el .ev { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.el:has(input:checked) { border-color: var(--accent); background: var(--c1); }
.clear { justify-self: start; background: none; border: 0; padding: 4px 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }

.notes { font-size: 13.5px; color: var(--muted); }
.notes ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.notes b { color: var(--ink); font-weight: 600; }

@media (max-width: 760px) {
  .next, .two { grid-template-columns: minmax(0, 1fr); }
  .panel { padding: 16px; }
}
@media (max-width: 480px) {
  .grid-wrap { grid-template-columns: 34px repeat(3, minmax(0, 1fr)); gap: 0 5px; }
  .axis, .col { --hr: 56px; }
  .blk { left: 2px; right: 2px; padding: 6px; }
  .blk .t { font-size: 12.5px; }
  .blk .code, .blk .tm, .blk .rm { font-size: 10.5px; }
  .axis span { font-size: 10px; right: 3px; }
}

/* header CTA */
.cta { justify-self: start; display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: var(--surface); font-weight: 600; text-decoration: none; font-size: 14.5px; }
.cta:hover { filter: brightness(1.08); }
.cta:focus-visible, .calbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* add to calendar */
.cal { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.step { display: grid; gap: 10px; min-width: 0; }
.step h3 { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.step h3 .num { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: var(--surface); font-family: var(--mono); font-size: 12.5px; }
.step p { margin: 0; font-size: 13.5px; color: var(--muted); }
.calbtns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.calbtn { display: grid; gap: 1px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); text-decoration: none; font: inherit; text-align: left; cursor: pointer; }
.calbtn:hover { border-color: var(--accent); }
.calbtn b { font-weight: 600; font-size: 14.5px; }
.calbtn span { font-size: 12px; color: var(--muted); }
.calbtn.primary { background: var(--c1); border-color: var(--accent); }
.feed { display: flex; gap: 8px; align-items: center; min-width: 0; }
.feed code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-family: var(--mono); font-size: 12px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.chosen-line { font-size: 13.5px; padding: 9px 12px; border-radius: 9px; background: var(--bg); }
.chosen-line b { font-weight: 600; }
.toast { font-size: 12.5px; color: var(--online); min-height: 1.2em; }
.el.none .en { color: var(--muted); }
@media (max-width: 760px) { .cal { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 400px) { .calbtns { grid-template-columns: minmax(0, 1fr); } }
.calbtn[download] { grid-column: 1 / -1; }
.wk .n { flex-wrap: wrap; }
.blk .lec { font-size: 11.5px; line-height: 1.25; margin-top: 2px; padding-top: 4px; border-top: 1px solid currentColor; border-top-color: color-mix(in srgb, currentColor 25%, transparent); }
.blk .lec em { font-style: normal; font-family: var(--mono); font-size: 10.5px; opacity: .8; }
@media (max-width: 480px) { .blk .lec { font-size: 10.5px; } }
.help { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; }
.help summary { cursor: pointer; font-weight: 600; }
.help summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.help ol { margin: 10px 0 8px; padding-left: 20px; display: grid; gap: 6px; }
.help p { margin: 0; color: var(--muted); }
.help b { font-weight: 600; }
