/* ===========================================================================
   LeadPulse — reset, typography, utilities (mobile-first)
   =========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-head);
  font-weight: 700;
  color: var(--tf-navy);
  margin: 0 0 .5em;
  line-height: 1.25;
}
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] h4 { color: var(--text); }

h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); font-weight: 600; }
h4 { font-size: var(--fs-base); font-weight: 600; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--tf-teal);
  text-decoration: none;
  transition: color var(--t-fast);
}
a:hover { color: var(--tf-teal-700); text-decoration: underline; }

small, .text-sm { font-size: var(--fs-sm); }
.text-xs { font-size: var(--fs-xs); }
.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-nowrap { white-space: nowrap; }
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.font-head { font-family: var(--font-head); }
.font-mono { font-family: var(--font-mono); }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 20px 0;
}

img, svg, video { max-width: 100%; height: auto; vertical-align: middle; }

code, kbd, pre {
  font-family: var(--font-mono);
  font-size: .92em;
}
code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
pre {
  background: var(--surface-2);
  padding: 12px 14px;
  border-radius: var(--radius);
  overflow-x: auto;
}

ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
ul.list-plain { list-style: none; padding: 0; margin: 0; }

/* Focus ------------------------------------------------------------------ */
:focus-visible {
  outline: 2px solid var(--tf-cyan);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  top: -48px; left: 8px;
  z-index: var(--z-toast);
  background: var(--tf-teal);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  transition: top var(--t-base);
}
.skip-link:focus { top: 8px; text-decoration: none; }

/* Scrollbars ------------------------------------------------------------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: var(--radius-pill);
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* Layout utilities -------------------------------------------------------- */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.block { display: block; }
.hidden { display: none !important; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1 1 auto; min-width: 0; }
.gap-2 { gap: 4px; }
.gap-4 { gap: 8px; }
.gap-6 { gap: 12px; }
.gap-8 { gap: 16px; }
.gap-12 { gap: 24px; }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 4px; }
.mt-4 { margin-top: 8px; }
.mt-6 { margin-top: 12px; }
.mt-8 { margin-top: 16px; }
.mt-12 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 4px; }
.mb-4 { margin-bottom: 8px; }
.mb-6 { margin-bottom: 12px; }
.mb-8 { margin-bottom: 16px; }
.mb-12 { margin-bottom: 24px; }
.ml-auto { margin-left: auto; }
.mr-auto { margin-right: auto; }
.p-0 { padding: 0; }
.p-8 { padding: 16px; }
.p-12 { padding: 24px; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.overflow-auto { overflow: auto; }

.grid-2, .grid-3, .grid-4 {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}

@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-2, .grid-3, .grid-4 { gap: 20px; }
}

.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* Visibility helpers ------------------------------------------------------ */
.mobile-only { display: block; }
.desktop-only { display: none; }
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
  .desktop-only { display: block; }
  .desktop-only.flex { display: flex; }
}

@media print {
  .no-print { display: none !important; }
}

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