/* ═══════════════════════════════════════════════════════════════════════
   THE REDESIGN'S LAYER OVER /upgrade: THE PLANS
   <html data-rd="upgrade">

   Linked after public/css/redesign.css, whose roles (--rd-*), keyframes and
   reduced-motion opt-out it uses, and only on this page
   (lib/page-redesign.js).

   The page KEEPS its own stylesheet (in production, the build's minified
   copy of it), its markup, its prices and its script. This layer is linked
   after it and restyles what it draws, so a rule here has to outrank the
   page's own rule for the same element: every selector starts at the
   document's data-rd attribute, and where the page's rule names several
   classes (which plan is current, which was picked), the rule here names
   them too.

   The page's script shows and hides its buttons, its banners and its
   checkout with style attributes and state classes: no rule here sets
   display on any of them. A value a style attribute sets is out of a
   stylesheet's reach except by !important, which is used for that and
   nothing else.
   ═══════════════════════════════════════════════════════════════════════ */

/* The page reads from the left, under its own name. That name is written
   for screen readers in the page as it is; here it heads the page. */
html[data-rd="upgrade"] .wrap { display: flex; flex-direction: column; padding: 28px var(--page-gutter) 72px; }
html[data-rd="upgrade"] .back { order: -1; align-self: flex-start; margin: 0 0 28px; font: 600 13px/1.3 var(--rd-sans); color: var(--rd-ink-2); }
html[data-rd="upgrade"] .back:hover { color: var(--rd-ink); }
html[data-rd="upgrade"] h1.sr-only {
  position: static !important; width: auto; height: auto; margin: 0 0 12px; padding: 0; overflow: visible; clip: auto; white-space: normal;
  font: var(--display-weight, 700) clamp(30px, 3.6vw, 48px)/1.06 var(--rd-display); letter-spacing: -.03em; text-wrap: balance;
  animation: rd-rise .6s var(--rd-ease) backwards;
}
html[data-rd="upgrade"] .sub {
  text-align: left; margin: 0 0 30px; max-width: 62ch; font-size: 17px; line-height: 1.55; color: var(--rd-ink-2);
  animation: rd-rise .6s var(--rd-ease) 60ms backwards;
}

/* What the page has to say before the plans: a note set off by a rule down
   its side, green for done, red for refused, the accent for what is next. */
html[data-rd="upgrade"] .banner {
  text-align: left; margin-bottom: 18px; padding: 13px 16px; border-radius: var(--rd-r-xs); font-size: 14px; line-height: 1.5;
}
html[data-rd="upgrade"] .banner.ok,
html[data-rd="upgrade"] .banner.err { color: var(--rd-ink); background: var(--rd-surface); border: 1px solid var(--rd-ring); }
html[data-rd="upgrade"] .banner.ok { border-left: 3px solid var(--good); }
html[data-rd="upgrade"] .banner.err { border-left: 3px solid var(--bad); }
/* Three of them carry their colours in style attributes. */
html[data-rd="upgrade"] #banner-onboarding,
html[data-rd="upgrade"] #banner-canceled,
html[data-rd="upgrade"] #banner-trial-offer {
  color: var(--rd-ink) !important; background: var(--rd-surface) !important;
  border: 1px solid var(--rd-ring) !important; border-left: 3px solid var(--accent) !important;
}
html[data-rd="upgrade"] #banner-trial-offer > div > div:first-child { color: var(--rd-ink) !important; }
html[data-rd="upgrade"] #btn-claim-day-pass {
  background: var(--rd-ink) !important; color: var(--rd-plane) !important; border: 1px solid var(--rd-ink); border-radius: var(--rd-pill);
}

/* ── the plans: one ruled block, a hairline between each ───────────── */
html[data-rd="upgrade"] .plans {
  gap: 1px; background: var(--rd-ring); border: 1px solid var(--rd-ring); border-radius: var(--rd-r); overflow: hidden;
}
/* Two plans (the third not offered to this reader) start at the page's left edge, like the rest. */
html[data-rd="upgrade"] .plans:not(:has(.plan.elite)) { margin: 0; }
/* A rule across a plan's top says which one the page is pointing at: ink
   for the one it recommends, the accent for the one you are on. */
html[data-rd="upgrade"] .plan {
  --rd-rule: transparent; --rd-name: var(--rd-muted);
  background: var(--rd-surface); border: 0; border-radius: 0; padding: 30px 26px 26px;
  box-shadow: inset 0 3px 0 var(--rd-rule);
  animation: rd-rise .6s var(--rd-ease) 120ms backwards;
}
html[data-rd="upgrade"] .plan:nth-child(2) { animation-delay: 180ms; }
html[data-rd="upgrade"] .plan:nth-child(3) { animation-delay: 240ms; }
html[data-rd="upgrade"] .plan.pro { --rd-rule: var(--rd-ink); --rd-name: var(--rd-ink); }
html[data-rd="upgrade"] .plan.is-current { --rd-rule: var(--accent); --rd-name: var(--accent); }
/* The page stops pointing at Pro once a reader is on another plan, or came for Elite. */
html[data-rd="upgrade"] .plans.has-current .plan.pro:not(.is-current),
html[data-rd="upgrade"] .plans.picked-elite .plan.pro {
  --rd-rule: transparent; --rd-name: var(--rd-muted); box-shadow: inset 0 3px 0 var(--rd-rule);
}
html[data-rd="upgrade"] .plans.picked-elite .plan.elite {
  --rd-rule: var(--rd-ink); --rd-name: var(--rd-ink); box-shadow: inset 0 3px 0 var(--rd-rule);
}
html[data-rd="upgrade"] .plan .plan-name,
html[data-rd="upgrade"] .plans.has-current .plan.pro:not(.is-current) .plan-name,
html[data-rd="upgrade"] .plans.picked-elite .plan.pro .plan-name,
html[data-rd="upgrade"] .plans.picked-elite .plan.elite .plan-name {
  font: 700 12px/1 var(--rd-mono); letter-spacing: .14em; color: var(--rd-name);
}
/* "Recommended" sits in the plan's corner, in ink. */
html[data-rd="upgrade"] .plan-badge {
  top: 24px; right: 22px; background: var(--rd-ink); color: var(--rd-plane); border-radius: var(--rd-pill);
  font: 700 10px/1 var(--rd-mono); letter-spacing: .1em; padding: 6px 10px; box-shadow: none;
}
/* The price is the page's largest figure. */
html[data-rd="upgrade"] .plan-price {
  margin-top: 20px; font: var(--display-weight, 700) clamp(40px, 4.2vw, 56px)/1 var(--rd-display);
  letter-spacing: -.035em; font-variant-numeric: tabular-nums; color: var(--rd-ink);
}
html[data-rd="upgrade"] .plan-price span { font: 500 14px/1 var(--rd-sans); letter-spacing: 0; color: var(--rd-muted); }
html[data-rd="upgrade"] .plan-desc { margin-top: 12px; font-size: 13px; line-height: 1.5; color: var(--rd-ink-2); }
/* What a plan holds: a list under a hairline, a plain tick beside each line. */
html[data-rd="upgrade"] .plan ul { margin: 22px 0 26px; padding-top: 16px; border-top: 1px solid var(--rd-ring); }
html[data-rd="upgrade"] .plan li { padding: 5px 0 5px 24px; font-size: 14px; line-height: 1.5; color: var(--rd-ink-2); }
html[data-rd="upgrade"] .plan li::before {
  top: 5px; width: 16px; height: auto; border-radius: 0; justify-content: flex-start;
  font-size: 12px; line-height: 1.75; color: var(--rd-ink); background: none;
}
html[data-rd="upgrade"] .plan li.na { color: var(--rd-muted); }
html[data-rd="upgrade"] .plan li.na::before { color: var(--rd-muted); background: none; }
html[data-rd="upgrade"] .plan li.all { color: var(--rd-ink); font-weight: 600; }
html[data-rd="upgrade"] .plan li.all::before { color: var(--accent); background: none; }
html[data-rd="upgrade"] .plan li.price-group {
  margin: 18px 0 6px; padding-left: 0; font: 700 10.5px/1.3 var(--rd-mono); letter-spacing: .12em; color: var(--rd-muted);
}
html[data-rd="upgrade"] .plan li.price-group:first-child { margin-top: 0; }

/* Buttons: ink for the one that buys, a ring for the rest. */
html[data-rd="upgrade"] .btn {
  padding: 12px 18px; border-radius: var(--rd-pill); font: 600 14.5px/1.2 var(--rd-sans);
  transition: background .2s, color .2s, border-color .2s, opacity .2s, transform .18s var(--rd-ease);
}
html[data-rd="upgrade"] .btn-primary { background: var(--rd-ink); color: var(--rd-plane); border: 1px solid var(--rd-ink); }
html[data-rd="upgrade"] .btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--rd-ink) 84%, var(--rd-plane)); }
html[data-rd="upgrade"] .btn-ghost { background: transparent; color: var(--rd-ink); border: 1px solid var(--rd-base); }
html[data-rd="upgrade"] .btn-ghost:hover:not(:disabled) { background: var(--rd-surface-2); border-color: var(--rd-ink-2); }
html[data-rd="upgrade"] .btn:active:not(:disabled) { transform: scale(.98); }
html[data-rd="upgrade"] .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* "Current plan" is where you are, not something to press. */
html[data-rd="upgrade"] #pro-current-btn:disabled,
html[data-rd="upgrade"] #elite-current-btn:disabled {
  opacity: 1; cursor: default; box-shadow: none; background: transparent; color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--rd-ring));
}

/* The small print under the plans. */
html[data-rd="upgrade"] .agree,
html[data-rd="upgrade"] .fine { text-align: left; max-width: 76ch; font-size: 12.5px; line-height: 1.6; color: var(--rd-muted); }
html[data-rd="upgrade"] .agree { margin-top: 22px; color: var(--rd-ink-2); }
html[data-rd="upgrade"] .agree a,
html[data-rd="upgrade"] .fine a { color: var(--rd-ink-2); text-decoration: underline; text-decoration-color: var(--rd-base); text-underline-offset: 3px; }
html[data-rd="upgrade"] .agree a:hover,
html[data-rd="upgrade"] .fine a:hover { color: var(--rd-ink); text-decoration-color: var(--rd-ink-2); }

/* Below a desk's width the plans stack: three side by side, or two beside
   an empty third, would be squeezed. */
@media (max-width: 860px) {
  html[data-rd="upgrade"] .plans,
  html[data-rd="upgrade"] .plans:not(:has(.plan.elite)) { grid-template-columns: minmax(0, 1fr); max-width: none; }
  html[data-rd="upgrade"] .plan { padding: 26px 20px 22px; }
  html[data-rd="upgrade"] .plan-badge { right: 18px; }
}
