/**
 * The payment pages' shared look (November 2026, first on the crypto checkout).
 *
 * The rules the owner approved, so the bank hand-off, the quick top-up page and
 * the result pages can follow them:
 *   - few containers, many rows: related facts sit in one panel split by
 *     hairlines (.pg-rows / .pg-row), never a bordered box per fact;
 *   - one hero figure per screen, the amount to act on, in the mono face;
 *   - a state is shown once (one status line, .pg-dot), and colour is kept for
 *     state: amber for what needs care, green for done, red for failure;
 *   - one alignment edge, the inline start;
 *   - cautions are plain lines with an icon (.pg-note), not callout boxes;
 *   - brand, help and language sit on the page (.pg-top), not in a card.
 *
 * Flat surfaces: no glass, glow or grid. Every side is a logical one, since the
 * pages are Farsi (rtl) or English (ltr); figures, addresses and ids are set
 * ltr in the markup. Fonts are self-hosted: Google Fonts and jsdelivr are not
 * reliably reachable from Iran.
 *
 * Path-versioned: the CDNs in front of us ignore the query string, so a changed
 * file takes a new name (the next is pay.v3.css).
 */

@font-face {
  font-family: "Shabnam";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/shabnam-400.woff2") format("woff2");
}

@font-face {
  font-family: "Shabnam";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/shabnam-500.woff2") format("woff2");
}

@font-face {
  font-family: "Shabnam";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/shabnam-700.woff2") format("woff2");
}

/* JetBrains Mono, Latin only (SIL OFL, jetbrains-mono-OFL.txt beside it): the
   figures, addresses and ids. Nothing Farsi ever falls to it. */
@font-face {
  font-family: "JetBrains Mono";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}

:root {
  --pg-bg: #14181d;
  --pg-panel: #1a1f26;
  --pg-well: #161a20;
  --pg-line: rgba(176, 196, 214, 0.12);
  --pg-line-strong: rgba(176, 196, 214, 0.22);
  --pg-text: #d3dde6;
  --pg-strong: #ffffff;
  --pg-steel: #c8d6e3;
  --pg-muted: #8d99a6;
  --pg-faint: #6f7b88;
  --pg-accent: #38bdf8;
  --pg-accent-dim: rgba(56, 189, 248, 0.1);
  /* The action blue of the panel and the Mini Apps (panel.css --accent on a
     dark theme, Telegram's button colour), so a button here is theirs. */
  --pg-button: #2ea6ff;
  --pg-button-text: #ffffff;
  --pg-ok: #34d399;
  --pg-ok-dim: rgba(52, 211, 153, 0.12);
  --pg-warn: #fbbf24;
  --pg-warn-dim: rgba(251, 191, 36, 0.08);
  --pg-warn-line: rgba(251, 191, 36, 0.25);
  --pg-err: #fb7185;
  --pg-err-dim: rgba(251, 113, 133, 0.1);
  --pg-err-line: rgba(251, 113, 133, 0.25);
  --pg-sans: "Shabnam", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --pg-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}

/* ------------------------------------------------------------------ */
/* Page                                                                */
/* ------------------------------------------------------------------ */
body.pg {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--pg-bg);
  color: var(--pg-text);
  font-family: var(--pg-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
}

.pg *,
.pg *::before,
.pg *::after {
  box-sizing: border-box;
}

/* Toggled with the hidden attribute; the display rules below would otherwise
   outrank the browser's display: none. */
.pg [hidden] {
  display: none !important;
}

.pg p,
.pg h1,
.pg h2,
.pg ol,
.pg ul {
  margin: 0;
}

.pg bdi {
  unicode-bidi: isolate;
}

.pg :focus-visible {
  outline: 2px solid var(--pg-accent);
  outline-offset: 2px;
}

.pg .mono {
  font-family: var(--pg-mono);
  font-variant-ligatures: none;
}

.pg svg {
  flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* Top bar: the mark, help, the other language                         */
/* ------------------------------------------------------------------ */
.pg-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 20px;
  padding-inline: 20px 8px;
}

.pg-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--pg-strong);
  text-decoration: none;
}

.pg-brand img {
  display: block;
  width: auto;
  height: 24px;
}

.pg-nav {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pg-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
  color: var(--pg-steel);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.pg-nav a:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--pg-strong);
}

.pg-nav svg {
  width: 18px;
  height: 18px;
}

/* The other language is named in its own script. */
.pg-nav .lang-switch {
  font-family: var(--pg-sans);
}

@media (min-width: 720px) {
  .pg-top {
    padding: 20px 40px;
  }

  .pg-brand img {
    height: 28px;
  }
}

/* ------------------------------------------------------------------ */
/* Surfaces                                                            */
/* ------------------------------------------------------------------ */
.pg-panel {
  background: var(--pg-panel);
  border: 1px solid var(--pg-line);
  border-radius: 20px;
  padding: 32px;
}

/* One panel of facts, split by hairlines. On the page it is the panel colour;
   inside a panel, a shade deeper. */
.pg-rows {
  background: var(--pg-panel);
  border: 1px solid var(--pg-line);
  border-radius: 14px;
  overflow: hidden;
}

.pg-panel .pg-rows {
  background: var(--pg-well);
}

.pg-row {
  padding: 14px 16px;
}

.pg-row + .pg-row {
  border-top: 1px solid var(--pg-line);
}

/* A label and the row's action (a copy button) on one line, so the value under
   them has the row's whole width. */
.pg-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.pg-label {
  font-size: 12px;
  line-height: 1.5;
  color: var(--pg-muted);
}

.pg-value {
  margin-top: 4px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--pg-strong);
  overflow-wrap: anywhere;
}

/* A value set ltr (an amount, an address, an id) still sits flush with its
   label: on the right in Farsi, while its own characters read left to right. */
.pg-value[dir="ltr"] {
  text-align: left;
}

html[dir="rtl"] .pg-value[dir="ltr"] {
  text-align: right;
}

/* A value led by a small icon (the gateway's lock). */
.pg-value--icon {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pg-value--icon svg {
  width: 14px;
  height: 14px;
  color: var(--pg-ok);
}

.pg-value--ok {
  color: var(--pg-ok);
}

/* A row that must not be missed (a memo): the one amber surface on a page. */
.pg-row--warn {
  background: var(--pg-warn-dim);
}

.pg-rows .pg-row--warn {
  border-top-color: var(--pg-warn-line);
}

.pg-row--warn .pg-label {
  font-weight: 700;
  color: var(--pg-warn);
}

@media (min-width: 720px) {
  .pg-label {
    font-size: 13px;
  }

  .pg-value {
    font-size: 15px;
  }

  .pg-row {
    padding: 14px 18px;
  }
}

/* ------------------------------------------------------------------ */
/* Text                                                                */
/* ------------------------------------------------------------------ */
.pg-title {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--pg-strong);
}

.pg-subtitle {
  font-size: 13px;
  font-weight: 500;
  color: var(--pg-muted);
}

/* A caution or a fact worth a line: muted, with an icon, never a box. */
.pg-note {
  display: flex;
  gap: 10px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--pg-muted);
}

.pg-note > svg {
  width: 16px;
  height: 16px;
  margin-top: 4px;
}

.pg-note b {
  font-weight: 700;
  color: var(--pg-text);
}

.pg-notes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* The one caution that must be read (the VPN before a bank gateway). */
.pg-note--warn {
  color: var(--pg-text);
}

.pg-note--warn > svg,
.pg-note--warn b {
  color: var(--pg-warn);
}

/* A message the page must say in a box: a refusal, a way back. */
.pg-notice {
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--pg-line);
  background: var(--pg-panel);
  font-size: 13px;
  line-height: 1.7;
  color: var(--pg-steel);
}

.pg-notice--error {
  border-color: var(--pg-err-line);
  background: var(--pg-err-dim);
  color: var(--pg-err);
}

.pg-notice--warn {
  border-color: var(--pg-warn-line);
  background: var(--pg-warn-dim);
  color: var(--pg-text);
}

.pg-link {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: var(--pg-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.pg-link:hover {
  color: var(--pg-accent);
}

.pg-notice .pg-link {
  font-weight: 600;
  color: var(--pg-accent);
}

/* ------------------------------------------------------------------ */
/* A page of one column: the hand-off, the top-up form, the results    */
/* ------------------------------------------------------------------ */
.pg-page {
  flex-grow: 1;
  width: 100%;
  max-width: 30rem;
  margin: 0 auto;
  padding: 8px 20px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* The last block (the actions) sits at the foot of a phone's screen. */
.pg-page > .pg-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pg-hero {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pg-hero-label,
.pg-hero-sub {
  font-size: 13px;
  color: var(--pg-muted);
}

.pg-hero-sub bdi {
  color: var(--pg-steel);
}

.pg-hero-figure {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--pg-strong);
}

.pg-hero-unit {
  font-family: var(--pg-sans);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--pg-steel);
}

/* A result: the mark, what happened, the figure if there is one, a line. */
.pg-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding-top: 24px;
  text-align: center;
}

.pg-result .pg-mark {
  margin-bottom: 6px;
}

.pg-result-text {
  max-width: 22rem;
  font-size: 14px;
  line-height: 1.75;
  color: var(--pg-steel);
}

.pg-result-figure {
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--pg-ok);
}

/* ------------------------------------------------------------------ */
/* Choices: a checkbox and a radio in the page's colours               */
/* ------------------------------------------------------------------ */
/* The browser's own boxes are white squares on this dark page
   (accent-color only reaches the ticked state), so both are drawn here. */
.pg-check,
.pg-radio {
  -webkit-appearance: none;
  appearance: none;
  display: grid;
  place-content: center;
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin: 0;
  border: 1.5px solid rgba(176, 196, 214, 0.35);
  background: var(--pg-panel);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, border-width 0.12s ease;
}

.pg-check {
  border-radius: 6px;
}

.pg-check::before {
  content: "";
  width: 11px;
  height: 11px;
  background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: transform 0.12s ease;
}

.pg-check:checked {
  background: var(--pg-button);
  border-color: var(--pg-button);
}

.pg-check:checked::before {
  transform: scale(1);
}

.pg-radio {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--pg-bg);
}

.pg-radio:checked {
  border: 5px solid var(--pg-accent);
}

.pg-check:hover,
.pg-radio:hover {
  border-color: var(--pg-accent);
}

/* ------------------------------------------------------------------ */
/* Status                                                              */
/* ------------------------------------------------------------------ */
.pg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--dot, var(--pg-accent));
  --dot-glow: rgba(56, 189, 248, 0.45);
}

.pg-dot--warn {
  --dot: var(--pg-warn);
  --dot-glow: rgba(251, 191, 36, 0.4);
}

.pg-dot--ok {
  --dot: var(--pg-ok);
}

.pg-dot--err {
  --dot: var(--pg-err);
}

/* Something is still happening: the dot breathes. The only looping motion. */
.pg-dot--live {
  animation: pg-pulse 1.8s ease-out infinite;
}

@keyframes pg-pulse {
  0% {
    box-shadow: 0 0 0 0 var(--dot-glow);
  }
  70%,
  100% {
    box-shadow: 0 0 0 6px rgba(0, 0, 0, 0);
  }
}

/* A done or failed screen's mark. */
.pg-mark {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--pg-ok-dim);
  color: var(--pg-ok);
}

.pg-mark svg {
  width: 26px;
  height: 26px;
}

.pg-mark--err {
  background: var(--pg-err-dim);
  color: var(--pg-err);
}

.pg-mark--warn {
  background: rgba(251, 191, 36, 0.12);
  color: var(--pg-warn);
}

.pg-mark--info {
  background: rgba(56, 189, 248, 0.12);
  color: var(--pg-accent);
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
/* The one primary action, in the panel's and the Mini Apps' blue (flat, as
   their .btn is), so the payment pages do not have a button of their own.
   Disabled, it goes neutral, never a faded blue. */
.pg-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  padding: 0 20px;
  border: 1px solid var(--pg-button);
  border-radius: 12px;
  background: var(--pg-button);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--pg-button-text);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.06s ease;
}

.pg-btn:hover {
  filter: brightness(1.06);
}

.pg-btn:active {
  transform: scale(0.98);
}

.pg-btn[disabled] {
  background: #222932;
  border-color: var(--pg-line);
  box-shadow: none;
  color: var(--pg-faint);
  filter: none;
  transform: none;
  cursor: not-allowed;
}

.pg-btn.is-loading {
  color: rgba(255, 255, 255, 0.75);
  cursor: progress;
}

.pg-btn--quiet {
  background: transparent;
  border-color: var(--pg-line-strong);
  box-shadow: none;
  color: var(--pg-steel);
}

.pg-btn--quiet:hover {
  filter: none;
  background: rgba(255, 255, 255, 0.04);
}

/* A small action inside a line (refresh the quote). */
.pg-btn--mini {
  display: inline-flex;
  width: auto;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 12px;
}

/* An icon alone: copy. It turns into a check for a moment when it worked. */
.pg-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin: -8px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--pg-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.pg-icon-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--pg-text);
}

.pg-icon-btn svg {
  width: 18px;
  height: 18px;
}

.pg-icon-btn .ic-done,
.pg-icon-btn.is-copied .ic-copy {
  display: none;
}

.pg-icon-btn.is-copied .ic-done {
  display: block;
  color: var(--pg-ok);
  animation: pg-pop 0.22s ease-out;
}

.pg-icon-btn.is-failed {
  color: var(--pg-warn);
}

@keyframes pg-pop {
  from {
    opacity: 0;
    transform: scale(0.7);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.pg-row--warn .pg-icon-btn {
  color: var(--pg-warn);
}

.pg-spinner {
  display: none;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: pg-spin 0.8s linear infinite;
}

.pg-btn--mini .pg-spinner {
  width: 12px;
  height: 12px;
}

.is-loading .pg-spinner {
  display: inline-block;
}

@keyframes pg-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pg-dot--live,
  .pg-icon-btn.is-copied .ic-done,
  .pg-spinner {
    animation: none;
  }

  .pg-btn,
  .pg-icon-btn,
  .pg-nav a,
  .pg-check,
  .pg-check::before,
  .pg-radio {
    transition: none;
  }
}
