/* Tritex Trade — design tokens */

:root {
  /* Primary */
  --primary-900: #14224F;
  --primary-700: #2A3E85;
  --primary-500: #4A5FB5;
  --primary-100: #E8ECF6;

  /* Accent (overridable via Tweaks) */
  --accent-600: #C25A1F;
  --accent-500: #DD6E2C;
  --accent-100: #FBEDE2;

  /* Neutrals */
  --bg: #FAFAF7;
  --surface: #FFFFFF;
  --border: #E5E2DA;
  --text-primary: #1A1F2C;
  --text-secondary: #5A6172;
  --text-muted: #8B91A0;

  /* Semantic */
  --success: #2F8A55;
  --warning: #B8860B;
  --info:    #3A6EA5;

  /* Type */
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Layout */
  --container: 1240px;
  --container-pad: 24px;

  /* Radii */
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
img, svg { display: block; max-width: 100%; }

/* Type scale */
.t-display  { font-size: 56px; line-height: 64px; font-weight: 700; letter-spacing: -0.02em; }
.t-h1       { font-size: 40px; line-height: 48px; font-weight: 700; letter-spacing: -0.015em; }
.t-h2       { font-size: 28px; line-height: 36px; font-weight: 600; letter-spacing: -0.01em; }
.t-h3       { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.005em; }
.t-body-lg  { font-size: 18px; line-height: 28px; font-weight: 400; }
.t-body     { font-size: 16px; line-height: 24px; font-weight: 400; }
.t-small    { font-size: 14px; line-height: 20px; font-weight: 400; }
.t-caption  { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.02em; }

@media (max-width: 720px) {
  .t-display { font-size: 40px; line-height: 48px; }
  .t-h1      { font-size: 32px; line-height: 40px; }
  .t-h2      { font-size: 24px; line-height: 32px; }
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}

/* Utility */
.mono-num { font-variant-numeric: tabular-nums; letter-spacing: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--r-sm);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  cursor: pointer;
  border: 1.5px solid transparent;
  background: transparent;
  color: inherit;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary-700);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-500); }
.btn-cta {
  background: var(--accent-600);
  color: #fff;
}
.btn-cta:hover { background: var(--accent-500); }
.btn-secondary {
  border-color: var(--primary-700);
  color: var(--primary-700);
}
.btn-secondary:hover { background: var(--primary-100); }
.btn-ghost {
  color: var(--primary-700);
  padding: 0 4px;
  height: 36px;
}
.btn-ghost:hover { text-decoration: underline; text-underline-offset: 4px; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 14px; }
.btn-block { width: 100%; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.02em;
}
.badge-hit       { background: var(--accent-100);  color: var(--accent-600); }
.badge-new       { background: var(--primary-100); color: var(--primary-700); }
.badge-stock     { background: #E5F1EB; color: var(--success); }
.badge-order     { background: #FBF1DA; color: var(--warning); }
.badge-info      { background: #E3ECF7; color: var(--info); }

/* Inputs */
.field {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-primary);
  font: inherit;
  font-size: 15px;
  outline: none;
  transition: border-color 120ms ease;
}
.field:focus { border-color: var(--primary-700); }
.field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* Surface */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}

/* Hairline divider */
.hr { height: 1px; background: var(--border); border: 0; margin: 0; }

/* Utility text colors */
.tx-secondary { color: var(--text-secondary); }
.tx-muted     { color: var(--text-muted); }
.tx-primary-900 { color: var(--primary-900); }
.tx-primary-700 { color: var(--primary-700); }
.tx-accent      { color: var(--accent-600); }

/* Section spacing */
.section {
  padding-top: 96px;
  padding-bottom: 96px;
}
@media (max-width: 720px) {
  .section { padding-top: 56px; padding-bottom: 56px; }
}

/* Eyebrow / section label */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary-700);
}
.eyebrow::before {
  content: "";
  display: inline-block;
  width: 24px;
  height: 1px;
  background: var(--primary-700);
}

/* Focus ring (accessibility) */
:focus-visible {
  outline: 2px solid var(--primary-500);
  outline-offset: 2px;
}

/* ─── Messenger pill buttons ─────────────────────────────────────── */
.msg-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  position: relative;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    border-color 200ms cubic-bezier(0.16, 1, 0.3, 1),
    background    200ms cubic-bezier(0.16, 1, 0.3, 1),
    color         200ms cubic-bezier(0.16, 1, 0.3, 1),
    transform     200ms cubic-bezier(0.16, 1, 0.3, 1);
}
.msg-pill__label { letter-spacing: 0.005em; }

/* The green online dot + pulsing ring */
.msg-dot {
  position: relative;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
}
.msg-dot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--success);
  animation: msgPulse 1.6s cubic-bezier(0.16, 1, 0.3, 1) infinite;
  pointer-events: none;
}
@keyframes msgPulse {
  0%   { transform: scale(1);   opacity: 0.5; }
  80%  { transform: scale(2);   opacity: 0;   }
  100% { transform: scale(2);   opacity: 0;   }
}

/* Hover: invert into solid primary */
.msg-pill:hover {
  border-color: var(--primary-500);
  background: var(--primary-700);
  color: #fff;
  transform: translateY(-2px);
}
.msg-pill:hover .msg-dot { background: #fff; }
.msg-pill:hover .msg-dot::after { background: #fff; }

/* Tooltip */
.msg-tip {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translate(-50%, -4px);
  background: var(--primary-900);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 50;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 6px 20px -4px rgba(20, 34, 79, 0.25);
}
.msg-tip::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: var(--primary-900);
}
.msg-pill:hover .msg-tip {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .msg-pill, .msg-tip { transition: none; }
  .msg-pill:hover { transform: none; }
  .msg-dot::after { animation: none; opacity: 0; }
}

/* ─── Category card · grid-equalised + premium hover ─────────────────── */
.cat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  grid-auto-rows: 1fr;
  gap: 16px;
  margin-top: 48px;
  align-items: stretch;
}
.cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  height: 100%;
  width: 100%;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 240ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 240ms cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}
.cat-card__icon {
  width: 44px; height: 44px;
  border-radius: 6px;
  background: var(--primary-100);
  color: var(--primary-700);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 240ms cubic-bezier(0.16, 1, 0.3, 1),
              color 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cat-card__body { display: flex; flex-direction: column; gap: 4px; }
.cat-card__count { font-size: 11px; color: var(--text-muted); font-weight: 500; }
.cat-card__title { font-size: 17px; font-weight: 600; color: var(--primary-900); line-height: 1.3; }
.cat-card__cta {
  margin-top: auto;
  color: var(--primary-700);
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cat-card__cta-arrow {
  display: inline-flex;
  transition: transform 240ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cat-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px -8px rgba(20, 34, 79, 0.18);
  border-color: var(--primary-500);
}
.cat-card:hover .cat-card__icon { background: var(--primary-700); color: #fff; }
.cat-card:hover .cat-card__cta { color: var(--accent-600); }
.cat-card:hover .cat-card__cta-arrow { transform: translateX(6px); }

@media (max-width: 720px) {
  .cat-card:hover { transform: translateY(-3px); }
  .cat-card:hover .cat-card__cta-arrow { transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .cat-card, .cat-card__icon, .cat-card__cta, .cat-card__cta-arrow { transition: none; }
  .cat-card:hover { transform: none; }
  .cat-card:hover .cat-card__cta-arrow { transform: none; }
}

/* ─── Hero Rotator ─────────────────────────────────────────────────────── */
.hr-stage { position: relative; aspect-ratio: 4/5; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.hr-slide {
  position: absolute; inset: 0;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 800ms cubic-bezier(0.4, 0, 0.2, 1), transform 800ms cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}
.hr-slide.is-active {
  opacity: 1;
  transform: scale(1);
}
.hr-progress {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px;
  background: rgba(255,255,255,0.18);
  z-index: 3;
}
.hr-progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: var(--primary-700);
  width: 0%;
}
.hr-progress-fill.is-running {
  animation: hrProgress 7000ms linear forwards;
}
.hr-progress-fill.is-paused { animation-play-state: paused; }
@keyframes hrProgress { from { width: 0%; } to { width: 100%; } }

.hr-caption {
  position: absolute; left: 24px; right: 24px; bottom: 24px;
  background: rgba(20,34,79,0.86);
  backdrop-filter: blur(12px);
  color: #fff;
  padding: 20px 24px;
  border-radius: 8px;
  z-index: 2;
  transition: transform 380ms cubic-bezier(0.22, 0.61, 0.36, 1), opacity 380ms ease-out;
}
.hr-caption.is-leaving { transform: translateY(8px); opacity: 0; }

.hr-dots {
  position: absolute;
  left: 24px; bottom: 100px;
  display: flex;
  gap: 10px;
  z-index: 4;
}
.hr-dot {
  width: 6px; height: 6px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.7);
  background: transparent;
  padding: 0; margin: 0;
  cursor: pointer;
  transition: background 200ms, border-color 200ms, transform 200ms;
  position: relative;
}
.hr-dot.is-active { background: #fff; border-color: #fff; transform: scale(1.2); }
.hr-dot:hover .hr-dot-tip { opacity: 1; transform: translate(-50%, -8px); }
.hr-dot-tip {
  position: absolute;
  left: 50%; bottom: 100%;
  transform: translate(-50%, 0);
  background: rgba(20,34,79,0.95);
  color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 6px 10px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  letter-spacing: 0.02em;
}

/* Number flip (01/05 → 02/05) */
.hr-num-host {
  display: inline-flex; align-items: baseline; gap: 0;
  font-variant-numeric: tabular-nums;
  perspective: 400px;
}
.hr-num-cell {
  display: inline-block;
  position: relative;
  height: 1em;
  line-height: 1;
  overflow: hidden;
  width: 1ch;
  vertical-align: bottom;
}
.hr-num-cell .hr-num-now,
.hr-num-cell .hr-num-prev {
  position: absolute; left: 0; right: 0;
  text-align: center;
  line-height: 1;
  backface-visibility: hidden;
}
.hr-num-cell .hr-num-now {
  animation: hrNumIn 300ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.hr-num-cell .hr-num-prev {
  animation: hrNumOut 300ms cubic-bezier(0.55, 0.06, 0.68, 0.19) both;
}
@keyframes hrNumIn {
  from { transform: rotateX(-90deg); opacity: 0; }
  to { transform: rotateX(0); opacity: 1; }
}
@keyframes hrNumOut {
  from { transform: rotateX(0); opacity: 1; }
  to { transform: rotateX(90deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hr-slide { transition: none; }
  .hr-progress-fill.is-running { animation: none; width: 0%; }
  .hr-caption { transition: none; }
  .hr-num-cell .hr-num-now,
  .hr-num-cell .hr-num-prev { animation: none; }
}
