/* gradplan
   SFU red marks what is happening now (in progress) and every action.
   Ink marks what is finished. Light red marks what is planned. */

:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #ffffff;
  --sunk: #ebebe8;
  --ink: #15171c;
  --ink-2: #3a3e47;
  --muted: #676c77;
  --line: #e0e1dd;
  --line-strong: #c3c5bf;

  --red: #a6192e;
  --red-dark: #84121f;
  --red-tint: #f7e5e7;
  --red-soft: #e6aab3;

  --done-fill: #15171c;
  --done-card: #e9e9e6;
  --on-red: #ffffff;

  --radius: 6px;
  --gap: 24px;
  --font: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111215;
    --surface: #1a1c20;
    --sunk: #24262b;
    --ink: #eef0f2;
    --ink-2: #cdd0d6;
    --muted: #a3a8b2;
    --line: #2d3036;
    --line-strong: #464a52;
    --red: #e34a60;
    --red-dark: #f06b7e;
    --red-tint: #3b1d23;
    --red-soft: #7d3440;
    --done-fill: #eef0f2;
    --done-card: #26282d;
    --on-red: #111215;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: 15px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-variation-settings: "wdth" 100;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.15; font-weight: 750; }
p { margin: 0; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.867rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Display type: wide Archivo carries the hierarchy */
.display {
  font-variation-settings: "wdth" 120;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 clamp(16px, 4vw, 40px);
  height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-variation-settings: "wdth" 125;
  font-weight: 800;
  font-size: 1.333rem;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.topbar-right { display: flex; align-items: center; gap: clamp(8px, 2vw, 20px); height: 100%; min-width: 0; }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.account-email { font-size: 0.8rem; color: var(--muted); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topnav { display: flex; gap: 4px; height: 100%; }
.topnav a {
  display: flex; align-items: center;
  padding: 0 12px;
  color: var(--muted);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.topnav a:hover { color: var(--ink); }
.topnav a.is-current { color: var(--ink); border-bottom-color: var(--red); }

.page { max-width: 1440px; margin: 0 auto; padding: 32px clamp(16px, 4vw, 40px) 64px; }

/* Buttons: colour changes on hover, never opacity */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--red);
  border-radius: var(--radius);
  background: var(--red);
  color: var(--on-red);
  font: inherit; font-weight: 650; font-size: 0.933rem;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--red-dark); border-color: var(--red-dark); }
.button:disabled { background: var(--line-strong); border-color: var(--line-strong); cursor: progress; }
.button-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.button-secondary:hover { background: var(--sunk); border-color: var(--ink); }
.button-small { min-height: 32px; padding: 0 12px; font-size: 0.867rem; }
.button-danger { background: var(--surface); color: var(--red); border-color: var(--red); }
.button-danger:hover { background: var(--red); color: var(--on-red); }
.text-button {
  background: none; border: 0; padding: 0;
  font: inherit; font-weight: 600; font-size: 0.867rem;
  color: var(--ink-2); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line-strong);
}
.text-button:hover { color: var(--ink); text-decoration-color: var(--ink); }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--ink); color: var(--bg);
  font-weight: 550;
  z-index: 20;
}
.toast-alert { background: var(--red); color: var(--on-red); }

/* ---------- Setup ---------- */
.setup { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
.setup-intro { position: sticky; top: 32px; padding-top: 24px; }
.setup-intro h1 { font-size: clamp(2.4rem, 4.6vw, 4rem); max-width: 12ch; }
.setup-intro .lede { font-size: 1.133rem; color: var(--ink-2); max-width: 44ch; margin-top: 20px; }
.setup-intro .fine { margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.867rem; max-width: 44ch; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.setup-form { padding: 8px 28px 28px; }
.step { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 0 12px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.step:last-of-type { border-bottom: 0; }
.step-number {
  font-variation-settings: "wdth" 125; font-weight: 800; font-size: 1.2rem;
  color: var(--red); line-height: 1.6;
}
.step-body { display: grid; gap: 16px; }
.step h2 { font-size: 1.133rem; line-height: 1.6; }

/* Forms */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field-row { display: flex; flex-wrap: wrap; gap: 16px; }
.field-row > .field { flex: 1 1 160px; }
.field-row > .field-small { flex: 0 1 110px; }
label, .label { font-weight: 600; font-size: 0.933rem; }
input[type="text"], input[type="number"], select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  font: inherit; font-size: 0.933rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
input[type="text"]:hover, input[type="number"]:hover, select:hover, textarea:hover { border-color: var(--ink-2); }
textarea { resize: vertical; }
input[type="file"] { font: inherit; font-size: 0.933rem; max-width: 100%; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--red); width: 16px; height: 16px; margin: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.checks-stacked { flex-direction: column; gap: 8px; }
.auth-tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--sunk); border-radius: var(--radius); }
.auth-tab {
  padding: 6px 14px; border: 0; border-radius: calc(var(--radius) - 3px);
  background: transparent; color: var(--muted);
  font: inherit; font-weight: 650; font-size: 0.9rem; cursor: pointer;
}
.auth-tab.is-current { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }
.form-errors { background: var(--red-tint); color: var(--ink); border-radius: var(--radius); padding: 12px 14px; }
.form-errors ul { margin: 4px 0 0; padding-left: 18px; }
.form-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Two big choices, used for BSc or BA and for the planner source */
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice-box {
  display: grid; gap: 4px; height: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}
.choice-box strong { font-size: 1rem; }
.choice-box span { font-size: 0.867rem; color: var(--muted); font-weight: 400; }
.choice:hover .choice-box { border-color: var(--ink-2); }
.choice input:checked + .choice-box { border-color: var(--red); box-shadow: inset 0 0 0 1px var(--red); background: var(--red-tint); }
.choice input:focus-visible + .choice-box { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- Plan page ---------- */
.summary {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 24px; align-items: end;
  padding-bottom: 28px; margin-bottom: 28px; border-bottom: 1px solid var(--line);
}
.summary-program { color: var(--ink-2); font-weight: 600; }
.summary-program span { color: var(--muted); font-weight: 400; }
.big-number { font-size: clamp(2.6rem, 6vw, 4.6rem); line-height: 1; margin-top: 10px; }
.big-number small { font-size: 0.4em; font-variation-settings: "wdth" 100; font-weight: 600; letter-spacing: 0; color: var(--ink-2); margin-left: 6px; }
.summary-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.runway { grid-column: 1 / -1; margin-top: 18px; }
.slots { display: grid; grid-template-columns: repeat(40, minmax(0, 1fr)); gap: 3px; }
.slot { height: 26px; border-radius: 2px; background: var(--sunk); }
.slot-completed { background: var(--done-fill); }
.slot-in_progress { background: var(--red); }
.slot-planned { background: var(--red-soft); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 12px; font-size: 0.933rem; color: var(--ink-2); }
.legend strong { color: var(--ink); font-weight: 700; }
.legend .key { display: inline-flex; align-items: center; gap: 8px; }
.legend .key::before { content: ""; width: 12px; height: 12px; border-radius: 2px; background: var(--sunk); }
.key-completed::before { background: var(--done-fill) !important; }
.key-in_progress::before { background: var(--red) !important; }
.key-planned::before { background: var(--red-soft) !important; }
.status-line { grid-column: 1 / -1; font-weight: 650; margin-top: 4px; }
.status-line.is-complete { color: var(--red); }

.workspace { display: grid; grid-template-columns: minmax(330px, 410px) minmax(0, 1fr); gap: 32px; align-items: start; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 1.333rem; font-variation-settings: "wdth" 115; font-weight: 800; letter-spacing: -0.01em; }

/* Requirement progress rows */
.progress {
  position: sticky; top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding-right: 4px;
}
.rows { display: grid; gap: 8px; }
.row { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.row.is-linked, .row.is-active { border-color: var(--ink); }
.row-toggle {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px;
  width: 100%; padding: 14px 16px;
  background: none; border: 0; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.row-name { font-weight: 650; }
.row-count { font-size: 0.867rem; color: var(--muted); white-space: nowrap; }
.row-count strong { color: var(--ink); font-weight: 650; }
.row-done .row-count strong { color: var(--muted); font-weight: 500; }
.bar { grid-column: 1 / -1; display: flex; height: 8px; border-radius: 2px; background: var(--sunk); overflow: hidden; }
.bar span { display: block; height: 100%; }
.bar-completed { background: var(--done-fill); }
.bar-in_progress { background: var(--red); }
.bar-planned { background: var(--red-soft); }
.row-note { grid-column: 1 / -1; font-size: 0.867rem; color: var(--muted); }
.row-open .row-note { color: var(--red); font-weight: 550; }
.row-toggle[aria-expanded="true"] .row-note { display: none; }

.row-detail { padding: 0 16px 16px; display: grid; gap: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.req { display: grid; gap: 6px; }
.req.is-linked .req-name { text-decoration: underline; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.req-head { display: flex; justify-content: space-between; gap: 12px; font-size: 0.933rem; }
.req-name { font-weight: 600; }
.req-state { font-size: 0.8rem; font-weight: 650; color: var(--muted); white-space: nowrap; }
.req-open .req-state { color: var(--red); }
.req-left { font-size: 0.867rem; color: var(--ink-2); }
.req-note { font-size: 0.8rem; color: var(--muted); }
.codes { display: flex; flex-wrap: wrap; gap: 4px; }
.code {
  display: inline-flex; align-items: center;
  min-height: 24px; padding: 0 7px;
  border-radius: 4px;
  font-size: 0.8rem; font-weight: 650;
  background: var(--sunk); color: var(--ink);
}
.code-completed { background: var(--done-card); }
.code-in_progress { background: var(--red-tint); color: var(--red); }
.code-planned { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.add-code {
  min-height: 26px; padding: 0 8px;
  border: 1px solid var(--line-strong); border-radius: 4px;
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 0.8rem; font-weight: 650; cursor: pointer;
}
.add-code:hover { border-color: var(--red); color: var(--red); }
.options-label { font-size: 0.8rem; color: var(--muted); width: 100%; }

/* Terms */
.terms-area { min-width: 0; display: grid; gap: 16px; }
.term-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(232px, 100%), 1fr)); gap: 12px; align-items: start; }
.term, .tray {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; align-content: start;
  min-width: 0;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.term.is-over, .tray.is-over { border-color: var(--red); background: var(--red-tint); }
.term-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 2px 2px 4px; }
.term-head h3 { font-size: 1rem; font-variation-settings: "wdth" 112; font-weight: 750; }
.term-units { font-size: 0.8rem; color: var(--muted); }
.term-current .term-head h3::after { content: " (now)"; font-variation-settings: "wdth" 100; font-weight: 500; color: var(--red); font-size: 0.8rem; }
.cards { display: grid; gap: 6px; min-height: 8px; }
.tray .cards { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.term > .text-button { justify-self: start; padding-left: 2px; }
.term-controls { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-left: 2px; }
.term-internship { background: var(--sunk); border-style: dashed; }
.term-tag {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--red); color: #fff;
  font-size: 0.68rem; font-weight: 700; font-variation-settings: "wdth" 100;
  letter-spacing: 0.02em; text-transform: uppercase; vertical-align: middle;
}
.term-note { font-size: 0.8rem; color: var(--muted); line-height: 1.4; padding: 4px 2px; }
input[type="file"]::file-selector-button {
  margin-right: 12px; min-height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; font-size: 0.867rem; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { border-color: var(--ink); background: var(--sunk); }

.card {
  display: grid; gap: 2px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line-strong);
  cursor: grab;
  user-select: none;
}
.card-completed { background: var(--done-card); box-shadow: none; }
.card-in_progress { background: var(--red-tint); box-shadow: none; }
.card-planned { background: var(--surface); box-shadow: none; border: 1px dashed var(--line-strong); padding: 9px 11px; }
.card:hover, .card.is-linked, .card.is-active { box-shadow: inset 0 0 0 2px var(--ink); }
.card-planned:hover, .card-planned.is-linked, .card-planned.is-active { border-color: var(--ink); border-style: solid; box-shadow: inset 0 0 0 1px var(--ink); }
.card.is-dragging { opacity: 0.35; }
.card-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.card-code {
  padding: 0; border: 0; background: none; color: inherit; cursor: pointer;
  font: inherit; font-weight: 750; font-size: 1rem; letter-spacing: 0.005em;
  font-variation-settings: "wdth" 108;
}
.card-units { font-size: 0.8rem; color: var(--muted); }
.card-title { font-size: 0.8rem; color: var(--ink-2); line-height: 1.35; }
.card-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 4px; font-size: 0.8rem; }
.card-status { font-weight: 650; }
.card-in_progress .card-status { color: var(--red); }
.card-planned .card-status { color: var(--muted); }
.card-counts { color: var(--muted); text-align: right; }

.add-course { display: flex; gap: 6px; }
.add-course input[type="text"] { flex: 1 1 0; min-width: 0; min-height: 34px; padding: 6px 8px; font-size: 0.867rem; }
.add-course .button { flex: none; }
.term-new { border-style: dashed; background: transparent; }
.term-new-fields { display: flex; gap: 6px; }
.term-new-fields select { flex: 1 1 0; min-width: 0; }
.term-new-fields input[type="number"] { flex: 0 0 84px; width: 84px; }
.tray { border-style: dashed; }

/* Settings and other pages */
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); }
.narrow { max-width: 720px; }
.stack { display: grid; gap: 20px; }
.panel-body { padding: 24px; display: grid; gap: 16px; }
.panel-body h2 { font-size: 1.133rem; }
.danger { border-color: var(--red-soft); }

/* Dialog */
.modal { border: 0; padding: 0; border-radius: 10px; width: min(560px, calc(100vw - 32px)); background: var(--surface); color: var(--ink); }
.modal::backdrop { background: rgba(10, 11, 14, 0.5); }
.modal-body { padding: 24px; display: grid; gap: 18px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { font-size: 1.333rem; font-variation-settings: "wdth" 115; font-weight: 800; }

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .progress { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .rows { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); align-items: start; }
}

@media (max-width: 860px) {
  .setup { grid-template-columns: 1fr; }
  .setup-intro { position: static; padding-top: 0; }
  .summary { grid-template-columns: 1fr; }
  .summary-actions { justify-content: flex-start; }
}

@media (max-width: 560px) {
  .topbar { height: auto; min-height: 60px; flex-wrap: wrap; gap: 8px; padding-top: 8px; padding-bottom: 8px; }
  .topbar-right { gap: 10px; }
  .topnav a { padding: 0 8px; font-size: 0.867rem; }
  .account-email { max-width: 14ch; }
  .slots { grid-template-columns: repeat(20, minmax(0, 1fr)); }
  .slot { height: 18px; }
  .setup-form { padding: 4px 18px 18px; }
  .field-row { flex-direction: column; gap: 10px; }
}
