/**
 * @file app.css
 * @description Presentation for the Semester dashboard. Tokens and rationale live in
 *              DESIGN.md at the project root; this file implements them.
 *
 * @status Active
 * @issues None
 * @todo None
 */

:root {
  --paper: oklch(98.8% 0.004 30);
  --paper-sunk: oklch(96.6% 0.006 30);
  --rule: oklch(90.5% 0.008 30);
  --rule-firm: oklch(83% 0.010 30);

  --ink: oklch(23% 0.014 262);
  --ink-2: oklch(46% 0.011 262);
  --ink-3: oklch(62% 0.009 262);

  --classes: oklch(48% 0.128 255);
  --blackboard: oklch(58% 0.145 62);
  --athletics: oklch(49% 0.17 20);
  --orgs: oklch(52% 0.095 195);
  --greek: oklch(50% 0.115 300);

  /* Official University of Arkansas cardinal (#9D2235), plus a hover/active pair. */
  --brand: oklch(42% 0.145 22);
  --brand-hi: oklch(37% 0.145 22);
  --brand-soft: oklch(95.5% 0.022 22);

  --good: oklch(50% 0.11 155);
  --warn: oklch(58% 0.145 62);
  --bad: oklch(52% 0.18 25);

  --t-xs: 0.6875rem;
  --t-sm: 0.8125rem;
  --t-base: 0.9375rem;
  --t-md: 1.125rem;
  --t-lg: 1.5rem;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 160ms;
}

*, *::before, *::after { box-sizing: border-box; }

/* The `hidden` attribute is enforced by the UA rule `[hidden] { display: none }`, which
   has the same specificity as a single class — so any component that sets its own
   `display` silently wins and stays on screen while the DOM says it is hidden. That is
   not a hypothetical: `.quiz` set `display: flex`, and the empty quiz overlay covered the
   whole dashboard with a dead Continue button on it. Make the attribute authoritative. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 var(--t-base)/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -0.011em; }
p { margin: 0; }
button, input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
}

/* The old centred-column rule lived here. It has to stay gone: <main> is now a grid item,
   and `margin-inline: auto` on a grid item disables stretch — the element shrinks to
   fit-content and centres itself, which is not what auto margins do in normal flow.
   Sizing for the content plane belongs to .content. */

/* --------------------------------------------------------------------- the shell

   Two planes. The sidebar COMMITS to the theme — it is a saturated brand surface and
   carries the identity: motif, letters, chapter name. The content plane stays paper, so
   the thing you actually came to read is quiet no matter how loud the theme is.

   That split is what makes a full identity takeover compatible with a twenty-second
   reading task. Committing everywhere would make a busy Tuesday unreadable. */

.shell {
  display: grid;
  grid-template-columns: 272px minmax(0, 1fr);
  min-height: 100vh;
}

/* ------------------------------------------------------------------- sidebar */

.side {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--brand);
  color: var(--paper);
  padding: 22px 18px 18px;
}

/* The identity block. The motif is a real presence rather than a texture: large, bled off
   the bottom edge, and legible as architecture. */
.side-identity { position: relative; flex: none; padding-bottom: 20px; }

.side-motif {
  position: absolute;
  right: -34px;
  bottom: -26px;
  width: 190px;
  color: var(--paper);
  opacity: 0.14;
  pointer-events: none;
}

.side-motif svg { width: 100%; height: auto; display: block; }

.side-letters {
  position: relative;
  font-size: 2.125rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  margin-bottom: 6px;
  min-height: 1px;
}

.side-letters:empty { display: none; }

.side-theme {
  position: relative;
  font-size: var(--t-base);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.side-term {
  position: relative;
  font-size: var(--t-sm);
  opacity: 0.72;
}

/* ---------------------------------------------------------------- navigation */

.side-nav {
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 22px;
}

.navlink {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--t-sm);
  text-align: left;
  cursor: pointer;
  opacity: 0.78;
  transition: background 150ms var(--ease), opacity 150ms var(--ease);
}

.navlink:hover { opacity: 1; background: oklch(from var(--paper) l c h / 0.10); }

/* Selected state is a filled plate, not a side stripe. */
.navlink.is-on {
  opacity: 1;
  font-weight: 600;
  background: oklch(from var(--paper) l c h / 0.17);
}

.navlink-meta { font-size: var(--t-xs); opacity: 0.7; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ sources */

.side-sources { flex: 1; min-height: 0; overflow-y: auto; }

.side-label {
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-bottom: 8px;
}

.side-foot { flex: none; padding-top: 14px; border-top: 1px solid oklch(from var(--paper) l c h / 0.2); }

.side-actions { display: flex; gap: 6px; margin: 10px 0 8px; }
.side-actions .btn { flex: 1; padding: 8px 10px; }

/* On the brand plane the primary button must invert, or it disappears into the ground. */
.side .btn-primary { background: var(--paper); color: var(--brand); }
.side .btn-primary:hover { background: oklch(from var(--paper) calc(l - 0.05) c h); }
.side .btn-quiet { border-color: oklch(from var(--paper) l c h / 0.35); color: var(--paper); }
.side .btn-quiet:hover { background: oklch(from var(--paper) l c h / 0.12); }
.side .btn-ghost { color: var(--paper); opacity: 0.7; }
.side .btn-ghost:hover { opacity: 1; background: oklch(from var(--paper) l c h / 0.12); }

.side-lastsync { font-size: var(--t-xs); opacity: 0.65; }
.side-signout { margin-top: 10px; padding-left: 0; }

.side .status-line { color: inherit; opacity: 0.85; font-size: var(--t-sm); }

/* ------------------------------------------------------------------ content */

.content {
  min-width: 0;
  padding: 34px clamp(24px, 4vw, 56px) 72px;
  max-width: 1080px;
}

.view[hidden] { display: none; }

/* Below the sidebar's useful width the themed plane becomes a compact bar rather than a
   stacked copy of itself. The mistake to avoid is reproducing the full sidebar
   horizontally: sync controls and a source list are worth a column, not a whole screen
   above the schedule. */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }

  .side {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "id nav sync";
    align-items: center;
    gap: 14px;
    padding: 10px 16px;
  }

  .side-identity {
    grid-area: id;
    padding-bottom: 0;
    display: flex;
    align-items: baseline;
    gap: 8px;
  }

  /* The motif is a sidebar-scale gesture; at bar height it is just clutter. */
  .side-motif { display: none; }
  .side-letters { font-size: 1.0625rem; margin-bottom: 0; }
  .side-term { display: none; }

  .side-nav {
    grid-area: nav;
    flex-direction: row;
    gap: 2px;
    margin-bottom: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .side-nav::-webkit-scrollbar { display: none; }
  .navlink { width: auto; padding: 7px 10px; white-space: nowrap; }
  .navlink-meta { display: none; }

  /* Sources live in Settings on a narrow screen; the bar keeps only what is actionable. */
  .side-sources { display: none; }

  .side-foot {
    grid-area: sync;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 0;
    border-top: 0;
  }

  .side-foot .status-line,
  .side-lastsync,
  .side-foot #preview,
  .side-signout { display: none; }

  .side-actions { margin: 0; }
  .side-actions .btn { padding: 7px 12px; }

  .content { padding: 22px 18px 64px; }
}

/* Narrower still: the nav scrolls and the identity gives up its name. */
@media (max-width: 520px) {
  .side-theme { display: none; }
  .setting { padding: 20px 0; }
}

/* -------------------------------------------------------------- term ruler */

.ruler-section { margin: 18px 0 44px; }

.ruler {
  position: relative;
  height: 22px;
  margin-bottom: 8px;
}

.ruler-track,
.ruler-elapsed {
  position: absolute;
  top: 9px;
  height: 3px;
  border-radius: 2px;
}

.ruler-track { left: 0; right: 0; background: var(--rule); }
.ruler-elapsed { left: 0; background: var(--brand); width: 0; transition: width 400ms var(--ease); }

.ruler-breaks { position: absolute; inset: 0; }

.ruler-break {
  position: absolute;
  top: 9px;
  height: 3px;
  background: var(--paper);
  border-top: 1px solid var(--rule-firm);
  border-bottom: 1px solid var(--rule-firm);
}

.ruler-today {
  position: absolute;
  top: 2px;
  width: 2px;
  height: 17px;
  background: var(--brand);
  transform: translateX(-1px);
}

.ruler-today-flag {
  position: absolute;
  top: -19px;
  left: 50%;
  transform: translateX(-50%);
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
  white-space: nowrap;
}

/* At the very start or end of term the centered flag would hang off the content edge. */
.ruler-today.at-start .ruler-today-flag { left: 0; transform: none; }
.ruler-today.at-end .ruler-today-flag { left: auto; right: 0; transform: none; }

.ruler-ends {
  display: flex;
  justify-content: space-between;
  font-size: var(--t-xs);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.ruler-mid { color: var(--ink-2); font-weight: 600; }

/* ------------------------------------------------------------------ notices */

.notice {
  padding: 12px 14px;
  border: 1px solid var(--rule-firm);
  border-radius: 6px;
  font-size: var(--t-sm);
  margin-bottom: 24px;
}

.notice-bad { border-color: var(--bad); color: var(--bad); }
.notice-warn { border-color: var(--warn); color: oklch(42% 0.11 62); }

/* -------------------------------------------------------------- section head */

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--rule-firm);
}

.section-head h2 { font-size: var(--t-md); }
.section-note { font-size: var(--t-sm); color: var(--ink-3); }

/* -------------------------------------------------------------------- setup */

.setup { margin-bottom: 44px; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }

.step {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: start;
  gap: 14px;
  padding: 16px 2px;
  border-bottom: 1px solid var(--rule);
}

.step:last-child { border-bottom: none; }

.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--rule-firm);
  display: grid;
  place-items: center;
  font-size: var(--t-xs);
  font-weight: 600;
  color: var(--ink-2);
  margin-top: 1px;
}

.step-done .step-num { background: var(--brand); border-color: var(--brand); color: var(--paper); }
.step-done .step-title { color: var(--ink-2); }

.step-title { font-weight: 500; }
.step-detail { font-size: var(--t-sm); color: var(--ink-3); margin-top: 2px; }
.step-slot { grid-column: 2 / -1; }

/* ------------------------------------------------------------------ columns */



/* ------------------------------------------------------------------- agenda */

.range { display: flex; gap: 2px; }

.range-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 4px 9px;
  font-size: var(--t-sm);
  color: var(--ink-3);
  cursor: pointer;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}

.range-btn:hover { color: var(--ink); background: var(--paper-sunk); }
.range-btn.is-on { color: var(--brand); background: var(--brand-soft); border-color: var(--rule-firm); }

.agenda-day { margin-top: 26px; }

.agenda-day-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 6px;
}

.agenda-day-name { font-size: var(--t-sm); font-weight: 600; }
.agenda-day-date { font-size: var(--t-sm); color: var(--ink-3); }
.agenda-today .agenda-day-name::after {
  content: "today";
  margin-left: 8px;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.entry {
  display: grid;
  grid-template-columns: 124px 14px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  padding: 9px 2px;
  border-top: 1px solid var(--rule);
}

.entry-time { font-size: var(--t-sm); color: var(--ink-2); white-space: nowrap; }
.entry-mark { width: 7px; height: 7px; border-radius: 50%; align-self: center; }
.entry-mark-classes { background: var(--classes); }
.entry-mark-blackboard { background: var(--blackboard); }
.entry-mark-athletics { background: var(--athletics); }
.entry-mark-orgs { background: var(--orgs); }
.entry-mark-greek { background: var(--greek); }

.entry-title { min-width: 0; }
.entry-meta { font-size: var(--t-sm); color: var(--ink-3); }

.empty {
  padding: 40px 0 8px;
  color: var(--ink-3);
  font-size: var(--t-sm);
  max-width: 46ch;
}

.empty strong { display: block; color: var(--ink); font-weight: 500; margin-bottom: 4px; font-size: var(--t-base); }

/* -------------------------------------------------------------------- panels */








.panel-collapsed > summary { padding: 14px 16px; margin: 0; cursor: pointer; list-style: none; }
.panel-collapsed > summary::-webkit-details-marker { display: none; }
.panel-collapsed > summary::after { content: " +"; color: var(--ink-3); }



.sources { list-style: none; margin: 0 0 14px; padding: 0; }

.source {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--t-sm);
}

.source:last-child { border-bottom: none; }
.source-mark { width: 7px; height: 7px; border-radius: 50%; align-self: center; flex: none; }
.source-name { flex: 1; }
.source-count { color: var(--ink-3); }
.source-blocked .source-name, .source-blocked .source-count { color: var(--ink-3); }




/* ---------------------------------------------------------------- sync steps */

.sync-steps { margin-bottom: 14px; border-top: 1px solid var(--rule); }

.sync-step {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--t-sm);
}

.sync-step-icon { color: var(--ink-3); text-align: center; }
.sync-step-detail { font-size: var(--t-xs); color: var(--ink-3); }
.sync-step-error { color: var(--bad); }
.sync-step-done .sync-step-icon { color: var(--good); }

/* ------------------------------------------------------------------ controls */

.btn {
  appearance: none;
  border: 1px solid var(--rule-firm);
  background: var(--paper);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: var(--t-sm);
  font-weight: 500;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), opacity var(--fast) var(--ease);
}

.btn:hover { border-color: var(--ink-3); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn:disabled:hover { border-color: var(--rule-firm); }

.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--paper); }
.btn-primary:hover { background: var(--brand-hi); border-color: var(--brand-hi); }

.btn-quiet { background: transparent; border-color: var(--rule-firm); color: var(--ink-2); }
.btn-quiet:hover { color: var(--ink); }

.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-3); padding: 4px 8px; }
.btn-ghost:hover { color: var(--ink); border-color: var(--rule-firm); }

/* switch */

.switch-row { display: flex; align-items: flex-start; gap: 11px; }
.switch { flex: none; margin-top: 1px; }
.switch input { position: absolute; opacity: 0; width: 36px; height: 20px; margin: 0; cursor: pointer; }

.switch-track {
  display: block;
  width: 36px;
  height: 20px;
  border-radius: 10px;
  background: var(--rule-firm);
  transition: background var(--fast) var(--ease);
}

.switch-thumb {
  display: block;
  width: 16px;
  height: 16px;
  margin: 2px;
  border-radius: 50%;
  background: var(--paper);
  transition: transform var(--fast) var(--ease);
}

.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(16px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--brand); outline-offset: 2px; }

.switch-label { display: flex; flex-direction: column; font-size: var(--t-sm); }
.switch-note { font-size: var(--t-xs); color: var(--ink-3); margin-top: 1px; }

.time-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: var(--t-sm); color: var(--ink-2); }
.time-row input { border: 1px solid var(--rule-firm); border-radius: 5px; padding: 4px 7px; background: var(--paper); }

/* fields */

.field { padding: 14px 0; border-bottom: 1px solid var(--rule); }
.field:last-child { border-bottom: none; padding-bottom: 0; }
.field > label { display: block; font-size: var(--t-xs); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 7px; }
.field input[type="url"] { width: 100%; border: 1px solid var(--rule-firm); border-radius: 5px; padding: 7px 9px; background: var(--paper); font-size: var(--t-sm); margin-bottom: 7px; }
.field-note { font-size: var(--t-xs); color: var(--ink-3); margin-bottom: 9px; line-height: 1.45; }
.field-result { font-size: var(--t-xs); margin-top: 8px; }
.field-result.is-good { color: var(--good); }
.field-result.is-bad { color: var(--bad); }

/* paste */

.paste { margin-top: 12px; }
.paste-help { font-size: var(--t-sm); color: var(--ink-2); margin-bottom: 8px; max-width: 62ch; }

.paste textarea {
  width: 100%;
  border: 1px solid var(--rule-firm);
  border-radius: 6px;
  padding: 10px;
  background: var(--paper);
  font-size: var(--t-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

.paste-actions { display: flex; gap: 8px; margin-top: 10px; }
.paste-preview:not(:empty) { margin-top: 14px; border-top: 1px solid var(--rule); }

.parsed {
  display: grid;
  grid-template-columns: auto auto auto minmax(0, 1fr);
  gap: 4px 14px;
  padding: 10px 0;
  font-size: var(--t-sm);
  border-bottom: 1px solid var(--rule);
}

.parsed-course { font-weight: 500; }
.parsed-dim { color: var(--ink-3); }

/* ---------------------------------------------------------------------- tabs */

.views { min-width: 0; }





/* Selected marker is cardinal chrome — see DESIGN.md, color strategy. */
.tab::after {
  content: "";
  position: absolute;
  inset: auto 0 -1px 0;
  height: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transition: transform var(--fast) var(--ease);
}



.tab.is-on::after { transform: scaleX(1); }
.tab:focus-visible { outline-offset: 4px; border-radius: 2px; }

/* ------------------------------------------------------------------ calendar */

/* The month grid earns the full width; the rail stacks beneath it. */


.cal-dow {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
}

.cal-dow span {
  padding: 0 0 8px 2px;
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* Hairlines are drawn by a 1px gap over a rule-colored ground — no cell borders. */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.cal-cell {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 98px;
  padding: 6px 6px 8px;
  background: var(--paper);
  border: 0;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}

.cal-cell:hover { background: var(--paper-sunk); }
.cal-cell:focus-visible { outline-offset: -2px; }
.cal-cell.is-sel { box-shadow: inset 0 0 0 2px var(--brand); }

/* Days off and days outside the term read as gaps, the way the ruler shows them. */
.cal-blank { background: var(--paper-sunk); cursor: default; }
.cal-off { background: var(--paper-sunk); }
.cal-off .cal-num { color: var(--ink-3); font-weight: 400; }

.cal-num { font-size: var(--t-sm); font-weight: 500; color: var(--ink-2); }

.cal-today .cal-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  /* Without this the span stretches to the cell width and the disc becomes an ellipse. */
  align-self: flex-start;
  min-width: 21px;
  height: 21px;
  margin: -2px 0 0 -3px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--paper);
  font-weight: 600;
}

.cal-ev {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  font-size: var(--t-xs);
  line-height: 1.4;
  color: var(--ink-2);
}

.cal-ev-mark { width: 6px; height: 6px; border-radius: 50%; }
.cal-ev-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-ev-time { color: var(--ink-3); }
.cal-more { padding-left: 11px; font-size: var(--t-xs); color: var(--ink-3); }
.cal-off-label { font-size: var(--t-xs); color: var(--ink-3); }

.cal-detail {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

.cal-detail-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.cal-detail-day { font-size: var(--t-sm); font-weight: 600; }
.cal-detail-note { font-size: var(--t-sm); color: var(--ink-3); }

/* --------------------------------------------------------------- assignments */

.assign-list { margin-top: 4px; }

.assign-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 10px;
  padding: 10px 2px;
  border-top: 1px solid var(--rule);
}

.assign-row:first-child { border-top: none; }

/* A real checkbox, sized up. The tick is ink: done is a state, not a source. */
.assign-check {
  appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1px solid var(--rule-firm);
  border-radius: 4px;
  background: var(--paper);
  cursor: pointer;
  position: relative;
  align-self: center;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}

.assign-check:hover { border-color: var(--ink-2); }
.assign-check:checked { background: var(--brand); border-color: var(--brand); }

.assign-check:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 4px;
  height: 9px;
  border: solid var(--paper);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.assign-check:disabled { opacity: 0.45; cursor: default; }

.assign-title { min-width: 0; }
.assign-meta { font-size: var(--t-sm); color: var(--ink-3); }

.assign-due {
  font-size: var(--t-sm);
  color: var(--ink-2);
  white-space: nowrap;
}

.assign-due.is-soon { color: var(--bad); font-weight: 500; }

/* Checked-off work stays legible but visibly settled. */
.assign-row.is-done .assign-title > span { text-decoration: line-through; color: var(--ink-3); }
.assign-row.is-done .assign-due { color: var(--ink-3); font-weight: 400; }
.assign-row.is-saving { opacity: 0.5; }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 800px) {
  .entry { grid-template-columns: 104px 14px minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .cal-cell { min-height: 76px; padding: 4px 4px 6px; }
  .cal-ev-time { display: none; }
  .cal-dow span { font-size: 0.625rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 1ms !important; animation-duration: 1ms !important; }
}

/* ------------------------------------------------------------------ sign-in gate */

/* Covers the app rather than replacing it: the dashboard markup stays in the DOM so
   nothing has to be re-created after sign-in. */
.gate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--paper);
}
/* .gate[hidden] used to live here; the global [hidden] guard covers it now. */

.gate-card {
  max-width: 26rem;
  text-align: center;
  display: grid;
  gap: 1rem;
  justify-items: center;
}
.gate-mark {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  background: var(--brand);
}
.gate-card h1 { font-size: var(--t-lg); }
.gate-card p { color: var(--ink-2); }
.gate-note { font-size: var(--t-sm); color: var(--ink-3); }
.gate-error { font-size: var(--t-sm); color: var(--bad); }
.gate-card .btn { margin-top: 0.25rem; }

/* ------------------------------------------------------------------ intro quiz

   The quiz borrows the term ruler's language rather than inventing its own: a hairline
   track across the top that fills as you go, and choices as hairline-separated rows
   instead of cards. It covers the dashboard entirely — a half-answered quiz over a
   half-built calendar is two unfinished things at once. */

body.quiz-open { overflow: hidden; }

.quiz {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: var(--paper);
  display: flex;
  flex-direction: column;
}

.quiz-rail {
  height: 2px;
  background: var(--rule);
  flex: none;
}

.quiz-bar {
  height: 100%;
  width: 0;
  background: var(--brand);
  transition: width 320ms var(--ease);
}

.quiz-frame {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  padding: 0 24px 28px;
  display: flex;
  flex-direction: column;
}

.quiz-masthead {
  flex: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 26px 0 22px;
}

.quiz-mark {
  font-size: var(--t-md);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--brand);
}

.quiz-count {
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
}

.quiz-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  /* The fade tells you there is more below without a scrollbar being the only cue. */
  mask-image: linear-gradient(to bottom, #000 calc(100% - 20px), transparent);
}

.quiz-screen { animation: quiz-in 260ms var(--ease); }

@keyframes quiz-in {
  from { opacity: 0; transform: translateY(6px); }
}

@media (prefers-reduced-motion: reduce) {
  .quiz-screen { animation: none; }
  .quiz-bar { transition: none; }
}

.quiz-head { margin-bottom: 22px; }

.quiz-title {
  font-size: 1.6rem;
  line-height: 1.2;
  letter-spacing: -0.022em;
  margin-bottom: 8px;
}

.quiz-note {
  color: var(--ink-2);
  font-size: var(--t-sm);
  line-height: 1.55;
  max-width: 46ch;
}

/* Selectable rows. Hairline-separated, filling faintly when chosen — the same
   restraint the agenda uses, so a chosen row reads as marked rather than as a button. */

.qopts {
  border-top: 1px solid var(--rule);
  margin-bottom: 4px;
}

.qopts-tail { margin-top: 22px; }

.qopt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 12px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}

.qopt:hover { background: var(--paper-sunk); }
.qopt.is-on { background: var(--brand-soft); }

.qopt input {
  margin: 2px 0 0;
  accent-color: var(--brand);
  width: 16px;
  height: 16px;
  flex: none;
}

.qopt-icon {
  flex: none;
  font-size: 1rem;
  line-height: 1.4;
}

.qopt-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.qopt-label { font-weight: 500; }
.qopt.is-on .qopt-label { color: var(--brand); }

.qopt-note {
  font-size: var(--t-sm);
  color: var(--ink-2);
  line-height: 1.45;
}

.qopt-meta {
  flex: none;
  font-size: var(--t-xs);
  color: var(--ink-3);
  padding-top: 2px;
  white-space: nowrap;
}

.quiz-group-head {
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin: 26px 0 8px;
}

.quiz-help {
  font-size: var(--t-sm);
  color: var(--ink-2);
  line-height: 1.55;
  margin: 14px 0 0;
  max-width: 52ch;
}

.quiz-link {
  display: inline-block;
  margin-top: 10px;
  font-size: var(--t-sm);
  font-weight: 500;
  color: var(--brand);
}

.quiz-detail:empty { display: none; }

/* The welcome screen's list of what gets built. Two columns of one line each. */

.quiz-preview {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.quiz-preview li {
  display: flex;
  gap: 16px;
  align-items: baseline;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
}

.quiz-preview-name {
  flex: none;
  width: 92px;
  font-weight: 500;
}

.quiz-preview-detail {
  color: var(--ink-2);
  font-size: var(--t-sm);
}

/* Paste-a-link. Same shape as the Blackboard field, because it is the same job. */

.quiz-paste { margin-top: 14px; }

.quiz-paste-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quiz-input {
  border: 1px solid var(--rule-firm);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--paper);
  font-size: var(--t-sm);
  min-width: 0;
}

.quiz-paste-row .quiz-input:first-child { flex: 1 1 130px; }
.quiz-paste-row .quiz-input:nth-child(2) { flex: 3 1 240px; }

.quiz-input-time { width: 120px; }

.quiz-result {
  font-size: var(--t-sm);
  color: var(--ink-2);
  margin-top: 8px;
  line-height: 1.5;
}

.quiz-result:empty { display: none; }
.quiz-result.is-good { color: var(--good); }
.quiz-result.is-bad { color: var(--bad); }

.quiz-added {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.quiz-added li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--t-sm);
}

.quiz-added-name { font-weight: 500; }
.quiz-added-count { color: var(--ink-3); }

.quiz-time {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  font-size: var(--t-sm);
  color: var(--ink-2);
}

/* The summary reads as a receipt: term on the left, what it means on the right. */

.quiz-summary {
  margin: 0;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 116px 1fr;
}

.quiz-summary dt,
.quiz-summary dd {
  margin: 0;
  padding: 11px 0;
  border-bottom: 1px solid var(--rule);
}

.quiz-summary dt {
  font-size: var(--t-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 14px;
}

.quiz-summary dd { color: var(--ink); }

.quiz-foot {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}

.quiz-foot-end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

@media (max-width: 560px) {
  .quiz-title { font-size: 1.35rem; }
  .quiz-summary { grid-template-columns: 1fr; }
  .quiz-summary dt { border-bottom: 0; padding-bottom: 0; }
  .quiz-preview-name { width: auto; }
  .quiz-preview li { flex-direction: column; gap: 2px; }
}

/* --------------------------------------------------- followed campus calendars */

.org-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.org-list:empty { display: none; }

.org-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--rule);
  font-size: var(--t-sm);
}

.org-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-drop {
  flex: none;
  border: 0;
  background: none;
  color: var(--ink-3);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}

.org-drop:hover { color: var(--bad); background: var(--paper); }

.org-empty {
  font-size: var(--t-sm);
  color: var(--ink-3);
  margin-bottom: 12px;
}

.org-picker { margin-top: 12px; }

.org-picker .qopts { border-top: 1px solid var(--rule); }
.org-picker .qopt { padding: 10px 8px; }
.org-picker .qopt-note { display: none; }

/* ---------------------------------------------------------------------- themes

   The six hand-written [data-theme] blocks that used to live here are gone. Every theme
   — the originals, the eight colleges, all thirty-five chapters, and a colour a student
   picks themselves — is now derived by theme-engine.js and written onto :root as custom
   properties. One code path, and nothing to hand-tune per palette.

   :root above stays the cardinal default so the page has a correct palette before any
   script runs. */

/* ------------------------------------------------------------- theme swatches */

/* Sized to fit two across the 296px settings rail, and to spread on the quiz's wider
   column. The rail is the tighter constraint, so it sets the minimum. */
.themes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
  margin-bottom: 6px;
}

/* The picker stacks: search, then a grid per group, then the custom row. */
#theme-picker { display: flex; flex-direction: column; gap: 4px; }
#theme-picker .quiz-group-head { margin: 14px 0 4px; }

.theme-opt {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px;
  border: 1px solid var(--rule-firm);
  border-radius: 8px;
  cursor: pointer;
  background: var(--paper);
  transition: border-color var(--fast) var(--ease);
}

.theme-opt:hover { border-color: var(--ink-3); }
.theme-opt.is-on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

.theme-opt input { position: absolute; opacity: 0; pointer-events: none; }

/* A miniature of the page itself: ground, a rule, a filled bar, and the source dots.
   More honest than a row of paint chips, because it shows the contrast too. */
.theme-chip {
  position: relative;
  border-radius: 5px;
  padding: 9px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 1px solid;
}

.theme-chip-bar { height: 4px; border-radius: 2px; width: 62%; }
.theme-chip-rule { height: 1px; }
.theme-chip-dots { display: flex; gap: 4px; }
.theme-chip-dot { width: 7px; height: 7px; border-radius: 50%; }

.theme-name {
  font-size: var(--t-sm);
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.theme-opt.is-on .theme-name { color: var(--brand); }
.theme-note { font-size: var(--t-xs); color: var(--ink-3); }


/* Greek letters as the swatch motif: plain characters in Semester's own typeface, never
   an organisation's own lettering. */
.theme-chip-letters {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1;
  opacity: 0.9;
}

.theme-search { width: 100%; margin-bottom: 4px; }

.themes { margin-bottom: 4px; }

/* The custom colour sits below the catalog and reads as one more option in the same
   family, rather than a settings control bolted underneath. */
.theme-custom {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--rule-firm);
  border-radius: 8px;
  cursor: pointer;
}

.theme-custom.is-on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }

.theme-custom-swatch {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--rule-firm);
  cursor: pointer;
}

/* The native swatch has its own inset padding; scaling it up hides the chrome. */
.theme-custom-swatch input {
  width: 200%;
  height: 200%;
  margin: -25%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.theme-custom-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }

.theme-custom-dark {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--t-sm);
  color: var(--ink-2);
  cursor: pointer;
}

.theme-custom-dark input { accent-color: var(--brand); }

/* The second stripe is shorter than the first: the accent leads, the chapter's other
   colour supports it. Equal bars would read as two brands rather than one palette. */
.theme-chip-bar-2 { width: 38%; height: 3px; opacity: 0.9; }


/* ------------------------------------------------------------------ settings */

/* Rows separated by rules, not stacked cards: the same language the agenda uses, and it
   keeps a long settings page from reading as a wall of boxes. */
.setting {
  padding: 26px 0;
  border-bottom: 1px solid var(--rule);
  max-width: 720px;
}

.setting:first-of-type { padding-top: 8px; }
.setting:last-child { border-bottom: 0; }

.setting-head { margin-bottom: 16px; }
.setting-head h3 { font-size: var(--t-md); font-weight: 600; letter-spacing: -0.012em; }
.setting-head p { font-size: var(--t-sm); color: var(--ink-3); margin-top: 3px; }

/* With a full screen to work in the picker breathes, instead of two-across in a rail. */
#view-settings .themes { grid-template-columns: repeat(auto-fit, minmax(144px, 1fr)); gap: 10px; }
#view-settings #theme-picker { gap: 6px; }

/* ------------------------------------------------------- campus event photos */

/* Real photos, and only where they exist: campus and chapter feeds publish them, classes
   and due dates never will. A thumbnail rather than a banner — this is a schedule, and a
   row that is mostly photograph stops being scannable. */
.entry-photo {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 6px;
  object-fit: cover;
  background: var(--paper-sunk);
  align-self: center;
}

.entry-photo[hidden] { display: none; }


/* Sign out lives in the sidebar on desktop; on a narrow screen the bar has no room, so
   Settings carries it too. Visible in exactly one place at each width. */
.settings-signout { display: none; }

@media (max-width: 860px) {
  .settings-signout { display: inline-flex; margin-top: 6px; }
}

/* The gate is the first screen a Google reviewer sees; the policy links have to
   be reachable from it, not only from the marketing page. */
.gate-legal { margin-top: 1rem; font-size: .82rem; opacity: .7; }
.gate-legal a { color: inherit; }

/* Sign in with Google branding: unaltered four-colour G on one of Google's three
   sanctioned fills. The brand crimson is not one of them. */
.btn-google { background: #131314; color: #E3E3E3; border-color: #8E918F; }
.btn-google:hover { background: #2a2a2b; border-color: #8E918F; }
.g-mark { width: 18px; height: 18px; flex: none; margin-right: 8px; vertical-align: -4px; }
