/* TECMOCSY messages - the ONE look for every notice and inline alert (docs/DESIGN.md §3).
   Change the tokens below and every message on the site follows.

   Notice  (TC.toast / toastr / Django messages): short feedback after an action,
           white card, bottom-centre; inside an open drawer it shows over the drawer.
   Alert   (.tc-alert, core/partials/_alerts.html): stays in the page next to the form
           it belongs to - errors the person must fix. */
:root {
  --tcn-surface: #fff;
  --tcn-ink: #202124;
  --tcn-muted: #5f6368;
  --tcn-line: #e8eaed;
  --tcn-soft: #f8f9fa;
  --tcn-hover: #f1f3f4;
  --tcn-success: #15803d;
  --tcn-error: #b42318;
  --tcn-warning: #b54708;
  --tcn-info: #5f6368;
  --tcn-radius: 12px;
  --tcn-shadow: 0 12px 32px -12px rgba(15, 17, 17, .28), 0 2px 6px rgba(15, 17, 17, .06);
  --tcn-font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tcn-width: 420px;
}

/* ---------------- notices ---------------- */
.tc-notices {
  position: fixed; z-index: 100000; left: 50%; bottom: 24px; transform: translateX(-50%);
  width: min(var(--tcn-width), calc(100vw - 32px));
  display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
/* phones: above the bottom bar */
@media (max-width: 639px) { .tc-notices { bottom: calc(84px + env(safe-area-inset-bottom)); } }
/* a drawer is open: show over the drawer, above its bottom bar, near what was pressed */
@media (min-width: 640px) {
  html.tc-drawer-open .tc-notices {
    left: auto; transform: none;
    right: calc(12px + (min(440px, 100vw - 24px) - min(var(--tcn-width), min(440px, 100vw - 24px) - 32px)) / 2);
    width: min(var(--tcn-width), calc(min(440px, 100vw - 24px) - 32px));
    bottom: 148px;
  }
}
.tc-notice {
  pointer-events: auto; overflow: hidden;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 10px 14px 16px;
  background: var(--tcn-surface); color: var(--tcn-ink);
  border: 1px solid var(--tcn-line); border-radius: var(--tcn-radius); box-shadow: var(--tcn-shadow);
  font: 400 14px/1.45 var(--tcn-font); letter-spacing: 0; text-align: left;
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s ease, transform .22s cubic-bezier(.2, .8, .2, 1);
}
.tc-notice.is-in { opacity: 1; transform: none; }
.tc-notice.is-out {
  opacity: 0; transform: translateY(4px);
  transition: opacity .14s ease, transform .14s ease, height .18s ease .1s,
              padding .18s ease .1s, margin .18s ease .1s, border-width .18s ease .1s;
}
.tc-notice__icon { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--tcn-info); }
.tc-notice__icon svg, .tc-alert__icon svg, .tc-notice__close svg { display: block; width: 100%; height: 100%; }
.tc-notice--success .tc-notice__icon { color: var(--tcn-success); }
.tc-notice--error .tc-notice__icon { color: var(--tcn-error); }
.tc-notice--warning .tc-notice__icon { color: var(--tcn-warning); }
.tc-notice__body { flex: 1; min-width: 0; padding-top: 1px; }
.tc-notice__title { margin: 0 0 2px; font-weight: 600; color: var(--tcn-ink); }
.tc-notice__msg { margin: 0; color: var(--tcn-ink); overflow-wrap: anywhere; }
.tc-notice__title + .tc-notice__msg { color: var(--tcn-muted); }
.tc-notice__action {
  flex: none; align-self: center; border: 0; background: none; cursor: pointer;
  padding: 6px 8px; border-radius: 8px; font: 600 14px/1 var(--tcn-font); color: var(--tcn-success);
  text-decoration: none;
}
.tc-notice__action:hover { background: var(--tcn-hover); }
.tc-notice__close {
  flex: none; width: 28px; height: 28px; margin: -3px 0 0; padding: 6px; border: 0; border-radius: 50%;
  background: none; color: var(--tcn-muted); cursor: pointer;
}
.tc-notice__close:hover { background: var(--tcn-hover); color: var(--tcn-ink); }
.tc-notice__close:focus-visible, .tc-notice__action:focus-visible { outline: 2px solid var(--tcn-ink); outline-offset: 1px; }
.tc-sr { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) {
  .tc-notice, .tc-notice.is-out { transition: opacity .12s linear; transform: none; }
}

/* ---------------- inline alerts (inside forms and pages) ---------------- */
.tc-alerts { display: flex; flex-direction: column; gap: 8px; margin: 0 0 16px; }
.tc-alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--tcn-line); border-radius: 10px;
  background: var(--tcn-soft); color: var(--tcn-ink);
  font: 400 14px/1.45 var(--tcn-font); text-align: left;
}
.tc-alert__icon { flex: none; width: 18px; height: 18px; margin-top: 1px; color: var(--tcn-info); }
.tc-alert__text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.tc-alert__text a { color: inherit; font-weight: 600; text-decoration: underline; }
.tc-alert--success .tc-alert__icon { color: var(--tcn-success); }
.tc-alert--error { border-color: #f0d0cc; }
.tc-alert--error .tc-alert__icon { color: var(--tcn-error); }
.tc-alert--warning .tc-alert__icon { color: var(--tcn-warning); }
