/* ============================================================
   CHECKOUT PAGE STYLES — layered on top of brand.css (SWA-813)

   checkout.html links brand.css BEFORE this file, so the shared brand
   layer — vendored fonts, :root tokens (light + dark), type scale, .btn,
   form fields, .alert base, reduced-motion — now lives in brand.css and
   was removed from here (it used to be a verbatim copy). This file is
   ONLY two things:
     1. checkout-only structure (split panel, stepper, Recurly #card host,
        plan detail, trust logos, pay buttons, step-2 summary), and
     2. the small INTENTIONAL-OVERRIDES block below — same selector as
        brand.css, but checkout needs a different value; these win by
        source order (this file loads last). DO NOT "dedupe" them back
        into brand.css: each diverges on purpose, noted inline.
   ============================================================ */

/* ============================================================
   INTENTIONAL OVERRIDES OF brand.css — do not remove (SWA-813)
   ============================================================ */
/* checkout has no `.page` wrapper (it uses .checkout), so the side gutter the
   brand flow pages get from .page lives on <body> here instead. */
body { padding-left: 24px; padding-right: 24px; }

/* the error banner spans the full split-panel width and centers, rather than
   filling a single card like the brand flow pages (brand.css: margin 0 0 22px). */
.alert { margin: 0 auto 22px; max-width: 1180px; }

/* checkout's .btn-close markup is an EMPTY <button>; brand.css styles a button
   with a literal × text node, so draw the glyph via ::before here. (Positioning
   comes from brand.css's identical .btn-close rule.) */
.alert .btn-close::before { content: "\00d7"; font-size: 18px; line-height: 22px; }

/* left-panel wordmark is a touch smaller than the brand pages' centered one
   (brand.css: 30px). */
.wordmark img { height: 28px; }

/* checkout's blobs are positioned for the LEFT PANEL and add a third; brand.css
   positions b1/b2 for a centered card. Re-declare all three in full — every
   property (incl opacity) is restated so each cleanly wins by source order. b2
   also resets `bottom`: brand's b2 sets `bottom: -100px`, which checkout's b2
   (top + explicit height) does not override, so it would otherwise leak in. */
.blob.b1 { width: 280px; height: 280px; top: -60px; right: -80px;
  background: radial-gradient(circle, var(--accent-light) 0%, transparent 70%); }
.blob.b2 { width: 220px; height: 220px; top: 240px; left: -90px; bottom: auto;
  background: radial-gradient(circle, var(--gold-top) 0%, transparent 70%); opacity: calc(var(--blob-opacity) * 0.7); }
.blob.b3 { width: 260px; height: 260px; bottom: -90px; right: -40px;
  background: radial-gradient(circle, var(--gold) 0%, transparent 72%); opacity: calc(var(--blob-opacity) * 0.45); }

/* brand.css spaces stacked fields with `.field + .field { margin-top: 18px }`,
   written for the brand flow pages' single-column forms. checkout lays its fields
   out in two-column grids (.field-grid and .billing-row) where the grid `gap`
   already handles spacing, so neutralize the inherited sibling margin there — it
   would otherwise drop every second-and-later field 18px below its row-mate. */
.field-grid > .field,
.billing-row > .field { margin-top: 0; }

/* ============================================================
   CHECKOUT SHELL (split-panel grid)
   ============================================================ */
.checkout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 420px 1fr;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 48px rgba(28, 25, 23, 0.08);
  position: relative;
}

/* ---- LEFT (brand atmosphere) ---- */
.panel-left {
  position: relative;
  /* Contain the panel's internal stacking (blobs z1, inner z2) so it doesn't
     leak into the root context and paint over the body-level reCAPTCHA badge,
     which Google fixes bottom-left at z-index:auto — the bottom-pinned logo
     tiles would otherwise cover it when they share that corner. */
  isolation: isolate;
  display: flex;
  flex-direction: column;
  background: var(--tan);
  border-right: 1px solid var(--border);
  padding: 36px 34px;
  overflow: hidden;
}
.panel-left-inner {
  position: relative;
  z-index: 2;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
/* The form panel is usually taller than the sidebar content. Push the whole
   trust cluster (badges + logo wall) to the bottom so the panel reads as two
   anchored groups — brand + plan up top, social proof at the foot — with the
   slack as deliberate breathing room between them. */
.trust-badges {
  margin-top: auto;
}

/* ---- SELECTED PLAN DETAIL ---- */
.plan-detail {
  background: var(--featured-bg);
  border: 1px solid var(--accent-light);
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 4px 16px rgba(254, 226, 101, 0.25), 0 16px 48px rgba(28, 25, 23, 0.06);
  position: relative;
}
.plan-detail .pd-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--heading);
  margin-top: 6px;
}
.plan-detail .pd-discount {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
}
/* gold pills: applied-coupon name (revealed on set.coupon) + free-trial tag
   next to the plan name (revealed in the trial pricing case) */
.plan-detail .pd-coupon,
.plan-detail .pd-trial-pill {
  display: inline-flex;
  align-items: baseline;
  padding: 3px 10px;
  border: 1px solid var(--accent-light);
  border-radius: 999px;
  background: rgba(230, 200, 0, 0.12);
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold-text);
}
.plan-detail .pd-coupon { margin-top: 10px; }
.plan-detail .pd-coupon .pd-coupon-label::after { content: "\00a0\00b7\00a0"; }
.plan-detail .pd-price {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--heading);
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 6px;
}
/* DM Mono only ships 400/500 — <strong>'s 700 would faux-bold (smeared glyphs) */
.plan-detail .pd-price strong {
  font-weight: 500;
}
.plan-detail .pd-price .pd-dim {
  color: var(--muted);
}
.plan-detail .pd-price .pd-strike {
  text-decoration: line-through;
  color: var(--muted);
}
/* narrow cards wrap the price line at the "·" separator, never mid-phrase */
.plan-detail .pd-price .pd-nowrap {
  white-space: nowrap;
}

/* trust badges */
.trust-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}
.trust-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.66rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}
.trust-badge svg { width: 14px; height: 14px; color: var(--gold-text); }

/* plan perks — what's included; fills the sidebar with value at the point of
   purchase. Copy mirrors the marketing site's feature set. */
.plan-perks {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.plan-perks li {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 0.92rem;
  line-height: 1.3;
  color: var(--text);
}
.plan-perks svg {
  flex-shrink: 0;
  width: 17px;
  height: 17px;
  color: var(--gold-text);
}

/* logos */
.logos-block .logos-label {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
/* Trust wall: each logo sits in its own subtle tile so the eight tight-cropped
   wordmarks (aspect ratios from ~1.8:1 to ~12.5:1) read as one even grid
   instead of a bunched, ragged row. The tile is the uniform visual unit;
   object-fit centers each logo inside it. The grayscale filter lives on the
   <img>, not the tile, so the dark-mode invert recolors only the logo and never
   flips the tile's surface. */
.logos-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.logo-card {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 58px;
  padding: 12px 18px;
  border: 1px solid var(--border);
  /* 16px radius + the warm 0 4px 16px shadow on hover mirror the checkout's own
     .plan-detail card and the marketing site's .feature-card, so the trust
     tiles read as the same brand object. */
  border-radius: 16px;
  background: var(--surface-2);
  transition: transform 0.3s ease, box-shadow 0.3s ease,
    border-color 0.3s ease, background 0.3s ease;
}
.logo-card img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  filter: grayscale(100%);
  opacity: 0.7;
  transition: filter 0.3s ease, opacity 0.3s ease;
}
.logo-card:hover {
  border-color: var(--border-strong);
  background: var(--surface);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(28, 25, 23, 0.06);
}
.logo-card:hover img {
  filter: none;
  opacity: 1;
}

/* ============================================================
   RIGHT (form) PANEL
   ============================================================ */
.panel-right {
  padding: 40px 44px 44px;
  background: var(--surface);
  min-width: 0;   /* let the 1fr grid track shrink so inner content wraps/ellipsizes instead of overflowing */
}

/* step indicator */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 30px;
}
.stepper .step {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stepper .dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.78rem;
  font-weight: 500;
  border: 1.5px solid var(--border-strong);
  color: var(--muted);
  background: var(--surface);
  transition: all 0.2s ease;
}
.stepper .step-label {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.stepper .connector {
  flex: 1;
  height: 1.5px;
  background: var(--border-strong);
  margin: 0 16px;
}
/* active */
.stepper .step.active .dot {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-top) 0%, var(--gold) 100%);
  color: #1c1917;
  box-shadow: 0 2px 0 0 var(--gold-edge), 0 4px 10px rgba(230,200,0,0.3);
}
.stepper .step.active .step-label { color: var(--heading); }
/* done */
.stepper .step.done .dot {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}
.stepper .step.done .step-label { color: var(--heading); }
.stepper .connector.done { background: var(--success); }

.form-head h1 { margin-bottom: 4px; }
.form-head p { color: var(--text); font-size: 0.92rem; margin-bottom: 26px; }

.field .input-prefix {
  position: relative;
  display: flex;
  align-items: center;
}
.field .input-prefix span {
  position: absolute;
  left: 14px;
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.85rem;
  color: var(--muted);
  pointer-events: none;
}
.field .input-prefix input { padding-left: 86px; }

/* readonly summary line for step 2 */
.summary-readonly {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 64px 14px 16px;   /* right room for the absolute Edit link */
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: start;
  margin-bottom: 22px;
}
/* names hug their content and stay together; contact group fills the rest
   and wraps to its own line when it can't sit beside the names */
.summary-readonly .sr-names { display: flex; gap: 28px; flex: 0 0 auto; }
/* flex-basis sets the wrap threshold (drops to its own line when it can't
   fit beside the names); min-width:0 lets the values ellipsis-shrink */
.summary-readonly .sr-contact { display: flex; gap: 28px; flex: 1 1 400px; min-width: 0; }
.summary-readonly .sr-item { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.summary-readonly .sr-contact .sr-item { flex: 1 1 0; }
.summary-readonly .sr-label {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.summary-readonly .sr-value { font-size: 0.9rem; color: var(--heading); font-weight: 500; min-width: 0; }
.summary-readonly .sr-edit { position: absolute; top: 14px; right: 16px; }
.summary-readonly .sr-edit a {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
/* email ellipsis-truncates when long; names flow at natural width */
.summary-readonly .sr-contact .sr-value {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- RECURLY CARDELEMENT HOST ----
   Host div for the Recurly v4 CardElement iframe. The card lives in a
   cross-origin iframe; checkout.html sets its text font + color via the JS
   style config, and the `#card iframe` rule below keeps the iframe transparent
   so this host's themed background shows through in both light and dark mode.
   The host provides the brand box and vertically centers the field to match
   the sibling text inputs. */
#card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 0 14px;
  min-height: 45px;
  display: flex;
  align-items: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.3s ease;
}
/* Recurly's field iframe declares no color-scheme, so in OS dark mode the
   browser paints an opaque light canvas behind it (the iframe content is
   light) that hides our dark host. Declaring the iframe `light` matches its
   content, so the browser drops that canvas and the host background shows
   through. (color-scheme: dark / light dark would resolve to dark in dark
   mode, re-introduce the mismatch, and the white canvas would return.) */
#card iframe {
  color-scheme: light;
}
/* Recurly injects .recurly-element with its own border / radius / top margin
   (recurly.css). Strip them so the #card host is the single visual field. */
#card .recurly-element {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
  width: 100%;
}
#card.recurly-element-focus,
#card:focus-within {
  outline: none;
  border-color: var(--gold);
  box-shadow: var(--focus-ring);
  background: var(--surface);
}
#card.recurly-element-invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.18);
}

/* billing row: wide street address + small zip */
.billing-row { display: grid; grid-template-columns: 1fr 130px; gap: 14px; align-items: start; }

.trial-line {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
  margin-top: 14px;
}
.trial-line strong { color: var(--gold-text); font-weight: 500; }

.pay-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0 16px;
}
.pay-divider::before, .pay-divider::after {
  content: ""; flex: 1; height: 1px; background: var(--border);
}
.pay-divider span {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 0.64rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.alt-pay { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
#paypal-button img { height: 18px; width: auto; display: block; }
/* Apple Pay block (shown via JS when available) — center its button + "-OR-" */
#apple-pay { text-align: center; }
#apple-pay .apple-pay-button { margin: 0 auto; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 860px) {
  .checkout { grid-template-columns: 1fr; }
  .panel-left {
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 22px 24px;
  }
  .panel-left-inner { gap: 16px; }
  .panel-right { padding: 32px 28px 36px; }
  /* Stacked layout: the sidebar becomes a top banner. Drop the perks list and
     logo wall so the form stays near the top; keep the plan card and the thin
     SSL / PCI / cancel-anytime badge strip for reassurance. The banner is
     prime above-the-fold space, so the card and panel paddings tighten too. */
  .plan-perks,
  .logos-block { display: none; }
  .plan-detail { padding: 16px 18px; }
  .plan-detail .pd-name { font-size: 1.05rem; }
  .plan-detail .pd-trial-pill {
    font-size: 0.56rem;
    padding: 2px 8px;
  }
}
@media (max-width: 680px) {
  .field-grid { grid-template-columns: 1fr; }
  /* phones: go full-bleed — the floating-card chrome costs ~50px of width */
  body { padding-left: 0; padding-right: 0; }
  .checkout {
    border-radius: 0;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }
}
@media (max-width: 480px) {
  .panel-right { padding: 26px 20px 30px; }
  .stepper .step-label { display: none; }
  .stepper .connector { margin: 0 10px; }
  .summary-readonly .sr-contact { min-width: 100%; }
}

/* ============================================================
   DARK THEME — checkout-only overrides. The shared dark tokens and the
   dark wordmark / link / alert swaps now live in brand.css's dark block;
   only checkout-specific dark rules remain here. Kept last on purpose:
   @media adds no specificity, so each override only beats its light
   counterpart by source order.
   ============================================================ */
@media (prefers-color-scheme: dark) {
  /* PayPal wordmark is two-tone blue; show PayPal's reverse (white) mark on the dark stone button */
  #paypal-button img { filter: brightness(0) invert(1); }
  .checkout { box-shadow: 0 16px 48px rgba(0,0,0,0.5); }
  .plan-detail { box-shadow: 0 4px 16px rgba(254, 226, 101, 0.1), 0 16px 48px rgba(0,0,0,0.35); }

  /* The trust logos are dark artwork built for light backgrounds, so on the
     dark panel they fall to near-zero contrast. invert() flips them light to
     stay legible. The filter is on the <img> only, so the tile surface keeps
     the dark tokens (--surface-2 / --border) coming from brand.css's dark block. */
  .logo-card img {
    filter: grayscale(100%) invert(1);
    opacity: 0.62;
  }
  /* Hover reveals the logo in true brand color. The logos are light-background
     artwork, so the hovered tile flips to a light stone chip — full color reads
     there, where it would be dark-on-dark on the panel surface. #d6d3d1 is the
     light theme's --border-strong, hardcoded because the stone tokens remap to
     dark inside this media block. Border matches the chip so the resting tile's
     dark border doesn't gash the light surface. */
  .logo-card:hover {
    background: #d6d3d1;
    border-color: #d6d3d1;
    box-shadow: 0 4px 16px rgba(28, 25, 23, 0.35);
  }
  .logo-card:hover img {
    filter: none;
    opacity: 1;
  }
}
