/* ═══════════════════════════════════════════════════════════════════════
   Change school (change_school.js): Home's button, the dialog, and the
   archived school sections in Grades > History. Composes the shared tokens
   only. Buttons keep .primary-btn / .ghost-btn and --r-btn (a full pill at
   --ctl-h), so no shape rules live here.
   ═══════════════════════════════════════════════════════════════════════ */

.chs-modal { width: min(560px, calc(100vw - 32px)); }
.chs-modal .modal-sub { overflow-wrap: anywhere; }

/* Primary: solid accent with the shared lip. Secondary: white with the faint ring. */
.chs-modal .primary-btn { box-shadow: 0 var(--lip-sm) 0 0 var(--lip-color); }
.chs-modal .primary-btn:active:not(:disabled) { box-shadow: 0 1px 0 0 var(--lip-color); transform: translateY(2px); }
.chs-modal .ghost-btn,
.chs-restore { background: var(--surface-strong); }

.chs-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.chs-modal[aria-busy="true"] .chs-actions { cursor: progress; }

/* The connectors step embeds the Connectors page's own tiles. A tile's
   ribbon sits 10px above it (.conn-tile-badge) and its shadow falls outside
   it, and a scroll box cuts both at its edge: the inset gives them room, and
   the side margins take it back so the tiles still line up with the text. */
.chs-conn-list {
  display: grid;
  gap: 10px;
  margin: 0 -6px 4px;
  padding: 12px 6px 10px;
  max-height: min(46vh, 420px);
  overflow: auto;
  overscroll-behavior: contain;
}

/* Archived school sections, Grades > History (student only). Each section
   is History's own .th-term card; the mint wrap sets them apart from this
   school's terms. Restore sits in the card's tag row. */
.chs-archives { display: grid; gap: 12px; margin-top: 16px; }
/* .th-term is a bare column (it sits on the page), so the wrap brings its
   own inset and corners: without them the mint is a square band with the
   school's name against its edge. */
.chs-archive.th-term {
  background: var(--panel-mint);
  padding: var(--row-pad);
  border-radius: var(--r-card);
}
/* The student's Teachers can see this switch: the Settings switch itself
   (.set-toggle), set on its own row under the card's head. */
.chs-vis { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.chs-vis-label { font-size: var(--t-small-size); line-height: var(--t-small-lh); color: var(--text-secondary); }

/* Phones: stacked full-width actions, primary on top. */
@media (max-width: 767px) {
  .chs-actions { flex-direction: column-reverse; align-items: stretch; }
  .chs-actions button { width: 100%; }
  .chs-archive .chs-restore { width: 100%; }
  /* The connectors step opens as "School changed. Undo" lands. A phone's
     toasts sit above the tab bar (soft.css), which put this one on Keep
     connectors. While this dialog is open the bar is under its backdrop, so
     the toast takes the bottom edge, clear of the dialog. */
  body:not(#_):has(#change-school-backdrop:not(.hidden)) #toast-wrap {
    bottom: calc(var(--s-3) + env(safe-area-inset-bottom, 0px)) !important;
  }
}

/* Calm step-in and settle, only for people who haven't asked for less motion. */
@media (prefers-reduced-motion: no-preference) {
  .chs-modal.chs-enter .modal-title,
  .chs-modal.chs-enter .modal-sub,
  .chs-modal.chs-enter .chs-step:not([hidden]) {
    animation: chs-in 180ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .chs-archive { animation: chs-in 200ms cubic-bezier(0.16, 1, 0.3, 1) both; }
  @keyframes chs-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
  }
}
@media (prefers-reduced-motion: reduce) {
  .chs-modal .primary-btn:active:not(:disabled) { transform: none; }
}

/* N6 on a connected connector card, and N7 under it. The card's own action
   buttons already wrap; the long label never truncates. */
.conn-tile-actions [data-act="switch"] { white-space: normal; text-align: center; }
.conn-tile-note {
  margin: 8px 0 0;
  font-size: var(--t-small-size);
  line-height: var(--t-small-lh);
  color: var(--text-secondary);
}
@media (max-width: 767px) {
  .conn-tile-actions [data-act="switch"] { flex: 1 1 100%; }
}
/* Outside the Connectors page (the Change connectors? step) the card's
   actions are the older flex row: let them wrap instead of overflowing. */
.chs-conn-list .conn-tile-actions { flex-wrap: wrap; }
/* Inside the dialog the tile has its border and the dialog's own lift: its
   page shadow would only be cut into a box by the list's edge. */
body:not(#_) .chs-conn-list .conn-tile { box-shadow: none !important; }
