/* =====================================================================
   ChloroBoost — Design System
   One place for palette, type, shape, motion. Code can re-theme here.
   No white backgrounds. Warm, rustic, premium, agrarian-but-modern.
   ===================================================================== */

:root {
  /* ---- Palette (locked) ---------------------------------------- */
  --lemon:    #E9D24A;   /* identity / highlights / active — never body text or big surfaces */
  --brick:    #B5603A;   /* buttons / CTAs */
  --brick-d:  #9C4E2D;   /* CTA pressed/hover */
  --brick-t:  #C9805F;   /* light brick tint */
  --sage:     #9CAF88;   /* support / charts */
  --sage-d:   #7E9268;
  --soil:     #6F5A43;   /* text/edges */
  --soil-2:   #A98E6B;   /* secondary */
  --cream:    #F4EEE2;   /* page background */
  --sand:     #EAE0CE;   /* cards */
  --sand-2:   #E2D5BD;   /* nested / wells */
  --sand-3:   #DBCBAE;   /* deeper edge */
  --ink:      #3A352F;   /* primary text */

  /* derived chart tones (share the family) */
  --clay:     #B5603A;
  --silt:     #C9A24B;
  --sandtex:  #D9C79A;
  --ok:       #6E8F5A;
  --warn:     #C68A3A;

  /* ---- Type ----------------------------------------------------- */
  --font: "Mulish", ui-rounded, "Segoe UI", system-ui, -apple-system, sans-serif;
  --fw-reg: 400; --fw-med: 500; --fw-sb: 600; --fw-b: 700; --fw-x: 800;

  /* ---- Shape (tweakable: --round scales radii) ----------------- */
  --round: 1;
  --r-xs: calc(8px  * var(--round));
  --r-sm: calc(12px * var(--round));
  --r-md: calc(18px * var(--round));
  --r-lg: calc(26px * var(--round));
  --r-xl: calc(36px * var(--round));
  --r-pill: 999px;

  /* ---- Shadow (tweakable: --soft scales blur/opacity) ---------- */
  --soft: 1;
  --sh-1: 0 calc(2px * var(--soft)) calc(8px * var(--soft)) rgba(78, 62, 40, calc(0.07 * var(--soft)));
  --sh-2: 0 calc(8px * var(--soft)) calc(28px * var(--soft)) rgba(78, 62, 40, calc(0.12 * var(--soft)));
  --sh-3: 0 calc(18px * var(--soft)) calc(50px * var(--soft)) rgba(58, 46, 30, calc(0.16 * var(--soft)));
  --ring: inset 0 0 0 1px rgba(111, 90, 67, 0.14);

  /* ---- Motion (tweakable: --reveal scales reveal durations) ---- */
  --reveal: 1;
  --ease: cubic-bezier(.22,.61,.36,1);

  --maxw: 1180px;
  --gutter: clamp(16px, 4vw, 32px);
}

/* =====================================================================
   Reset / base
   ===================================================================== */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--cream);
  font-weight: var(--fw-reg);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 16px;
  /* subtle organic background wash, never white */
  background-image:
    radial-gradient(120% 80% at 12% -10%, rgba(233,210,74,0.10), transparent 60%),
    radial-gradient(120% 90% at 100% 0%, rgba(156,175,136,0.16), transparent 55%);
  background-attachment: fixed;
}
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--lemon); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--lemon); color: var(--ink); }

h1, h2, h3, h4 { margin: 0; font-weight: var(--fw-x); line-height: 1.08; letter-spacing: -0.01em; }
p { margin: 0; text-wrap: pretty; }
small { font-size: 0.82em; }

/* =====================================================================
   App shell
   ===================================================================== */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  padding: 12px var(--gutter);
  background: color-mix(in srgb, var(--cream) 82%, transparent);
  backdrop-filter: blur(10px) saturate(1.1);
  border-bottom: 1px solid rgba(111,90,67,0.12);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.topbar .brand img { height: 30px; width: auto; filter: drop-shadow(0 1px 1px rgba(0,0,0,.08)); }
.topbar .brand .wm { font-weight: var(--fw-x); letter-spacing: .14em; color: var(--soil); font-size: 15px; text-transform: uppercase; }
.topbar .spacer { flex: 1; }

/* progress dots */
.progress { display: flex; align-items: center; gap: 7px; }
.progress .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--sand-3); transition: all .4s var(--ease);
}
.progress .dot.done { background: var(--sage); }
.progress .dot.active { background: var(--lemon); transform: scale(1.35); box-shadow: 0 0 0 4px rgba(233,210,74,.22); }
.progress .lbl { font-size: 12px; color: var(--soil-2); font-weight: var(--fw-sb); margin-left: 4px; letter-spacing: .02em; }

.stage { flex: 1; width: 100%; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: var(--gutter); }
.wrap.narrow { max-width: 640px; }

/* screen transitions — transform-only so content is always painted */
.screen { animation: screenIn .5s var(--ease); }
@keyframes screenIn { from { transform: translateY(12px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .screen { animation: none; } }

/* =====================================================================
   Reusable bits
   ===================================================================== */
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: var(--fw-x); letter-spacing: .16em;
  text-transform: uppercase; color: var(--soil-2);
}
.eyebrow::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--lemon); }

.card {
  background: var(--sand);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1), var(--ring);
  padding: clamp(18px, 3vw, 26px);
}
.card.raised { box-shadow: var(--sh-2), var(--ring); }

.muted { color: var(--soil-2); }
.soil { color: var(--soil); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  border: none; border-radius: var(--r-pill);
  padding: 14px 22px; font-size: 15px; font-weight: var(--fw-x);
  letter-spacing: .01em; transition: transform .15s var(--ease), box-shadow .2s, background .2s;
  text-decoration: none; color: var(--ink); background: var(--sand-2);
  box-shadow: var(--ring);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn .ico { width: 18px; height: 18px; }
.btn-primary { background: var(--brick); color: #FBF3EA; box-shadow: var(--sh-2); }
.btn-primary:hover { background: var(--brick-d); }
.btn-ghost { background: transparent; box-shadow: inset 0 0 0 1.5px rgba(111,90,67,.28); }
.btn-ghost:hover { background: rgba(111,90,67,.06); }
.btn-sage { background: var(--sage); color: #2c3622; }
.btn-sage:hover { background: var(--sage-d); }
.btn-lg { padding: 17px 28px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--r-pill);
  background: var(--sand-2); color: var(--soil);
  font-weight: var(--fw-b); font-size: 14px;
  border: 1.5px solid transparent; transition: all .18s var(--ease);
  user-select: none;
}
.chip:hover { border-color: var(--soil-2); transform: translateY(-1px); }
.chip.on { background: var(--lemon); color: var(--ink); border-color: color-mix(in srgb, var(--lemon) 70%, var(--soil)); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sage); }

/* form controls */
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 13px; font-weight: var(--fw-x); color: var(--soil); letter-spacing: .01em; }
.field .hint { font-size: 12px; color: var(--soil-2); }
.control, .select, input[type=text], input[type=email], input[type=number], textarea {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--ink);
  background: var(--cream);
  border: 1.5px solid rgba(111,90,67,.22);
  border-radius: var(--r-sm);
  padding: 13px 15px; transition: border-color .18s, box-shadow .18s;
}
.control:focus, .select:focus, input:focus, textarea:focus {
  outline: none; border-color: var(--sage-d);
  box-shadow: 0 0 0 4px rgba(156,175,136,.22);
}
.select { appearance: none; background-image:
  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236F5A43' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 15px center; padding-right: 40px; cursor: pointer; }
textarea { resize: vertical; min-height: 84px; }

.input-group { position: relative; display: flex; gap: 8px; }
.input-group .control { flex: 1; }

/* source label */
.src {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10.5px; font-weight: var(--fw-b); letter-spacing: .04em;
  text-transform: uppercase; color: var(--soil-2);
  background: var(--sand-2); padding: 3px 8px; border-radius: var(--r-pill);
}
.src::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--sage); }
.src.unavail::before { background: var(--soil-2); }

/* divider */
.rule { height: 1px; background: rgba(111,90,67,.14); border: 0; margin: 18px 0; }

/* badge */
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: var(--fw-x); letter-spacing: .02em;
}
.badge-zone { background: var(--sage); color: #2c3622; }
.badge-safe { background: color-mix(in srgb, var(--sage) 40%, var(--cream)); color: var(--soil); box-shadow: var(--ring); }

/* =====================================================================
   Skeleton loading
   ===================================================================== */
.sk { position: relative; overflow: hidden; background: var(--sand-2); border-radius: var(--r-sm); }
.sk::after {
  content: ""; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.45), transparent);
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }
.sk-line { height: 12px; border-radius: 6px; margin: 8px 0; }
.sk-circle { border-radius: 50%; }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }

/* value animate-in — transform only (no blur/opacity gating) */
.reveal-v { animation: revealV calc(.55s * var(--reveal)) var(--ease); }
@keyframes revealV { from { transform: translateY(9px); } to { transform: none; } }
.count { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { .reveal-v { animation: none; } }

/* =====================================================================
   Utility
   ===================================================================== */
.row { display: flex; gap: 14px; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-sm { gap: 8px; } .gap-lg { gap: 22px; }
.grow { flex: 1; }
.stack > * + * { margin-top: var(--st, 16px); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tnum { font-variant-numeric: tabular-nums; }
