/* ============================================================
   PackHouse Design System — components
   CSS ports of the React primitives from the handoff bundle
   (Button, Badge, Card, StatBlock, SectionHeader, Input). Values
   mirror the component source exactly so markup stays pixel-true.
   ============================================================ */

/* ---------------- Button ---------------- */
.ph-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: var(--radius-xs);
  border: var(--border-thin) solid transparent;
  cursor: pointer;
  text-transform: uppercase;
  white-space: nowrap;
  line-height: 1;
  text-align: center;
  transition: transform var(--dur-fast) var(--ease-out),
    background var(--dur-base) var(--ease-out),
    color var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}
.ph-btn--sm { padding: 9px 16px; font-size: var(--text-sm); }
.ph-btn--md { padding: 13px 24px; font-size: 0.9375rem; }
.ph-btn--lg { padding: 17px 32px; font-size: var(--text-base); }

.ph-btn--primary {
  background: var(--action-primary);
  color: var(--action-primary-text);
  box-shadow: var(--shadow-red);
}
.ph-btn--primary:hover { transform: translateY(-2px); background: var(--action-primary-hover); color: var(--action-primary-text); }

.ph-btn--secondary {
  background: transparent;
  color: var(--text-strong);
  border-color: var(--line-ink);
}
.ph-btn--secondary:hover { transform: translateY(-2px); background: var(--ph-red); color: #fff; border-color: var(--ph-red); }

.ph-btn--ghost { background: transparent; color: var(--text-strong); }
.ph-btn--ghost:hover { transform: translateY(-2px); color: var(--ph-red); }

.ph-btn--inverse {
  background: transparent;
  color: var(--text-on-dark);
  border-color: var(--line-on-dark);
}
.ph-btn--inverse:hover { transform: translateY(-2px); border-color: var(--ph-red); color: var(--ph-red-bright); }

.ph-btn:active { transform: translateY(0) scale(0.98); }
.ph-btn[disabled], .ph-btn.is-disabled { opacity: 0.45; cursor: not-allowed; }
.ph-btn .ph-arrow { font-family: var(--font-mono); }

/* Keyboard focus — the design strips link underlines and runs on dark glass,
   so an explicit focus ring is required (WCAG 2.4.7). */
.ph-btn:focus-visible { outline: 2px solid var(--ph-red-bright); outline-offset: 2px; }

/* ---------------- Badge ---------------- */
.ph-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1;
  padding: 6px 10px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
  background: var(--surface-sunken);
  color: var(--text-strong);
  border: var(--border-hair) solid var(--line-strong);
}
.ph-badge--pill { padding: 6px 12px; border-radius: var(--radius-pill); }
.ph-badge--red { background: var(--ph-red); color: #fff; border-color: var(--ph-red); }
.ph-badge--outline { background: transparent; color: var(--text-strong); border-color: var(--line-ink); }
.ph-badge--dark { background: var(--surface-inverse); color: var(--text-on-dark); border-color: var(--line-on-dark); }
.ph-badge--success { background: rgba(31,122,77,0.12); color: var(--status-success); border-color: rgba(31,122,77,0.3); }
.ph-badge__dot { width: 6px; height: 6px; border-radius: var(--radius-pill); background: var(--ph-red); flex: none; }
.ph-badge--red .ph-badge__dot { background: #fff; }

/* ---------------- Card ---------------- */
.ph-card {
  position: relative;
  background: var(--surface-card);
  color: var(--text-body);
  border: var(--border-hair) solid var(--line-strong);
  border-radius: var(--radius-xs);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-base) var(--ease-out),
    box-shadow var(--dur-base) var(--ease-out),
    border-color var(--dur-base) var(--ease-out);
}
.ph-card--dark {
  background: var(--surface-inverse-raised);
  color: var(--text-on-dark);
  border-color: var(--line-on-dark);
  box-shadow: none;
}
.ph-card--top-rule { border-top: var(--border-rule) solid var(--ph-red); }
.ph-card--interactive { cursor: pointer; }
.ph-card--interactive:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--ph-red);
}
.ph-card--dark.ph-card--interactive:hover { box-shadow: var(--shadow-lg); }
.ph-card__index {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  letter-spacing: 0.12em;
  color: var(--text-muted);
  display: block;
  margin-bottom: var(--space-4);
}

/* ---------------- StatBlock ---------------- */
.ph-stat { display: flex; flex-direction: column; gap: 10px; }
.ph-stat__rule { width: 40px; height: var(--border-rule); background: var(--ph-red); }
.ph-stat__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.5rem, 4vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text-strong);
}
.ph-stat--dark .ph-stat__value { color: var(--text-on-dark); }
.ph-stat__suffix { color: var(--ph-red); }
.ph-stat__label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}
.ph-stat--dark .ph-stat__label { color: var(--text-muted-on-dark); }

/* ---------------- SectionHeader ---------------- */
.ph-section-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  text-align: left;
  align-items: flex-start;
  max-width: 820px;
}
.ph-section-header--center { text-align: center; align-items: center; max-width: 720px; margin-inline: auto; }
.ph-section-header__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-muted);
}
.ph-section-header--dark .ph-section-header__eyebrow { color: var(--text-muted-on-dark); }
.ph-section-header__tick { width: 10px; height: 10px; background: var(--ph-red); flex: none; }
/* Scoped under body.packhouse so it out-specifies the global heading reset. */
body.packhouse .ph-section-header__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-display-lg);
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text-strong);
  text-wrap: balance;
  margin: 0;
}
body.packhouse .ph-section-header--dark .ph-section-header__title { color: var(--text-on-dark); }
.ph-section-header__lead {
  font-size: var(--text-lead);
  line-height: 1.55;
  color: var(--text-body);
  max-width: 620px;
  margin: 0;
  text-wrap: pretty;
}
.ph-section-header--dark .ph-section-header__lead { color: var(--text-muted-on-dark); }

/* ---------------- Input ---------------- */
.ph-field { display: flex; flex-direction: column; gap: 8px; }
.ph-field__label {
  font-family: var(--font-mono);
  font-size: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
}
.ph-field__input {
  width: 100%;
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-strong);
  background: var(--surface-card);
  border: var(--border-thin) solid var(--line-strong);
  border-radius: var(--radius-xs);
  padding: 13px 14px;
  outline: none;
  transition: border-color var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.ph-field__input:focus {
  border-color: var(--line-ink);
  box-shadow: 0 0 0 3px rgba(255,16,16,0.12);
}
.ph-field__input--error { border-color: var(--ph-red); }
.ph-field__hint { font-size: var(--text-xs); color: var(--text-muted); }
.ph-field__hint--error { color: var(--ph-red); }
