/* ============================================================
   Captured Hunt — Brand Primitives (v37.25.13)
   Reusable component classes: buttons, chips, sheets, toasts,
   modals, empty-states. Everything references tokens in :root.
   ============================================================ */

/* -------- Buttons: primary / secondary / tertiary / ghost -- */
.ch-btn {
  display:inline-flex; align-items:center; justify-content:center;
  gap:8px; padding:10px 16px; border:none; cursor:pointer;
  font-family:var(--font-d); font-weight:600; font-size:14px;
  letter-spacing:0.01em; border-radius:var(--radius-md);
  transition:transform var(--dur-micro) var(--ease-micro),
             background var(--dur-micro) var(--ease-micro),
             box-shadow var(--dur-micro) var(--ease-micro);
  -webkit-tap-highlight-color:transparent;
}
.ch-btn:active { transform:scale(0.97); }
.ch-btn:disabled { opacity:0.4; cursor:not-allowed; }

.ch-btn--primary {
  background:var(--brand-orange); color:var(--brand-black);
  box-shadow:var(--shadow-1);
}
.ch-btn--primary:hover { background:var(--brand-orange-hover); }
.ch-btn--primary:active { box-shadow:none; }

.ch-btn--secondary {
  background:transparent; color:var(--brand-cream);
  border:1px solid var(--stroke-strong);
}
.ch-btn--secondary:hover { border-color:var(--brand-cream-dim); background:var(--surface-2); }

.ch-btn--tertiary {
  background:transparent; color:var(--brand-orange);
  padding:8px 12px;
}
.ch-btn--tertiary:hover { background:var(--brand-orange-soft); }

.ch-btn--danger {
  background:var(--status-danger); color:var(--brand-cream);
}

.ch-btn--sm { padding:6px 10px; font-size:12px; border-radius:var(--radius-sm); }
.ch-btn--lg { padding:14px 20px; font-size:15px; border-radius:var(--radius-lg); }
.ch-btn--pill { border-radius:var(--radius-pill); }
.ch-btn--block { width:100%; }

/* -------- Chips: filter, status, property switcher --------- */
.ch-chip {
  display:inline-flex; align-items:center; gap:6px;
  padding:6px 12px; border-radius:var(--radius-pill);
  background:var(--surface-2); color:var(--brand-cream);
  border:1px solid var(--stroke);
  font-family:var(--font-d); font-weight:500; font-size:12px;
  letter-spacing:0.02em; cursor:pointer;
  transition:all var(--dur-micro) var(--ease-micro);
  -webkit-tap-highlight-color:transparent;
}
.ch-chip:hover { border-color:var(--brand-cream-dim); }
.ch-chip:active { transform:scale(0.96); }
.ch-chip--active {
  background:var(--brand-orange); color:var(--brand-black);
  border-color:var(--brand-orange);
}
.ch-chip--warn { background:var(--status-warn-soft); color:var(--brand-orange); border-color:transparent; }
.ch-chip--ghost { background:transparent; }
.ch-chip .ch-chip__dot { width:6px; height:6px; border-radius:50%; background:currentColor; }

/* -------- Cards ------------------------------------------- */
.ch-card {
  background:var(--surface-1);
  border:1px solid var(--stroke);
  border-radius:var(--radius-md);
  padding:var(--space-4);
  box-shadow:var(--shadow-1);
}
.ch-card--elevated {
  background:var(--surface-2);
  box-shadow:var(--shadow-2);
}

/* -------- Sheets (bottom sheets) -------------------------- */
.ch-sheet-backdrop {
  position:fixed; inset:0; background:rgba(0,0,0,0.55);
  z-index:5000;
  animation:ch-fade-in var(--dur-enter) var(--ease-enter);
}
.ch-sheet {
  position:fixed; left:0; right:0; bottom:0;
  background:var(--surface-1);
  border-top:1px solid var(--stroke);
  border-radius:var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow:var(--shadow-3);
  z-index:5001;
  padding:var(--space-4);
  padding-bottom:calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  max-height:88vh; overflow-y:auto;
  animation:ch-slide-up var(--dur-enter) var(--ease-enter);
}
.ch-sheet__grip {
  width:44px; height:4px; margin:0 auto var(--space-3);
  background:var(--stroke-strong); border-radius:var(--radius-pill);
}
.ch-sheet__title {
  font-family:var(--font-d); font-weight:600; font-size:17px;
  color:var(--brand-cream); margin-bottom:var(--space-3);
}

/* -------- Toasts ------------------------------------------ */
#ch-toast-stack {
  position:fixed; left:50%; transform:translateX(-50%);
  bottom:calc(24px + env(safe-area-inset-bottom, 0px));
  display:flex; flex-direction:column; gap:8px;
  z-index:9999; pointer-events:none;
  max-width:min(420px, calc(100vw - 32px));
}
.ch-toast {
  display:flex; align-items:center; gap:12px;
  padding:12px 16px 12px 14px;
  background:var(--surface-2); color:var(--brand-cream);
  border-left:3px solid var(--brand-orange);
  border-radius:var(--radius-md);
  box-shadow:var(--shadow-2);
  font-family:var(--font-b); font-size:13px; font-weight:500;
  pointer-events:auto;
  animation:ch-slide-up var(--dur-enter) var(--ease-enter);
}
.ch-toast--danger { border-left-color:var(--status-danger); }
.ch-toast--success { border-left-color:var(--brand-cream); }

/* -------- Modals (custom alert/confirm) -------------------- */
.ch-modal-backdrop {
  position:fixed; inset:0; background:rgba(0,0,0,0.65);
  z-index:9000; display:flex; align-items:center; justify-content:center;
  padding:var(--space-4);
  animation:ch-fade-in var(--dur-enter) var(--ease-enter);
}
.ch-modal {
  background:var(--surface-1);
  border:1px solid var(--stroke);
  border-radius:var(--radius-lg);
  box-shadow:var(--shadow-3);
  width:min(400px, 100%);
  padding:var(--space-5);
  animation:ch-scale-in var(--dur-enter) var(--ease-spring);
}
.ch-modal__title {
  font-family:var(--font-d); font-weight:600; font-size:17px;
  color:var(--brand-cream); margin-bottom:var(--space-2);
}
.ch-modal__body {
  color:var(--text-dim); font-size:14px; line-height:1.5;
  margin-bottom:var(--space-4);
}
.ch-modal__actions {
  display:flex; gap:var(--space-2); justify-content:flex-end;
}

/* -------- Empty states ------------------------------------- */
.ch-empty {
  display:flex; flex-direction:column; align-items:center;
  padding:var(--space-6) var(--space-4); text-align:center;
  color:var(--text-dim);
}
.ch-empty__icon {
  width:60px; height:60px; margin-bottom:var(--space-3);
  color:var(--brand-cream); opacity:0.7;
}
.ch-empty__title {
  font-family:var(--font-d); font-weight:600; font-size:16px;
  color:var(--brand-cream); margin-bottom:var(--space-1);
}
.ch-empty__body {
  font-size:13px; line-height:1.5;
  margin-bottom:var(--space-4); max-width:280px;
}
.ch-empty__cta { margin-bottom:var(--space-2); }

/* -------- Monospace numeric data --------------------------- */
.ch-mono { font-family:var(--font-mono); font-variant-numeric:tabular-nums; letter-spacing:-0.01em; }

/* -------- Motion keyframes --------------------------------- */
@keyframes ch-fade-in {
  from { opacity:0; }
  to   { opacity:1; }
}
@keyframes ch-slide-up {
  from { transform:translateY(24px); opacity:0; }
  to   { transform:translateY(0);    opacity:1; }
}
@keyframes ch-scale-in {
  from { transform:scale(0.92); opacity:0; }
  to   { transform:scale(1);    opacity:1; }
}
@keyframes ch-pulse-orange {
  0%,100% { box-shadow:0 0 0 0 rgba(232,121,26,0.4); }
  50%     { box-shadow:0 0 0 8px rgba(232,121,26,0); }
}

/* -------- Skeletons (loading shimmer) ---------------------- */
.ch-skel {
  background:linear-gradient(90deg,
    var(--surface-1) 0%, var(--surface-2) 50%, var(--surface-1) 100%);
  background-size:200% 100%;
  animation:ch-shimmer 1.4s linear infinite;
  border-radius:var(--radius-sm);
}
@keyframes ch-shimmer {
  from { background-position:200% 0; }
  to   { background-position:-200% 0; }
}

/* -------- Selected map pin state --------------------------- */
/* v37.25.19: teardrop pins get an orange glow instead of the ring pulse
   (which was tuned for circular chips). Uses the brand orange for on-brand
   emphasis without changing the pin’s cream fill or black glyph. */
.ch-pin--selected {
  filter:drop-shadow(0 0 8px rgba(232,121,26,0.85))
         drop-shadow(0 2px 4px rgba(0,0,0,0.55));
  animation:ch-pulse-drop 1.8s ease-out infinite;
}
@keyframes ch-pulse-drop {
  0%,100% { filter:drop-shadow(0 0 6px rgba(232,121,26,0.55))
                    drop-shadow(0 2px 4px rgba(0,0,0,0.55)); }
  50%     { filter:drop-shadow(0 0 12px rgba(232,121,26,0.95))
                    drop-shadow(0 2px 4px rgba(0,0,0,0.55)); }
}

/* -------- Universal press feedback on interactive rows ----- */
[data-press] { transition:transform var(--dur-micro) var(--ease-micro); }
[data-press]:active { transform:scale(0.98); }
