/* St. Maria College shared shell styles, paired with shell.js and loaded by every page (college, campus, mail,
   affairs): the top bar and account menu, toasts, the offline bar, read-failure cards and motion states.
   Colour tokens come from theme.css / app.css. */
:root { --ease: cubic-bezier(.2, .7, .2, 1); --dur-fast: .16s; --dur: .28s; }

/* ---------- top bar ---------- */
#college-nav { position: sticky; top: 0; z-index: 30; }
.college-top { display: flex; align-items: center; gap: 18px; min-height: 60px; padding: 6px 18px 6px 12px; background: var(--red); color: var(--cream); position: relative; box-shadow: 0 3px 0 var(--red-deep); }
.college-top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -9px; height: 6px; background: repeating-linear-gradient(90deg, var(--gold) 0 14px, transparent 14px 20px); opacity: .9; pointer-events: none; }
.college-brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex: none; }
.college-brand svg { width: 32px; height: 39px; transform: rotate(-4deg); filter: drop-shadow(1px 2px 0 rgba(0,0,0,.25)); }
.college-brand .n { display: grid; line-height: 1.05; }
.college-brand .en { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: .01em; }
.college-brand .cn { font-family: var(--zh); font-weight: 700; font-size: 10.5px; letter-spacing: .45em; color: var(--gold-soft); margin-top: 3px; }
.college-places { display: flex; gap: 4px; margin-left: 8px; }
.college-places a { display: grid; justify-items: center; padding: 5px 13px 4px; border-radius: 4px; color: var(--cream); text-decoration: none; line-height: 1.15; }
.college-places a:hover { background: rgba(0,0,0,.16); }
.college-places a.on { background: var(--paper); color: var(--red-deep); box-shadow: 2px 2px 0 rgba(0,0,0,.25); }
.nav-zh { font-family: var(--zh); font-weight: 700; font-size: 15px; }
.nav-en { font-family: var(--label); font-size: 8.5px; letter-spacing: .18em; opacity: .75; }
.nav-account { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.nav-me { display: flex; align-items: center; gap: 8px; font-size: 13px; min-width: 0; }
.nav-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--red-deep); font-weight: 700; font-size: 13px; box-shadow: 0 0 0 2px var(--cream); flex: none; }
.nav-login { margin-left: auto; background: none; border: 1px solid rgba(243,231,210,.5); color: var(--cream); padding: 5px 12px; border-radius: 4px; font-size: 13px; text-decoration: none; box-shadow: none; font-weight: 400; }

.nav-login:hover { background: rgba(0,0,0,.18) !important; }
.nav-account { position: relative; }
.nav-me { background: none; border: 0; box-shadow: none; color: var(--cream); padding: 3px 8px 3px 3px; border-radius: 20px; font: inherit; font-size: 13px; cursor: pointer; }
.nav-me:hover, .nav-me[aria-expanded="true"] { background: rgba(0,0,0,.18); }
.nav-caret { font-size: 10px; opacity: .8; }
.nav-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 220px; display: grid; padding: 6px; background: var(--paper, #FBF4E6); color: var(--ink, #2A2320);
  box-shadow: 3px 4px 0 rgba(0,0,0,.2), 0 18px 28px -14px rgba(0,0,0,.6); border-top: 4px solid var(--gold, #D3A33B); }
.nav-menu[hidden] { display: none; }
.nav-menu-who { display: grid; padding: 8px 10px 10px; border-bottom: 1px dashed rgba(74,48,42,.3); margin-bottom: 4px; }
.nav-menu-who b { font-family: var(--zh); color: var(--red-deep); }
.nav-menu-who span { font-size: 12px; color: var(--muted, #7a6a60); overflow-wrap: anywhere; }
.nav-menu a, .nav-menu button { display: block; text-align: left; padding: 9px 10px; border-radius: 4px; color: inherit; text-decoration: none; font: inherit; font-size: 14px;
  background: none; border: 0; box-shadow: none; cursor: pointer; font-weight: 400; }
.nav-menu a:hover, .nav-menu a:focus-visible, .nav-menu button:hover, .nav-menu button:focus-visible { background: var(--cream, #F3E7D2); outline: none; }
.nav-menu-logout { color: var(--red) !important; border-top: 1px dashed rgba(74,48,42,.3) !important; margin-top: 4px; border-radius: 0 0 4px 4px !important; }
@media (max-width: 760px) {
  .college-top { gap: 8px; padding: 6px 10px; flex-wrap: wrap; }
  .college-brand .cn { display: none; }
  .college-brand .en { font-size: 16px; }
  .college-places { order: 3; width: 100%; margin: 0; justify-content: space-between; padding-bottom: 6px; }
  .college-places a { flex: 1; padding: 4px 2px; }
  .nav-en { display: none; }
  .nav-name { display: none; }
  .nav-menu { position: fixed; right: 10px; left: 10px; top: 56px; }
}

/* ---------- toast, offline bar, failure card ---------- */
.college-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) rotate(-1deg); z-index: 60; max-width: calc(100% - 32px);
  background: var(--gold-soft); color: var(--brown); padding: 10px 18px; box-shadow: 2px 4px 0 rgba(0,0,0,.25); font-weight: 700; }
.college-toast[data-kind="error"] { background: var(--red); color: var(--cream); }
.college-offline { position: sticky; top: 0; z-index: 35; padding: 7px 14px; text-align: center; font-size: 13px; font-weight: 700; background: var(--brown, #4A302A); color: var(--cream); }
.college-failure { display: grid; justify-items: start; gap: 6px; padding: 18px 20px; background: var(--paper, #FBF4E6); color: var(--ink); border-left: 4px solid var(--red);
  box-shadow: 3px 4px 0 rgba(0,0,0,.2); }
.college-failure b { font-family: var(--zh); color: var(--red-deep); }
.college-failure span { font-size: 13.5px; color: var(--brown); }
.college-failure.compact { padding: 10px 12px; box-shadow: none; background: transparent; }

/* ---------- motion states (driven by College.motion / mount / list) ---------- */
[data-motion], .motion-overlay { transition: opacity var(--dur) var(--ease), translate var(--dur) var(--ease); }
/* Snapshot of replaced content: never interactive, never in the accessibility tree (see College.mount). */
.motion-overlay[data-snapshot] * { pointer-events: none !important; }
[data-motion-state="entering"] { opacity: 0; translate: 0 8px; }
[data-motion-state="entered-pending"], [data-motion-state="entered"] { opacity: 1; translate: 0 0; }
[data-motion-state="leaving"] { opacity: 1; }
[data-motion-state="leaving-active"], [data-motion-state="left"] { opacity: 0; translate: 0 -4px; }
/* The previous view fades out on top of the new one without taking layout space or input. */
.motion-overlay { position: absolute; inset: 0 0 auto 0; pointer-events: none; z-index: 1; }
:has(> .motion-overlay) { position: relative; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; scroll-behavior: auto !important; }
  [data-motion-state="entering"] { opacity: 1; translate: none; }
}
html[data-reduced-motion] [data-motion-state] { transition: none !important; }
html[data-reduced-motion] .motion-overlay { display: none; }

/* ---------- back/forward cache: private content stays hidden until the account is confirmed ---------- */
html[data-verifying] body > :not(#college-nav):not(#college-verify):not(#college-offline),
html[data-verifying] .nav-account { visibility: hidden; }
#college-verify .small-btn { margin-left: 10px; padding: 3px 10px; border: 1px solid rgba(243,231,210,.6); border-radius: 4px; background: transparent; color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
#college-verify .small-btn:hover, #college-verify .small-btn:focus-visible { background: rgba(0,0,0,.25); }
