/* ---------------------------------------------------------------------
   Tokens
--------------------------------------------------------------------- */
:root {
  --bg:          #E9ECE6;
  --panel:       #FDFDFB;
  --ink:         #16211D;
  --ink-soft:    #566158;
  --ink-faint:   #8A9389;
  --accent:      #1E7F63;
  --accent-ink:  #0E4633;
  --accent-soft: #DCEDE5;
  --amber:       #B8842B;
  --error:       #B23A2E;
  --line:        #D3D8CC;
  --line-strong: #B7BEAE;

  --font-body: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  /* Payment pages should stay legible and predictable — keep light mode
     regardless of system theme, like most checkout flows do. */
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 1px 1px, rgba(22,33,29,0.06) 1px, transparent 0);
  background-size: 18px 18px;
  color: var(--ink);
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 32px 16px;
}

/* ---------------------------------------------------------------------
   The stub: two-pane ticket card
--------------------------------------------------------------------- */
.stub {
  --stub-max-width: 780px;
  display: grid;
  grid-template-columns: 0.85fr auto 1.15fr;
  align-items: stretch;
  width: 100%;
  max-width: var(--stub-max-width);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(22,33,29,0.04);
  overflow: hidden;
  opacity: 0;
  transform: translateY(6px);
  animation: stub-in 0.5s cubic-bezier(.2,.8,.2,1) forwards;
}

@keyframes stub-in {
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .stub { animation: none; opacity: 1; transform: none; }
}

.stub--status {
  grid-template-columns: 1fr;
  max-width: 440px;
}

/* --- Left pane: brand / ledger facts --- */
.stub__brand {
  padding: 36px 30px;
  background: var(--accent-ink);
  color: #EAF3EE;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.stub__brand-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stub__mark {
  color: var(--accent);
  font-size: 18px;
}

.stub__brand-name {
  font-family: var(--font-mono);
  font-size: 15px;
  letter-spacing: 0.02em;
  color: #EAF3EE;
}
.stub__brand-name em {
  font-style: normal;
  color: #9FD9BF;
}

.stub__ledger {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.stub__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(234,243,238,0.18);
  font-size: 13px;
}
.stub__row:last-child { border-bottom: none; padding-bottom: 0; }

.stub__row dt {
  color: #9FB3A8;
}
.stub__row dd {
  margin: 0;
  font-family: var(--font-mono);
  text-align: right;
  color: #EAF3EE;
}

.stub__note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: #9FB3A8;
}

/* --- Perforated divider --- */
.stub__perforation {
  width: 1px;
  background-image: radial-gradient(circle, var(--bg) 2.5px, transparent 2.6px);
  background-size: 1px 14px;
  background-repeat: repeat-y;
  background-position: center;
  position: relative;
}
.stub__perforation::before,
.stub__perforation::after {
  content: '';
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 22px;
  background: var(--bg);
  border-radius: 50%;
}
.stub__perforation::before { top: -11px; }
.stub__perforation::after { bottom: -11px; }

/* --- Right pane: the form --- */
.stub__form {
  padding: 36px 34px;
}

.stub__heading {
  margin: 0 0 24px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.field {
  display: block;
  margin-bottom: 18px;
}

.field__label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field__label em {
  font-style: normal;
  color: var(--ink-faint);
}

.field input[type="text"],
.field input[type="email"] {
  width: 100%;
  padding: 11px 12px;
  font-family: var(--font-body);
  font-size: 14.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field__amount-row {
  display: flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
.field__amount-row:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field__currency {
  border: none;
  border-right: 1px solid var(--line);
  background: #F4F5F0;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  padding: 0 10px;
  outline: none;
}

.field__amount-input {
  flex: 1;
  border: none !important;
  font-family: var(--font-mono) !important;
  font-size: 22px !important;
  font-weight: 500;
  padding: 10px 14px !important;
  letter-spacing: 0.01em;
}
.field__amount-input:focus-visible {
  box-shadow: none !important;
}

.field__error {
  font-size: 13px;
  color: var(--error);
  margin: -6px 0 16px;
}

.pay-button {
  position: relative;
  width: 100%;
  padding: 13px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: background 0.15s ease, transform 0.1s ease;
}
.pay-button:hover { background: var(--accent-ink); }
.pay-button:active { transform: scale(0.99); }
.pay-button:disabled { opacity: 0.75; cursor: default; }

.pay-button--link {
  text-decoration: none;
  margin-top: 22px;
}

.pay-button__spinner {
  display: none;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
}
.pay-button.is-loading .pay-button__spinner {
  display: inline-block;
  animation: spin 0.7s linear infinite;
}
.pay-button.is-loading .pay-button__label { opacity: 0.85; }

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

.stub__fineprint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
}

/* ---------------------------------------------------------------------
   Status pages (success / cancel)
--------------------------------------------------------------------- */
.status {
  padding: 44px 36px;
  text-align: center;
}

.status__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 18px;
  margin-bottom: 18px;
}
.status--error .status__icon,
.status--cancelled .status__icon {
  background: #F2E3E0;
  color: var(--error);
}
.status__icon--spin { animation: spin 1.1s linear infinite; }

.status h1 {
  font-size: 19px;
  margin: 0 0 10px;
}

.status p {
  font-size: 14px;
  color: var(--ink-soft);
  line-height: 1.6;
  margin: 0 0 20px;
}

.status .stub__ledger {
  text-align: left;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
.status .stub__row dt,
.status .stub__row dd { color: var(--ink-soft); }
.status .stub__row dd { color: var(--ink); }
.status .stub__row { border-bottom: 1px dashed var(--line); }

/* ---------------------------------------------------------------------
   Responsive
--------------------------------------------------------------------- */
@media (max-width: 640px) {
  .stub {
    grid-template-columns: 1fr;
  }
  .stub__perforation {
    width: auto;
    height: 1px;
    background-image: radial-gradient(circle, var(--bg) 2.5px, transparent 2.6px);
    background-size: 14px 1px;
    background-repeat: repeat-x;
    background-position: center;
  }
  .stub__perforation::before,
  .stub__perforation::after {
    top: 50%;
    left: -11px;
    transform: translateY(-50%);
  }
  .stub__perforation::after { left: auto; right: -11px; }
  .stub__brand, .stub__form { padding: 28px 24px; }
}
