/* ENSC Curriculum Navigator */
:root {
  --year-sep: #5b636c;
  --red: #a6192e;
  --red-dark: #7d1222;
  --ink: #1f2328;
  --ink-2: #4b5560;
  --ink-3: #6e7781;
  --line: #d9dde2;
  --bg: #f4f5f7;
  --card: #ffffff;
  --pill: #ffffff;
  --pill-line: #c9cfd6;

  --sel-bg: #a6192e;   --sel-ink: #ffffff;
  --pre-bg: #fde7ae;   --pre-line: #c48a00;  --pre-ink: #5c3f00;
  --co-bg:  #e6dcfa;   --co-line:  #6a48c2;  --co-ink:  #34206e;
  --lead-bg:#cdeee1;   --lead-line:#1c8a62;  --lead-ink:#0d4632;

  /* Semester column shades and separators */
  --fall-bg:   #fbf3e6;  --fall-hd:   #7a4b12;
  --spring-bg: #eef7ec;  --spring-hd: #2f6b2a;
  --summer-bg: #eaf3fb;  --summer-hd: #1f5687;
  --sem-sep:   #5b636c;

  --radius: 8px;
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); }
.wrap { max-width: 1440px; margin: 0 auto; padding: 0 20px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
button { font: inherit; }

/* Header */
.site-header { background: var(--card); border-top: 6px solid var(--red); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 28px; padding-top: 14px; padding-bottom: 14px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.brand-logo { height: 64px; width: auto; display: block; }
.brand-mark { background: var(--red); color: #fff; font-weight: 800; letter-spacing: .04em; padding: 10px 12px; border-radius: 4px; font-size: 20px; }
.brand-school { font-weight: 700; font-size: 18px; line-height: 1.2; }
.header-title { border-left: 1px solid var(--line); padding-left: 28px; }
.header-title h1 { margin: 0; font-size: 26px; line-height: 1.15; color: var(--red); letter-spacing: -.01em; }
.header-title p { margin: 2px 0 0; color: var(--ink-3); font-size: 14px; }

/* Advisory notice (inside the header) */
.advisory { background: #fff6e0; border-top: 1px solid #f0d58a; }
.advisory-inner { display: flex; gap: 14px; align-items: flex-start; padding-top: 10px; padding-bottom: 10px; }
.advisory-label { flex: none; margin-top: 1px; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: #fff; background: #8a5a00; padding: 3px 8px; border-radius: 4px; }
.advisory p { margin: 0; font-size: 13.5px; line-height: 1.5; color: #4a3500; max-width: 1150px; }
@media (max-width: 720px) {
  .advisory-inner { flex-direction: column; gap: 6px; }
}

/* Option buttons */
.toolbar { margin: 22px 0 10px; }
.option-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin-bottom: 8px; }
.options { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { border: 1.5px solid var(--pill-line); background: var(--card); color: var(--ink); padding: 9px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; transition: background .15s, border-color .15s, color .15s; }
.opt:hover { border-color: var(--red); color: var(--red); }
.opt[aria-checked="true"] { background: var(--red); border-color: var(--red); color: #fff; }
.opt:focus-visible, .course:focus-visible, .chip:focus-visible { outline: 3px solid #0b62d6; outline-offset: 2px; }

/* Controls */
.controls { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; padding: 12px 0 16px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.toggles { border: 0; margin: 0; padding: 0; display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; }
.toggles legend { float: left; margin-right: 6px; font-size: 13px; color: var(--ink-2); padding: 0; }
.toggle { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-weight: 600; font-size: 14px; user-select: none; }
.toggle input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink-2); }
.toggle .sw { width: 18px; height: 14px; border-radius: 3px; border: 1.5px solid; }
.t-pre .sw  { background: var(--pre-bg);  border-color: var(--pre-line); }
.t-co .sw   { background: var(--co-bg);   border-color: var(--co-line); }
.t-lead .sw { background: var(--lead-bg); border-color: var(--lead-line); }
.toggle input:not(:checked) ~ .sw { opacity: .35; }

.search { position: relative; flex: 0 1 340px; min-width: 220px; }
.search input { width: 100%; padding: 8px 12px; border: 1.5px solid var(--pill-line); border-radius: var(--radius); font: inherit; background: var(--card); }
.search input:focus { outline: none; border-color: var(--red); }
.find-results { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; right: 0; margin: 0; padding: 4px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 320px; overflow: auto; }
.find-results li { padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 14px; }
.find-results li[aria-selected="true"], .find-results li:hover { background: var(--bg); }
.find-results b { color: var(--red); margin-right: 6px; }
.find-results .muted { color: var(--ink-3); font-size: 12px; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 22px; align-items: start; padding-bottom: 40px; }
.status { color: var(--ink-3); padding: 20px 0; }
.status.error { color: var(--red); font-weight: 600; }

/* Plan grid */
.plan-grid { display: grid; grid-template-columns: 78px repeat(3, minmax(0, 1fr)); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  /* clip (not hidden) keeps the rounded corners without breaking the frozen header row */
  overflow: visible; overflow: clip; }
.plan-grid .hd { background: #2b2f36; color: #fff; font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; padding: 9px 12px;
  position: sticky; top: 0; z-index: 5; box-shadow: 0 2px 4px rgba(0,0,0,.18); }
.plan-grid .yr { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 10px 6px; border-top: 2px solid var(--year-sep); background: #fafbfc; font-weight: 700; color: var(--ink-2); text-align: center; }
.plan-grid .yr small { display: block; font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.plan-grid .yr strong { font-size: 24px; line-height: 1; color: var(--ink); }
.term { border-top: 2px solid var(--year-sep); border-left: 2px solid var(--sem-sep); padding: 10px; min-height: 56px; }
.plan-grid .hd.sem { border-left: 2px solid var(--sem-sep); }
.plan-grid .hd + .yr { border-top: 0; }
.plan-grid .hd.sem-fall   { background: var(--fall-hd); }
.plan-grid .hd.sem-spring { background: var(--spring-hd); }
.plan-grid .hd.sem-summer { background: var(--summer-hd); }
.term.sem-fall   { background-color: var(--fall-bg); }
.term.sem-spring { background-color: var(--spring-bg); }
.term.sem-summer { background-color: var(--summer-bg); }
.plan-grid .yr { border-right: 0; }
.term-label { display: none; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin-bottom: 6px; }
.term.empty { background-image: repeating-linear-gradient(135deg, transparent 0 8px, rgba(0,0,0,.05) 8px 9px); }
.courses { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }

.course { display: flex; flex-direction: column; align-items: flex-start; text-align: left; width: 100%; padding: 6px 9px; border: 1.5px solid var(--pill-line); background: var(--pill); border-radius: 6px; cursor: pointer; color: var(--ink); transition: background .12s, border-color .12s, box-shadow .12s, opacity .12s; min-height: 34px; justify-content: center; }
.course:hover { border-color: var(--ink-2); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.course .c-code { font-weight: 700; font-size: 14px; letter-spacing: .01em; }
.course .c-title { font-size: 11.5px; line-height: 1.3; color: var(--ink-3); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.course.placeholder { border-style: dashed; background: #fafbfc; }
.course.coop { background: #eef4fb; border-color: #9db8d6; border-style: solid; }
.course.coop .c-code { color: #234e7d; }

/* Relationship shading */
.has-selection .course:not(.is-sel):not(.is-pre):not(.is-co):not(.is-lead) { opacity: .55; }
.course.is-pre  { background: var(--pre-bg);  border-color: var(--pre-line);  color: var(--pre-ink); }
.course.is-co   { background: var(--co-bg);   border-color: var(--co-line);   color: var(--co-ink); }
.course.is-lead { background: var(--lead-bg); border-color: var(--lead-line); color: var(--lead-ink); }
.course.is-pre .c-title, .course.is-co .c-title, .course.is-lead .c-title { color: inherit; opacity: .85; }
.course.is-sel  { background: var(--sel-bg); border-color: var(--sel-bg); color: var(--sel-ink); box-shadow: 0 2px 8px rgba(166,25,46,.35); opacity: 1; }
.course.is-sel .c-title { color: #fbe3e6; }
.course .tag { margin-top: 3px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }

/* Extra groups (electives) */
.group { margin-top: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.group h3 { margin: 0; padding: 10px 14px; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; border-bottom: 1px solid var(--line); color: var(--ink-2); }
.group h3 span { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--ink-3); margin-left: 6px; }
.group .courses { padding: 12px; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }

/* Detail panel */
.panel { position: sticky; top: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; max-height: calc(100vh - 28px); overflow: auto; }
.panel h2 { margin: 0 0 6px; font-size: 18px; }
.panel-empty p { color: var(--ink-2); margin: 0 0 14px; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 14px; }
.legend li { display: flex; align-items: center; gap: 9px; }
.key { width: 22px; height: 16px; border-radius: 4px; border: 1.5px solid; display: inline-block; }
.k-sel { background: var(--sel-bg); border-color: var(--sel-bg); }
.k-pre { background: var(--pre-bg); border-color: var(--pre-line); }
.k-co { background: var(--co-bg); border-color: var(--co-line); }
.k-lead { background: var(--lead-bg); border-color: var(--lead-line); }

.d-code { display: inline-block; font-size: 13px; font-weight: 700; color: #fff; background: var(--red); padding: 3px 9px; border-radius: 4px; letter-spacing: .03em; }
.d-title { margin: 8px 0 4px; font-size: 19px; line-height: 1.25; }
.d-where { margin: 0 0 12px; font-size: 12.5px; color: var(--ink-3); }
.d-desc { margin: 0 0 6px; color: var(--ink); font-size: 13.5px; line-height: 1.5; white-space: pre-line; }
.d-sec { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 12px; }
.d-sec h3 { margin: 0 0 5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-2); display: flex; font-size: 11.5px; align-items: center; gap: 8px; }
.d-sec h3 .key { width: 14px; height: 11px; }
.d-sec p { margin: 0 0 8px; font-size: 13px; white-space: pre-line; }
.d-sec .none { color: var(--ink-3); font-style: italic; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1.5px solid; cursor: pointer; background: #fff; }
.chip.c-pre  { background: var(--pre-bg);  border-color: var(--pre-line);  color: var(--pre-ink); }
.chip.c-co   { background: var(--co-bg);   border-color: var(--co-line);   color: var(--co-ink); }
.chip.c-lead { background: var(--lead-bg); border-color: var(--lead-line); color: var(--lead-ink); }
.chip.off-plan { border-style: dashed; }
.chip[disabled] { cursor: default; opacity: .75; }
.chip-note { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.d-special { background: #fff7e0; border: 1px solid #f0d58a; border-radius: 6px; padding: 10px 12px; font-size: 13px; white-space: pre-line; }
.d-missing { background: var(--bg); border-radius: 6px; padding: 10px 12px; color: var(--ink-2); font-size: 13px; }
.d-close { float: right; border: 0; background: none; color: var(--ink-3); cursor: pointer; font-size: 13px; text-decoration: underline; }

/* Multi-semester marker (*) */
.multi-mark { color: var(--red); font-weight: 800; margin-left: 2px; font-size: 1.05em; line-height: 1; }
.course.is-sel .multi-mark { color: #fff; }
.course.is-pre .multi-mark, .course.is-co .multi-mark, .course.is-lead .multi-mark { color: inherit; }
.multi-mark.big { font-size: 18px; margin: 0 6px 0 0; vertical-align: -3px; }
.multi-legend { display: flex; align-items: center; gap: 2px; margin: -6px 0 14px; padding: 0 0 10px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.d-multi { display: flex; gap: 6px; align-items: flex-start; background: #fdf0f2; border: 1px solid #efc3ca; border-radius: 6px; padding: 9px 12px; margin: 10px 0 4px; font-size: 13px; }
.d-multi strong { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--red-dark); margin-bottom: 2px; }
.d-multi-text { white-space: pre-line; }
.d-sec h3 .multi-mark.big { font-size: 16px; margin-right: 2px; vertical-align: -2px; }

/* Links inside course text */
.ext-link { color: #0b5cad; text-decoration: underline; overflow-wrap: anywhere; word-break: break-word; }
.ext-link:hover { color: #073f78; }
.ext-link::after { content: " ↗"; font-size: .85em; text-decoration: none; display: inline-block; }

/* Floating "current option" bar (appears once the option buttons scroll out of view) */
:root { --float-h: 46px; }
.float-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 30; height: var(--float-h); background: var(--red); color: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.2); transform: translateY(-110%); transition: transform .2s ease; }
.opt-floating .float-bar { transform: none; }
.float-inner { display: flex; align-items: center; gap: 12px; height: 100%; }
.float-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; opacity: .85; }
.float-name { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.float-switch { margin-left: auto; }
.float-switch select { font: inherit; font-size: 13px; padding: 4px 8px; border-radius: 6px; border: 1px solid rgba(255,255,255,.6); background: #fff; color: var(--ink); max-width: 220px; }
.float-top { font: inherit; font-size: 13px; font-weight: 600; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.7); border-radius: 6px; padding: 4px 10px; cursor: pointer; white-space: nowrap; }
.float-top:hover { background: rgba(255,255,255,.15); }
.float-switch select:focus-visible, .float-top:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
/* Keep the frozen semester row and the details panel below the bar */
.opt-floating .plan-grid .hd { top: var(--float-h); }
.opt-floating .panel { top: calc(var(--float-h) + 12px); max-height: calc(100vh - var(--float-h) - 24px); }
@media (prefers-reduced-motion: reduce) { .float-bar { transition: none; } }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--card); color: var(--ink-3); font-size: 13px; }
.footer-mid { display: flex; flex-direction: column; gap: 2px; }
.visit-count b { color: var(--ink); font-variant-numeric: tabular-nums; }
.footer-credit { display: block; margin-top: 2px; font-size: 12.5px; }
.footer-inner { display: flex; gap: 10px 24px; flex-wrap: wrap; justify-content: space-between; padding-top: 14px; padding-bottom: 14px; }
.site-footer a { color: var(--red); }

/* Responsive */
@media (max-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; order: -1; }
  .panel-empty .legend { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .float-label, .float-top { display: none; }
  .float-name { font-size: 15px; }
  .float-switch select { max-width: 150px; }
  .wrap { padding: 0 16px; }
  .header-title { border-left: 0; padding-left: 0; }
  .header-title h1 { font-size: 22px; }
  .plan-grid { grid-template-columns: 1fr; }
  .plan-grid .hd.sem { display: none; }
  .plan-grid .hd { position: static; box-shadow: none; }
  .plan-grid .yr { flex-direction: row; gap: 8px; justify-content: flex-start; padding: 8px 12px; background: #2b2f36; color: #fff; }
  .plan-grid .yr small, .plan-grid .yr strong { color: #fff; font-size: 14px; }
  .term { border-left: 0; border-top: 2px solid var(--sem-sep); }
  .term.sem-fall .term-label   { color: var(--fall-hd); }
  .term.sem-spring .term-label { color: var(--spring-hd); }
  .term.sem-summer .term-label { color: var(--summer-hd); }
  .term-label { display: block; }
  .term.empty { display: none; }
  .courses { grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); }
}
@media print {
  .float-bar { display: none; }
  .controls, .site-footer a, .toolbar .opt:not([aria-checked="true"]) { display: none; }
  .layout { grid-template-columns: 1fr; }
  .panel { position: static; }
}
