/* R291 — BUYING AN ACCESS CODE.
 *
 * WHY THIS IS A FILE AND NOT A <style> BLOCK, AND WHY IT IS NOT site.css.
 *
 * The site's server-level Content-Security-Policy is
 *
 *   default-src 'none'; style-src 'self'; script-src 'self'; connect-src 'self';
 *   img-src 'self'; font-src 'self'; frame-ancestors 'none'; base-uri 'self';
 *   form-action 'none'
 *
 * There is no 'unsafe-inline', so an inline <style> and a style="" attribute are
 * both BLOCKED and the page would render as unstyled text. Every rule these
 * three pages use therefore lives here and is served same-origin. `form-action
 * 'none'` is also why nothing here is an HTML form that posts: the pages talk to
 * the service with fetch(), same-origin, which connect-src 'self' allows.
 *
 * IT IS SEPARATE FROM site.css DELIBERATELY. These pages must be shippable on
 * their own, without rebuilding and redeploying every marketing page — the R291
 * deploy adds three files to the live release and changes nothing else. A
 * purchase surface that could only ship as part of a full site release would be
 * a purchase surface hostage to whatever else is unreleased that week.
 *
 * FONTS ARE THE SYSTEM STACK, for /pay/pay.css's reason: the site's Golos Text
 * lives at a CONTENT-HASHED path under /static/, and a hardcoded reference to a
 * hashed filename in a hand-written file breaks on the next release that touches
 * the font bundle.
 *
 * MOBILE FIRST, AND THAT IS NOT A SLOGAN HERE. Every rule below is written for a
 * 360-wide phone and widened by exactly three min-width queries. R289 measured
 * what the other order costs: a stylesheet written at 1180 and squeezed down is
 * a stylesheet whose phone layout nobody ever designed.
 */

:root {
  --bg: #F3F4F9;
  --panel: #FFFFFF;
  --panel-2: #F7F8FC;
  --ink: #14161F;
  --ink-2: #4A5066;
  --ink-3: #5F667F;
  --line: #DCDFEA;
  --line-2: #C9CDDE;
  --accent: #4A51E0;
  --accent-press: #383FC4;
  --accent-soft: rgba(74, 81, 224, 0.09);
  --on-accent: #FFFFFF;
  --ok: #1E9E63;
  --ok-soft: rgba(30, 158, 99, 0.1);
  --hold: #8A6A1F;
  --bad: #C7413F;
  --bad-soft: rgba(199, 65, 63, 0.09);
  --mark-graphite: #6A7190;
  --sans: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Liberation Mono', monospace;
  --r-panel: 22px;
  --r-card: 16px;
  --r-btn: 14px;
  /* R289's floor: a tap target is 48px and a gutter never falls below the
     notch inset. Both are referenced rather than repeated. */
  --tap: 48px;
  --gut: max(20px, env(safe-area-inset-left));
}

/* R-WEB-IOS-ONBOARDING-REDESIGN-1 — the site's palette and the site's theme
   switch: the dark accent is the site's #8F94FF with dark text on it (7:1),
   and a choice made with the site's toggle (theme.js → data-theme) holds here
   too instead of the page flipping back to the system setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0B11;
    --panel: #14161F;
    --panel-2: #191C27;
    --ink: #F2F3F8;
    --ink-2: #A8AEC4;
    --ink-3: #878DA6;
    --line: #252938;
    --line-2: #333850;
    --accent: #8F94FF;
    --accent-press: #7A80F0;
    --accent-soft: rgba(143, 148, 255, 0.14);
    --on-accent: #0A0B11;
    --ok: #3FBF85;
    --ok-soft: rgba(63, 191, 133, 0.14);
    --hold: #D8B65A;
    --bad: #E2585C;
    --bad-soft: rgba(226, 88, 92, 0.14);
    --mark-graphite: #B7BDD2;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0B11;
  --panel: #14161F;
  --panel-2: #191C27;
  --ink: #F2F3F8;
  --ink-2: #A8AEC4;
  --ink-3: #878DA6;
  --line: #252938;
  --line-2: #333850;
  --accent: #8F94FF;
  --accent-press: #7A80F0;
  --accent-soft: rgba(143, 148, 255, 0.14);
  --on-accent: #0A0B11;
  --ok: #3FBF85;
  --ok-soft: rgba(63, 191, 133, 0.14);
  --hold: #D8B65A;
  --bad: #E2585C;
  --bad-soft: rgba(226, 88, 92, 0.14);
  --mark-graphite: #B7BDD2;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  padding: 0 var(--gut) calc(40px + env(safe-area-inset-bottom));
}

.page { max-width: 640px; margin: 0 auto; }

/* ---------- header ---------- */
.brand {
  display: flex; align-items: center; gap: 9px;
  padding: 22px 0 8px; font-weight: 700; letter-spacing: 0.18em; font-size: 13px;
}
.brand a { color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 9px; }
.mk-a, .mk-b { stroke: var(--accent); fill: none; }
.mk-b { stroke: var(--mark-graphite); }
.mk-c { fill: var(--accent); }

h1 {
  font-size: 27px; line-height: 1.2; letter-spacing: -0.02em;
  margin: 14px 0 8px; font-weight: 680;
}
.lead { color: var(--ink-2); margin: 0 0 22px; font-size: 15.5px; }
.eyebrow {
  color: var(--ink-3); font-size: 12px; letter-spacing: 0.1em;
  text-transform: uppercase; margin: 0 0 4px; font-weight: 600;
}

/* ---------- plan cards ----------
   ONE COLUMN ON A PHONE, and the whole card is the control. A radio dot beside
   a price is a 12px target next to a 200px one; making the card the label means
   the thing a thumb aims at is the thing it can see. */
.plans { display: grid; gap: 10px; margin: 0 0 20px; }

.plan {
  position: relative;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 14px;
  background: var(--panel); border: 1.5px solid var(--line);
  border-radius: var(--r-card); padding: 16px 17px;
  cursor: pointer; min-height: var(--tap);
  transition: border-color 0.14s ease, background 0.14s ease;
}
.plan:hover { border-color: var(--line-2); }
.plan input { position: absolute; opacity: 0; pointer-events: none; }
.plan.on { border-color: var(--accent); background: var(--accent-soft); }
.plan:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

.plan-term { grid-column: 1; font-size: 17px; font-weight: 620; margin: 0; }
.plan-price {
  grid-column: 2; grid-row: 1 / span 2; justify-self: end;
  font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.plan-per { grid-column: 1; font-size: 13.5px; color: var(--ink-3); margin: 0; }
.plan-save {
  grid-column: 1; justify-self: start; margin: 6px 0 0;
  font-size: 12.5px; font-weight: 600; color: var(--ok);
  background: var(--ok-soft); border-radius: 99px; padding: 3px 10px;
}

/* ---------- the button ---------- */
.cta {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  width: 100%; min-height: 54px; border: 0; border-radius: var(--r-btn);
  background: var(--accent); color: var(--on-accent); font: 620 17px/1.2 var(--sans);
  cursor: pointer; padding: 15px 20px; text-decoration: none;
}
.cta:hover { background: var(--accent-press); color: var(--on-accent); }
.cta:active { transform: translateY(1px); }
.cta:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.cta[disabled] { opacity: 0.5; cursor: default; transform: none; }
.cta.second {
  background: var(--panel); color: var(--ink); border: 1.5px solid var(--line);
  font-weight: 560; min-height: var(--tap);
}
.cta.second:hover { background: var(--panel-2); border-color: var(--line-2); }

.fine { color: var(--ink-3); font-size: 13px; margin: 14px 0 0; }
.fine a { color: var(--ink-2); }

/* ---------- panels ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-panel); padding: 22px 18px; margin: 0 0 14px;
}
.panel h2 { font-size: 17px; font-weight: 640; margin: 0 0 8px; letter-spacing: -0.01em; }
.panel p { margin: 0 0 10px; color: var(--ink-2); font-size: 15px; }
.panel p:last-child { margin-bottom: 0; }

.note {
  border-left: 3px solid var(--line-2); padding: 2px 0 2px 13px;
  color: var(--ink-2); font-size: 14.5px; margin: 14px 0 0;
}
.note.bad { border-left-color: var(--bad); color: var(--ink); }

/* ---------- the state marks ---------- */
.mark { width: 44px; height: 44px; display: block; margin: 0 0 12px; }
.mark--ok { color: var(--ok); }
.mark--bad { color: var(--bad); }

/* The waiting mark: a ring that turns. It is deliberately slow and small —
   somebody has just paid, and a fast spinner reads as a system under strain. */
.spin {
  width: 34px; height: 34px; margin: 0 0 14px;
  border: 3px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: turn 1.05s linear infinite;
}
@keyframes turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spin { animation-duration: 3s; }
}

/* ---------- the code ----------
   THE ONE THING ON THE PAGE THAT MATTERS. It is big, monospaced, tracked out so
   the groups read as groups, and selectable in one gesture. */
.codewrap {
  background: var(--panel-2); border: 1.5px dashed var(--line-2);
  border-radius: var(--r-card); padding: 20px 14px; text-align: center;
  margin: 0 0 12px;
}
.code {
  font: 700 clamp(23px, 7.6vw, 32px)/1.25 var(--mono);
  letter-spacing: 0.055em; color: var(--ink); user-select: all;
  word-break: break-word; margin: 0;
}
.copied {
  display: block; color: var(--ok); font-size: 13.5px; font-weight: 600;
  margin: 10px 0 0; min-height: 19px;
}

.steps { margin: 16px 0 0; padding: 0; list-style: none; counter-reset: s; }
.steps li {
  position: relative; padding: 0 0 0 32px; margin: 0 0 11px;
  color: var(--ink-2); font-size: 15px; counter-increment: s;
}
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: 1px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font: 700 12px/22px var(--sans); text-align: center;
}

.linkbox {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--r-card); padding: 12px 13px; margin: 10px 0 0;
}
.linkbox .u {
  flex: 1 1 200px; min-width: 0; font: 13px/1.4 var(--mono);
  color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.rows { margin: 14px 0 0; border-top: 1px solid var(--line); }
.row {
  display: flex; justify-content: space-between; gap: 14px;
  padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 15px;
}
.row .k { color: var(--ink-3); }
.row .v { font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.row .vcode { font-family: var(--mono); letter-spacing: 0.03em; user-select: all; }

.foot { color: var(--ink-3); font-size: 13px; margin: 26px 0 0; text-align: center; }
.foot a { color: var(--ink-2); }

/* ---------- R320: the steps, the device question, the sign-in state ---------- */
.stepblock { margin: 0 0 22px; }
.stepblock h2 { font-size: 18px; font-weight: 640; margin: 0 0 8px; letter-spacing: -0.01em; }
.step {
  color: var(--accent); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 700; margin: 0 0 4px;
}
.panel-p { color: var(--ink-2); font-size: 15px; margin: 0 0 6px; }
.hint { color: var(--ink-2); font-size: 14.5px; margin: 10px 0 0; }

/* The device question: three equal cells, the whole cell is the control, and
   the chosen one reads like the chosen plan card above it. */
.seg {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  background: var(--panel); border: 1.5px solid var(--line); border-radius: var(--r-card);
  padding: 6px;
}
.seg button {
  min-height: var(--tap); border: 1.5px solid transparent; border-radius: 11px;
  background: transparent; color: var(--ink); font: 600 15.5px/1.2 var(--sans);
  cursor: pointer; padding: 10px 6px;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.seg button:hover { background: var(--panel-2); }
.seg button[aria-checked="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* "Signed in as …": a quiet confirmation, never a card. */
.signed {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--ink); font-size: 15px; margin: 14px 0 0;
}
.signed .tick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ok-soft); color: var(--ok); font-weight: 700; font-size: 13px;
}
.signed a { color: var(--ink-2); }

/* The "paid" line above the receipt's own heading: the mark and the words on
   one line, so the heading below is free to say what to do next. */
.okline {
  display: flex; align-items: center; gap: 10px; margin: 14px 0 0;
  color: var(--ok); font-weight: 640; font-size: 15px;
}
.okline .mark { width: 28px; height: 28px; margin: 0; }
.h-gap { margin-top: 18px !important; }
.panel .cta { margin-top: 14px; }
.panel .cta.second { margin-top: 10px; }
.panel .codewrap { margin-top: 10px; }
.panel .steps + .codewrap { margin-top: 0; }
#appleDone .steps { margin-top: 10px; }

/* Anything the page has not decided about yet stays out of the layout, so a
   slow network never shows a half-built screen. */
[hidden] { display: none !important; }

/* ---------- wider screens ---------- */
@media (min-width: 560px) {
  body { padding: 0 28px 56px; }
  h1 { font-size: 32px; }
  .panel { padding: 26px 24px; border-radius: 26px; }
  .plan { padding: 18px 20px; }
  .plan-price { font-size: 29px; }
}
@media (min-width: 860px) {
  .page { max-width: 720px; }
  h1 { font-size: 36px; margin-top: 26px; }
  .plans { gap: 12px; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   R-WEB-IOS-ONBOARDING-REDESIGN-1 — the purchase pages as part of the site
   ═══════════════════════════════════════════════════════════════════════════ */
body { padding-top: 0; }
.top {
  max-width: 640px; margin: 0 auto; display: flex; align-items: center;
  justify-content: space-between; gap: 12px; padding-top: env(safe-area-inset-top);
}
.top .brand { padding: 18px 0 8px; }
.top-link {
  color: var(--ink-2); text-decoration: none; font-size: 15px; font-weight: 500;
  min-height: var(--tap); display: inline-flex; align-items: center; padding: 0 4px;
}
.top-link:hover { color: var(--accent); }
a { color: var(--accent); }
.lead { font-size: 16.5px; }

/* The official store badges (unmodified files; see src/BADGES-SOURCE.md).
   Same geometry as site.css: --bh is the VISIBLE badge height, and the Google
   PNG's own transparent margin is offset, never cropped out of the file. */
.stores { --bh: 44px; display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 2px; }
.store { position: relative; display: block; flex: none; height: var(--bh); border-radius: 8px; }
.store:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.store img { display: block; max-width: none; }
.store-as { width: calc(var(--bh) * 2.99160); }
.store-as img { width: 100%; height: 100%; }
.store-gp img { position: absolute; left: 0; width: auto; }
.gp-ru { width: calc(var(--bh) * 646 / 192); }
.gp-ru img { height: calc(var(--bh) * 250 / 192); top: calc(var(--bh) * -29 / 192); }
.steps li .stores { margin-bottom: 4px; }
.panel > .stores { margin-top: 4px; }

/* The pay button stays in reach of the thumb on a phone: it rides the bottom
   of the screen while the plans scroll, and settles in place after them. */
.paybar {
  position: sticky; bottom: 0; z-index: 2; margin: 0 calc(-1 * var(--gut));
  padding: 12px var(--gut) calc(12px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
}
.paybar + .fine { margin-top: 4px; margin-bottom: 26px; }

/* the short questions: disclosure rows, not paragraphs */
.faqlite details { border-top: 1px solid var(--line); }
.faqlite details:first-of-type { border-top: 0; }
.faqlite summary {
  cursor: pointer; list-style: none; min-height: var(--tap);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-weight: 600; font-size: 15.5px; color: var(--ink); padding: 6px 0;
}
.faqlite summary::-webkit-details-marker { display: none; }
.faqlite summary::after { content: '+'; color: var(--accent); font-size: 20px; font-weight: 400; }
.faqlite details[open] summary::after { content: '−'; }
.faqlite details p { margin: 0 0 12px; }

.linkbtn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--accent);
  text-decoration: underline; cursor: pointer; min-height: 32px;
}

/* The iPhone receipt: «Сохранить в Apple ID» is step 1 and the install /
   sign-in panel below is steps 2–3 — so the saved note does not repeat them. */
.is-iphone #appleDone .steps { display: none; }
.is-iphone #applePanel { border-color: var(--accent); }

@media (min-width: 560px) {
  .top { padding-left: 0; padding-right: 0; }
  .paybar { position: static; margin: 0; padding: 0; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .paybar + .fine { margin-top: 14px; }
}
@media (min-width: 860px) {
  .top { max-width: 720px; }
}

/* An Apple relay address (…@privaterelay.appleid.com) is one 34-character
   word; on a 320 px phone it pushed the page 2 px wide. Let it break. */
#appleDone, .acctEmail, #signedText, .note { overflow-wrap: anywhere; }

/* The one-line summary of what is being bought, right above the button. */
.summary {
  margin: 4px 0 10px; padding: 12px 14px; border-radius: 12px;
  background: var(--accent-soft); color: var(--ink); font-size: 15px; font-weight: 560;
}
/* «Ссылка на эту покупку» is a just-in-case, not a step: folded by default. */
details.fold > summary {
  cursor: pointer; list-style: none; min-height: var(--tap);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-weight: 600; font-size: 15.5px; color: var(--ink);
}
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: '+'; color: var(--accent); font-size: 20px; font-weight: 400; }
details.fold[open] > summary::after { content: '−'; }
details.fold[open] > summary { margin-bottom: 8px; }
/* The iPhone's last screen: the one panel that matters, marked as done. */
.panel-done { border-color: var(--ok); }
.is-iphone #applePanel { border-color: var(--accent); }
