/*
 * Shared styling for the public BodyPlan tools and the Build My Plan funnel.
 *
 * Built on the same tokens as the SEO landing pages (templates/seo_landing.html)
 * so the tools read as part of the product rather than a bolted-on calculator
 * directory. Mobile-first throughout: most traffic here arrives from a phone
 * search result and leaves through an App Store button.
 */

.bpt {
  --bpt-ink: #0a1733;
  --bpt-muted: #475569;
  --bpt-subtle: #64748b;
  --bpt-accent: #3b82f6;
  --bpt-accent-strong: #1d4ed8;
  --bpt-border: rgba(15, 23, 42, 0.08);
  --bpt-surface: #ffffff;
  --bpt-surface-alt: #f8fafc;
  --bpt-radius: 1rem;
  color: var(--bpt-ink);
}

.bpt-container {
  width: 100%;
  max-width: 56rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 4rem;
  /* Respect notches and home indicators on phones. */
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
  padding-bottom: max(4rem, calc(3rem + env(safe-area-inset-bottom)));
}

@media (min-width: 768px) {
  .bpt-container { padding-top: 2rem; }
}

/* Pages with a two-column hero need the extra width to justify the split. */
.bpt-container--wide { max-width: 68rem; }

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */
.bpt-crumb {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem;
  font-size: 0.8rem; color: var(--bpt-subtle); margin-bottom: 1.25rem;
}
.bpt-crumb a { color: var(--bpt-accent-strong); text-decoration: none; font-weight: 600; }
.bpt-crumb a:hover { text-decoration: underline; }
.bpt-crumb [aria-current] { color: var(--bpt-ink); font-weight: 600; }

/* ── Header ─────────────────────────────────────────────────────────────── */
/* Copy leads; a single device shot sits alongside it on wide screens and is
   dropped on phones, where the form should be the first thing after the H1. */
.bpt-header { display: grid; gap: 2.5rem; align-items: center; }
@media (min-width: 900px) {
  .bpt-header { grid-template-columns: minmax(0, 1fr) minmax(0, 15rem); }
}
.bpt-header-copy { min-width: 0; }
.bpt-header-media { display: none; }
@media (min-width: 900px) {
  .bpt-header-media {
    display: block; margin-left: auto;
    /* Fixed phone proportions with a top crop: the source images are full-length
       screenshots and would otherwise size themselves off their own height. */
    width: 11rem; aspect-ratio: 9 / 19.5;
    border-radius: 1.4rem; overflow: hidden;
    background: #0a1220; border: 1px solid rgba(15, 23, 42, 0.12);
    box-shadow: 0 28px 55px -30px rgba(15, 23, 42, 0.65);
    transform: rotate(-3deg);
  }
}
.bpt-header-media img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; object-position: top center;
}

.bpt-eyebrow {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--bpt-accent-strong);
  background: rgba(59, 130, 246, 0.09);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 9999px; padding: 0.35rem 0.8rem;
}
.bpt-h1 {
  font-family: "Manrope", "Helvetica Neue", Arial, sans-serif;
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.1;
  font-size: clamp(1.75rem, 4.5vw, 2.5rem);
  margin: 0.85rem 0 0; max-width: 20ch;
}
.bpt-standfirst {
  margin-top: 0.85rem; font-size: clamp(0.98rem, 0.4vw + 0.92rem, 1.1rem);
  line-height: 1.6; color: var(--bpt-muted); max-width: 60ch;
}

/* ── Form ───────────────────────────────────────────────────────────────── */
.bpt-form { margin-top: 1.75rem; }
.bpt-card {
  background: var(--bpt-surface); border: 1px solid var(--bpt-border);
  border-radius: var(--bpt-radius); padding: 1.25rem;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.02), 0 12px 32px -26px rgba(15, 23, 42, 0.35);
}
@media (min-width: 640px) { .bpt-card { padding: 1.5rem; } }

.bpt-field { margin-bottom: 1.15rem; }
.bpt-field:last-child { margin-bottom: 0; }
.bpt-label {
  display: block; font-size: 0.88rem; font-weight: 700;
  color: var(--bpt-ink); margin-bottom: 0.5rem;
}
.bpt-hint { font-size: 0.78rem; color: var(--bpt-subtle); font-weight: 500; margin-top: 0.35rem; }

.bpt-input, .bpt-select {
  width: 100%; border: 1.5px solid #d8dee9; border-radius: 0.7rem;
  padding: 0.75rem 0.85rem; font-size: 1rem; color: var(--bpt-ink);
  background: #fff; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  /* 16px minimum stops iOS Safari zooming the viewport on focus. */
  font-family: inherit;
}
.bpt-select {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2364748b'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 0 1 1.06.02L10 11.17l3.71-3.94a.75.75 0 1 1 1.08 1.04l-4.24 4.5a.75.75 0 0 1-1.08 0l-4.24-4.5a.75.75 0 0 1 .02-1.06Z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center; background-size: 1.15rem;
  padding-right: 2.5rem;
}
.bpt-input:focus, .bpt-select:focus {
  border-color: var(--bpt-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18);
}
.bpt-input-row { display: flex; gap: 0.6rem; }
.bpt-input-row .bpt-input { flex: 1; min-width: 0; }

/* Chip pickers — fewer taps and no keyboard on mobile. */
.bpt-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.bpt-chip { position: relative; }
.bpt-chip input {
  position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer;
}
.bpt-chip span {
  display: block; padding: 0.6rem 0.95rem; border-radius: 0.65rem;
  border: 1.5px solid #d8dee9; background: #fff;
  font-size: 0.9rem; font-weight: 600; color: var(--bpt-muted);
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  text-align: center; user-select: none;
}
.bpt-chip input:checked + span {
  border-color: var(--bpt-accent); background: rgba(59, 130, 246, 0.08);
  color: var(--bpt-accent-strong);
}
.bpt-chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25); }
.bpt-chips--grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(6.5rem, 1fr)); }
.bpt-chips--days { grid-template-columns: repeat(auto-fit, minmax(3rem, 1fr)); }

.bpt-toggle { display: inline-flex; padding: 0.2rem; background: #eef2f7; border-radius: 0.65rem; }
.bpt-toggle .bpt-chip span {
  border: none; background: transparent; padding: 0.45rem 0.9rem; border-radius: 0.5rem;
}
.bpt-toggle .bpt-chip input:checked + span { background: #fff; color: var(--bpt-ink); box-shadow: 0 1px 3px rgba(15,23,42,0.12); }

.bpt-submit {
  width: 100%; margin-top: 1.35rem; border: none; cursor: pointer;
  padding: 0.95rem 1.5rem; border-radius: 0.8rem;
  background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
  color: #fff; font-size: 1rem; font-weight: 700; font-family: inherit;
  box-shadow: 0 14px 30px -14px rgba(99, 102, 241, 0.65);
  transition: filter 0.15s, transform 0.15s;
}
.bpt-submit:hover:not(:disabled) { filter: brightness(1.07); }
.bpt-submit:active:not(:disabled) { transform: translateY(1px); }
.bpt-submit:disabled { opacity: 0.6; cursor: progress; }

.bpt-error {
  margin-top: 0.9rem; padding: 0.75rem 0.95rem; border-radius: 0.7rem;
  background: #fef2f2; border: 1px solid #fecaca; color: #b91c1c;
  font-size: 0.88rem; line-height: 1.5;
}
.bpt-field-error { margin-top: 0.4rem; font-size: 0.8rem; color: #b91c1c; font-weight: 600; }

/* ── Results ────────────────────────────────────────────────────────────── */
/* Results are deliberately heavier than the form: the answer is the product. */
.bpt-results { margin-top: 2rem; scroll-margin-top: 5rem; }
.bpt-results[hidden] { display: none; }

.bpt-headline-card {
  border-radius: 1.25rem; padding: 1.75rem 1.5rem;
  background: linear-gradient(150deg, #0b1220 0%, #16233d 100%);
  color: #fff; text-align: center;
}
.bpt-headline-label {
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #93c5fd;
}
.bpt-headline-value {
  font-family: "Sora", "Manrope", sans-serif;
  font-size: clamp(2.5rem, 9vw, 3.75rem); font-weight: 800;
  letter-spacing: -0.04em; line-height: 1; margin-top: 0.5rem;
}
.bpt-headline-unit { font-size: 0.45em; font-weight: 700; margin-left: 0.15em; color: #cbd5e1; }
.bpt-headline-note { margin-top: 0.75rem; font-size: 0.85rem; color: #cbd5e1; line-height: 1.55; }

.bpt-stat-grid {
  display: grid; gap: 0.75rem; margin-top: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr));
}
.bpt-stat {
  background: var(--bpt-surface); border: 1px solid var(--bpt-border);
  border-radius: 0.9rem; padding: 1rem; text-align: center;
}
.bpt-stat-label {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--bpt-subtle);
}
.bpt-stat-value {
  font-family: "Sora", "Manrope", sans-serif; font-weight: 800;
  font-size: 1.5rem; letter-spacing: -0.02em; margin-top: 0.35rem; color: var(--bpt-ink);
}
.bpt-stat-sub { font-size: 0.75rem; color: var(--bpt-subtle); margin-top: 0.2rem; }

.bpt-section-title {
  font-family: "Manrope", sans-serif; font-weight: 800; font-size: 1.15rem;
  letter-spacing: -0.02em; margin: 2rem 0 0.85rem;
}

/* Rows instead of a table: wide tables are unreadable on a phone. */
.bpt-rows { display: grid; gap: 0.5rem; }
.bpt-row {
  display: flex; align-items: center; justify-content: space-between; gap: 0.75rem;
  background: var(--bpt-surface); border: 1px solid var(--bpt-border);
  border-radius: 0.8rem; padding: 0.85rem 1rem;
}
.bpt-row-lead { min-width: 0; }
.bpt-row-title { font-weight: 700; font-size: 0.95rem; color: var(--bpt-ink); }
.bpt-row-sub { font-size: 0.8rem; color: var(--bpt-subtle); margin-top: 0.15rem; }
.bpt-row-value {
  font-family: "Sora", "Manrope", sans-serif; font-weight: 800;
  font-size: 1.1rem; letter-spacing: -0.02em; white-space: nowrap;
}

.bpt-note {
  margin-top: 1rem; font-size: 0.83rem; line-height: 1.6; color: var(--bpt-subtle);
}
.bpt-note strong { color: var(--bpt-muted); }

/* ── Explanatory prose ──────────────────────────────────────────────────── */
.bpt-prose { margin-top: 3rem; }
.bpt-prose h2 {
  font-family: "Manrope", sans-serif; font-weight: 800; font-size: 1.3rem;
  letter-spacing: -0.02em; margin-top: 2rem;
}
.bpt-prose h2:first-child { margin-top: 0; }
.bpt-prose h3 { font-weight: 700; font-size: 1rem; margin-top: 1.5rem; }
.bpt-prose p, .bpt-prose li {
  font-size: 0.97rem; line-height: 1.7; color: var(--bpt-muted); max-width: 62ch;
}
.bpt-prose p { margin-top: 0.75rem; }
.bpt-prose ul { margin-top: 0.75rem; padding-left: 1.15rem; list-style: disc; }
.bpt-prose li { margin-top: 0.4rem; }
.bpt-prose a { color: var(--bpt-accent-strong); font-weight: 600; text-decoration: none; }
.bpt-prose a:hover { text-decoration: underline; }

.bpt-faq { display: grid; gap: 0.65rem; margin-top: 1rem; }
.bpt-faq details {
  border-radius: 0.9rem; border: 1px solid var(--bpt-border);
  background: var(--bpt-surface-alt); padding: 1rem 1.15rem;
}
.bpt-faq summary { cursor: pointer; font-weight: 700; font-size: 0.93rem; color: var(--bpt-ink); }
.bpt-faq p { margin-top: 0.6rem; font-size: 0.9rem; }

/* ── Sources and disclaimers ────────────────────────────────────────────── */
/* Verifiable but not shouty: available to anyone who wants to check the
   working, without burying the result under citations. */
.bpt-sources {
  margin-top: 1.25rem; border: 1px solid var(--bpt-border);
  border-radius: 0.9rem; background: var(--bpt-surface-alt); padding: 0.9rem 1.1rem;
}
.bpt-sources summary {
  cursor: pointer; display: flex; align-items: center; justify-content: space-between;
  gap: 0.5rem; font-size: 0.85rem; font-weight: 700; color: var(--bpt-muted);
  list-style: none;
}
.bpt-sources summary::-webkit-details-marker { display: none; }
.bpt-sources summary svg { width: 1rem; height: 1rem; flex: 0 0 auto; transition: transform 0.2s; }
.bpt-sources[open] summary svg { transform: rotate(180deg); }
.bpt-sources-method {
  margin-top: 0.85rem; font-size: 0.85rem; line-height: 1.6; color: var(--bpt-muted);
}
.bpt-source-list { list-style: none; margin: 0.85rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.bpt-source-list a {
  display: block; padding: 0.7rem 0.85rem; border-radius: 0.65rem;
  background: #fff; border: 1px solid var(--bpt-border); text-decoration: none;
}
.bpt-source-list a:hover { border-color: rgba(59, 130, 246, 0.35); }
.bpt-source-title { display: block; font-size: 0.85rem; font-weight: 700; color: var(--bpt-accent-strong); }
.bpt-source-note { display: block; margin-top: 0.25rem; font-size: 0.79rem; line-height: 1.55; color: var(--bpt-subtle); }

.bpt-disclaimer {
  display: flex; gap: 0.7rem; margin-top: 1.25rem;
  padding: 0.95rem 1.1rem; border-radius: 0.9rem;
  background: #fffbeb; border: 1px solid #fde68a;
}
.bpt-disclaimer svg { flex: 0 0 auto; width: 1.05rem; height: 1.05rem; margin-top: 0.1rem; color: #b45309; }
.bpt-disclaimer p { font-size: 0.83rem; line-height: 1.6; color: #78350f; }
.bpt-disclaimer-general { margin-top: 0.5rem; color: #92400e; }
.bpt-disclaimer a { color: #92400e; font-weight: 700; text-decoration: underline; }

/* ── App CTA ────────────────────────────────────────────────────────────── */
.bpt-cta {
  margin-top: 2.5rem; border-radius: 1.25rem; padding: 1.75rem 1.5rem;
  background: #0b1220; color: #fff;
}
.bpt-cta h2 {
  font-family: "Manrope", sans-serif; font-weight: 800;
  font-size: clamp(1.25rem, 3.5vw, 1.5rem); letter-spacing: -0.02em;
}
.bpt-cta p { margin-top: 0.6rem; font-size: 0.93rem; line-height: 1.6; color: #cbd5e1; max-width: 52ch; }
.bpt-cta-points { list-style: none; margin: 1.1rem 0 0; padding: 0; display: grid; gap: 0.5rem; }
.bpt-cta-points li {
  display: flex; align-items: flex-start; gap: 0.55rem;
  font-size: 0.88rem; color: #e2e8f0; line-height: 1.5;
}
.bpt-cta-points svg { flex: 0 0 auto; width: 1rem; height: 1rem; margin-top: 0.2rem; color: #4ade80; }

.bpt-stores { display: flex; flex-wrap: wrap; gap: 0.7rem; margin-top: 1.4rem; }
.bpt-stores a { display: block; line-height: 0; border-radius: 0.6rem; transition: opacity 0.15s, transform 0.15s; }
.bpt-stores a:hover { opacity: 0.88; transform: translateY(-1px); }
.bpt-stores img { height: 46px; width: auto; display: block; }
/* When the platform is known, the other store stays available but recedes. */
.bpt-stores[data-primary] a[data-secondary="true"] { opacity: 0.55; }
.bpt-stores[data-primary] a[data-secondary="true"]:hover { opacity: 0.8; }
.bpt-cta-footnote { margin-top: 0.9rem; font-size: 0.78rem; color: #94a3b8; }

/* ── Related tools ──────────────────────────────────────────────────────── */
.bpt-related { margin-top: 2.5rem; }
.bpt-related-grid {
  display: grid; gap: 0.75rem; margin-top: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}
.bpt-related-card {
  display: block; padding: 1.1rem 1.25rem; border-radius: 0.9rem;
  border: 1px solid var(--bpt-border); background: var(--bpt-surface);
  text-decoration: none; color: var(--bpt-ink);
  transition: transform 0.15s, border-color 0.15s;
}
.bpt-related-card:hover { transform: translateY(-2px); border-color: rgba(59, 130, 246, 0.35); }
/* Both are <span> inside an <a>; block display keeps name and summary stacked. */
.bpt-related-name { display: block; font-weight: 700; font-size: 0.95rem; }
.bpt-related-sub {
  display: block; font-size: 0.83rem; color: var(--bpt-subtle);
  margin-top: 0.3rem; line-height: 1.5;
}

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

@media (prefers-reduced-motion: reduce) {
  .bpt-submit, .bpt-related-card, .bpt-stores a { transition: none; }
}
