/* Responsive overrides for narrow screens.

   Media queries add no specificity, so these rules win only by loading after
   the plain layout rules they override: .app / .sidebar / .nav* / .main /
   .topbar in css/base.css and .today-strip* in css/home.css.
   index.html loads this sheet after those, but not last: the feature sheets
   from auth.css to admin.css load after it. None of them sets these shell
   selectors; keep it that way (put such a rule in base.css instead), or it
   would win at every width and the phone layout would never apply. */
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  /* .nav-item/.nav-group-head/.nav-child are all `width: 100%` for the
     vertical list — in a row-direction flex container that makes every pill
     fight for the full row width instead of sizing to its own content, which
     is what turned this into a lopsided, cut-off mess. Reset them to their
     natural width and let the row scroll instead of wrapping. */
  .nav { flex-direction: row; align-items: center; overflow-x: auto; overflow-y: hidden; gap: var(--sp-1); }
  .nav-item, .nav-group-head, .nav-child {
    width: auto;
    flex: 0 0 auto;
    white-space: nowrap;
    padding: var(--sp-2) var(--sp-3);
  }
  /* The vertical left-edge active bar reads fine in a column; on a row it's
     a stray thin line next to the label instead of under it. */
  .nav-item.active::before { left: 6px; right: 6px; top: auto; bottom: 2px; width: auto; height: 2px; }
  .nav-group {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    border-left: 1px solid var(--border);
    padding-left: var(--sp-1);
  }
  .nav-group-body { display: flex; }
  .nav-group-body[hidden] { display: none; }
  .nav-child { padding-left: var(--sp-3); }
  .main { padding: var(--sp-5) var(--gutter); }
  .topbar { padding: var(--sp-2) var(--gutter) 0; }
  /* The secondary strip's fixed two columns would squeeze cards below the
     250px minimum the primary strip enforces — stack them instead. */
  .today-strip-secondary { grid-template-columns: minmax(0, 1fr); }
  .today-strip { grid-template-columns: 1fr; }
  .today-strip-primary { flex-direction: column; }
  .today-strip-col:not(:last-child) {
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
}

/* Layout fixes (issue #16 item 9): the phone nav strip. */
@media (max-width: 760px) {
  /* The search hint and version cost 56px of a phone screen and the shortcut
     needs a keyboard. */
  .sidebar-footer { display: none; }
  /* The hover-only x sat invisible but tappable between course tabs. A
     class page has its own Drop button; restoring stays in the Dropped list. */
  .nav-child-row:not(.dropped) .nav-drop { display: none; }
  /* The strip scrolls sideways: fade its right edge until the end. */
  @supports (animation-timeline: scroll()) {
    .nav {
      -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--nav-fade)), transparent);
      mask-image: linear-gradient(to right, #000 calc(100% - var(--nav-fade)), transparent);
      animation-timeline: scroll(self inline);
    }
  }
}
