/* ZamCredit Design Tokens — from BuildSpec v5 §2.2 */
:root {
  /* Copper */
  --color-copper-50:  #FBF3EC;
  --color-copper-100: #F5E0CE;
  --color-copper-200: #EBBE9A;
  --color-copper-300: #DC9A6A;
  --color-copper-400: #C87B47;
  --color-copper-500: #B8542A;
  --color-copper-600: #9A4220;
  --color-copper-700: #7A3319;
  --color-copper-800: #5C2613;
  --color-copper-900: #3E190C;

  /* Emerald */
  --color-emerald-50:  #E8F5EC;
  --color-emerald-500: #228B4C;
  --color-emerald-700: #15623A;
  --color-emerald-900: #0B3D24;

  /* Warm neutrals */
  --color-cream-50:  #FDF8F1;
  --color-cream-100: #F7EFE2;
  --color-cream-200: #EDE0CB;
  --color-sand-300:  #D4BFA0;
  --color-sand-500:  #8A7558;
  --color-soot-700:  #3A3530;
  --color-soot-900:  #1A1A1A;

  /* Accents */
  --color-flame:   #D22630;
  --color-flame-600: #B41E28;
  --color-sunrise: #E8833A;

  /* Semantic */
  --color-success: var(--color-emerald-500);
  --color-warning: var(--color-sunrise);
  --color-error:   var(--color-flame);
  --color-info:    #2A6FB8;

  /* Fonts */
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'Plus Jakarta Sans', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Courier New', monospace;

  /* Shadows (warm) */
  --shadow-sm: 0 1px 2px rgba(58, 53, 48, 0.06);
  --shadow-md: 0 4px 12px rgba(58, 53, 48, 0.08), 0 1px 3px rgba(58, 53, 48, 0.04);
  --shadow-lg: 0 12px 32px rgba(58, 53, 48, 0.10), 0 4px 8px rgba(58, 53, 48, 0.05);
  --shadow-xl: 0 24px 64px rgba(58, 53, 48, 0.12), 0 8px 16px rgba(58, 53, 48, 0.06);
  --shadow-copper-glow: 0 0 0 3px rgba(184, 84, 42, 0.15);
  --shadow-flame-glow:  0 0 0 3px rgba(210, 38, 48, 0.20);

  /* Easing */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--color-cream-50);
  color: var(--color-soot-900);
  -webkit-font-smoothing: antialiased;
  margin: 0;
  line-height: 1.5;
}

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

/* Typography scale */
.text-display-xl { font-family: var(--font-display); font-size: clamp(56px, 8vw, 88px); line-height: 1.02; letter-spacing: -0.02em; font-weight: 700; }
.text-display-l  { font-family: var(--font-display); font-size: clamp(44px, 6vw, 72px); line-height: 1.04; letter-spacing: -0.015em; font-weight: 600; }
.text-display-m  { font-family: var(--font-display); font-size: clamp(36px, 5vw, 56px); line-height: 1.08; letter-spacing: -0.01em; font-weight: 600; }
.text-h1 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 40px); line-height: 1.12; letter-spacing: -0.005em; font-weight: 600; }
.text-h2 { font-family: var(--font-display); font-size: clamp(24px, 3vw, 32px); line-height: 1.2; font-weight: 600; }
.text-h3 { font-family: var(--font-body);    font-size: clamp(20px, 2.4vw, 24px); line-height: 1.28; font-weight: 700; }
.text-body-l { font-size: 18px; line-height: 1.5; }
.text-body-m { font-size: 16px; line-height: 1.5; }
.text-body-s { font-size: 14px; line-height: 1.5; }
.text-caption { font-size: 12px; line-height: 1.4; letter-spacing: 0.005em; text-transform: uppercase; font-weight: 600; }
.text-mono-price { font-family: var(--font-mono); font-size: clamp(28px, 4vw, 40px); line-height: 1; letter-spacing: 0; font-weight: 600; }

/* Container */
.container-z { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
@media (min-width: 1024px) { .container-z { padding: 0 48px; } }

/* Section */
.section { padding: 64px 0; }
@media (min-width: 1024px) { .section { padding: 128px 0; } }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; border-radius: 12px; border: 0; cursor: pointer; transition: all 200ms var(--ease-out); text-decoration: none; white-space: nowrap; }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: var(--shadow-copper-glow); }
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; border-radius: 8px; }
.btn-md { height: 44px; padding: 0 24px; font-size: 16px; }
.btn-lg { height: 52px; padding: 0 32px; font-size: 18px; }
.btn-xl { height: 64px; padding: 0 40px; font-size: 20px; border-radius: 16px; font-weight: 700; }
.btn-primary { background: var(--color-copper-500); color: var(--color-cream-50); }
.btn-primary:hover { background: var(--color-copper-600); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-cta { background: var(--color-flame); color: var(--color-cream-50); }
.btn-cta:hover { background: var(--color-flame-600); transform: translateY(-1px); box-shadow: var(--shadow-lg); }
.btn-cta:focus-visible { box-shadow: var(--shadow-flame-glow); }
.btn-secondary { background: transparent; color: var(--color-copper-500); border: 2px solid var(--color-copper-500); }
.btn-secondary:hover { background: var(--color-copper-50); }
.btn-ghost { background: transparent; color: var(--color-soot-900); }
.btn-ghost:hover { background: var(--color-cream-100); }

/* Cards */
.card { background: var(--color-cream-50); border-radius: 16px; padding: 24px; transition: all 250ms var(--ease-out); }
.card-elevated { box-shadow: var(--shadow-md); }
.card-outlined { border: 1px solid var(--color-cream-200); }
.card-ghost { border: 1px dashed var(--color-sand-300); }
.card-hover:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); cursor: pointer; }

/* Inputs */
.input {
  width: 100%;
  height: 52px;
  padding: 0 16px;
  border: 1.5px solid var(--color-cream-200);
  border-radius: 12px;
  background: var(--color-cream-50);
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--color-soot-900);
  transition: all 150ms var(--ease-out);
}
.input:focus { outline: none; border-color: var(--color-copper-500); box-shadow: var(--shadow-copper-glow); }
.input.error { border-color: var(--color-flame); }
.input:disabled { opacity: 0.5; cursor: not-allowed; }
.input-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; color: var(--color-soot-700); }
.input-helper { margin-top: 8px; font-size: 14px; color: var(--color-sand-500); }
.input-helper.error { color: var(--color-flame); }

/* Badge */
.badge { display: inline-flex; align-items: center; padding: 4px 12px; border-radius: 9999px; font-size: 12px; font-weight: 600; letter-spacing: 0.005em; text-transform: uppercase; }
.badge-match { background: var(--color-emerald-500); color: var(--color-cream-50); }
.badge-self { background: var(--color-copper-100); color: var(--color-copper-700); }
.badge-partner { background: var(--color-sand-300); color: var(--color-soot-700); }
.badge-active { background: var(--color-emerald-50); color: var(--color-emerald-700); }
.badge-speed { background: var(--color-sunrise); color: var(--color-cream-50); }

/* Slider */
input[type="range"] { -webkit-appearance: none; width: 100%; height: 6px; background: var(--color-cream-200); border-radius: 9999px; outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 50%; background: var(--color-cream-50); border: 3px solid var(--color-copper-500); cursor: pointer; transition: transform 150ms var(--ease-out); }
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.1); }
input[type="range"]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--color-cream-50); border: 3px solid var(--color-copper-500); cursor: pointer; }

/* Progress */
.progress-track { height: 4px; background: var(--color-cream-200); border-radius: 9999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--color-copper-500); transition: width 300ms var(--ease-out); }

/* Radio card */
.radio-card { display: flex; align-items: center; gap: 16px; padding: 16px; border: 1px solid var(--color-cream-200); border-radius: 12px; background: var(--color-cream-50); cursor: pointer; transition: all 150ms var(--ease-out); position: relative; min-height: 80px; }
.radio-card:hover { border-color: var(--color-copper-300); }
.radio-card.selected { border: 2px solid var(--color-copper-500); padding: 15px; }
.radio-card.selected::before { content: ""; position: absolute; left: -2px; top: -2px; bottom: -2px; width: 4px; background: var(--color-copper-500); border-radius: 12px 0 0 12px; }
.radio-card.selected .radio-card-icon { color: var(--color-copper-500); }

/* Accordion */
.accordion-item { border-bottom: 1px solid var(--color-cream-200); }
.accordion-trigger { width: 100%; display: flex; align-items: center; justify-content: space-between; padding: 20px 0; background: none; border: 0; text-align: left; cursor: pointer; font-family: var(--font-body); font-size: 20px; font-weight: 700; color: var(--color-soot-900); transition: color 150ms; }
.accordion-trigger:hover { color: var(--color-copper-500); }
.accordion-trigger .chev { transition: transform 150ms var(--ease-out); }
.accordion-item.open .accordion-trigger .chev { transform: rotate(45deg); }
.accordion-content { max-height: 0; overflow: hidden; transition: max-height 300ms var(--ease-out); }
.accordion-item.open .accordion-content { max-height: 400px; }
.accordion-content-inner { padding: 0 0 24px; font-size: 16px; line-height: 1.6; color: var(--color-soot-700); }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(26, 26, 26, 0.6); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; opacity: 0; pointer-events: none; transition: opacity 250ms var(--ease-out); }
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal { background: var(--color-cream-50); border-radius: 24px; box-shadow: var(--shadow-xl); max-width: 640px; width: 100%; max-height: 80vh; overflow: auto; padding: 40px; transform: scale(0.96); transition: transform 300ms var(--ease-out); position: relative; }
.modal-overlay.open .modal { transform: scale(1); }

/* FAB */
.fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 60;
  width: 60px; height: 60px; border-radius: 50%;
  background: #25D366; color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-lg); cursor: pointer; border: 0; transition: transform 200ms var(--ease-out);
}
.fab:hover { transform: scale(1.08); }
.fab-close { position: absolute; top: -4px; left: -4px; width: 22px; height: 22px; border-radius: 50%; background: var(--color-soot-900); color: #fff; border: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 12px; }

/* Hero decoration */
.chitenge-circles {
  position: absolute; pointer-events: none; opacity: 0.1;
}
.chitenge-diamond {
  position: absolute; inset: 0; top: 0; height: 12px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='12' viewBox='0 0 48 12'><path d='M0 6 L6 0 L12 6 L6 12 Z M12 6 L18 0 L24 6 L18 12 Z M24 6 L30 0 L36 6 L30 12 Z M36 6 L42 0 L48 6 L42 12 Z' fill='none' stroke='%23DC9A6A' stroke-width='1'/></svg>");
  background-repeat: repeat-x;
  opacity: 0.4;
}

/* Fade-in */
@keyframes fade-up { from { opacity: 0; transform: translateY(16px);} to { opacity: 1; transform: none;} }
.fade-up { animation: fade-up 700ms var(--ease-out) both; }
.fade-up.d1 { animation-delay: 80ms; }
.fade-up.d2 { animation-delay: 160ms; }
.fade-up.d3 { animation-delay: 240ms; }
.fade-up.d4 { animation-delay: 320ms; }

/* Chitenge rotating loader */
@keyframes spin { to { transform: rotate(360deg); } }
.loader-spin { animation: spin 8s linear infinite; }

/* Lite mode — disable images + animation */
body.lite-mode img { display: none; }
body.lite-mode [data-lite-hide] { display: none !important; }
body.lite-mode * { animation: none !important; transition: none !important; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Grid helpers */
.grid-3 { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } }
.grid-2x3 { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid-2x3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .grid-2x3 { grid-template-columns: repeat(3, 1fr); } }
.grid-2 { display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .grid-2 { grid-template-columns: repeat(2, 1fr); } }

.hide-mobile { display: none; }
@media (min-width: 768px) { .hide-mobile { display: initial; } .hide-desktop { display: none; } }

.brand-bar { width: 4px; border-radius: 4px; align-self: stretch; }
.text-muted { color: var(--color-sand-500); }
.text-soot { color: var(--color-soot-700); }
.text-copper { color: var(--color-copper-500); }
.text-emerald { color: var(--color-emerald-500); }
.text-flame { color: var(--color-flame); }

.link { color: var(--color-copper-500); text-decoration: underline; text-underline-offset: 4px; font-weight: 500; }
.link:hover { color: var(--color-copper-700); }
