/* ==========================================================================
   Meditrina — styles.css
   Mobile-first, zero external frameworks.
   Palette from the Meditrina Design System (plum + violet + terracotta).
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --navy: #2E2458;        /* plum — hero, dark sections, headings */
  --navy-soft: #3A2E6E;   /* plum-2 — cards on dark */
  --teal: #5B4B9E;        /* violet — brand, structure, positive highlight */
  --teal-dark: #4A3C85;   /* violet-ink — hover, violet text */
  --teal-soft: #F0ECF8;   /* lilac-soft — soft violet background */
  --terra: #C65D3B;       /* terracotta — primary CTA, care accent */
  --terra-dark: #A6462A;  /* terracotta-ink — CTA hover */
  --terra-soft: #FAF0EA;  /* terracotta-soft — warm highlight */
  --bg: #F7F4F2;          /* stone canvas */
  --surface: #FFFFFF;
  --border: #E8E1E6;
  --text: #271F33;
  --muted: #6A6276;
  --danger: #C62828;
  --danger-soft: #FCEDEC;

  --font-head: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 12, 31, .06), 0 1px 3px rgba(16, 12, 31, .08);
  --shadow-md: 0 4px 12px rgba(46, 36, 88, .1);
  --shadow-lg: 0 18px 40px rgba(46, 36, 88, .18);

  --maxw: 1180px;
  --gutter: 20px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
}
h1, h2, h3, h4 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; color: var(--navy); }
p { margin: 0 0 1em; }
a { color: var(--teal-dark); text-decoration: none; }
img, svg { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; list-style: none; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; background: var(--teal-soft); color: var(--teal-dark); padding: 1px 6px; border-radius: 6px; }

/* ---------- Layout helpers ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.container.narrow { max-width: 820px; }
.section { padding: 56px 0; }
.section-alt { background: var(--surface); }
.section-title { font-size: clamp(1.5rem, 4.5vw, 2.1rem); font-weight: 800; text-align: center; }
.section-title.left { text-align: left; }
.section-title.light { color: #fff; }
.section-lead { text-align: center; color: var(--muted); max-width: 720px; margin: 0 auto 2rem; }
.subsection-title { text-align: center; margin-top: 2.5rem; font-size: 1.3rem; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font-family: var(--font-head); font-weight: 700; font-size: .95rem;
  padding: 12px 20px; border-radius: var(--radius-sm); border: 2px solid transparent;
  cursor: pointer; transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
  text-align: center; line-height: 1.1;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--terra); color: #fff; }
.btn-primary:hover { background: var(--terra-dark); box-shadow: var(--shadow-md); }
.btn-ghost { background: transparent; color: var(--teal-dark); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--teal); background: var(--teal-soft); }
.btn-sm { padding: 9px 14px; font-size: .85rem; }
.btn-lg { padding: 15px 26px; font-size: 1.02rem; }
.btn-block { display: flex; width: 100%; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 16px; height: 64px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--font-head); font-weight: 800; color: var(--navy); }
.brand-name { font-size: 1.05rem; }
.nav-desktop { display: none; gap: 22px; margin-left: auto; }
.nav-desktop a { color: var(--muted); font-weight: 600; font-size: .92rem; }
.nav-desktop a:hover { color: var(--navy); }
.nav-cta { display: none; }

.hamburger { margin-left: auto; width: 42px; height: 42px; display: inline-flex; flex-direction: column; justify-content: center; gap: 5px; background: none; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; padding: 0 10px; }
.hamburger span { height: 2px; background: var(--navy); border-radius: 2px; transition: .2s; }

/* ---------- Mobile drawer ---------- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(23,15,31,.5); z-index: 60; }
.mobile-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(82vw, 320px);
  background: var(--surface); z-index: 70; padding: 72px 22px 24px;
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 18px;
  transform: translateX(0);
}
.mobile-drawer[hidden] { display: none; }
.drawer-overlay[hidden] { display: none; }
.drawer-close { position: absolute; top: 16px; right: 16px; font-size: 2rem; line-height: 1; background: none; border: none; color: var(--navy); cursor: pointer; }
.drawer-nav { display: flex; flex-direction: column; gap: 4px; }
.drawer-nav a { padding: 12px 8px; font-weight: 600; color: var(--navy); border-bottom: 1px solid var(--border); }

body.no-scroll { overflow: hidden; }

/* ---------- Hero ---------- */
.hero { padding: 40px 0 48px; background: linear-gradient(180deg, #fff 0%, var(--bg) 100%); }
.hero-grid { display: grid; gap: 36px; }
.eyebrow {
  display: inline-block; background: var(--teal-soft); color: var(--teal-dark);
  font-weight: 700; font-size: .78rem; padding: 7px 14px; border-radius: 999px;
  margin-bottom: 16px; border: 1px solid #e4dcf3;
}
.hero h1 { font-size: clamp(1.8rem, 6.5vw, 3rem); font-weight: 800; }
.hero-sub { color: var(--muted); font-size: 1.05rem; max-width: 560px; }
.hero-ctas { display: flex; flex-direction: column; gap: 12px; margin: 24px 0 26px; }
.trust-strip { display: grid; gap: 10px; }
.trust-strip li { display: flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 600; color: var(--navy); }
.trust-strip svg { flex: 0 0 auto; }

/* Hero phone mockup */
.hero-visual { display: flex; justify-content: center; }
.phone {
  position: relative; width: 270px; background: var(--navy); border-radius: 34px;
  padding: 12px; box-shadow: var(--shadow-lg);
}
.phone-notch { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 110px; height: 20px; background: var(--navy); border-radius: 0 0 14px 14px; z-index: 2; }
.phone-screen { background: linear-gradient(180deg, var(--teal-soft), #fff); border-radius: 24px; padding: 34px 16px 18px; min-height: 440px; }
.app-topbar { display: flex; align-items: center; gap: 8px; font-size: .72rem; font-weight: 700; color: var(--navy); margin-bottom: 14px; }
.app-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--terra); box-shadow: 0 0 0 3px rgba(198,93,59,.2); }
.app-card { background: #fff; border-radius: 16px; padding: 16px; box-shadow: var(--shadow-sm); border: 1px solid var(--border); }
.app-card-title { font-family: var(--font-head); font-weight: 700; color: var(--navy); margin-bottom: 12px; }
.app-checks li { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--text); padding: 7px 0; border-bottom: 1px dashed var(--border); }
.app-checks li.ok::before { content: "✔"; color: var(--teal); font-weight: 800; }
.app-badge { margin-top: 12px; background: var(--teal); color: #fff; font-size: .78rem; font-weight: 700; text-align: center; padding: 9px; border-radius: 10px; }
.app-offline-pill { margin-top: 14px; text-align: center; font-size: .72rem; font-weight: 700; color: var(--teal-dark); }

/* ---------- Problem stats ---------- */
.stat-grid { display: grid; gap: 16px; margin-top: 2rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); border-top: 4px solid var(--danger); }
.stat-card.danger { background: var(--danger-soft); }
.stat-big { font-family: var(--font-head); font-weight: 800; font-size: 1.5rem; color: var(--danger); margin-bottom: 8px; }
.stat-card p { margin: 0; color: var(--text); font-size: .95rem; }

/* ---------- Calculator ---------- */
.calc-grid { display: grid; gap: 24px; margin-top: 1rem; }
.calc-controls { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-sm); }
.calc-field { margin-bottom: 24px; }
.calc-field:last-child { margin-bottom: 0; }
.calc-field label { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; color: var(--navy); margin-bottom: 10px; gap: 10px; font-size: .95rem; }
.calc-value { color: var(--teal-dark); font-family: var(--font-head); font-weight: 800; font-variant-numeric: tabular-nums; }
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--border); outline: none; }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 22px; height: 22px; border-radius: 50%; background: var(--teal); border: 3px solid #fff; box-shadow: var(--shadow-sm); cursor: pointer; }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--teal); border: 3px solid #fff; box-shadow: var(--shadow-sm); cursor: pointer; }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.preset-btn { font-family: var(--font-body); font-size: .76rem; font-weight: 600; padding: 7px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg); color: var(--muted); cursor: pointer; transition: .12s; }
.preset-btn:hover, .preset-btn.active { border-color: var(--teal); background: var(--teal-soft); color: var(--teal-dark); }

.calc-output { background: var(--navy); color: #fff; border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-md); }
.out-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,.12); }
.out-label { font-size: .9rem; color: #d8d2e6; }
.out-num { font-family: var(--font-head); font-weight: 800; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.out-row.danger .out-num { color: #F5A3A3; }
.out-row.teal .out-num { color: #CBBEF0; }
.out-row.strong { border-bottom: none; }
.out-row.strong .out-num { font-size: 1.5rem; }
.calc-output .btn { margin-top: 18px; }
.calc-note { margin: 12px 0 0; font-size: .76rem; color: #b4accb; text-align: center; }

/* ---------- Flow ---------- */
.flow { display: grid; gap: 14px; margin-top: 2rem; align-items: stretch; }
.flow-step { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; text-align: center; box-shadow: var(--shadow-sm); }
.flow-num { display: inline-flex; width: 40px; height: 40px; border-radius: 50%; background: var(--teal-soft); color: var(--teal-dark); font-family: var(--font-head); font-weight: 800; align-items: center; justify-content: center; margin-bottom: 12px; }
.flow-step h3 { font-size: 1.05rem; }
.flow-step p { margin: 0; color: var(--muted); font-size: .9rem; }
.flow-arrow { display: none; align-items: center; justify-content: center; color: var(--teal); font-size: 1.6rem; font-weight: 800; }

/* ---------- Shields ---------- */
.shield-grid { display: grid; gap: 16px; margin-top: 1.5rem; }
.shield-card { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--terra); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm); }
.shield-card h4 { font-size: 1.05rem; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.shield-card p { margin: 0; color: var(--muted); font-size: .92rem; }
.tag { background: var(--danger-soft); color: var(--danger); font-size: .68rem; font-weight: 700; padding: 3px 8px; border-radius: 999px; font-family: var(--font-body); }

/* ---------- Report ---------- */
.report-grid { display: grid; gap: 28px; }
.report-visual { display: flex; justify-content: center; }
.doc-card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-lg); width: 100%; max-width: 380px; }
.doc-head { display: flex; flex-direction: column; gap: 2px; border-bottom: 2px solid var(--navy); padding-bottom: 12px; margin-bottom: 12px; }
.doc-head strong { color: var(--navy); font-family: var(--font-head); }
.doc-head span { font-size: .78rem; color: var(--muted); }
.doc-line { display: flex; justify-content: space-between; gap: 10px; font-size: .85rem; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.doc-line span:first-child { color: var(--muted); font-weight: 600; }
.doc-line span:last-child { color: var(--text); font-variant-numeric: tabular-nums; text-align: right; }
.doc-seal { margin-top: 14px; background: var(--teal-soft); color: var(--teal-dark); font-weight: 700; font-size: .82rem; text-align: center; padding: 10px; border-radius: 10px; }
.report-sub { font-size: 1.05rem; margin-top: 1.2rem; }
.report-list { display: grid; gap: 8px; }
.report-list li { position: relative; padding-left: 24px; color: var(--text); font-size: .92rem; }
.report-list li::before { content: "✔"; position: absolute; left: 0; color: var(--teal); font-weight: 800; }
.report-note { margin-top: 1rem; color: var(--muted); font-style: italic; }

/* ---------- Dark compliance section ---------- */
.section-dark { background: var(--navy); }
.compliance-grid { display: grid; gap: 16px; margin-top: 2rem; }
.compliance-card { background: var(--navy-soft); border-left: 4px solid var(--teal); border-radius: var(--radius); padding: 22px; }
.compliance-card h3 { color: #fff; font-size: 1.05rem; }
.compliance-card p { margin: 0; color: #d8d2e6; font-size: .92rem; }
.compliance-card code { background: rgba(183,166,224,.2); color: #CBBEF0; }

/* ---------- Pricing ---------- */
.pricing-formula { text-align: center; background: var(--teal-soft); border: 1px solid #e4dcf3; border-radius: var(--radius); padding: 16px 20px; max-width: 760px; margin: 0 auto 2rem; font-size: .95rem; color: var(--navy); }
.pricing-grid { display: grid; gap: 18px; }
.price-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px 24px; box-shadow: var(--shadow-sm); text-align: center; }
.price-card.featured { border: 2px solid var(--teal); box-shadow: var(--shadow-lg); }
.popular-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--teal); color: #fff; font-size: .72rem; font-weight: 700; padding: 5px 14px; border-radius: 999px; }
.price-card h3 { font-size: 1.25rem; }
.price-sub { color: var(--muted); font-size: .85rem; margin: 0 0 14px; }
.price-value { font-family: var(--font-head); font-weight: 800; font-size: 2rem; color: var(--navy); margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.price-value span { font-size: .9rem; font-weight: 600; color: var(--muted); }
.price-value.muted { font-size: 1.05rem; color: var(--teal-dark); }
.price-desc { color: var(--muted); font-size: .9rem; min-height: 2.6em; }
.addon-note { text-align: center; color: var(--muted); font-size: .88rem; margin-top: 1.4rem; }
.founding-banner { margin-top: 2rem; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 22px 24px; font-size: .95rem; border-left: 5px solid var(--terra); }
.founding-banner strong { color: #E6AC6A; }

/* ---------- Lead form ---------- */
.diag-grid { display: grid; gap: 28px; }
.diag-list { display: grid; gap: 12px; margin: 1.2rem 0; }
.diag-list li { position: relative; padding-left: 28px; font-weight: 600; color: var(--navy); }
.diag-list li::before { content: "✔"; position: absolute; left: 0; color: var(--teal); font-weight: 800; }
.diag-reassure { color: var(--muted); font-size: .9rem; }

.diag-form-wrap { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow-md); }
.field { margin-bottom: 16px; }
.field label, .field legend { display: block; font-weight: 600; font-size: .9rem; color: var(--navy); margin-bottom: 6px; padding: 0; }
.field input[type="text"], .field input[type="tel"], .field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 1rem; color: var(--text); background: #fff; transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(91,75,158,.18); }
.field input.invalid, .field select.invalid { border-color: var(--danger); background: var(--danger-soft); }
.err { display: block; color: var(--danger); font-size: .8rem; margin-top: 5px; min-height: 1em; }

.pills { border: none; margin: 0 0 16px; padding: 0; }
.pill-group { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; }
.pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pill span { display: inline-block; padding: 9px 14px; border: 1px solid var(--border); border-radius: 999px; font-size: .84rem; color: var(--muted); cursor: pointer; transition: .12s; }
.pill input:checked + span { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-dark); font-weight: 600; }
.pill input:focus-visible + span { box-shadow: 0 0 0 3px rgba(91,75,158,.3); }

.form-privacy { font-size: .78rem; color: var(--muted); text-align: center; margin: 12px 0 0; }
.btn[aria-busy="true"] { opacity: .75; pointer-events: none; }

.success-panel { text-align: center; padding: 10px 6px; }
.success-panel svg { margin: 0 auto 14px; }
.success-panel h3 { font-size: 1.3rem; }
.success-panel p { color: var(--muted); margin-bottom: 20px; }

/* ---------- FAQ ---------- */
.faq-list { display: grid; gap: 12px; margin-top: 1.5rem; }
.faq-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.faq-item summary { list-style: none; cursor: pointer; padding: 18px 20px; font-family: var(--font-head); font-weight: 700; color: var(--navy); font-size: 1rem; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; font-size: 1.5rem; color: var(--terra); line-height: 1; flex: 0 0 auto; transition: transform .2s; }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-answer { padding: 0 20px 18px; }
.faq-answer p { margin: 0; color: var(--muted); font-size: .94rem; }

/* ---------- Footer ---------- */
.site-footer { background: var(--navy); color: #d8d2e6; padding: 40px 0 90px; }
.footer-inner { display: grid; gap: 22px; }
.footer-brand .brand-name { color: #fff; font-family: var(--font-head); font-weight: 800; font-size: 1.1rem; }
.footer-disclaimer { font-size: .8rem; color: #b4accb; margin: 10px 0 0; max-width: 620px; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-nav a { color: #d8d2e6; font-size: .9rem; }
.footer-nav a:hover { color: #fff; }
.footer-legal { font-size: .8rem; color: #b4accb; margin: 0; }

/* ---------- Sticky mobile CTA bar ---------- */
.mobile-cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; gap: 10px; padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255,255,255,.97); backdrop-filter: blur(8px);
  border-top: 1px solid var(--border); box-shadow: 0 -4px 16px rgba(16,12,31,.08);
}
.mobile-cta-bar .btn { flex: 1; padding: 13px 10px; font-size: .9rem; }

/* ==========================================================================
   Breakpoints
   ========================================================================== */
@media (min-width: 560px) {
  .stat-grid, .shield-grid, .compliance-grid { grid-template-columns: 1fr 1fr; }
  .hero-ctas { flex-direction: row; }
  .hero-ctas .btn { flex: 1; }
}

@media (min-width: 768px) {
  .section { padding: 72px 0; }
  .nav-desktop { display: flex; }
  .nav-cta { display: inline-flex; margin-left: 6px; }
  .hamburger { display: none; }
  .calc-grid { grid-template-columns: 1.1fr 1fr; align-items: start; }
  .report-grid { grid-template-columns: 1fr 1fr; align-items: center; }
  .diag-grid { grid-template-columns: 1fr 1.2fr; align-items: start; }
  .pricing-grid { grid-template-columns: repeat(3, 1fr); align-items: start; }
  .flow { grid-template-columns: 1fr auto 1fr auto 1fr; align-items: center; }
  .flow-arrow { display: flex; }
  .footer-inner { grid-template-columns: 1.4fr 1fr; align-items: start; }
  .footer-legal { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,.12); padding-top: 18px; }
  .mobile-cta-bar { display: none !important; }
}

@media (min-width: 992px) {
  .hero-grid { grid-template-columns: 1.1fr .9fr; align-items: center; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .shield-grid { grid-template-columns: 1fr 1fr; }
  .compliance-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---------- Motion / print ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

@media print {
  .site-header, .mobile-cta-bar, .hero-ctas, .drawer-overlay, .mobile-drawer, .hamburger { display: none !important; }
  body { background: #fff; }
  .section { padding: 20px 0; }
  a { color: #000; }
}
