/* =========================================================================
   CommandX · Base styles and project utilities
   Only what Bootstrap 5.3 does not already provide. Prefer Bootstrap
   utilities (d-flex, gap-2, text-primary, fw-semibold, ...) in markup.
   ========================================================================= */

/* ---------- Base ---------- */
html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--cx-font-sans);
  font-size: var(--cx-fs-base);
  color: var(--cx-text);
  background-color: var(--cx-canvas);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  overscroll-behavior: none;
}

/* Headings and paragraphs carry no default margins; spacing comes from layout classes. */
h1, h2, h3, h4, h5, h6,
p {
  margin: 0;
}

h1, h2, h3, h4, h5, h6 {
  color: var(--cx-text-strong);
  font-weight: 700;
  letter-spacing: var(--cx-tracking-tight);
  line-height: 1.25;
}

a {
  color: var(--cx-navy);
}

img {
  max-width: 100%;
}

button,
select,
input,
textarea {
  font-family: inherit;
}

h1:focus {
  outline: none;
}

/* ---------- Icons (Material Symbols) ---------- */
.material-symbols-outlined {
  font-family: "Material Symbols Outlined" !important;
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-feature-settings: "liga";
  -webkit-font-smoothing: antialiased;
}

/* ---------- Scrollbars ---------- */
::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-thumb {
  background: var(--cx-slate-300);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--cx-slate-400);
}

::-webkit-scrollbar-track {
  background: transparent;
}

/* =========================================================================
   Utilities (cx- prefix). Naming follows Bootstrap: {property}-{value}.
   ========================================================================= */

/* Font size scale (see tokens.css) */
.cx-fs-2xs { font-size: var(--cx-fs-2xs) !important; }
.cx-fs-xs { font-size: var(--cx-fs-xs) !important; }
.cx-fs-sm { font-size: var(--cx-fs-sm) !important; }
.cx-fs-base { font-size: var(--cx-fs-base) !important; }
.cx-fs-md { font-size: var(--cx-fs-md) !important; }
.cx-fs-lg { font-size: var(--cx-fs-lg) !important; }
.cx-fs-xl { font-size: var(--cx-fs-xl) !important; }
.cx-fs-2xl { font-size: var(--cx-fs-2xl) !important; }
.cx-fs-3xl { font-size: var(--cx-fs-3xl) !important; }
.cx-fs-4xl { font-size: var(--cx-fs-4xl) !important; }

/* Letter spacing */
.cx-tracking-tight { letter-spacing: var(--cx-tracking-tight) !important; }
.cx-tracking-wide { letter-spacing: var(--cx-tracking-wide) !important; }

/* Numbers */
.cx-tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* Interaction */
.cx-cursor-pointer { cursor: pointer !important; }
.cx-select-none { user-select: none !important; }
.cx-whitespace-nowrap { white-space: nowrap !important; }

/* Horizontal scroller without a visible scrollbar */
.cx-scroll-x {
  overflow-x: auto;
  scrollbar-width: none;
}

.cx-scroll-x::-webkit-scrollbar {
  display: none;
}

/* Vertical stack with design-system rhythm (1rem, 1.25rem from md) */
.cx-stack {
  display: flex;
  flex-direction: column;
  gap: var(--cx-space-4);
}

@media (min-width: 768px) {
  .cx-stack {
    gap: var(--cx-space-5);
  }
}

/* ---------- Shared animations ---------- */
@keyframes cx-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cx-slide-up {
  from { transform: translateY(12px) scale(0.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

@keyframes cx-pulse {
  50% { opacity: 0.5; }
}

@keyframes cx-progress-slide {
  0% { left: -45%; }
  100% { left: 100%; }
}

@keyframes cx-progress-shrink {
  from { width: 100%; }
  to { width: 0%; }
}

/* ---------- Blazor framework ---------- */
.valid.modified:not([type=checkbox]) {
  outline: 1px solid #26b050;
}

.invalid {
  outline: 1px solid var(--cx-crimson);
}

.validation-message {
  color: var(--cx-crimson);
  font-size: var(--cx-fs-sm);
}

.blazor-error-boundary {
  background: #b32121;
  padding: 1rem;
  color: #ffffff;
}

.blazor-error-boundary::after {
  content: "An error has occurred.";
}

/* ---------- Font size preference (themeHelper.setFontSize) ---------- */
/* Root size drives all rem spacing. 14px (medium) is the size the UI was designed at. */
html.font-size-small { font-size: 13px; }
html.font-size-medium { font-size: 14px; }
html.font-size-large { font-size: 16px; }
