/* Course hub — the tab strip, the Canvas assignment rows, and the grouped
   "Course material" dropdowns.
   Token-driven throughout, so light and dark both come from css/base.css.
   Rows inside a group reuse .material-list / .material-row from
   css/course-hub.css, the tabs themselves are the shared .course-tabs /
   .course-tab underline component (css/notes-bar.css), and the document viewer is shared app-wide
   (.doc-view-*); only what is specific to a class page lives here. */

/* ---- the tab strip ----
   One rule the strip owes the shared component: .course-tab draws its active
   state as a 2px bottom border, so the bar's own hairline has to sit under it
   rather than beside it. */
.course-tabbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin: 0 0 var(--sp-5);
  border-bottom: 1px solid var(--border);
}

/* The tabs take the whole row, so ✕ Drop class — which is not a tab — is
   pushed to the far end of the strip. The -1px pulls the active underline
   down onto the bar's border instead of stacking two lines. */
.course-tabbar .course-tabs {
  flex: 1;
  min-width: 0;
  margin-bottom: -1px;
}

.course-tabbar .course-drop {
  flex-shrink: 0;
  margin: 0 0 var(--sp-2) auto;
}

/* Narrow content (issue #16 F-38): the five tabs stay on one row and scroll
   sideways instead of stacking two or three rows with Drop class between
   them; in a narrower column Drop class takes its own row above the strip,
   so the tabs keep the bar's bottom rule. Container widths, because at 768
   the sidebar leaves the page a 470px column. */
@container main (max-width: 640px) {
  .course-tabbar .course-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .course-tabbar .course-tabs::-webkit-scrollbar { display: none; }
  .course-tabbar .course-tab { flex: none; white-space: nowrap; }
}
@container main (max-width: 520px) {
  .course-tabbar .course-tabs { flex-basis: 100%; }
  .course-tabbar .course-drop { order: -1; }
}

/* ---- Canvas assignment rows (.assess-item / .assess-row from css/course-hub.css) ----
   A Canvas row has no "what should I study" panel to open: without a local
   file there is nothing to find related coursework for. One with no Canvas
   link has nothing to click at all, so it must not look clickable. */
.assess-row.static { cursor: default; }
.assess-row.static:hover { background: none; }

/* The due badge sits between the title and the caret and never squeezes. */
.assess-row > .badge { flex-shrink: 0; }

/* Work already handed in stays on the page — seeing it ticked off is the
   point — but stops competing with what is still due. */
.assess-item.done { opacity: 0.65; }
.assess-item.done .assess-name { text-decoration: line-through; }

/* ---- the stack of dropdowns ---- */
.mat-groups {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.mat-group {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

/* <summary> is the whole clickable/focusable header. The default disclosure
   triangle is replaced by .mat-caret so it can sit inside the flex row. */
.mat-group-head {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-2) var(--sp-3);
  cursor: pointer;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text);
  list-style: none;
  user-select: none;
}
.mat-group-head::-webkit-details-marker { display: none; }
.mat-group-head::marker { content: ""; }
.mat-group-head:hover { background: var(--surface-2); }
.mat-group-head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.mat-caret {
  flex-shrink: 0;
  width: 12px;
  font-size: var(--fs-2xs);
  line-height: 1;
  color: var(--text-muted);
  transition: transform 0.12s ease;
}
.mat-group[open] > .mat-group-head .mat-caret { transform: rotate(90deg); }

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

.mat-group-count {
  flex-shrink: 0;
  padding: 1px var(--sp-2);
  border-radius: var(--radius);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: var(--accent-soft);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* The shared .material-list draws its own box; inside a group the group
   already provides one, so drop the outer border and the rounding. */
.mat-group > .material-list {
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
}

/* The stored-zyBook line under the groups: one row, the button at the far
   end and on the text's line, a gap below the last group (issue #16 F-89). */
.card.mat-stored {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-2) var(--sp-3);
  margin-top: var(--sp-2);
}
.mat-stored > .spacer { flex: 1; }
.mat-stored > .btn { white-space: nowrap; }
