/*
 * Semantic design-system layer.
 *
 * main.css still contains the historical component layout. This file is loaded
 * last and owns colors, elevation, focus and feedback states. Components should
 * consume these semantic tokens instead of introducing theme-specific colors.
 */

body[data-theme] {
  --text-color: var(--ink);
  --text-muted: color-mix(in srgb, var(--ink) 68%, transparent);
  --muted: var(--text-muted);
  --border-color: var(--border);
  --surface-raised: color-mix(in srgb, var(--surface) 96%, var(--ink));
  --surface-muted: color-mix(in srgb, var(--surface) 88%, var(--canvas));
  --surface-hover: color-mix(in srgb, var(--surface) 88%, var(--accent));
  --backdrop: rgba(3, 8, 15, .72);
  --focus-ring: color-mix(in srgb, var(--accent) 42%, transparent);
  --success: #168542;
  --warning: #b87900;
  --info: #247aa5;
  --status-warning-bg: color-mix(in srgb, var(--surface) 84%, var(--warning));
  --status-danger-bg: color-mix(in srgb, var(--surface) 84%, var(--danger));
  --status-success-bg: color-mix(in srgb, var(--surface) 84%, var(--success));
  --status-info-bg: color-mix(in srgb, var(--surface) 84%, var(--info));
  --control-shadow: 0 .2rem .55rem color-mix(in srgb, var(--ink) 12%, transparent);
  color: var(--text-color);
  background: var(--canvas);
}

body[data-color-mode="dark"] {
  --surface-raised: color-mix(in srgb, var(--surface) 92%, white);
  --surface-muted: color-mix(in srgb, var(--surface) 82%, var(--canvas));
  --surface-hover: color-mix(in srgb, var(--surface) 80%, var(--accent));
  --backdrop: rgba(0, 0, 0, .78);
  --success: #52d187;
  --warning: #f6c453;
  --info: #6fc5ec;
  --status-warning-bg: color-mix(in srgb, var(--surface) 78%, var(--warning));
  --status-danger-bg: color-mix(in srgb, var(--surface) 78%, var(--danger));
  --status-success-bg: color-mix(in srgb, var(--surface) 78%, var(--success));
  --status-info-bg: color-mix(in srgb, var(--surface) 78%, var(--info));
  color-scheme: dark;
}

body[data-color-mode="light"] { color-scheme: light; }

/* Global typography and interactive states. */
body[data-theme] main { min-height: calc(100dvh - 10rem); }
body[data-theme] small,
body[data-theme] .text-muted { color: var(--text-muted) !important; }
body[data-theme] ::placeholder { color: var(--text-muted); opacity: .82; }

body[data-theme] :where(a, button, input, textarea, select, summary):focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

body[data-theme] :where(button, .btn, a, summary) {
  -webkit-tap-highlight-color: transparent;
}

body[data-theme] :where(button, .btn):disabled {
  cursor: not-allowed;
  box-shadow: none;
  opacity: .55;
  transform: none;
}

/* Surfaces shared by pages, cards, dialogs and menus. */
body[data-theme] :where(
  .content-card, .form-card, .note-card, .profile-section,
  .profile-action-card, .theme-settings, .theme-option,
  .call-directory, .call-stage, .call-contact, .call-history__item,
  .stream-create-card, .stream-card, .stream-stage,
  .storage-panel, .storage-section, .storage-file,
  .platform-card, .dm-layout, .dm-request, .dm-message > span,
  .media-player, .dropdown-content, .ui-modal__dialog,
  .card, .list-group-item
) {
  color: var(--text-color);
  background-color: var(--surface);
  border-color: var(--border-color);
}

body[data-theme] :where(
  .profile-action-card, .theme-option, .call-contact,
  .call-history__item, .stream-card, .storage-file,
  .platform-card, .dm-request, .ui-modal__dialog
) {
  box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 5%, transparent);
}

body[data-theme] :where(
  .profile-action-card, .theme-option, .call-contact,
  .stream-card, .storage-file, .platform-card, .dm-conversation
):hover {
  background-color: var(--surface-hover);
  border-color: color-mix(in srgb, var(--border) 48%, var(--accent));
}

body[data-theme] :where(.page-action-bar, .dm-new-conversation, .dm-device) {
  color: var(--text-color);
  background: var(--surface-muted);
  border-color: var(--border-color);
}

body[data-theme] .section-heading {
  margin: 1rem 0 .75rem;
  padding: .8rem .95rem;
  color: var(--ink);
  color: var(--text-color);
  background: var(--surface);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--control-shadow);
}

body[data-theme] .section-heading :where(h1, h2, h3) {
  color: var(--ink);
  color: var(--text-color);
}

body[data-theme] .section-heading p {
  color: var(--ink);
  opacity: .82;
}

body[data-theme] .empty-state {
  color: var(--ink);
  color: var(--text-color);
  background: var(--surface);
  background: var(--surface-raised);
  border: 1px dashed var(--accent);
  border: 1px dashed color-mix(in srgb, var(--accent) 62%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 8%, transparent), var(--control-shadow);
}

body[data-theme] .empty-state .fa {
  color: var(--accent);
  opacity: 1;
}

body[data-theme] .empty-state p {
  color: var(--ink);
  color: var(--text-color);
  font-weight: 650;
}

/* Forms retain contrast in every theme and expose a consistent focus state. */
body[data-theme] :where(
  .form-control, .form-select,
  input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]),
  textarea, select
) {
  color: var(--text-color);
  background-color: var(--surface-raised);
  border-color: var(--border-color);
  caret-color: var(--accent);
}

body[data-theme] :where(
  .form-control, .form-select,
  input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]),
  textarea, select
):focus {
  color: var(--text-color);
  background-color: var(--surface-raised);
  border-color: var(--accent);
  box-shadow: 0 0 0 .2rem var(--focus-ring);
  outline: 0;
}

/* Feedback and notifications. Never use a light-only hard-coded fill here. */
body[data-theme] :where(.alert, .flash) {
  position: relative;
  padding: .8rem .95rem;
  color: var(--text-color);
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  border-left-width: 4px;
  border-radius: var(--radius);
  box-shadow: var(--control-shadow);
}

body[data-theme] :where(.alert-warning, .flash) {
  color: var(--text-color);
  background: var(--status-warning-bg);
  border-color: color-mix(in srgb, var(--warning) 72%, var(--border));
  border-left-color: var(--warning);
}

body[data-theme] .alert-danger {
  color: var(--text-color);
  background: var(--status-danger-bg);
  border-color: color-mix(in srgb, var(--danger) 72%, var(--border));
  border-left-color: var(--danger);
}

body[data-theme] .alert-success {
  color: var(--text-color);
  background: var(--status-success-bg);
  border-color: color-mix(in srgb, var(--success) 72%, var(--border));
  border-left-color: var(--success);
}

body[data-theme] .alert-info {
  color: var(--text-color);
  background: var(--status-info-bg);
  border-color: color-mix(in srgb, var(--info) 72%, var(--border));
  border-left-color: var(--info);
}

body[data-theme] :where(.alert-secondary, .alert-dark) {
  color: var(--text-color);
  background: var(--surface-muted);
  border-color: var(--border-color);
  border-left-color: var(--slate);
}

body[data-theme] :where(
  .chat-status, .dm-status, .dm-request-status,
  .profile-feedback, .media-player__status, #UploadStatus
):not(:empty) {
  padding: .6rem .75rem;
  color: var(--text-color);
  background: var(--status-info-bg);
  border: 1px solid color-mix(in srgb, var(--info) 60%, var(--border));
  border-left: 4px solid var(--info);
  border-radius: 8px;
}

body[data-theme] .profile-feedback[data-state="success"] {
  color: var(--text-color);
  background: var(--status-success-bg);
  border-color: color-mix(in srgb, var(--success) 60%, var(--border));
  border-left-color: var(--success);
}

body[data-theme] .profile-feedback[data-state="error"] {
  color: var(--text-color);
  background: var(--status-danger-bg);
  border-color: color-mix(in srgb, var(--danger) 60%, var(--border));
  border-left-color: var(--danger);
}

/* Lite CDN corporate shell — Exchange/Fluent-inspired, intentionally strict. */
body[data-theme] {
  --radius: 2px;
  --accent: #0f6cbd;
  --accent-dark: #115ea3;
  --accent-contrast: #ffffff;
  --danger: #c50f1f;
  --success: #107c10;
  --warning: #8a6d00;
  --info: #0f6cbd;
  --shadow: 0 1px 3px rgba(0, 0, 0, .14);
  --control-shadow: none;
  --focus-ring: rgba(15, 108, 189, .28);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

body[data-theme][data-color-mode="light"] {
  --ink: #242424;
  --slate: #0f6cbd;
  --slate-dark: #115ea3;
  --mist: #ffffff;
  --canvas: #f5f5f5;
  --surface: #ffffff;
  --border: #d1d1d1;
  --header-bg: #0f6cbd;
  --footer-bg: #f0f0f0;
}

body[data-theme][data-color-mode="dark"] {
  --ink: #f5f5f5;
  --slate: #0f6cbd;
  --slate-dark: #115ea3;
  --mist: #ffffff;
  --canvas: #1b1a19;
  --surface: #252423;
  --border: #484644;
  --header-bg: #0f6cbd;
  --footer-bg: #201f1e;
}

body[data-theme] .site-header {
  padding: 0;
  background: var(--header-bg);
  border-bottom: 1px solid rgba(0, 0, 0, .18);
  backdrop-filter: none;
}

body[data-theme] .site-nav {
  min-height: 48px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

body[data-theme] .site-nav__brand {
  min-height: 48px;
  gap: .7rem;
  padding: 0 .85rem;
  color: #fff !important;
  border-right: 1px solid rgba(255, 255, 255, .22);
}

body[data-theme] .site-nav__brand > span {
  width: 30px;
  height: 30px;
  background: #fff;
  border-radius: 2px;
}

body[data-theme] .site-nav__brand strong {
  font-size: 1rem;
  font-weight: 600;
}

body[data-theme] .nav-item,
body[data-theme] .profile-button,
body[data-theme] .auth-link {
  min-height: 48px;
  padding: 0 .85rem;
  color: rgba(255, 255, 255, .92) !important;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
  font-weight: 600;
}

body[data-theme] .site-nav__actions {
  align-items: stretch;
  gap: 0;
}

body[data-theme] :where(.nav-item, .profile-button, .auth-link) {
  justify-content: center;
  min-width: 92px;
  border-left: 1px solid rgba(255, 255, 255, .16) !important;
  font-size: .86rem;
  line-height: 1;
}

body[data-theme] :where(.nav-item, .profile-button, .auth-link) .fa {
  width: 1rem;
  margin: 0;
  text-align: center;
  font-size: 1rem;
}

body[data-theme] .language-switch {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  gap: .3rem;
  padding: 0 .75rem;
  color: rgba(255, 255, 255, .55);
  border-left: 1px solid rgba(255, 255, 255, .18);
  font-size: .72rem;
  font-weight: 700;
}

body[data-theme] .language-switch a {
  color: rgba(255, 255, 255, .68);
  text-decoration: none;
}

body[data-theme] .language-switch a:hover,
body[data-theme] .language-switch a[aria-current="true"] {
  color: #fff;
}

body[data-theme] :where(.nav-item, .profile-button, .auth-link):hover,
body[data-theme] .nav-item--active {
  color: #fff !important;
  background: rgba(0, 0, 0, .14) !important;
}

body[data-theme] .dropdown--open .profile-button {
  color: #fff !important;
  background: rgba(0, 0, 0, .18) !important;
}

body[data-theme] .dropdown--open .profile-button .fa-angle-down {
  transform: rotate(180deg);
}

body[data-theme] main {
  min-height: calc(100dvh - 122px);
  padding: 24px 0 32px;
}

body[data-theme] .hero-card {
  position: relative;
  margin-top: 0;
  padding: clamp(2.5rem, 7vw, 5.5rem) clamp(1.5rem, 7vw, 5rem);
  color: var(--text-color);
  background: var(--surface);
  border: 1px solid var(--border-color);
  border-top: 5px solid var(--accent);
  border-radius: 0;
  box-shadow: var(--shadow);
  text-align: left;
}

body[data-theme] .institution-seal,
body[data-theme] .institution-about__seal {
  width: 56px;
  height: 56px;
  background: #f4f8fc;
  border: 1px solid #b8d4ea;
  border-radius: 2px;
}

body[data-theme] .institution-abbr {
  margin-top: 1rem;
  color: var(--accent);
  opacity: 1;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
}

body[data-theme] .hero-card h1 {
  margin-top: .25rem;
  color: var(--text-color);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  letter-spacing: -.035em;
}

body[data-theme] .hero-card .institution-full-name,
body[data-theme] .hero-card .hero-card__lead {
  width: min(100%, 720px);
  margin-right: 0;
  margin-left: 0;
  color: var(--text-muted);
  opacity: 1;
}

body[data-theme] .hero-card__time {
  padding: .45rem .65rem;
  color: var(--text-color);
  background: var(--surface-muted);
  border: 1px solid var(--border-color);
  border-radius: 2px;
  font-size: .8rem;
}

body[data-theme] :where(
  .content-card, .form-card, .note-card, .profile-section,
  .profile-action-card, .theme-settings, .theme-option,
  .call-directory, .call-stage, .call-contact, .call-history__item,
  .stream-create-card, .stream-card, .stream-stage,
  .storage-panel, .storage-section, .storage-file,
  .platform-card, .dm-layout, .dm-request,
  .media-player, .dropdown-content, .ui-modal__dialog,
  .card, .list-group-item, .auth-card, .page-heading
) {
  border-radius: 2px;
  box-shadow: none;
}

body[data-theme] .page-heading {
  color: #fff;
  background: #0f6cbd;
  border-left: 4px solid #004578;
}

body[data-theme] .page-heading__icon,
body[data-theme] .platform-card__icon,
body[data-theme] .hero-card__icon,
body[data-theme] .auth-card__icon {
  color: #0f6cbd;
  background: #fff;
  border: 1px solid color-mix(in srgb, #0f6cbd 35%, var(--border));
  border-radius: 2px;
}

body[data-theme] .auth-email-advisory {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin: .65rem 0 1rem;
  padding: .7rem .8rem;
  color: #364f63;
  background: #f4f8fc;
  border-left: 3px solid #0f6cbd;
  font-size: .82rem;
  line-height: 1.45;
}

body[data-theme] .auth-email-advisory i {
  flex: 0 0 auto;
  margin-top: .15rem;
  color: #0f6cbd;
}

body[data-theme] .email-preferences-card__body {
  max-width: 720px;
  padding: clamp(1.25rem, 4vw, 2rem);
}

body[data-theme] .email-preferences-card__body p {
  color: var(--text-muted);
  line-height: 1.65;
}

body[data-theme] .email-preferences-card__lead {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .9rem 1rem;
  color: var(--text-color) !important;
  background: var(--status-info-bg);
  border-left: 3px solid var(--info);
}

body[data-theme] .email-preferences-card__lead i {
  margin-top: .2rem;
  color: var(--info);
}

body[data-theme] .platform-grid {
  gap: 1px;
  overflow: hidden;
  background: var(--border-color);
  border: 1px solid var(--border-color);
}

body[data-theme] .platform-card {
  min-height: 92px;
  border: 0;
}

body[data-theme] a.platform-card:hover {
  transform: none;
  background: color-mix(in srgb, var(--surface) 92%, var(--accent));
  box-shadow: inset 3px 0 0 var(--accent);
}

body[data-theme] :where(.btn, button, input, textarea, select, .form-control, .form-select) {
  border-radius: 2px !important;
}

body[data-theme] .btn {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .5rem .85rem;
  border-width: 1px;
  box-shadow: none;
  font-size: .86rem;
  font-weight: 600;
  line-height: 1.15;
}

body[data-theme] .btn .fa {
  width: 1rem;
  margin: 0;
  text-align: center;
}

body[data-theme] :where(.btn-primary, .btn-warning) {
  color: #fff !important;
  background: #0f6cbd !important;
  border-color: #0f6cbd !important;
  box-shadow: none !important;
}

body[data-theme] :where(.btn-primary, .btn-warning):hover {
  background: #115ea3 !important;
  border-color: #115ea3 !important;
  transform: none;
}

body[data-theme] .btn-secondary {
  color: var(--text-color);
  background: var(--surface);
  border-color: var(--border-color);
  box-shadow: none;
}

body[data-theme] .site-footer {
  color: var(--text-color);
  background: var(--footer-bg);
  border-top: 1px solid var(--border-color);
}

body[data-theme] .site-footer a { color: var(--accent); }
body[data-theme] .site-footer :where(strong, small) { color: var(--text-color) !important; }
body[data-theme] .release-badge {
  color: var(--text-color);
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: 2px;
}

@media (min-width: 576px) and (max-width: 1199px) {
  body[data-theme] .site-header .container { max-width: none; padding-right: 0; padding-left: 0; }
  body[data-theme] .site-nav {
    display: grid;
    width: 100%;
    padding: 0;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 44px 48px;
  }
  body[data-theme] .site-nav__brand {
    min-height: 44px;
    padding: 0 1rem;
    border-right: 0;
  }
  body[data-theme] .site-nav__brand > span { width: 28px; height: 28px; }
  body[data-theme] .site-nav__brand strong { display: inline; }
  body[data-theme] .language-switch {
    min-height: 44px;
    grid-column: 2;
    grid-row: 1;
  }
  body[data-theme] .site-nav__actions {
    display: flex;
    width: 100%;
    min-width: 0;
    margin: 0;
    grid-column: 1 / -1;
    grid-row: 2;
    overflow-x: auto;
    border-top: 1px solid rgba(255, 255, 255, .16);
    scrollbar-width: none;
  }
  body[data-theme] .site-nav__actions::-webkit-scrollbar { display: none; }
  body[data-theme] .site-nav__actions > :where(a, .dropdown) {
    min-width: 112px;
    flex: 1 0 auto;
  }
  body[data-theme] .site-nav__actions :where(.nav-item, .profile-button, .auth-link) {
    width: auto;
    min-width: 112px;
    min-height: 48px;
    justify-content: center;
    padding: 0 .7rem;
    background: transparent !important;
  }
  body[data-theme] .site-nav__actions .dropdown .profile-button { width: 100%; }
  body[data-theme] .site-nav__actions :where(.nav-item, .profile-button) span { display: inline; }
  body[data-theme] .site-nav__actions .dropdown--open .profile-button,
  body[data-theme] .site-nav__actions .profile-button:hover {
    background: rgba(0, 0, 0, .14) !important;
  }
}

@media (max-width: 575px) {
  body[data-theme] main { padding-top: 12px; }
  body[data-theme] .site-header .container { padding-right: 0; padding-left: 0; }
  body[data-theme] .site-nav {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 44px 48px;
  }
  body[data-theme] .site-nav__brand {
    display: inline-flex;
    width: auto;
    min-width: 0;
    min-height: 44px;
    justify-content: flex-start;
    padding: 0 .75rem;
    border-right: 0;
  }
  body[data-theme] .site-nav__brand > span { width: 28px; height: 28px; }
  body[data-theme] .site-nav__brand strong { display: inline; }
  body[data-theme] .language-switch {
    min-height: 44px;
    grid-column: 2;
    grid-row: 1;
  }
  body[data-theme] .site-nav__actions {
    display: flex;
    width: auto;
    min-width: 0;
    margin: 0;
    grid-column: 1 / -1;
    grid-row: 2;
    justify-content: flex-start;
    overflow-x: auto;
    border-top: 1px solid rgba(255, 255, 255, .16);
    scrollbar-width: none;
  }
  body[data-theme] .site-nav__actions::-webkit-scrollbar { display: none; }
  body[data-theme] .site-nav__actions > :where(a, .dropdown) {
    min-width: 0;
    flex: 0 0 auto;
  }
  body[data-theme] .site-nav__actions > :where(a, .dropdown > button) {
    min-width: 104px;
    justify-content: center;
    padding-right: .35rem;
    padding-left: .35rem;
  }
  body[data-theme] .site-nav__actions .nav-item span { display: inline; }
  body[data-theme] .site-nav__actions:has(#login) > a { flex: 1 1 0; }
  body[data-theme] .site-nav__actions .auth-link {
    min-width: 150px;
    font-size: .8rem;
    white-space: nowrap;
  }
  body[data-theme] .hero-card { padding: 2rem 1.25rem; }
}

/* Navigation and dropdowns. */
body[data-theme] .dropdown-content {
  overflow: hidden;
  background: var(--surface-raised);
  border: 1px solid var(--border-color);
  box-shadow: 0 .75rem 2rem color-mix(in srgb, black 32%, transparent);
}

body[data-theme] .dropdown-content.dropdown-content--open {
  display: block;
  z-index: 2000;
  width: min(18rem, calc(100vw - 1.5rem));
  min-width: 190px;
  padding: .4rem;
  border-radius: 2px;
}

body[data-theme] .dropdown-content :where(a, button) {
  color: var(--text-color);
  background: transparent;
}

body[data-theme] .dropdown-content :where(a, button):hover,
body[data-theme] .dropdown-content :where(a, button):focus-visible {
  color: var(--text-color);
  background: var(--surface-hover);
}

/* Modal elevation is deliberately stronger than page cards in dark mode. */
body[data-theme] .ui-modal__backdrop { background: var(--backdrop); }
body[data-theme] .ui-modal__dialog {
  background: var(--surface-raised);
  border-color: color-mix(in srgb, var(--border) 65%, var(--accent));
  box-shadow: 0 1.25rem 4rem rgba(0, 0, 0, .52), 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent);
}
body[data-theme] .ui-modal__header { background: var(--surface-muted); }
body[data-theme] .ui-modal__close { color: var(--text-color); }
body[data-theme] .ui-modal__close:hover { background: var(--surface-hover); }

body[data-theme] .call-ringing {
  color: var(--text-color);
  background:
    radial-gradient(circle at 50% 22%, color-mix(in srgb, var(--accent) 28%, transparent), transparent 44%),
    var(--surface-raised);
}
body[data-theme] .call-ringing :where(p, small) { color: var(--text-muted); }
body[data-theme] .call-ringing__action { color: var(--text-color); }
body[data-theme] .call-ringing__action--accept i { background: var(--success); color: var(--surface); }

/* Tables and progress indicators no longer assume a light canvas. */
body[data-theme] :where(.table, .zebra, .divTable) { color: var(--text-color); }
body[data-theme] :where(.table > :not(caption) > * > *, .zebra td, .zebra th, .divTableCell, .divTableHead) {
  color: var(--text-color);
  background-color: var(--surface);
  border-color: var(--border-color);
}
body[data-theme] :where(.zebra th, .divTableHeading, .divTableFoot) {
  color: var(--text-color);
  background: var(--surface-muted);
}
body[data-theme] .upload-progress { color: var(--text-color); background: var(--surface); border-color: var(--warning); }
body[data-theme] .upload-progress .progress { background: var(--surface-muted); border-color: var(--border-color); }
body[data-theme] .upload-progress .progress-bar { color: #111827; background: var(--warning); }
body[data-theme] .upload-progress-details { color: var(--text-color); }

/* Scrollbars are visible without becoming the brightest element. */
body[data-theme] { scrollbar-color: var(--border) var(--canvas); }
body[data-theme] *::-webkit-scrollbar { width: .7rem; height: .7rem; }
body[data-theme] *::-webkit-scrollbar-track { background: var(--canvas); }
body[data-theme] *::-webkit-scrollbar-thumb { background: var(--border); border: 2px solid var(--canvas); border-radius: 999px; }

@media (max-width: 520px) {
  body[data-theme] :where(.alert, .flash) { margin-right: .5rem; margin-left: .5rem; }
  body[data-theme] .ui-modal__dialog { border-right: 0; border-bottom: 0; border-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  body[data-theme] *,
  body[data-theme] *::before,
  body[data-theme] *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
