/*
 * pricing.css — page-scoped styles for the marketing pricing page (/{locale}/pricing).
 * Loaded ONLY on that page (via the pricing view's @section('styles')), after marketing.css, so it
 * reuses the shared :root tokens (--bg, --text, --muted, --border, --green, --green-hover, --accent,
 * --hero-bg, --sky-*, --focus) and only adds pricing layout. The site is dark-only; this page is the
 * 'night' theme (no .blog-body light scope). Kept out of marketing.css so the home/critical path
 * isn't burdened with styles only /pricing needs. No JavaScript — the page stays byte-identical /
 * CDN-cacheable. The page prices the prepaid-credit model: three per-minute rate cards (the price
 * shown is the per-minute rate), a metering explainer, and the bring-your-own security note.
 */

/* Clear the fixed .site-header and reuse the home page's continuous night sky: the same
   #000 -> --sky-* gradient as marketing.css's `.content`, whose final stop (--sky-horizon) is the
   footer video's own sky — since <footer> is the next sibling after </main>, the gradient flows
   straight into the footer scene. z-index:0 makes a stacking context so the ::before starfield sits
   over this background but below the cards. Keep the gradient + starfield in sync with `.content`. */
.pricing-main {
  position: relative;
  z-index: 0;
  padding: clamp(6rem, 12vw, 9rem) 24px 4rem;
  background: linear-gradient(
    180deg,
    #000 0%,
    var(--sky-top) 18%,
    var(--sky-mid) 50%,
    var(--sky-horizon) 100%
  );
}
/* Faint tiled starfield over the whole page (identical to `.content::before`), fading in toward the
   horizon where it meets the footer video. Purely decorative. */
.pricing-main::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 18% 24%, rgba(255,255,255,0.9), transparent),
    radial-gradient(1px 1px at 62% 12%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 82% 46%, rgba(255,255,255,0.8), transparent),
    radial-gradient(1.5px 1.5px at 40% 68%, rgba(255,255,255,0.65), transparent),
    radial-gradient(1px 1px at 8% 82%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 72% 88%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 14% 8%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1.5px 1.5px at 52% 30%, rgba(255,255,255,0.75), transparent),
    radial-gradient(1px 1px at 90% 20%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 4% 52%, rgba(255,255,255,0.65), transparent),
    radial-gradient(1px 1px at 30% 44%, rgba(255,255,255,0.55), transparent),
    radial-gradient(1px 1px at 48% 56%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 68% 62%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 88% 74%, rgba(255,255,255,0.6), transparent),
    radial-gradient(1px 1px at 24% 92%, rgba(255,255,255,0.55), transparent),
    radial-gradient(1px 1px at 58% 82%, rgba(255,255,255,0.55), transparent);
  background-size: 300px 300px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.75) 100%);
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.75) 100%);
  opacity: 0.7;
}

/* ===== Hero ===== */
.pricing-hero {
  max-width: 820px;
  margin: 0 auto clamp(2rem, 5vw, 3.25rem);
  text-align: center;
}
.pricing-title {
  color: var(--text);
  font-size: clamp(34px, 5vw, 56px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
  text-wrap: balance;
  margin: 0;
}
.pricing-sub {
  color: var(--muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.55;
  text-wrap: pretty;
  margin: 16px auto 0;
  /* Shares the title's measure (.pricing-hero's 820px) rather than sitting 100px narrower inside
     it — the two centred blocks then read as one column. Widen the hero and this follows. */
  max-width: 820px;
}

/* ===== Rate grid wrap =====
   1232px is the site's content width, not an arbitrary number: it mirrors the nav box
   (.nav max-width 1280 − 24px padding-inline each side) and .blog-container, so the rate grid
   starts flush with the logo and ends flush with the Sign up button, exactly like /docs and /blog.
   The prose blocks below (hero, FAQ) deliberately stay narrower — those are reading measures. */
.pricing-wrap {
  max-width: 1232px;
  margin: 0 auto;
}

/* ===== Rate cards =====
   Each card is a subgrid sharing the outer grid's rows, so the five bands —
   name, tagline, price, CTA, features — line up across all cards no matter how
   many lines a tagline/feature wraps to in any locale (no JS, no brittle
   per-band min-heights). The five in-flow children map 1:1 to the five rows;
   the absolutely-positioned badge is out of flow and takes no row. */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 18px;
  row-gap: 18px;
}
.plan-card {
  position: relative;
  display: grid;
  grid-template-rows: subgrid;
  grid-row: span 5;
  row-gap: 0;
  background: rgba(13, 17, 23, 0.72);
  /* Square corners on purpose — no border-radius. The featured card's `0 0 0 1px` ring and the
     badge overlapping the top edge both follow the sharp corner; don't reintroduce a radius here
     without checking those two. */
  border: 1px solid var(--border);
  padding: 26px 22px;
  backdrop-filter: blur(6px);
}
.plan-card--featured {
  border-color: var(--green-hover);
  box-shadow: 0 0 0 1px var(--green-hover), 0 18px 50px rgba(0, 0, 0, 0.5);
}
.plan-badge {
  position: absolute;
  top: -11px;
  left: 22px;
  background: var(--green);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 4px 10px;
  border-radius: 999px;
}
.plan-name {
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}
.plan-tagline {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 6px 0 0;
}
.plan-price {
  margin: 18px 0 20px;
  align-self: end;
}
.plan-amount {
  color: var(--text);
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.plan-per {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  margin-left: 6px;
}
.plan-cta {
  display: block;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.plan-cta:hover { border-color: var(--muted); background: rgba(255, 255, 255, 0.08); }
.plan-cta--primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.plan-cta--primary:hover { background: var(--green-hover); border-color: var(--green-hover); }
.plan-features {
  list-style: none;
  margin: 22px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.plan-features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
}
.plan-check {
  flex: none;
  margin-top: 1px;
  color: var(--green-hover);
}

/* ===== Shared section heading (metering explainer) ===== */
.pricing-section-heading {
  color: var(--text);
  font-size: clamp(24px, 3.5vw, 32px);
  font-weight: 700;
  text-align: center;
  margin: 0 0 24px;
}

/* ===== How the meter runs =====
   Four plain bands rather than cards, so they read as explanation and never compete with the rate
   grid above them. Two-up on desktop, one column on narrow screens. */
.pricing-meter {
  max-width: 1232px;
  margin: clamp(3rem, 7vw, 5rem) auto 0;
}
.meter-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  column-gap: 40px;
  row-gap: 28px;
}
.meter-item h3 {
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.meter-item p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

/* ===== Bring-your-own security note =====
   The reason the lowest rate needs BOTH your LLM account and your server. A single bordered band
   with a green rule down its leading edge — deliberately louder than body copy, quieter than a
   rate card, because it is a promise rather than a price. */

/* ===== FAQ ===== */
.pricing-faq {
  max-width: 760px;
  margin: clamp(3rem, 7vw, 5rem) auto 0;
}
.pricing-faq-heading {
  color: var(--text);
  font-size: clamp(24px, 3.5vw, 32px);
  font-weight: 700;
  text-align: center;
  margin: 0 0 24px;
}
.pricing-faq-item {
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
}
.pricing-faq-item summary {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  padding: 14px 28px 14px 0;
  position: relative;
}
.pricing-faq-item summary::-webkit-details-marker { display: none; }
.pricing-faq-item summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}
.pricing-faq-item[open] summary::after { content: "\2212"; }
.pricing-faq-item p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 14px;
  max-width: 660px;
}
.pricing-faq-item summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }

/* ===== Responsive =====
   Three rate cards go straight from 3-up to 1-up: a 2-up row would leave one card orphaned on its
   own line, which reads as a layout bug rather than a choice. */
@media (max-width: 940px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .meter-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .pricing-main { padding-top: 6.5rem; }
}

/* ===== Light theme ===== */
/* The page defaults to the night theme above; when the resolved theme is light (<html
   data-appearance='light'>, set by the inline theme script), the pricing page turns light. The
   shared tokens + chrome (header/footer/wordmark/menu) come from marketing.css's theme-adaptive
   section (.pricing-body is one of its scopes); this block only re-skins the page-specific pieces:
   drop the night sky + starfield for a flat light canvas, and lift the dark-glass cards to white. */
:root[data-appearance='light'] .pricing-body .pricing-main {
  background: var(--bg);
}
:root[data-appearance='light'] .pricing-body .pricing-main::before {
  display: none;
}
:root[data-appearance='light'] .pricing-body .plan-card {
  background: #ffffff;
  border-color: var(--border);
  box-shadow: 0 1px 2px rgba(31, 35, 40, 0.06);
  backdrop-filter: none;
}
:root[data-appearance='light'] .pricing-body .plan-card--featured {
  border-color: var(--green-hover);
  box-shadow: 0 0 0 1px var(--green-hover), 0 18px 44px rgba(26, 127, 55, 0.16);
}
:root[data-appearance='light'] .pricing-body .plan-cta {
  background: #ffffff;
  border-color: var(--border);
}
:root[data-appearance='light'] .pricing-body .plan-cta:hover {
  background: var(--hero-bg);
  border-color: var(--border-hover);
}
/* The green primary CTA + "Start here" badge keep the brand green (white text) in both themes —
   re-assert green here so the general light .plan-cta override above (white bg) doesn't leave the
   flagged card's button as white text on white. */
:root[data-appearance='light'] .pricing-body .plan-cta--primary {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
:root[data-appearance='light'] .pricing-body .plan-cta--primary:hover {
  background: var(--green-hover);
  border-color: var(--green-hover);
}
/* The security note is the page's only other dark-glass panel — lift it the same way the cards
   are lifted, keeping the green leading rule in both themes. */
