/* ============================================================
   BASE — Reset, typography, utility classes
   ============================================================ */

/* ── Reset ───────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--font-body) !important;
  font-size: 1rem;
  line-height: 1.6;
  background: var(--clr-bg) !important;
  color: var(--clr-text) !important;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition:
    background var(--transition-normal),
    color var(--transition-normal);
}
img,
video {
  max-width: 100%;
  height: auto;
  display: block;
}
a {
  color: var(--clr-primary);
  text-decoration: none;
}
a:hover {
  color: var(--clr-primary-dk);
}
ul,
ol {
  list-style: none;
}
button {
  cursor: pointer;
  font-family: inherit;
}
input,
select,
textarea,
button {
  font-family: inherit;
  font-size: 1rem;
}
table {
  border-collapse: collapse;
  width: 100%;
}
main {
  flex: 1;
}

/* ── Typography ──────────────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.25;
  color: var(--clr-text);
}
h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
}
h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
}
h3 {
  font-size: clamp(1.15rem, 2.5vw, 1.5rem);
}
h4 {
  font-size: 1.15rem;
}
p {
  color: var(--clr-text-muted);
}

/* ── Focus visible ───────────────────────────────────────── */
:focus-visible {
  outline: 3px solid var(--clr-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ── Skip link (accessibility) ───────────────────────────── */
.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--sp-md);
  background: var(--clr-primary);
  color: var(--clr-text-on-primary);
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-sm);
  z-index: 9999;
  font-weight: 600;
}
.skip-link:focus {
  left: var(--sp-md);
}

/* ── Layout containers ───────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
  padding-inline: var(--sp-md);
}
.container-fluid {
  width: 100%;
  padding-inline: var(--sp-md);
}
.container--sm {
  max-width: 720px;
}
.container--lg {
  max-width: 1400px;
}

/* indexer / sin — legacy layout helpers used across includes */
.indexer {
  width: 100%;
}
.sin {
  max-width: 780px;
  margin-inline: auto;
}

/* ── Grid utilities ──────────────────────────────────────── */
.grid {
  display: grid;
  gap: var(--sp-md);
}
.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.grid-3 {
  grid-template-columns: repeat(3, 1fr);
}
.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}
@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}
@media (min-width: 481px) and (max-width: 768px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Flex utilities ──────────────────────────────────────── */
.flex {
  display: flex;
}
.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}
.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.flex-col {
  display: flex;
  flex-direction: column;
}
.gap-sm {
  gap: var(--sp-sm);
}
.gap-md {
  gap: var(--sp-md);
}
.gap-lg {
  gap: var(--sp-lg);
}

/* ── Spacing ─────────────────────────────────────────────── */
.mt-sm {
  margin-top: var(--sp-sm);
}
.mt-md {
  margin-top: var(--sp-md);
}
.mt-lg {
  margin-top: var(--sp-lg);
}
.mb-sm {
  margin-bottom: var(--sp-sm);
}
.mb-md {
  margin-bottom: var(--sp-md);
}
.mb-lg {
  margin-bottom: var(--sp-lg);
}
.py-md {
  padding-block: var(--sp-md);
}
.py-lg {
  padding-block: var(--sp-lg);
}
.py-xl {
  padding-block: var(--sp-xl);
}
.py-2xl {
  padding-block: var(--sp-2xl);
}
.px-md {
  padding-inline: var(--sp-md);
}

/* ── Text utilities ──────────────────────────────────────── */
.text-center {
  text-align: center;
}
.text-right {
  text-align: right;
}
.text-muted {
  color: var(--clr-text-muted);
}
.text-primary {
  color: var(--clr-primary);
}
.text-sm {
  font-size: 0.875rem;
}
.text-xs {
  font-size: 0.75rem;
}
.text-lg {
  font-size: 1.125rem;
}
.font-bold {
  font-weight: 700;
}
.font-semi {
  font-weight: 600;
}

/* ── Visibility ──────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.hide-mobile {
  display: block;
}
.show-mobile {
  display: none;
}
@media (max-width: 768px) {
  .hide-mobile {
    display: none !important;
  }
  .show-mobile {
    display: block !important;
  }
}

/* ── Alerts / Notices ─────────────────────────────────────── */
.alert {
  padding: var(--sp-sm) var(--sp-md);
  border-radius: var(--radius-md);
  border-left: 4px solid currentColor;
  margin-bottom: var(--sp-md);
  font-size: 0.9rem;
}
.alert--success {
  background: #d4edda;
  color: #155724;
  border-color: var(--clr-success);
}
.alert--error {
  background: #f8d7da;
  color: #721c24;
  border-color: var(--clr-danger);
}
.alert--warning {
  background: #fff3cd;
  color: #856404;
  border-color: var(--clr-warning);
}
.alert--info {
  background: #d1ecf1;
  color: #0c5460;
  border-color: var(--clr-info);
}

/* ── Badge ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge--primary {
  background: var(--clr-primary-lt);
  color: var(--clr-primary);
}
.badge--success {
  background: #d4edda;
  color: var(--clr-success);
}
.badge--warning {
  background: #fff3cd;
  color: #856404;
}
.badge--danger {
  background: #f8d7da;
  color: var(--clr-danger);
}
.badge--info {
  background: #d1ecf1;
  color: var(--clr-info);
}
.badge--neutral {
  background: var(--clr-border);
  color: var(--clr-text-muted);
}

/* ── Breadcrumbs (SEO & UX) ──────────────────────────────── */
.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-xs);
  align-items: center;
  font-size: 0.85rem;
  color: var(--clr-text-muted);
  padding: var(--sp-sm) 0;
}
.breadcrumbs a {
  color: var(--clr-text-muted);
}
.breadcrumbs a:hover {
  color: var(--clr-primary);
}
.breadcrumbs span.sep {
  color: var(--clr-border);
}
.breadcrumbs span.current {
  color: var(--clr-text);
  font-weight: 500;
}

/* ── Divider ─────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--clr-border);
  margin: var(--sp-lg) 0;
}

/* ── Section heading ─────────────────────────────────────── */
.section-head {
  text-align: center;
  margin-bottom: var(--sp-xl);
}
.section-head h2 {
  margin-bottom: var(--sp-sm);
}
.section-head p {
  max-width: 55ch;
  margin-inline: auto;
}

/* ── Empty state ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--sp-2xl) var(--sp-md);
  color: var(--clr-text-muted);
}
.empty-state svg,
.empty-state img {
  margin: 0 auto var(--sp-md);
  opacity: 0.4;
  width: 80px;
}
.empty-state h3 {
  color: var(--clr-text);
  margin-bottom: var(--sp-sm);
}

/* ── Toast notifications ─────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: var(--sp-lg);
  right: var(--sp-lg);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--sp-sm);
}
.toast {
  background: var(--clr-secondary);
  color: #fff;
  padding: var(--sp-sm) var(--sp-lg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  font-size: 0.9rem;
  animation:
    slideInToast 0.3s ease,
    fadeOutToast 0.4s ease 2.6s forwards;
  max-width: 300px;
}
.toast--success {
  background: var(--clr-success);
}
.toast--error {
  background: var(--clr-danger);
}
@keyframes slideInToast {
  from {
    transform: translateX(120%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
@keyframes fadeOutToast {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

/* ── Page transition overlay ─────────────────────────────── */
.page-loader {
  position: fixed;
  inset: 0;
  background: var(--clr-primary);
  z-index: 9999;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms ease;
  pointer-events: none;
}
