/* ==========================================================================
   Components — buttons, cards, badges, forms, footer, callouts, tables
   ========================================================================== */

/* ---- Buttons ---- */
.btn {
  --btn-fg: var(--color-white);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.78rem 1.15rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  border: 1px solid transparent;
  color: var(--btn-fg);
  background: var(--color-ink-900);
  transition: transform var(--duration-fast) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard), background var(--duration-base) var(--ease-standard), border-color var(--duration-base) var(--ease-standard), color var(--duration-base) var(--ease-standard);
  min-height: 2.65rem;
  max-width: 100%;
  text-align: center;
  white-space: normal;
  line-height: 1.15;
}

.btn svg { width: 1.05em; height: 1.05em; flex-shrink: 0; }

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .btn { transition: background var(--duration-base), border-color var(--duration-base); }
  .btn:hover { transform: none; }
}

.btn--primary {
  background: var(--gradient-cta);
  box-shadow: var(--shadow-glow-cyan);
}

.btn--primary:hover { box-shadow: var(--shadow-glow-violet); }

.btn--dark { background: var(--color-ink-900); }
.btn--dark:hover { background: var(--color-ink-800); }

.btn--ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-strong);
}

.btn--ghost:hover { background: var(--color-mist-100); border-color: var(--color-mist-400); }

.btn--on-dark {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-white);
  border-color: var(--border-on-dark);
}

.btn--on-dark:hover { background: rgba(255, 255, 255, 0.12); }

.btn--sm { padding: 0.55rem 0.9rem; font-size: var(--fs-xs); min-height: 2.2rem; }
.btn--lg { padding: 0.9rem 1.45rem; font-size: var(--fs-base); }
.btn--block { width: 100%; }

.btn--text {
  background: none;
  color: var(--accent-primary-strong);
  padding: 0.3rem 0;
  min-height: auto;
}

.btn--text:hover { color: var(--accent-secondary); transform: none; }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.55;
  pointer-events: none;
}

/* ---- Badges / tags ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  background: var(--color-mist-100);
  color: var(--accent-primary-strong);
  border: 1px solid var(--border-subtle);
}

.badge--cyan { background: rgba(23, 185, 214, 0.12); color: var(--color-cyan-600); border-color: rgba(23, 185, 214, 0.25); }
.badge--violet { background: rgba(124, 92, 240, 0.12); color: var(--color-violet-600); border-color: rgba(124, 92, 240, 0.25); }
.badge--teal { background: rgba(31, 184, 148, 0.12); color: var(--color-teal-500); border-color: rgba(31, 184, 148, 0.25); }
.badge--amber { background: rgba(247, 154, 18, 0.12); color: var(--color-amber-500); border-color: rgba(247, 154, 18, 0.25); }
.badge--on-dark { background: rgba(255, 255, 255, 0.08); color: var(--color-cyan-300); border-color: var(--border-on-dark); }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---- Cards ---- */
.card {
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: clamp(1rem, 2.2vw, 1.45rem);
  box-shadow: var(--shadow-sm);
  transition: transform var(--duration-base) var(--ease-standard), box-shadow var(--duration-base) var(--ease-standard), border-color var(--duration-base) var(--ease-standard);
}

a.card:hover, .card.is-interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-mist-300);
}

@media (prefers-reduced-motion: reduce) {
  a.card:hover, .card.is-interactive:hover { transform: none; }
}

.card__icon {
  width: 2.65rem;
  height: 2.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background: linear-gradient(155deg, rgba(23, 185, 214, 0.14), rgba(124, 92, 240, 0.14));
  color: var(--accent-primary-strong);
  margin-bottom: 0.9rem;
}

.card__icon svg {
  width: 1.35rem;
  height: 1.35rem;
}

.card__title { font-size: var(--fs-md); margin-bottom: 0.5rem; }
.card__body {
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  overflow-wrap: anywhere;
}

.card__link {
  margin-top: var(--space-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  color: var(--accent-primary-strong);
}

.card__link svg { width: 1rem; height: 1rem; transition: transform var(--duration-base) var(--ease-standard); }
a.card:hover .card__link svg { transform: translateX(3px); }

.card--dark {
  background: var(--surface-dark-alt);
  border-color: var(--border-on-dark);
  color: var(--text-on-dark);
}

.card--dark .card__body { color: var(--text-on-dark-muted); }

.card--flush { padding: 0; overflow: hidden; }

.card--stat { text-align: left; }
.card--stat .stat-value {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-black);
  letter-spacing: var(--ls-tight);
  display: block;
}
.card--stat .stat-label { color: var(--text-secondary); font-size: var(--fs-sm); }

/* ---- Icon tile (standalone) ---- */
.icon-tile {
  width: 2.45rem;
  height: 2.45rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.icon-tile svg {
  width: 60%;
  height: 60%;
}

/* ---- Breadcrumbs ---- */
.breadcrumbs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  font-size: var(--fs-xs);
  color: var(--text-muted);
  padding-block: var(--space-sm);
}

.breadcrumbs a { color: var(--text-secondary); }
.breadcrumbs a:hover { color: var(--accent-primary-strong); }
.breadcrumbs [aria-current="page"] { color: var(--text-primary); font-weight: var(--fw-medium); }
.breadcrumbs svg { width: 0.7rem; height: 0.7rem; opacity: 0.6; }

/* ---- Callouts / notices ---- */
.callout {
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent-primary);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-alt);
  display: flex;
  gap: 0.85rem;
  min-width: 0;
}

.callout svg { width: 1.2rem; height: 1.2rem; flex-shrink: 0; color: var(--accent-primary-strong); margin-top: 0.15rem; }
.callout h3, .callout p { font-size: var(--fs-sm); }
.callout h3 { margin-bottom: 0.25rem; }
.callout p { color: var(--text-secondary); }

.callout--warning { border-left-color: var(--accent-warning); }
.callout--warning svg { color: var(--accent-warning); }

.callout--info { border-left-color: var(--accent-secondary); }
.callout--info svg { color: var(--accent-secondary); }

/* ---- Numbered step list ---- */
.step-list { counter-reset: step; display: flex; flex-direction: column; gap: var(--space-sm); }

.step-list li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  min-height: 2rem;
}

.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 0;
  width: 2.1rem; height: 2.1rem;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: var(--fw-bold);
  font-size: var(--fs-sm);
  color: var(--color-white);
  background: var(--gradient-cta);
}

.step-list strong { display: block; margin-bottom: 0.2rem; }
.step-list span { color: var(--text-secondary); font-size: var(--fs-sm); }

/* ---- Feature checklists ---- */
.feature-checks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 0.55rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.feature-checks--wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.feature-checks li {
  display: flex;
  align-items: flex-start;
  gap: 0.45rem;
  min-width: 0;
  max-width: none;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.78);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  line-height: 1.35;
}

.feature-checks li span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.feature-checks svg {
  width: 1rem;
  height: 1rem;
  margin-top: 0.1rem;
  flex-shrink: 0;
  color: var(--accent-primary-strong);
}

.section--dark .feature-checks li,
[data-surface="dark"] .feature-checks li {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--border-on-dark);
  color: var(--text-on-dark-muted);
}

.section--dark .feature-checks svg,
[data-surface="dark"] .feature-checks svg {
  color: var(--color-cyan-300);
}

/* ---- Definition / info table ---- */
.info-table { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.info-table tr:not(:last-child) th, .info-table tr:not(:last-child) td { border-bottom: 1px solid var(--border-subtle); }
.info-table th, .info-table td {
  text-align: left;
  padding: 0.85rem 1.1rem;
  font-size: var(--fs-sm);
  vertical-align: top;
}
.info-table th { width: 38%; color: var(--text-secondary); font-weight: var(--fw-medium); background: var(--surface-alt); }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Forms ---- */
.form-grid { display: grid; gap: var(--space-sm); }

@media (min-width: 40rem) {
  .form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.field { display: flex; flex-direction: column; gap: 0.4rem; }

.field label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--text-primary);
}

.field .required { color: var(--accent-danger); margin-left: 0.2em; }

.field input,
.field textarea,
.field select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.95rem;
  font-size: var(--fs-sm);
  background: var(--surface-raised);
  color: var(--text-primary);
  width: 100%;
  min-height: 2.9rem;
  transition: border-color var(--duration-fast) var(--ease-standard), box-shadow var(--duration-fast) var(--ease-standard);
}

.field textarea { min-height: 8rem; resize: vertical; }

.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible {
  border-color: var(--accent-primary);
  box-shadow: var(--focus-ring);
  outline: none;
}

.field input:user-invalid,
.field textarea:user-invalid {
  border-color: var(--accent-danger);
}

.field-hint { font-size: var(--fs-xs); color: var(--text-muted); }
.field-error {
  font-size: var(--fs-xs);
  color: var(--accent-danger);
  display: none;
  align-items: center;
  gap: 0.3rem;
}
.field.has-error .field-error { display: flex; }
.field.has-error input, .field.has-error textarea, .field.has-error select { border-color: var(--accent-danger); }

.field-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  font-size: var(--fs-xs);
  color: var(--text-secondary);
}

.field-check input { width: 1.1rem; height: 1.1rem; margin-top: 0.15rem; flex-shrink: 0; }

.honeypot-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.form-status {
  display: none;
  align-items: flex-start;
  gap: 0.65rem;
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  margin-top: var(--space-sm);
}

.form-status svg { width: 1.3rem; height: 1.3rem; flex-shrink: 0; margin-top: 0.1rem; }
.form-status.is-visible { display: flex; }
.form-status--success { background: rgba(31, 184, 148, 0.1); color: var(--color-teal-500); border: 1px solid rgba(31, 184, 148, 0.3); }
.form-status--error { background: rgba(240, 96, 74, 0.1); color: var(--color-coral-500); border: 1px solid rgba(240, 96, 74, 0.3); }
.form-status--loading { background: var(--surface-alt); color: var(--text-secondary); border: 1px solid var(--border-subtle); }

.spinner {
  width: 1.1rem; height: 1.1rem;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.4s; }
}

/* ---- Footer ---- */
.site-footer {
  background: linear-gradient(180deg, var(--color-ink-850), var(--color-ink-950));
  border-top: 1px solid rgba(127, 230, 242, 0.2);
  color: var(--text-on-dark);
  overflow: hidden;
}

.site-footer a { color: var(--text-on-dark-muted); }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--color-white); }

.footer-top {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: minmax(0, 1.15fr) repeat(3, minmax(0, 1fr));
  align-items: start;
  padding-block: var(--space-lg);
}

@media (max-width: 62rem) {
  .footer-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 34rem) {
  .footer-top { grid-template-columns: 1fr; }
}

.footer-brand .brand {
  color: var(--color-white);
  margin-bottom: 0.75rem;
  width: fit-content;
  max-width: 100%;
}
.footer-brand .brand__logo {
  width: min(100%, 14.25rem);
  max-height: 5.9rem;
  object-fit: contain;
  object-position: left center;
}
.footer-brand .brand__name small { color: var(--text-on-dark-muted); }
.footer-brand p { color: var(--text-on-dark-muted); font-size: var(--fs-sm); max-width: 23rem; }

.footer-social { display: flex; gap: 0.6rem; margin-top: var(--space-sm); }
.footer-social a {
  width: 2.75rem; height: 2.75rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border-on-dark);
}
.footer-social a:hover { background: rgba(255, 255, 255, 0.08); }
.footer-social svg { width: 1.1rem; height: 1.1rem; }

.footer-col-title {
  font-size: var(--fs-xs);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--text-on-dark-muted);
  margin-bottom: var(--space-sm);
}

.footer-col ul { display: flex; flex-direction: column; gap: 0.48rem; }
.footer-col a { font-size: var(--fs-sm); }

.footer-newsletter { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.6rem; }
.footer-newsletter .field input { background: rgba(255, 255, 255, 0.05); border-color: var(--border-on-dark); color: var(--color-white); }
.footer-newsletter .field input::placeholder { color: var(--text-on-dark-muted); }

.footer-bottom {
  border-top: 1px solid var(--border-on-dark);
  padding-block: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  font-size: var(--fs-xs);
  color: var(--text-on-dark-muted);
}

.footer-bottom-links { display: flex; flex-wrap: wrap; gap: 1.1rem; }

.footer-disclaimer-note {
  font-size: var(--fs-xs);
  color: var(--text-on-dark-muted);
  max-width: none;
  padding: 0.85rem 1rem;
  margin-top: var(--space-lg);
  border: 1px solid var(--border-on-dark);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.045);
  margin-bottom: 0;
}

/* ---- Pagination ---- */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.4rem; margin-top: var(--space-lg); }
.pagination a, .pagination span {
  min-width: 2.5rem; height: 2.5rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  font-size: var(--fs-sm);
  border: 1px solid var(--border-subtle);
}
.pagination a:hover { background: var(--color-mist-100); }
.pagination [aria-current="page"] { background: var(--color-ink-900); color: var(--color-white); border-color: var(--color-ink-900); }

/* ---- Filter chips (insights) ---- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 0.55rem; }
.filter-chip {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-strong);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  background: var(--surface-raised);
}
.filter-chip[aria-pressed="true"] {
  background: var(--color-ink-900);
  color: var(--color-white);
  border-color: var(--color-ink-900);
}

/* ---- Archived-content banner ---- */
.archive-banner {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: var(--space-sm) var(--space-md);
  background: var(--surface-alt);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
}

.archive-banner svg { width: 1.3rem; height: 1.3rem; flex-shrink: 0; color: var(--text-muted); margin-top: 0.1rem; }

/* ---- Logo / partner strip ---- */
.strip { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-lg); }

/* ---- Prose (long-form article / legal content) ---- */
.prose { max-width: var(--width-prose); }
.prose > * + * { margin-top: 1.1em; }
.prose h2 { margin-top: 1.8em; font-size: var(--fs-xl); }
.prose h3 { margin-top: 1.4em; font-size: var(--fs-lg); }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose ul { list-style: disc; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: 0.5em; }
.prose a { color: var(--text-link); text-decoration: underline; text-underline-offset: 0.15em; }
.prose strong { font-weight: var(--fw-semibold); }

@media (max-width: 46rem) {
  .btn {
    width: 100%;
    justify-content: center;
  }
  .card__icon {
    width: 2.45rem;
    height: 2.45rem;
  }
  .card__icon svg {
    width: 1.25rem;
    height: 1.25rem;
  }
  .info-table,
  .info-table tbody,
  .info-table tr,
  .info-table th,
  .info-table td {
    display: block;
    width: 100%;
  }
  .info-table th {
    border-bottom: 1px solid var(--border-subtle);
  }
  .footer-top {
    gap: var(--space-sm);
    padding-block: var(--space-lg);
  }
  .footer-bottom {
    align-items: flex-start;
  }
  .footer-bottom-links {
    gap: 0.8rem;
  }
}
