/* styles.css — "Soft Mountain" brand system (Section 2). Mobile-first, calm,
   grounded. Color is NEVER used to imply a number is good or bad. */

:root {
  /* Palette — Soft Mountain */
  --teal:  #43736A;
  --sage:  #A3BFBA;
  --tan:   #BF9E80;
  --clay:  #D29C7A;
  --brown: #A47257;
  --ink:   #2E2A26;
  --paper: #FBF8F3;

  /* Derived tints (kept neutral, no judgment coloring) */
  --sage-10: rgba(163, 191, 186, 0.18);
  --sage-20: rgba(163, 191, 186, 0.35);
  --teal-10: rgba(67, 115, 106, 0.10);
  --line:    rgba(46, 42, 38, 0.14);

  /* Typography — system stack only (no external fonts, offline-safe) */
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, "Helvetica Neue", sans-serif;
  --font-head: var(--font-body);

  --maxw: 640px;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(46, 42, 38, 0.08), 0 8px 24px rgba(46, 42, 38, 0.06);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.6;
  font-size: 17px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout shell ---------- */
.app-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  max-width: var(--maxw);
  margin: 0 auto;
}
.app-header .logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex: 0 0 auto;
}
.app-header .logo-fallback {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid var(--teal);
  display: grid; place-items: center;
  color: var(--teal); font-weight: 700; font-size: 1.1rem;
  flex: 0 0 auto;
}
.app-header .wordmark {
  font-size: 0.95rem;
  color: var(--teal);
  font-weight: 600;
  letter-spacing: 0.01em;
}

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0.5rem 1.25rem 4rem;
}

/* ---------- Progress ---------- */
.progress {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 1.25rem;
}
.progress-track {
  height: 4px;
  background: var(--sage-20);
  border-radius: 99px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--teal);
  border-radius: 99px;
  width: 0%;
  transition: width 0.35s ease;
}

/* ---------- Screens ---------- */
.screen { animation: fade 0.3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--brown);
  font-weight: 700;
  margin: 0 0 0.6rem;
}
h1, h2, h3 { font-family: var(--font-head); color: var(--teal); line-height: 1.25; font-weight: 700; }
h1 { font-size: 1.7rem; margin: 0 0 0.75rem; }
h2 { font-size: 1.35rem; margin: 0 0 0.6rem; }
h3 { font-size: 1.05rem; margin: 0 0 0.4rem; }

.question { font-size: 1.5rem; color: var(--teal); font-weight: 700; margin: 0.2rem 0 0.6rem; line-height: 1.25; }
.microcopy { color: var(--ink); opacity: 0.85; margin: 0 0 1.4rem; }
.header-label { font-weight: 700; color: var(--teal); margin: 0 0 0.3rem; }

p { margin: 0 0 1rem; }

/* ---------- Buttons & choices ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.4rem;
  font: inherit; font-weight: 600;
  padding: 0.85rem 1.5rem;
  border-radius: var(--radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  background: var(--teal); color: var(--paper);
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.btn:hover { background: #375f57; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.secondary { background: transparent; color: var(--teal); border-color: var(--teal); }
.btn.secondary:hover { background: var(--teal-10); }
.btn.clay { background: var(--clay); color: var(--ink); }
.btn.clay:hover { background: #c68e69; }

.actions { display: flex; gap: 0.75rem; margin-top: 1.6rem; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; min-width: 130px; }
.actions .btn.back { flex: 0 0 auto; min-width: 0; }

/* Choice cards (single & multi select) */
.choices { display: flex; flex-direction: column; gap: 0.7rem; margin: 0.5rem 0 0; }
.choice {
  text-align: left;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
  width: 100%;
}
.choice:hover { border-color: var(--sage); background: var(--sage-10); }
.choice.selected { border-color: var(--teal); background: var(--sage-10); box-shadow: inset 0 0 0 1px var(--teal); }
.choice .choice-title { font-weight: 700; color: var(--teal); display: block; }
.choice .choice-desc { display: block; margin-top: 0.2rem; font-size: 0.95rem; opacity: 0.85; }

/* Two-up buttons (sex) */
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.two-up .choice { text-align: center; padding: 1.3rem 1rem; font-weight: 700; }

/* ---------- Inputs ---------- */
.field { margin: 0.3rem 0 0; }
label.field-label { display: block; font-weight: 600; margin-bottom: 0.35rem; color: var(--ink); }
input[type="number"], input[type="text"], textarea {
  font: inherit;
  width: 100%;
  padding: 0.8rem 0.9rem;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, .choice:focus-visible, .btn:focus-visible, a:focus-visible, .linklike:focus-visible {
  outline: 3px solid var(--sage);
  outline-offset: 2px;
  border-color: var(--teal);
}
textarea { min-height: 96px; resize: vertical; }
.input-row { display: flex; gap: 0.6rem; align-items: flex-end; }
.input-row .field { flex: 1; }
.suffix { color: var(--ink); opacity: 0.7; padding-bottom: 0.85rem; }
.hint { font-size: 0.85rem; opacity: 0.7; margin-top: 0.35rem; }
.error-text { color: var(--brown); font-size: 0.9rem; margin-top: 0.45rem; font-weight: 600; }

/* Unit toggle */
.unit-toggle { display: inline-flex; border: 1.5px solid var(--teal); border-radius: 99px; overflow: hidden; margin-bottom: 1rem; }
.unit-toggle button {
  font: inherit; font-weight: 600; border: none; background: transparent; color: var(--teal);
  padding: 0.4rem 1rem; cursor: pointer;
}
.unit-toggle button.active { background: var(--teal); color: var(--paper); }

/* ---------- Inline link that opens a panel ("Why only two options?") ---------- */
.linklike {
  background: none; border: none; padding: 0; margin: 0;
  color: var(--brown); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.linklike:hover { color: var(--teal); }
.panel {
  margin-top: 0.9rem;
  background: var(--sage-10);
  border-left: 3px solid var(--sage);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  font-size: 0.96rem;
}
.panel[hidden] { display: none; }

/* ---------- Safety blocks (calm, never alarmist, no red) ---------- */
.safety-block {
  background: #fff;
  border: 1.5px solid var(--tan);
  border-radius: var(--radius);
  padding: 1.3rem 1.25rem;
  box-shadow: var(--shadow);
}
.safety-block h2 { color: var(--brown); }
.referral-link { display: inline-block; margin-top: 0.4rem; color: var(--teal); font-weight: 600; }

/* ---------- Ranges table (body fat orientation) ---------- */
.ranges { display: flex; flex-direction: column; gap: 0.6rem; margin: 0.6rem 0 0; }
.range-row {
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius);
  padding: 0.85rem 1rem;
}
.range-row .range-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.range-row .range-name { font-weight: 700; color: var(--teal); }
.range-row .range-pct { font-weight: 700; color: var(--brown); }
.range-row .range-desc { font-size: 0.93rem; opacity: 0.85; margin-top: 0.25rem; }

/* ---------- Intro ---------- */
.intro-card { text-align: left; }
.intro-lead { font-size: 1.15rem; }

/* ---------- Report ---------- */
.report-section { margin: 0 0 2rem; }
.report-opening { font-size: 1.15rem; color: var(--ink); margin-bottom: 1.3rem; }

.number-block {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.4rem 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.4rem;
}
.calories-line { text-align: center; margin-bottom: 1.2rem; }
.calories-line .calories-label { font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--brown); font-weight: 700; }
.calories-line .calories-value { font-size: 2.6rem; font-weight: 700; color: var(--teal); line-height: 1.1; }
.calories-line .calories-unit { font-size: 0.95rem; opacity: 0.7; }

.macros-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; border-top: 1px solid var(--line); padding-top: 1.1rem; }
.macro { text-align: center; }
.macro .macro-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--brown); font-weight: 700; }
.macro .macro-grams { font-size: 1.5rem; font-weight: 700; color: var(--teal); }
.macro .macro-pct { font-size: 0.85rem; opacity: 0.6; }

.note {
  background: var(--sage-10);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  font-size: 0.95rem;
  margin: 1.1rem 0;
}
.note .note-label { font-weight: 700; color: var(--brown); display: block; margin-bottom: 0.3rem; }

.analogy {
  background: #fff;
  border: 1.5px solid var(--sage);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem;
  margin: 1.6rem 0;
}
.analogy p:last-child { margin-bottom: 0; }

.report-cta {
  text-align: center;
  background: var(--teal-10);
  border-radius: var(--radius);
  padding: 1.6rem 1.3rem;
  margin-top: 1.6rem;
}
.report-cta h2 { margin-top: 0; }

.milestone-callout { background: var(--sage-10); border-radius: 10px; padding: 0.8rem 1rem; margin: 0.8rem 0; font-weight: 600; }

/* Course + consultation inline links inside report body */
.report-section a { color: var(--teal); font-weight: 600; }

/* ---------- Sample meal plan ---------- */
.plan-offer {
  background: var(--sage-10);
  border: 1.5px solid var(--sage);
  border-radius: var(--radius);
  padding: 1.4rem 1.3rem;
  margin: 1.6rem 0;
  text-align: center;
}
.plan-offer h2 { margin-top: 0; }

/* The featured variant makes the sample-day offer the obvious next step. */
.plan-offer.featured {
  background: var(--teal);
  border-color: var(--teal);
  padding: 2.2rem 1.5rem;
  margin: 2.4rem 0;
  box-shadow: var(--shadow);
}
.plan-offer.featured .eyebrow { color: var(--sage); }
.plan-offer.featured h2 { color: var(--paper); font-size: 1.6rem; }
.plan-offer.featured p { color: var(--paper); opacity: 0.92; max-width: 34rem; margin-left: auto; margin-right: auto; }

.btn-large {
  font-size: 1.1rem;
  padding: 1rem 2rem;
  margin-top: 0.4rem;
}

/* Allergen chips */
.allergen-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.choice.allergen {
  width: auto;
  flex: 0 0 auto;
  padding: 0.6rem 1rem;
  border-radius: 99px;
  font-weight: 600;
  color: var(--teal);
}

/* Meal cards */
.meal-list { display: flex; flex-direction: column; gap: 0.85rem; margin-top: 1.2rem; }
.meal-card {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}
.meal-head {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 0.75rem; flex-wrap: wrap;
}
.meal-slot {
  text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem;
  font-weight: 700; color: var(--brown);
}
.meal-macros { font-size: 0.85rem; opacity: 0.7; }
.meal-name { margin: 0.3rem 0 0.15rem; font-size: 1.1rem; }
.meal-serving { margin: 0 0 0.6rem; font-size: 0.95rem; opacity: 0.85; }
.meal-details summary {
  cursor: pointer; font-weight: 600; color: var(--teal);
  font-size: 0.93rem; padding: 0.2rem 0;
}
.meal-details summary:hover { color: var(--brown); }
.meal-ingredients { margin: 0.6rem 0; padding-left: 1.1rem; font-size: 0.94rem; }
.meal-ingredients li { margin-bottom: 0.2rem; }
.scale-hint { opacity: 0.6; font-size: 0.85em; font-style: normal; }
.meal-steps { font-size: 0.94rem; margin: 0.5rem 0 0; opacity: 0.9; }

@media (max-width: 520px) {
  .meal-head { flex-direction: column; gap: 0.1rem; }
}

/* ---------- Footer / sources ---------- */
.app-footer {
  max-width: var(--maxw);
  margin: 2rem auto 0;
  padding: 1.5rem 1.25rem 3rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--ink);
  opacity: 0.75;
}
.app-footer h3 { font-size: 0.85rem; color: var(--brown); text-transform: uppercase; letter-spacing: 0.1em; }
.app-footer ul { padding-left: 1.1rem; margin: 0.4rem 0; }
.app-footer li { margin-bottom: 0.3rem; }
.app-footer a { color: var(--teal); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  body { font-size: 16px; }
  .question { font-size: 1.3rem; }
  h1 { font-size: 1.45rem; }
  .macros-row { grid-template-columns: 1fr; gap: 0.9rem; }
  .macro { display: flex; align-items: baseline; justify-content: space-between; text-align: left; border-bottom: 1px solid var(--line); padding-bottom: 0.6rem; }
  .macro .macro-grams { font-size: 1.3rem; }
  .two-up { grid-template-columns: 1fr; }
  .calories-line .calories-value { font-size: 2.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
  .progress-fill { transition: none; }
}
