/*
 * The FlyPass card page on Design System 3.0 — the checkout proposal's
 * section B (views B1–B8, approved 2026-10-20). One white page inside the
 * app's sheet: the amount, the cards we take, the DS fields, the save switch,
 * Pay and the provider sentence. Light only, as the app is.
 *
 * Type is the DS's own Funnel, self-hosted (the CSP loads nothing from
 * anyone else). Sizes are written against a 17 px root and follow iOS's
 * Dynamic Type through `-apple-system-body`; Android's WebView scales the
 * text itself, so every height that holds text is a minimum.
 */

@font-face {
  font-family: "Funnel Sans";
  src: url("/assets/FunnelSans-zzU05adE.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Funnel Display";
  src: url("/assets/FunnelDisplay-h7i3A3FI.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* The riyal and dirham signs, which Funnel has no glyph for and few fonts draw yet. */
@font-face {
  font-family: "FlyPass Signs";
  src: url("/assets/FlyPassSigns-CHo_gEU5.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
  unicode-range: U+20C1, U+20C3;
}

:root {
  /* DS 3.0 tokens (cloud, sky, lime, red; the app's src/ds/tokens.ts). */
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --surface-3: #e3e8ef;
  --line: #e3e8ef;
  --field-line: #c9d0db;
  --text: #0d1017;
  --text-2: #596274;
  --text-3: #687285;
  --text-disabled: #a4adbc;
  --link: #1f67e6;
  --focus: #2f7bf5;
  --focus-halo: rgba(47, 123, 245, 0.16);
  --primary: #b8f34a;
  --primary-pressed: #a9e63a;
  --on-primary: #0d1017;
  --contrast: #0d1017;
  --contrast-pressed: #262c38;
  --on-contrast: #ffffff;
  --info-bg: #e5f1ff;
  --info-fg: #1a57c9;
  --danger: #c9302c;
  --danger-bg: #fdecec;
  --danger-fg: #b42323;
  --peach-bg: #ffede3;
  --peach-fg: #b4471a;
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-full: 999px;
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 320ms;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font-sans:
    "Funnel Sans", "FlyPass Signs", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display:
    "Funnel Display", "Funnel Sans", "FlyPass Signs", system-ui, -apple-system, sans-serif;
  /* One DS point: 1/17 of the root, which is iOS's body size. */
  --u: calc(1rem / 17);
}

html {
  font-size: 17px;
  /* iOS: the root follows Dynamic Type; elsewhere this is ignored and 17 px stands. */
  font: -apple-system-body;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--surface);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: calc(16 * var(--u));
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

p,
h1 {
  margin: 0;
}

/* A heading takes the focus only so a screen reader starts there (view.ts › announce). */
[tabindex="-1"]:focus {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

svg.i {
  display: block;
  flex: none;
  width: calc(20 * var(--u));
  height: calc(20 * var(--u));
  fill: currentColor;
}

/* ---- The page: 20 in (Android's Material sheet: 24 at the sides), 16 between ---- */

.page,
.form,
.shapes {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page {
  padding: 20px;
}

.android .page {
  padding: 20px 24px;
}

.fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pair {
  display: flex;
  gap: 12px;
}

.pair > * {
  flex: 1;
  min-width: 0;
}

/* ---- B1: the page's own shapes while it reads the session ---- */

.sk {
  border-radius: var(--r-xs);
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    var(--surface-3) 45%,
    var(--surface-2) 90%
  );
  background-size: 220% 100%;
  animation: shimmer 1.5s linear infinite;
}

.sk-caption {
  width: 46%;
  height: 12px;
}

.sk-total {
  width: 40%;
  height: 30px;
  margin-top: -8px;
}

.sk-field {
  height: 56px;
  border-radius: var(--r-md);
}

.sk-pay {
  height: 52px;
  margin-top: 8px;
  border-radius: var(--r-full);
}

@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -120% 0;
  }
}

.noscript {
  font-size: calc(14 * var(--u));
  color: var(--text-2);
}

/* ---- The amount: the order in Footnote, the total in Title 1 ---- */

.summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-weight: inherit;
}

.caption {
  font: 480 calc(13 * var(--u)) / calc(18 * var(--u)) var(--font-sans);
  color: var(--text-2);
}

.total {
  font: 700 calc(30 * var(--u)) / calc(36 * var(--u)) var(--font-display);
  letter-spacing: -0.018em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

/* ---- Brand marks: the owners' own files on a white tile, 4 clear around ---- */

.accepted {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mark {
  flex: none;
  box-sizing: border-box;
  width: 40px;
  height: 28px;
  padding: 4px;
  border-radius: 6px;
  background: #ffffff;
  box-shadow: inset 0 0 0 1px var(--line);
  display: grid;
  place-items: center;
}

.mark i {
  display: block;
  width: 100%;
  height: 100%;
  background: center / contain no-repeat;
}

.mark.visa i {
  background-image: url("/assets/visa-58-UVeCK.png");
}

.mark.mastercard i {
  background-image: url("/assets/mastercard-BXbqP7FH.svg");
}

.mark.abbr {
  padding: 0;
  font: 800 9.5px/12px var(--font-sans);
  letter-spacing: 0.05em;
  color: var(--text);
}

.mark.glyph {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: var(--peach-bg);
  box-shadow: none;
  color: var(--peach-fg);
}

.mark.sm {
  width: 36px;
  height: 24px;
  border-radius: 5px;
}

/* ---- DS fields: the label above, 56 tall, the message under ---- */

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field label {
  padding-inline-start: 2px;
  font: 560 calc(14 * var(--u)) / calc(18 * var(--u)) var(--font-sans);
  color: var(--text);
}

.input {
  box-sizing: border-box;
  min-height: max(56px, calc(56 * var(--u)));
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--field-line);
  transition: box-shadow var(--dur-2) var(--ease-out);
  cursor: text;
}

.input:focus-within {
  box-shadow:
    inset 0 0 0 1.5px var(--text),
    0 0 0 4px var(--focus-halo);
}

.field.invalid .input {
  box-shadow:
    inset 0 0 0 1.5px var(--danger),
    0 0 0 4px var(--danger-bg);
}

.input input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 12px 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: 420 calc(16 * var(--u)) / calc(22 * var(--u)) var(--font-sans);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  caret-color: var(--text);
}

.input input::placeholder {
  color: var(--text-3);
  opacity: 1;
}

.input .lead {
  color: var(--text-3);
}

.input .end {
  display: flex;
  align-items: center;
  margin-inline-start: auto;
}

.input .end:empty {
  display: none;
}

.help {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  padding-inline-start: 2px;
  font: 480 calc(13 * var(--u)) / 1.4 var(--font-sans);
  color: var(--text-2);
}

.help:empty {
  display: none;
}

.help svg.i {
  width: calc(15 * var(--u));
  height: calc(15 * var(--u));
  margin-top: calc(1.5 * var(--u));
}

.field.invalid .help {
  color: var(--danger-fg);
}

/* ---- B3: the saved card as the app lists it ---- */

.saved {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.saved .slot {
  display: contents;
}

.saved .t,
.toggle .t {
  font: 620 calc(15 * var(--u)) / calc(20 * var(--u)) var(--font-sans);
  color: var(--text);
}

.saved .s,
.toggle .s {
  margin-top: 1px;
  font: 480 calc(13 * var(--u)) / calc(18 * var(--u)) var(--font-sans);
  color: var(--text-2);
}

.saved .t {
  font-variant-numeric: tabular-nums;
}

/* ---- Save this card: the platform's own switch (iOS; Material 3 on Android) ---- */

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  cursor: pointer;
}

.switch {
  all: unset;
  box-sizing: border-box;
  position: relative;
  flex: none;
  width: 51px;
  height: 31px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  cursor: pointer;
  transition: background var(--dur-2) var(--ease-out);
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 2px 4px rgba(13, 16, 23, 0.18),
    0 0 0 0.5px rgba(13, 16, 23, 0.05);
  transition: transform var(--dur-3) var(--ease-out);
}

.switch .thumb {
  display: none;
}

.switch[aria-checked="true"] {
  background: var(--primary);
}

.switch[aria-checked="true"]::after {
  transform: translateX(20px);
}

[dir="rtl"] .switch[aria-checked="true"]::after {
  transform: translateX(-20px);
}

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

.android .toggle {
  min-height: 48px;
}

.android .switch {
  width: 52px;
  height: 32px;
  border-radius: 16px;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 2px var(--text-3);
}

.android .switch::after {
  top: 8px;
  inset-inline-start: 8px;
  width: 16px;
  height: 16px;
  background: var(--text-3);
  box-shadow: none;
  transition: none;
}

.android .switch[aria-checked="true"] {
  background: var(--primary);
  box-shadow: none;
}

.android .switch[aria-checked="true"]::after {
  display: none;
}

.android .switch[aria-checked="true"] .thumb {
  position: absolute;
  top: 4px;
  inset-inline-end: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--contrast);
  color: var(--primary);
  display: grid;
  place-items: center;
}

.android .switch .thumb svg.i {
  width: 14px;
  height: 14px;
}

/* ---- Buttons: the DS pill ---- */

.btn {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--r-full);
  font: 620 calc(16 * var(--u)) / calc(20 * var(--u)) var(--font-sans);
  letter-spacing: -0.005em;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform var(--dur-1) var(--ease-out),
    background var(--dur-1);
}

.btn:active {
  transform: scale(0.97);
}

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

.btn.primary {
  background: var(--primary);
  color: var(--on-primary);
}

.btn.primary:active {
  background: var(--primary-pressed);
}

.btn.contrast {
  background: var(--contrast);
  color: var(--on-contrast);
}

.btn.contrast:active {
  background: var(--contrast-pressed);
}

.btn.sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: calc(14.5 * var(--u));
}

.btn[disabled] {
  background: var(--surface-2);
  color: var(--text-disabled);
  cursor: default;
  transform: none;
}

/* Paying…: still the lime action, with its spinner, and no second press. */
.btn.primary[aria-busy="true"] {
  background: var(--primary);
  color: var(--on-primary);
}

.btn .spin {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

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

.pay {
  width: 100%;
  margin-top: 8px;
}

.provider {
  text-align: center;
  text-wrap: balance;
  font: 480 calc(12.5 * var(--u)) / calc(17 * var(--u)) var(--font-sans);
  color: var(--text-2);
}

.provider svg.i {
  display: inline-block;
  width: calc(13 * var(--u));
  height: calc(13 * var(--u));
  margin-inline-end: 2px;
  vertical-align: calc(-2 * var(--u));
}

/* ---- Alerts: the test-payments note (dev), the provider's refusal (B5) ---- */

.inline {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font: 520 calc(13 * var(--u)) / calc(18 * var(--u)) var(--font-sans);
}

.inline.info {
  background: var(--info-bg);
  color: var(--info-fg);
}

.inline svg.i {
  width: calc(16 * var(--u));
  height: calc(16 * var(--u));
  margin-top: calc(1 * var(--u));
}

.inline b {
  font-weight: 650;
}

.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 10px 14px 16px;
  padding-inline: 16px 10px;
  border-radius: var(--r-md);
  font: 480 calc(14 * var(--u)) / calc(20 * var(--u)) var(--font-sans);
}

.banner.danger {
  background: var(--danger-bg);
  color: var(--danger-fg);
}

.banner svg.i {
  margin-top: calc(1 * var(--u));
}

.banner b {
  display: block;
  font-weight: 650;
}

/* ---- B7 · B8 and every page that is not the form: the DS state, in the sheet ---- */

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 12px 0;
  text-align: center;
}

.state .art svg {
  display: block;
  width: 150px;
  height: 120px;
}

.state h1 {
  font: 700 calc(19 * var(--u)) / calc(24 * var(--u)) var(--font-display);
  letter-spacing: -0.008em;
  color: var(--text);
}

.state p {
  max-width: 30ch;
  font: 480 calc(14 * var(--u)) / calc(20 * var(--u)) var(--font-sans);
  color: var(--text-2);
}

.state .actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.state .actions .quiet {
  background: transparent;
  color: var(--link);
}

@media (prefers-reduced-motion: reduce) {
  .sk,
  .btn .spin {
    animation: none;
  }

  .switch,
  .switch::after,
  .input,
  .btn {
    transition: none;
  }
}
