/* ========== PAYMENT RESULT DIALOG ==========
   Shown when PayPal sends the customer back. Markup: web_framework/templates/common/payment_result.twig,
   behaviour: web/js/payment_result.js. Colours and radii come from branding.css. */

.pr-modal {
  position: fixed;
  inset: 0;
  z-index: 2100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.pr-modal[hidden] { display: none; }

.pr-overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 14, 0.84);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: pr-fade 0.35s ease both;
}

.pr-card {
  position: relative;
  width: 100%;
  max-width: 27rem;
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 3.25rem 2.5rem 2.5rem;
  text-align: center;
  background:
    radial-gradient(120% 65% at 50% 0%, rgba(232, 180, 76, 0.11), transparent 62%),
    var(--color-bg-surface);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), var(--shadow-glow);
  animation: pr-rise 0.55s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.pr-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 14%;
  right: 14%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-accent-primary), transparent);
  opacity: 0.75;
}

.pr-x {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--color-border-default);
  border-radius: 50%;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}
.pr-x:hover { border-color: var(--color-accent-primary); color: var(--color-text-primary); }

.pr-panel[hidden] { display: none; }
.pr-panel { animation: pr-fade 0.4s ease both; }

/* mark: a thin gold ring, one glyph per state */
.pr-mark {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
  margin: 0 auto 1.75rem;
  color: var(--color-accent-primary);
}
.pr-mark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pr-mark circle, .pr-mark path { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; }
.pr-track { stroke-width: 1.5; opacity: 0.2; }
.pr-arc { stroke-width: 2; }
.pr-spin { transform-origin: 36px 36px; animation: pr-turn 1.6s linear infinite; }
.pr-ring { stroke-width: 1.5; }
.pr-ring-static { opacity: 0.55; }
.pr-glyph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.7rem;
}
.pr-mark-muted { color: var(--color-text-muted); }
.pr-mark-alert { color: var(--color-danger); }

.pr-mark-done .pr-ring { stroke-dasharray: 214; stroke-dashoffset: 214; animation: pr-draw 0.8s 0.1s ease-out forwards; }
.pr-mark-done .pr-check { stroke-width: 2.5; stroke-dasharray: 52; stroke-dashoffset: 52; animation: pr-draw 0.5s 0.65s ease-out forwards; }

/* words */
.pr-title {
  margin: 0 0 0.7rem;
  font-family: 'Cormorant Garamond', var(--font-family-heading);
  font-weight: 600;
  font-size: clamp(2rem, 6vw, 2.5rem);
  line-height: 1.1;
  text-wrap: balance;
  color: var(--color-text-primary);
}
.pr-line {
  margin: 0 auto;
  max-width: 22rem;
  font-family: 'Cormorant Garamond', var(--font-family-heading);
  font-style: italic;
  font-size: 1.3rem;
  line-height: 1.4;
  color: var(--color-text-secondary);
}
.pr-slow { margin-top: 1rem; }

/* state variants: the copy for both lives in the markup, the attributes pick one */
.pr-panel[data-trial="1"] .pr-if-paid,
.pr-panel[data-trial="0"] .pr-if-trial { display: none; }
.pr-panel[data-reason="duplicate_trial"] .pr-if-other,
.pr-panel:not([data-reason="duplicate_trial"]) .pr-if-dup { display: none; }
.pr-panel[data-offer="1"] .pr-no-offer,
.pr-panel[data-offer="0"] .pr-has-offer,
.pr-panel[data-offer="0"] .pr-offer { display: none; }

/* what the paid retry costs: typography between two gold rules */
.pr-offer {
  margin: 1.75rem 0 0;
  padding: 1rem 0 0.9rem;
  border-top: 1px solid rgba(232, 180, 76, 0.3);
  border-bottom: 1px solid rgba(232, 180, 76, 0.3);
  text-align: left;
}
.pr-offer-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.pr-offer-plan {
  font-family: 'Cormorant Garamond', var(--font-family-heading);
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1.15;
  color: var(--color-text-primary);
}
.pr-offer-price { white-space: nowrap; color: var(--color-text-secondary); }
.pr-offer-price b {
  font-family: 'Cormorant Garamond', var(--font-family-heading);
  font-weight: 600;
  font-size: 2.2rem;
  line-height: 1;
  font-variant-numeric: lining-nums;
  color: var(--color-accent-primary);
}
.pr-offer-price i {
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.pr-offer-meta {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.45rem;
  min-height: 1em;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-secondary);
}
.pr-offer-meta span[hidden] { display: none; }
.pr-offer-meta span:last-child:not([hidden]) { margin-left: auto; }

/* actions */
.pr-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
  margin-top: 1.9rem;
}
.pr-primary { width: 100%; justify-content: center; }
.pr-primary[disabled] { opacity: 0.7; cursor: progress; transform: none; box-shadow: none; }
.pr-link {
  background: none;
  border: 0;
  padding: 0.3rem 0.5rem;
  font: 500 0.95rem/1.2 'Inter', var(--font-family-base);
  color: var(--color-accent-primary);
  text-decoration: underline;
  text-decoration-color: rgba(232, 180, 76, 0.4);
  text-underline-offset: 0.35em;
  cursor: pointer;
  transition: color 0.2s, text-decoration-color 0.2s;
}
.pr-link:hover { color: var(--color-accent-primary-hover); text-decoration-color: currentColor; }
.pr-error {
  margin: 1rem auto 0;
  max-width: 22rem;
  font-family: 'Cormorant Garamond', var(--font-family-heading);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.35;
  color: var(--color-danger);
}
.pr-error[hidden] { display: none; }
.pr-modal :focus-visible { outline: 2px solid var(--color-accent-primary); outline-offset: 3px; }

@keyframes pr-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pr-rise { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes pr-turn { to { transform: rotate(360deg); } }
@keyframes pr-draw { to { stroke-dashoffset: 0; } }

/* phones: the dialog becomes a sheet from the bottom edge */
@media (max-width: 520px) {
  .pr-modal { align-items: flex-end; padding: 0; }
  .pr-card {
    max-width: none;
    max-height: 92vh;
    max-height: 92dvh;
    padding: 2.75rem 1.5rem calc(1.75rem + env(safe-area-inset-bottom, 0px));
    border-width: 1px 0 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation-name: pr-sheet;
  }
  .pr-mark { width: 4rem; height: 4rem; margin-bottom: 1.4rem; }
  .pr-offer-plan { font-size: 1.3rem; }
  .pr-offer-price b { font-size: 1.9rem; }
}
@keyframes pr-sheet { from { transform: translateY(100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .pr-overlay, .pr-card, .pr-panel { animation: none; }
  .pr-spin { animation-duration: 6s; }
  .pr-mark-done .pr-ring, .pr-mark-done .pr-check { animation: none; stroke-dashoffset: 0; }
}
