/* ── Pricing page ───────────────────────────────────────
 * Scoped under .pricing; built on the shared design tokens in
 * main.css so it inherits light/dark theming automatically.
 * The monthly/annual toggle is pure CSS (radio + :checked) — no JS.
 */

/* The pricing page loads only main.css + this file (no home.css/account.css), so it must set its
 * own themed page background — otherwise the body falls through to the browser's canvas, which is
 * dark on a dark-OS machine even when the clicked.bio theme is toggled to light. */
body.page--pricing {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

.pricing {
  max-width: 1160px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-5) var(--space-16);
  color: var(--text);
}
.pricing :where(h1, h2, h3, h4) { color: var(--text); letter-spacing: -0.01em; }

/* hidden toggle inputs (control everything below via :checked) */
.pricing .bp-radio { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ── Hero ─────────────────────────────────────────────── */
.pr-hero { text-align: center; padding: var(--space-6) 0 var(--space-2); }
.pr-eyebrow {
  text-transform: uppercase; letter-spacing: 0.12em; font-weight: 700;
  font-size: var(--text-xs); color: var(--accent-strong); margin: 0 0 var(--space-2);
}
.pr-hero h1 { font-size: clamp(2rem, 5vw, 2.8rem); margin: 0 0 var(--space-3); line-height: var(--leading-tight); }
.pr-lede { font-size: var(--text-lg); color: var(--muted); max-width: 640px; margin: 0 auto; line-height: var(--leading-normal); }

/* ── Billing toggle (CSS only) ────────────────────────── */
.bp-toggle {
  display: inline-flex; align-items: center; gap: 4px; margin: var(--space-6) auto 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 5px; box-shadow: var(--shadow);
}
.bp-opt {
  font-weight: 700; font-size: var(--text-sm); color: var(--muted);
  padding: 8px 18px; border-radius: var(--radius-pill); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: background var(--duration-base, 200ms), color var(--duration-base, 200ms);
}
.bp-opt .save-pill { font-size: var(--text-xs); color: var(--accent-strong); font-weight: 700; }
.pricing #bp-monthly:checked ~ .pr-hero .bp-opt[for="bp-monthly"],
.pricing #bp-annual:checked ~ .pr-hero .bp-opt[for="bp-annual"] {
  background: var(--accent-gradient); color: #fff;
}
.pricing #bp-monthly:checked ~ .pr-hero .bp-opt[for="bp-monthly"] .save-pill,
.pricing #bp-annual:checked ~ .pr-hero .bp-opt[for="bp-annual"] .save-pill { color: #fff; }
.bp-radio:focus-visible ~ .pr-hero .bp-toggle { outline: 2px solid var(--accent-strong); outline-offset: 3px; }

/* price swap driven by the annual radio */
.pricing .price-annual { display: none; }
.pricing #bp-annual:checked ~ .cards .price-monthly { display: none; }
.pricing #bp-annual:checked ~ .cards .price-annual { display: inline; }

/* ── Plan cards ───────────────────────────────────────── */
.cards {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px;
  margin: var(--space-10) 0 var(--space-6); align-items: stretch;
}
.card {
  background: var(--card-color); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 22px 18px; display: flex; flex-direction: column;
  box-shadow: var(--shadow); backdrop-filter: blur(8px);
}
.card.featured {
  border: 2px solid var(--accent-strong); position: relative;
  box-shadow: 0 16px 40px var(--glow-strong);
}
.card .popular {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%);
  background: var(--accent-gradient); color: #fff; font-size: var(--text-xs); font-weight: 800;
  letter-spacing: 0.06em; text-transform: uppercase; padding: 4px 12px; border-radius: var(--radius-pill);
  white-space: nowrap;
}
.card h3 { margin: 0 0 2px; font-size: var(--text-lg); }
.card .tag { color: var(--muted); font-size: var(--text-sm); min-height: 40px; margin-bottom: 10px; }
.card .price {
  font-size: 2rem; font-weight: 800; letter-spacing: -0.02em;
  display: flex; align-items: baseline; gap: 6px; min-height: 2.4rem;
}
.card .price .per { font-size: var(--text-sm); font-weight: 600; color: var(--text-tertiary); }
.card .peruser { font-size: var(--text-xs); color: var(--accent-strong); font-weight: 700; min-height: 18px; margin-top: 3px; }

.card .cta {
  /* Fixed height + single line so a longer label (e.g. "Switch to Starter")
     never grows the button and shoves the feature rows below out of alignment
     across columns. */
  display: flex; align-items: center; justify-content: center;
  min-height: 44px; white-space: nowrap;
  text-align: center; margin: 16px 0 14px; padding: 0 11px;
  border-radius: var(--radius-sm); font-weight: 700; text-decoration: none;
  background: var(--accent-gradient); color: #fff; border: 1px solid transparent;
  transition: filter 150ms ease;
}
.card .cta:hover { filter: brightness(1.05); }
.card .cta--ghost { background: transparent; border: 1px solid var(--accent-strong); color: var(--accent-strong); }
/* Logged-in: the plan you're already on */
.card.card--current { border-color: var(--accent-strong); box-shadow: inset 0 0 0 1px var(--accent-strong); }
.card .cta.is-current { background: var(--surface-dim); border: 1px solid var(--border); color: var(--muted); cursor: default; filter: none; }
.card .cta.is-busy { opacity: 0.6; pointer-events: none; }
.card .cta--ghost:hover { background: var(--accent-gradient-faint); filter: none; }

.card ul { list-style: none; margin: 0; padding: 0; font-size: var(--text-sm); }
.card ul.spec { margin: 2px 0 0; }
.card ul.spec li {
  padding: 6px 0; border-top: 1px solid var(--line); min-height: 1.6em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text);
}
.card ul.extras { margin-top: 12px; padding-top: 10px; border-top: 2px solid var(--border); }
.card ul.extras li { padding: 5px 0 5px 22px; position: relative; color: var(--text); }
.card ul.extras li::before { content: "✓"; position: absolute; left: 0; color: var(--accent-strong); font-weight: 800; }
.card ul.extras li.lead { color: var(--muted); font-weight: 700; padding-left: 0; margin-top: 2px; }
.card ul.extras li.lead::before { content: ""; }
.card ul.extras li strong { color: var(--text); }

/* ── "Every plan includes" strip ──────────────────────── */
.freebar {
  background: var(--accent-gradient-faint); border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg); padding: 20px 24px; margin: var(--space-8) 0;
}
.freebar h4 { margin: 0 0 6px; font-size: var(--text-lg); }
.freebar p { margin: 0; color: var(--muted); font-size: var(--text-sm); }
.freebar .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.freebar .chip {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill);
  padding: 5px 13px; font-size: var(--text-sm); font-weight: 600; color: var(--text);
}

/* ── Section heading ──────────────────────────────────── */
.pricing .sec-h { font-size: var(--text-2xl); margin: var(--space-12) 0 var(--space-4); text-align: center; }

/* ── Comparison table ─────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.pricing table {
  width: 100%; min-width: 720px; border-collapse: collapse; background: var(--surface);
  font-size: var(--text-sm); overflow: hidden;
}
.pricing th, .pricing td { padding: 11px 13px; text-align: center; border-bottom: 1px solid var(--line); }
.pricing th:first-child, .pricing td:first-child { text-align: left; font-weight: 600; }
.pricing thead th { background: var(--accent-gradient-faint); font-size: var(--text-sm); position: sticky; top: 0; }
.pricing thead th.feat { color: var(--accent-strong); }
.pricing tr.group td { background: var(--surface-dim); font-weight: 800; text-align: left; color: var(--accent-strong); letter-spacing: 0.02em; }
.pricing td .y { color: var(--accent-strong); font-weight: 800; }
.pricing td .n { color: var(--text-disabled); }
.compare-note { font-size: var(--text-xs); color: var(--text-tertiary); margin: 12px 4px 0; text-align: center; line-height: var(--leading-normal); }

/* info bubble + tooltip */
.info {
  display: inline-flex; align-items: center; justify-content: center; width: 15px; height: 15px;
  border-radius: 50%; background: var(--accent-strong); color: #fff; font-size: 0.64rem; font-weight: 800;
  font-style: italic; cursor: help; margin-left: 6px; position: relative; vertical-align: middle;
}
.info::after {
  /* Anchor to the icon's left edge and extend rightward. Every info icon lives in the left
     (feature-name) column, so centering would overflow off the left side of the viewport. */
  content: attr(data-tip); position: absolute; bottom: 150%; left: 0; transform: none;
  width: 220px; max-width: min(220px, 70vw); background: #0f172a; color: #fff; padding: 9px 11px; border-radius: var(--radius-sm);
  font-size: var(--text-xs); font-weight: 500; font-style: normal; line-height: 1.4; text-align: left;
  white-space: normal; opacity: 0; visibility: hidden; transition: opacity 120ms ease;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.28); z-index: 20; pointer-events: none;
}
.info:hover::after, .info:focus::after { opacity: 1; visibility: visible; }

/* ── FAQ ──────────────────────────────────────────────── */
.faq { max-width: 760px; margin: 0 auto; }
.faq details {
  border: 1px solid var(--border); border-radius: var(--radius-md);
  background: var(--card-color); margin-bottom: 10px; overflow: hidden;
}
.faq summary {
  cursor: pointer; padding: 15px 18px; font-weight: 700; font-size: var(--text-base);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--accent-strong); font-weight: 800; font-size: 1.2rem; flex-shrink: 0; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0; padding: 0 18px 16px; color: var(--muted); line-height: var(--leading-relaxed); font-size: var(--text-sm); }

/* ── Final CTA ────────────────────────────────────────── */
.final-cta {
  text-align: center; margin: var(--space-16) auto 0; max-width: 620px;
  padding: var(--space-10) var(--space-6); border-radius: var(--radius-lg);
  background: var(--accent-gradient-faint); border: 1px solid var(--border-accent);
}
.final-cta h2 { font-size: var(--text-2xl); margin: 0 0 var(--space-2); }
.final-cta p { color: var(--muted); margin: 0 0 var(--space-6); }
.final-cta .cta--big {
  display: inline-block; background: var(--accent-gradient); color: #fff; text-decoration: none;
  font-weight: 700; padding: 14px 28px; border-radius: var(--radius-sm); font-size: var(--text-lg);
  transition: filter 150ms ease;
}
.final-cta .cta--big:hover { filter: brightness(1.05); }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 980px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .card ul.spec li { white-space: normal; }
}
@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .bp-opt { padding: 8px 14px; }
}
