/* ==========================================================================
   TeamTrek V3 — Shared components
   Buttons · cards · frames · tabs · badges · tiles · toggles · sparklines
   Every section composes these; no section defines its own button or card.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  border-radius: var(--r-sm);
  font-weight: var(--weight-semi);
  white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease-ui),
              box-shadow var(--dur-micro) var(--ease-ui),
              border-color var(--dur-micro) var(--ease-ui),
              color var(--dur-micro) var(--ease-ui);
}
.btn:disabled { opacity: .5; pointer-events: none; }
.btn .icon { transition: transform var(--dur-micro) var(--ease-ui); }
.btn:hover .icon--arrow { transform: translateX(3px); }

.btn--lg { height: 52px; padding-inline: 1.625rem; font-size: 1.0625rem; }
.btn--md { height: 44px; padding-inline: 1.25rem; font-size: 1rem; }
.btn--sm { height: 38px; padding-inline: 1.0625rem; font-size: .875rem; }

.btn--primary { background: var(--primary-700); color: #fff; }
.btn--primary:hover { background: var(--primary-800); box-shadow: var(--shadow-brand); }
.btn--primary:active { background: var(--primary-900); }

.btn--secondary { background: #fff; color: var(--neutral-900); border: 1px solid var(--neutral-300); }
.btn--secondary:hover { background: var(--neutral-50); border-color: var(--neutral-400); }
.btn--secondary:active { background: var(--neutral-100); }

.btn--ghost { color: var(--neutral-800); }
.btn--ghost:hover { background: var(--neutral-100); color: var(--primary-700); }

.btn--on-dark { background: #fff; color: var(--primary-900); }
.btn--on-dark:hover { background: var(--primary-100); }

.btn--on-dark-outline { color: #fff; border: 1px solid rgba(255,255,255,.28); }
.btn--on-dark-outline:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.45); }

.btn--block { width: 100%; }

.link-arrow {
  display: inline-flex; align-items: center; gap: .375rem;
  font-weight: var(--weight-semi); color: var(--primary-700);
  transition: gap var(--dur-micro) var(--ease-ui);
}
.link-arrow:hover { gap: .625rem; }

/* --------------------------------------------------------------------------
   2. Surfaces
   -------------------------------------------------------------------------- */
.card {
  border-radius: var(--r-lg);
  border: 1px solid var(--neutral-200);
  background: #fff;
  transition: transform var(--dur-ui) var(--ease-brand),
              box-shadow var(--dur-ui) var(--ease-brand),
              border-color var(--dur-micro) var(--ease-ui);
}
.card--lift:hover { transform: translateY(-3px); box-shadow: var(--shadow-03); border-color: var(--neutral-300); }
.card--pad { padding: clamp(1.25rem, 2vw, 1.75rem); }

.panel {
  border-radius: var(--r-md);
  border: 1px solid var(--neutral-200);
  background: #fff;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .875rem 1.125rem;
  border-bottom: 1px solid var(--neutral-200);
  background: var(--neutral-50);
  border-radius: var(--r-md) var(--r-md) 0 0;
}
.panel__title { font-size: .8125rem; font-weight: var(--weight-semi); color: var(--neutral-900); }
.panel__meta  { font-size: .75rem; color: var(--neutral-500); }
.panel__body { padding: 1.125rem; }

/* Browser-chrome frame around the product mocks */
.frame {
  overflow: hidden;
  border-radius: var(--r-xl);
  border: 1px solid var(--neutral-200);
  background: #fff;
  box-shadow: var(--shadow-04);
}
.frame--hero { box-shadow: var(--shadow-hero); border-radius: var(--r-lg); }
.frame__bar {
  display: flex; align-items: center; gap: .5rem;
  height: 40px; padding-inline: 1.125rem;
  border-bottom: 1px solid var(--neutral-200);
  background: var(--neutral-50);
}
.frame__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--neutral-300); flex-shrink: 0; }
.frame__lock { margin-left: .625rem; width: 13px; height: 13px; color: var(--neutral-400); }
.frame__label {
  border-radius: var(--r-pill); background: var(--neutral-150);
  padding: .1875rem .6875rem;
  font-size: .75rem; font-weight: var(--weight-medium); color: var(--neutral-500);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.frame__spacer { margin-left: auto; }
.frame__body { position: relative; }

/* Cap the mock body.
   The mocks are what set a section's height floor — the dashboard mock alone
   runs past 800px, which would dwarf the copy column beside it. Capping keeps
   the frame chrome, the aspect and the composition, and clips the body with a
   soft fade rather than a scrollbar: the standard product-screenshot
   treatment, and it needs no interaction.
   The fade is applied only when the mock is genuinely taller than the cap
   (js/animations.js adds .is-clipped after measuring), otherwise a mock that
   already fits gets its last row dimmed for no reason. */
.frame--capped .frame__body {
  max-height: var(--frame-cap, 400px);
  overflow: hidden;
}
.frame--capped .frame__body.is-clipped {
  -webkit-mask-image: linear-gradient(to bottom, #000 0 88%, transparent 100%);
          mask-image: linear-gradient(to bottom, #000 0 88%, transparent 100%);
}

/* --------------------------------------------------------------------------
   3. Badges, pills, tiles
   -------------------------------------------------------------------------- */
.badge-pill {
  display: inline-flex; align-items: center; gap: .375rem;
  border-radius: var(--r-pill); padding: .3125rem .6875rem;
  font-size: .75rem; font-weight: var(--weight-semi); white-space: nowrap;
}
.badge-pill .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge--success { background: var(--success-tint); color: var(--success-text); }
.badge--success .dot { background: var(--success-fill); }
.badge--warning { background: var(--warning-tint); color: var(--warning-text); }
.badge--warning .dot { background: var(--warning-fill); }
.badge--danger  { background: var(--danger-tint);  color: var(--danger-text); }
.badge--danger .dot { background: var(--danger-fill); }
.badge--tint { background: var(--primary-50); color: var(--primary-700); }
.badge--tint .dot { background: var(--primary-600); }

.chip-tag {
  display: inline-flex; align-items: center;
  border: 1px solid var(--neutral-300); border-radius: var(--r-xs);
  padding: .1875rem .5rem;
  font-size: .75rem; font-weight: var(--weight-medium); color: var(--neutral-600);
}
.chip-tag--on-dark { border-color: var(--ink-line); color: var(--neutral-400); }
.chip-tag--live { border-color: var(--primary-700); color: var(--primary-300); }

.tile {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: var(--primary-100); color: var(--primary-800);
  flex-shrink: 0;
}
.tile--sm { width: 34px; height: 34px; border-radius: var(--r-sm); }
.tile--md { width: 44px; height: 44px; }
.tile--lg { width: 48px; height: 48px; }
.tile--quiet { background: var(--neutral-50); border: 1px solid var(--neutral-200); color: var(--neutral-500); }

.dot-live {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: var(--primary-600);
  animation: tt-pulse 2.2s var(--ease-ui) infinite;
}

.status-line {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .75rem; font-weight: var(--weight-medium); color: var(--primary-700);
}

/* --------------------------------------------------------------------------
   4. Checklist (used by product tabs and use cases)
   -------------------------------------------------------------------------- */
.checklist { display: flex; flex-direction: column; gap: .75rem; }
.checklist li { display: flex; align-items: flex-start; gap: .75rem; color: var(--neutral-800); }
.checklist .icon { margin-top: 3px; color: var(--primary-600); }

.bullets { display: grid; gap: .625rem; }
.bullets li { display: flex; align-items: center; gap: .625rem; color: var(--neutral-800); }
.bullets li::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--primary-600); flex: none;
}

/* --------------------------------------------------------------------------
   5. Tab pillbar — shared by the product tabs and the use-case tabs
   -------------------------------------------------------------------------- */
.pillbar {
  position: relative;
  display: inline-flex; gap: .25rem;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  border-radius: var(--r-pill);
  background: var(--neutral-150);
  padding: .3125rem;
  scrollbar-width: none;
}
.pillbar::-webkit-scrollbar { display: none; }
.pillbar--n100 { background: var(--neutral-100); }

.pillbar__indicator {
  position: absolute; top: .3125rem; left: 0;
  height: calc(100% - .625rem);
  border-radius: var(--r-pill);
  background: #fff;
  box-shadow: var(--shadow-01);
  transition: transform var(--dur-ui) var(--ease-brand), width var(--dur-ui) var(--ease-brand);
  pointer-events: none;
}
.pillbar__tab {
  position: relative;
  white-space: nowrap;
  border-radius: var(--r-pill);
  padding: .625rem 1.125rem;
  font-size: .9375rem; font-weight: var(--weight-semi);
  color: var(--neutral-600);
  transition: color var(--dur-micro) var(--ease-ui);
}
.pillbar__tab:hover { color: var(--neutral-800); }
.pillbar__tab[aria-selected="true"] { color: var(--neutral-900); }

/* Bordered tab row — used by the "by role" tabs */
.tabrow {
  display: flex; flex-wrap: wrap; gap: .5rem;
}
.tabrow--scroll {
  flex-wrap: nowrap; overflow-x: auto; padding-bottom: .25rem;
  scrollbar-width: none; overscroll-behavior-x: contain;
}
.tabrow--scroll::-webkit-scrollbar { display: none; }
.tabrow__tab {
  display: inline-flex; align-items: center;
  min-height: 44px; padding: .625rem 1.125rem;
  border: 1px solid var(--neutral-300); border-radius: var(--r-sm);
  background: #fff; color: var(--neutral-800);
  font-size: .9375rem; font-weight: var(--weight-semi);
  white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease-ui),
              color var(--dur-micro) var(--ease-ui),
              border-color var(--dur-micro) var(--ease-ui);
}
.tabrow__tab:hover { background: var(--neutral-50); border-color: var(--neutral-400); }
.tabrow__tab[aria-selected="true"] {
  background: var(--primary-700); border-color: var(--primary-700); color: #fff;
}

/* Panel crossfade shared by every tabbed section */
.panel-fade { transition: opacity var(--dur-ui) var(--ease-brand), transform var(--dur-ui) var(--ease-brand); }
.panel-fade.is-leaving  { opacity: 0; transform: translateY(-8px); }
.panel-fade.is-entering { opacity: 0; transform: translateY(12px); }

/* Enter animation for a single tab-panel element (the figure half of a
   two-column panel, say), delayed with --enter-delay so it follows the copy
   rather than arriving with it. */
.tab-in {
  opacity: 0; transform: translateY(10px);
  animation: fadeUpSm .46s var(--ease-brand) forwards;
  animation-delay: var(--enter-delay, 0s);
}

/* Staggered enter for tab-panel children */
.tab-enter > * {
  opacity: 0; transform: translateY(8px);
  animation: fadeUpSm .42s var(--ease-brand) forwards;
}
.tab-enter > *:nth-child(1) { animation-delay: 0s; }
.tab-enter > *:nth-child(2) { animation-delay: .06s; }
.tab-enter > *:nth-child(3) { animation-delay: .12s; }
.tab-enter > *:nth-child(4) { animation-delay: .18s; }
.tab-enter > *:nth-child(5) { animation-delay: .24s; }

/* --------------------------------------------------------------------------
   6. Meters, tracks, sparklines
   -------------------------------------------------------------------------- */
.meter { display: grid; gap: .375rem; }
.meter__row {
  display: flex; justify-content: space-between; gap: .75rem;
  font-size: .8125rem; color: var(--neutral-600);
  font-variant-numeric: tabular-nums;
}
.meter__track {
  height: 5px; border-radius: var(--r-pill);
  background: var(--neutral-150); overflow: hidden;
}
.meter__bar {
  /* Authored as a <span>, so it needs an explicit box — an inline element
     ignores width and the fill would never appear. */
  display: block;
  height: 100%; border-radius: var(--r-pill);
  background: var(--primary-600);
  width: 0;
  transition: width var(--dur-figure) var(--ease-brand);
}
.meter__bar--soft { background: var(--primary-300); }
.meter__bar--quiet { background: var(--neutral-300); }
.meter--on-dark .meter__track { background: var(--ink-700); }
.meter--on-dark .meter__row { color: var(--neutral-400); }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.spark span {
  flex: 1; min-width: 2px; border-radius: 1px;
  background: var(--primary-200);
  height: 8%;
  transition: height .56s var(--ease-brand);
}
.spark span:last-child { background: var(--primary-600); }

.toggle {
  width: 32px; height: 18px; border-radius: var(--r-pill);
  background: var(--primary-600); position: relative; flex: none;
}
.toggle::after {
  content: ""; position: absolute; top: 3px; right: 3px;
  width: 12px; height: 12px; border-radius: 50%; background: #fff;
  transition: transform var(--dur-ui) var(--ease-brand);
}
.toggle--off { background: var(--neutral-200); }
.toggle--off::after { background: var(--neutral-400); transform: translateX(-14px); }

/* Data table used inside mock panels */
.dtable { width: 100%; font-size: .8125rem; }
.dtable__head,
.dtable__row { display: grid; gap: .5rem; padding: .625rem .875rem; align-items: center; }
.dtable__head {
  background: var(--neutral-50);
  border-bottom: 1px solid var(--neutral-200);
  font-size: .6875rem; font-weight: var(--weight-semi);
  text-transform: uppercase; letter-spacing: .08em; color: var(--neutral-500);
}
.dtable__row { border-bottom: 1px solid var(--neutral-150); font-variant-numeric: tabular-nums; }
.dtable__row:last-child { border-bottom: 0; }
.dtable__pos { color: var(--primary-700); font-weight: var(--weight-semi); }
