/* ============================================================
   Visceral Fat Calculator — Custom CSS
   Tailwind CDN handles utilities; this file adds bespoke
   component styles and CSS custom properties.
   ============================================================ */

/* ---------- Design tokens ---------------------------------- */
:root {
  --hero-gradient:   linear-gradient(135deg, #2563eb 0%, #9333ea 100%);
  --success-green:   #10b981;
  --warning-yellow:  #f59e0b;
  --danger-red:      #ef4444;
  --text-primary:    #111827;
  --text-muted:      #6b7280;
  --radius-xl:       0.75rem;
  --shadow-card:     0 4px 24px rgba(0,0,0,.08);
  --transition:      all 0.2s ease;
}

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

html {
  color-scheme: light; /* Prevent Safari/Firefox auto dark-mode on the root element */
  scroll-behavior: smooth; /* CSS-level smooth scroll — Firefox, Edge, Chrome all support this */
}

/* Respect OS reduced-motion preference across all browsers */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

body {
  /* Correct stack: named font → Apple system → Segoe (Win) → system-ui (universal fallback) */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--text-primary);
  background: #f9fafb;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale; /* Firefox on macOS */
  color-scheme: light; /* Prevent Safari auto dark-mode colour shifts */
}

/* ---------- Hero gradient ---------------------------------- */
.hero-gradient {
  background: var(--hero-gradient);
}

/* ---------- Buttons ---------------------------------------- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #0d9488, #059669);
  color: #fff;
  font-weight: 700;
  padding: 1rem 2rem;
  border-radius: var(--radius-xl);
  box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
  border: none;
  cursor: pointer;
  /* Explicit properties instead of 'all' — avoids Firefox filter jank */
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  will-change: transform;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent; /* Remove iOS tap flash */
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.5);
  filter: brightness(1.06);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: #fff;
  color: #374151;
  font-weight: 600;
  padding: 0.875rem 1.75rem;
  border-radius: var(--radius-xl);
  border: 2px solid #e5e7eb;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn-secondary:hover {
  border-color: #9ca3af;
  background: #f9fafb;
}

/* ---------- Risk badges ------------------------------------ */
.risk-low {
  background: #d1fae5;
  border: 1.5px solid #6ee7b7;
  color: #065f46;
}

.risk-moderate {
  background: #fef3c7;
  border: 1.5px solid #fcd34d;
  color: #92400e;
}

.risk-high {
  background: #fee2e2;
  border: 1.5px solid #fca5a5;
  color: #7f1d1d;
}

/* ---------- Card ------------------------------------------- */
.card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
  padding: 2rem;
}

/* ---------- Form inputs ------------------------------------ */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid #e5e7eb;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-family: inherit; /* Firefox inherits body font, others need explicit */
  color: var(--text-primary);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  outline: none;
  /* Normalize select/input appearance across Safari, Firefox, Chrome */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Custom dropdown arrow for <select> — consistent across all browsers */
select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

/* Hide number input spinners — inconsistent across browsers */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield; /* Firefox */
}

/* Custom radio buttons — consistent teal across ALL browsers incl. Safari < 15.4 */
input[type="radio"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid #d1d5db;
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
  position: relative;
  vertical-align: middle;
}
input[type="radio"]:checked {
  border-color: #0d9488;
  background: #0d9488;
  box-shadow: inset 0 0 0 3px #fff;
}
input[type="radio"]:focus-visible {
  outline: 2px solid #0d9488;
  outline-offset: 2px;
}

/* Custom checkbox — consistent across browsers */
input[type="checkbox"] {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  border: 2px solid #d1d5db;
  border-radius: 0.25rem;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
  vertical-align: middle;
}
input[type="checkbox"]:checked {
  border-color: #0d9488;
  background: #0d9488;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6l3 3 4-5' stroke='%23fff' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}

.form-input:focus {
  border-color: #0d9488;
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.14);
}

.form-input.error {
  border-color: var(--danger-red);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.form-input.valid {
  border-color: var(--success-green);
}

.field-error {
  color: var(--danger-red);
  font-size: 0.8rem;
  margin-top: 0.25rem;
  min-height: 1rem;
}

/* ---------- VAT meter ------------------------------------- */
.vat-meter {
  height: 10px;
  border-radius: 9999px;
  background: #e5e7eb;
  overflow: hidden;
  margin-top: 0.5rem;
}

.vat-meter-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}

.vat-meter-fill.low      { background: var(--success-green); }
.vat-meter-fill.moderate { background: var(--warning-yellow); }
.vat-meter-fill.high     { background: var(--danger-red); }

/* ---------- Spinner --------------------------------------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Unit toggle ------------------------------------ */
.unit-toggle {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 9999px;
  padding: 3px;
  gap: 2px;
  border: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.unit-btn {
  padding: 0.3rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  background: transparent;
  color: #64748b;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.unit-btn.active {
  background: #fff;
  color: #0d9488;
  box-shadow: 0 1px 4px rgba(0,0,0,.10);
}

/* Unit suffix badge inside inputs */
.input-unit {
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
  pointer-events: none;
  letter-spacing: 0.04em;
}

.input-wrap {
  position: relative;
}

.input-wrap .form-input {
  padding-right: 2.75rem; /* space for unit badge */
}

/* ---------- Modal ----------------------------------------- */
.modal-backdrop {
  position: fixed;
  /* Explicit TRBL fallback for Safari ≤ 14.0 which lacks `inset` shorthand */
  top: 0; right: 0; bottom: 0; left: 0;
  inset: 0;
  background: rgba(0,0,0,0.55);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.modal-backdrop.open {
  opacity: 1;
  pointer-events: auto; /* 'all' is SVG-only; 'auto' is correct for HTML */
}

.modal-panel {
  background: #fff;
  border-radius: 1rem;
  max-width: 480px;
  width: 100%;
  padding: 2rem;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 25px 50px rgba(0,0,0,.25);
}

.modal-backdrop.open .modal-panel {
  transform: scale(1) translateY(0);
}

/* ---------- Progress steps -------------------------------- */
.step-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.step-indicator.active { color: #2563eb; }
.step-indicator.done   { color: var(--success-green); }

/* ---------- Scroll animations ----------------------------- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in-up {
  animation: fadeInUp 0.5s ease both;
}

/* ---------- Social proof ticker --------------------------- */
.social-proof-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(255,255,255,0.15);
  -webkit-backdrop-filter: blur(8px); /* Safari < 16 */
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 9999px;
  padding: 0.4rem 1rem;
  font-size: 0.85rem;
  color: #fff;
}

/* ---------- Responsive tweaks ----------------------------- */
@media (max-width: 640px) {
  .card { padding: 1.25rem; }
  .btn-primary { padding: 0.875rem 1.5rem; }
}

/* ============================================================
   LANDING PAGE — Additional Styles
   ============================================================ */

/* Teal/optimistic palette tokens */
:root {
  --teal-primary:  #0d9488;
  --teal-dark:     #0f766e;
  --teal-light:    #f0fdfa;
  --amber-accent:  #f59e0b;
  --amber-dark:    #d97706;
  --navy:          #0f172a;
}

/* Hero gradient — dark navy → teal */
.teal-hero-gradient {
  background-color: #0f172a; /* Safari/older browser solid fallback */
  background: linear-gradient(135deg, #0f172a 0%, #134e4a 60%, #0d9488 100%);
}

/* Teal CTA button */
.btn-teal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #0d9488, #059669);
  color: #fff;
  font-weight: 700;
  padding: 0.875rem 1.75rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 20px rgba(13,148,136,.4);
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  will-change: transform;
  text-decoration: none;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
}
.btn-teal:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(13,148,136,.5);
  filter: brightness(1.06);
}
.btn-teal:active  { transform: translateY(0); }
.btn-teal:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Amber CTA button */
.btn-amber {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #fff;
  font-weight: 700;
  padding: 0.875rem 1.75rem;
  border-radius: 0.75rem;
  box-shadow: 0 4px 20px rgba(245,158,11,.35);
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
  will-change: transform;
  text-decoration: none;
  letter-spacing: 0.01em;
  -webkit-tap-highlight-color: transparent;
}
.btn-amber:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(245,158,11,.5);
  filter: brightness(1.06);
}
.btn-amber:active  { transform: translateY(0); }
.btn-amber:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* Sticky navigation */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.97);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e2e8f0;
}

/* Section label pill */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--teal-light);
  color: #0f766e;
  border-radius: 9999px;
  padding: 0.3rem 1rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* Pain-point card */
.pain-card {
  background: #fff;
  border-left: 4px solid var(--amber-accent);
  border-radius: 0.625rem;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
  transition: box-shadow 0.2s;
}
.pain-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.09); }

/* Health-risk stat card */
.risk-stat {
  background: linear-gradient(135deg, #fef2f2, #fff);
  border: 1px solid #fecaca;
  border-radius: 0.75rem;
  padding: 1.5rem;
  text-align: center;
}

/* Years-of-life highlight card */
.years-card {
  background: linear-gradient(135deg, #0f766e, #0d9488);
  color: #fff;
  border-radius: 1rem;
  padding: 2.5rem;
}

/* Photo frame */
.photo-frame {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.14);
}

/* Feature pill */
.feature-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--teal-light);
  color: #0f766e;
  border: 1px solid #99f6e4;
  border-radius: 9999px;
  padding: 0.35rem 0.875rem;
  font-size: 0.82rem;
  font-weight: 600;
}

/* Week plan cards */
.week-card {
  background: #fff;
  border-radius: 0.75rem;
  border: 2px solid #e2e8f0;
  padding: 1.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.week-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.week-card.week-1 { border-top: 4px solid #0d9488; }
.week-card.week-2 { border-top: 4px solid #10b981; }
.week-card.week-3 { border-top: 4px solid #f59e0b; }
.week-card.week-4 { border-top: 4px solid #8b5cf6; }

/* Timeline */
.timeline-item { display: flex; gap: 1rem; align-items: flex-start; }
.timeline-dot {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: var(--teal-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  flex-shrink: 0;
}

/* Testimonial card */
.testimonial-card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.75rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
  border: 1px solid #f1f5f9;
  transition: box-shadow 0.2s;
}
.testimonial-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,.1); }

/* Avatar circle */
.avatar {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

/* Study/reference badge */
.study-badge {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.625rem;
  padding: 0.875rem 1rem;
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.5;
}

/* FAQ accordion */
.faq-item { border-bottom: 1px solid #e2e8f0; }
.faq-question {
  width: 100%;
  text-align: left;
  padding: 1.25rem 0;
  font-weight: 600;
  font-size: 1rem;
  color: #0f172a;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  transition: color 0.15s;
}
.faq-question:hover { color: var(--teal-primary); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease, padding 0.35s ease;
  color: #64748b;
  line-height: 1.75;
  font-size: 0.95rem;
}
.faq-item.open .faq-answer { max-height: 400px; padding-bottom: 1.25rem; }
.faq-chevron { transition: transform 0.3s ease; flex-shrink: 0; }
.faq-item.open .faq-chevron { transform: rotate(180deg); }

/* Scroll-reveal */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* Responsive */
@media (max-width: 768px) {
  .week-card  { padding: 1rem; }
  .years-card { padding: 1.5rem 1rem; }
  .btn-teal, .btn-amber { padding: 0.875rem 1.5rem; }
}
