/* Pamoja Pass — AFCON 2027 (PAMOJA) tri-nation palette, powered by AfriXPay.
   Derived from the host flags: pitch green (KE/TZ), gold (UG/TZ), pan-African
   red (KE/UG), Tanzanian sky as a fine accent, on warm black.
   Fan = light (stadium daylight). Gate = black (steward screen). Vendor = light.

   Token semantics kept from the AfriX base so markup stays unchanged:
   --sun = PRIMARY action (now pitch green), --sun-deep = hot accent (now red),
   --leaf = success green, --gold = tournament gold. */

:root {
  --paper: #faf7ef;
  --paper-deep: #f0ead8;
  --card: #fffdf6;
  --ink: #16130c;
  --ink-raised: #221e12;
  --ink-soft: #4c4735;
  --ink-faint: #7e7862;
  --sand-soft: #e8e0c8;
  --sand-faint: #b3ac90;
  --sun: #0f7b3d;        /* pitch green — primary action */
  --sun-deep: #ce1126;   /* pan-African red — kickers, numbers, alerts */
  --sun-soft: #f9e0e2;
  --leaf: #0f7b3d;
  --leaf-deep: #0a5a2c;
  --leaf-soft: #e1efe3;
  --gold: #f3c321;       /* tournament gold */
  --gold-deep: #9a7500;
  --sky: #00a3dd;        /* Tanzanian sky — fine accent */
  --danger: #ce1126;
  --danger-soft: #f9e0e2;
  --rule: rgba(22, 19, 12, 0.16);
  --rule-strong: rgba(22, 19, 12, 0.45);
  --rule-inv: rgba(250, 247, 239, 0.18);
  --disp: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(22, 19, 12, 0.06), 0 12px 32px -12px rgba(22, 19, 12, 0.22);
}

* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body);
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img, svg, video, canvas { display: block; max-width: 100%; }
button, input, select { font: inherit; color: inherit; }

h1, h2, h3 { font-family: var(--disp); line-height: 1.05; letter-spacing: -0.015em; font-weight: 700; text-wrap: balance; }

.mono { font-family: var(--mono); }
.muted { color: var(--ink-soft); }
.hidden { display: none !important; }

.kicker {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sun-deep);
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
}
.kicker::before { content: ""; width: 2em; height: 1px; background: currentColor; opacity: 0.6; }

/* ---------- shell ---------- */
.app { min-height: 100dvh; display: flex; flex-direction: column; }
.shell { width: 100%; max-width: 30rem; margin: 0 auto; padding: 0 1.1rem 3rem; flex: 1; }
.shell.wide { max-width: 44rem; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 0;
  margin-bottom: 0.4rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.6rem; font-family: var(--disp); font-weight: 700; font-size: 1.15rem; text-decoration: none; color: inherit; }
.brand .mark {
  width: 1.9em;
  height: 1.9em;
  border-radius: 7px;
  /* tri-nation band: pitch green / gold / red, ruled in warm black */
  background: linear-gradient(180deg,
    #0f7b3d 0 31%, #16130c 31% 36%,
    #f3c321 36% 64%, #16130c 64% 69%,
    #ce1126 69% 100%);
  box-shadow: inset 0 0 0 1.5px #16130c;
}
.brand-col { display: flex; flex-direction: column; line-height: 1.05; }
.brand-sub { font-family: var(--mono); font-weight: 500; font-size: 0.5rem; letter-spacing: 0.22em; color: var(--ink-faint); margin-top: 0.2em; }
.gate .brand-sub { color: var(--sand-faint); }
.top-chip {
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  color: var(--leaf-deep);
  border: 1px solid rgba(44, 122, 87, 0.4);
  border-radius: 5px;
  padding: 0.3em 0.55em;
}

/* ---------- primitives ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--disp);
  font-weight: 600;
  font-size: 1rem;
  padding: 0.85em 1.5em;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.15s, opacity 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-sun { background: var(--sun); color: #fffdf6; }
.btn-sun:not(:disabled):hover { box-shadow: 0 10px 28px -8px var(--sun); transform: translateY(-1px); }
.btn-ink { background: var(--ink); color: var(--paper); }
.btn-ghost { border-color: var(--rule-strong); }
.btn-block { width: 100%; }
.btn-sm { font-size: 0.85rem; padding: 0.55em 1.1em; }

.card {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.15rem 1.2rem;
  box-shadow: var(--shadow);
}
.card + .card, .stack > * + * { margin-top: 0.9rem; }

.field { margin-top: 0.9rem; }
.field label { display: block; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-faint); margin-bottom: 0.4rem; }
.input {
  width: 100%;
  padding: 0.8em 1em;
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 1.05rem;
}
.input:focus { outline: 2px solid var(--sun); outline-offset: 1px; border-color: transparent; }
.input.mono { letter-spacing: 0.12em; }

.hint { font-size: 0.8rem; color: var(--ink-faint); margin-top: 0.5rem; }
.hint b { color: var(--sun-deep); font-family: var(--mono); }
.error-line { color: var(--danger); font-size: 0.85rem; margin-top: 0.6rem; min-height: 1.2em; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  border-radius: 999px;
  padding: 0.35em 0.8em;
}
.badge.ok { background: var(--leaf-soft); color: var(--leaf-deep); }
.badge.ok::before { content: "●"; font-size: 0.8em; }
.badge.wait { background: var(--sun-soft); color: var(--sun-deep); }
.badge.wait::before { content: "◌"; }

/* ---------- home ---------- */
.home-hero { margin: 1.6rem 0 1.4rem; }
.home-hero h1 { font-size: clamp(2rem, 9vw, 2.7rem); margin-top: 0.5rem; }
.home-hero h1 .m { color: var(--sun-deep); }
.home-hero p { color: var(--ink-soft); margin-top: 0.7rem; max-width: 38ch; }
.role-card { display: flex; align-items: center; gap: 1rem; text-decoration: none; color: inherit; transition: transform 0.15s; }
.role-card:hover { transform: translateY(-2px); }
.role-num { font-family: var(--disp); font-weight: 750; font-size: 1.6rem; color: var(--sun); min-width: 1.4em; }
.role-card h3 { font-size: 1.15rem; }
.role-card p { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.15rem; }
.role-card .go { margin-left: auto; font-family: var(--disp); font-weight: 700; color: var(--sun-deep); }
.demo-note { font-size: 0.75rem; color: var(--ink-faint); margin-top: 1.4rem; line-height: 1.5; }

/* ---------- fan ---------- */
.fanid-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ink) 0%, #143b22 100%);
  color: var(--paper);
  border-radius: var(--radius);
  padding: 1.2rem 1.3rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--gold);
}
.fanid-card::after {
  content: "";
  position: absolute;
  inset: auto -20% -60% auto;
  width: 70%;
  aspect-ratio: 1;
  background: radial-gradient(closest-side, rgba(243, 195, 33, 0.32), transparent 70%);
}
.fanid-top { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 0.6rem; letter-spacing: 0.2em; color: var(--sand-faint); }
.fanid-main { display: flex; gap: 1rem; align-items: center; margin-top: 0.9rem; }
.fanid-photo {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--ink-raised);
  border: 1px solid var(--rule-inv);
}
.fanid-name { font-family: var(--disp); font-weight: 700; font-size: 1.3rem; }
.fanid-phone { font-family: var(--mono); font-size: 0.72rem; color: var(--sand-faint); margin-top: 0.15rem; }

.balance-row { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.balance-num { font-family: var(--disp); font-weight: 750; font-size: 1.9rem; letter-spacing: -0.02em; }
.balance-num .cur { font-size: 0.55em; font-weight: 500; color: var(--ink-soft); margin-right: 0.3em; }

.match-card h3 { font-size: 1.1rem; }
.match-meta { font-size: 0.8rem; color: var(--ink-soft); margin-top: 0.2rem; }
.match-meta .mono { font-size: 0.7rem; color: var(--sun-deep); }
.buy-row { display: flex; gap: 0.6rem; margin-top: 0.85rem; }
.buy-row .btn { flex: 1; font-size: 0.85rem; padding: 0.6em 0.4em; }

.tix-row { display: flex; align-items: center; gap: 0.9rem; text-decoration: none; color: inherit; }
.tix-qr-mini { width: 44px; height: 44px; border-radius: 8px; background: var(--paper-deep); display: grid; place-items: center; font-family: var(--disp); font-weight: 800; color: var(--sun-deep); }
.tix-row h4 { font-size: 0.98rem; }
.tix-row p { font-size: 0.75rem; color: var(--ink-soft); }
.tix-row .seat { margin-left: auto; font-family: var(--mono); font-size: 0.72rem; color: var(--leaf-deep); }

/* ticket detail */
.ticket-hero { text-align: center; padding: 1.4rem 1.2rem 1.2rem; }
.qr-holder { width: min(78vw, 300px); margin: 0.9rem auto 0; padding: 12px; background: #fff; border-radius: 14px; border: 1px solid var(--rule); }
.qr-holder svg { width: 100%; height: auto; }
.ring-row { display: flex; align-items: center; justify-content: center; gap: 0.6rem; margin-top: 0.8rem; font-size: 0.8rem; color: var(--ink-soft); }
.ring { width: 26px; height: 26px; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 3; }
.ring .bg { stroke: var(--rule); }
.ring .fg { stroke: var(--sun-deep); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.ticket-facts { display: flex; justify-content: space-around; margin-top: 1rem; padding-top: 1rem; border-top: 1px dashed var(--rule-strong); }
.fact .k { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.16em; color: var(--ink-faint); text-transform: uppercase; }
.fact .v { font-family: var(--disp); font-weight: 700; font-size: 1rem; margin-top: 0.15rem; }
.admitted-strip { margin-top: 1rem; background: var(--leaf-soft); color: var(--leaf-deep); border-radius: 10px; padding: 0.6rem; font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.12em; }

/* pin sheet */
.sheet-mask { position: fixed; inset: 0; background: rgba(33, 29, 23, 0.55); display: grid; place-items: end center; z-index: 40; }
.sheet { width: 100%; max-width: 30rem; background: var(--paper); border-radius: 18px 18px 0 0; padding: 1.3rem 1.3rem 2rem; }
.sheet h3 { font-size: 1.2rem; }
.sheet .sub { font-size: 0.85rem; color: var(--ink-soft); margin-top: 0.25rem; }

.back { background: none; border: 0; color: var(--ink-soft); font-size: 0.85rem; cursor: pointer; padding: 0.4rem 0; display: inline-flex; gap: 0.4em; align-items: center; }
.back:hover { color: var(--ink); }

.list-h { display: flex; align-items: baseline; justify-content: space-between; margin: 1.5rem 0 0.6rem; }
.list-h h2 { font-size: 1.05rem; }
.list-h .mono { font-size: 0.62rem; letter-spacing: 0.16em; color: var(--ink-faint); }

/* ---------- gate (dark) ---------- */
.gate body, .gate { background: var(--ink); color: var(--paper); }
.gate .topbar { border-bottom: 1px solid var(--rule-inv); }
.gate .brand { color: var(--paper); }
.gate .card { background: var(--ink-raised); border-color: var(--rule-inv); box-shadow: none; }
.gate .input { background: var(--ink-raised); border-color: var(--rule-inv); color: var(--paper); }
.gate .kicker { color: var(--gold); }
.gate h1 { color: var(--paper); }
.gate .muted { color: var(--sand-faint); }

.scan-stage { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; aspect-ratio: 4 / 5; }
.scan-stage video { width: 100%; height: 100%; object-fit: cover; }
.scan-frame { position: absolute; inset: 12% 15%; border: 2px solid rgba(245, 241, 232, 0.65); border-radius: 16px; pointer-events: none; }
.scan-frame::before { content: ""; position: absolute; inset: -2px; border-radius: 16px; border: 2px solid var(--gold); clip-path: inset(0 78% 78% 0); }
.scan-hint { position: absolute; bottom: 0.7rem; left: 0; right: 0; text-align: center; font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.18em; color: rgba(245, 241, 232, 0.75); }

.mode-row { display: flex; gap: 0.6rem; align-items: center; justify-content: space-between; margin-top: 0.9rem; }
.toggle { display: inline-flex; border: 1px solid var(--rule-inv); border-radius: 999px; overflow: hidden; }
.toggle button { background: none; border: 0; color: var(--sand-faint); font-family: var(--mono); font-size: 0.66rem; letter-spacing: 0.14em; padding: 0.5em 1em; cursor: pointer; }
.toggle button.on { background: var(--paper); color: var(--ink); font-weight: 500; }
.queue-pill { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.12em; color: var(--gold); }

.gate-result { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 1.5rem; text-align: center; }
.gate-result.ok { background: var(--leaf); color: #f2f7f3; }
.gate-result.warn { background: var(--gold-deep); color: #fdf4e4; }
.gate-result.bad { background: var(--danger); color: #fdeeec; }
.gr-inner { max-width: 26rem; }
.gr-mark { font-size: 4.2rem; line-height: 1; font-family: var(--disp); font-weight: 800; }
.gr-title { font-family: var(--disp); font-weight: 750; font-size: 2rem; margin-top: 0.4rem; letter-spacing: -0.01em; }
.gr-photo { width: 108px; height: 108px; border-radius: 16px; object-fit: cover; margin: 1rem auto 0; border: 3px solid rgba(255, 255, 255, 0.7); }
.gr-name { font-family: var(--disp); font-weight: 700; font-size: 1.4rem; margin-top: 0.8rem; }
.gr-meta { font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.1em; margin-top: 0.4rem; opacity: 0.9; }
.gr-sub { font-size: 0.85rem; opacity: 0.85; margin-top: 0.9rem; }

/* ---------- vendor ---------- */
.pay-qr { width: min(60vw, 240px); margin: 0.8rem auto; padding: 10px; background: #fff; border: 1px solid var(--rule); border-radius: 12px; }
.pay-qr svg { width: 100%; height: auto; }
.feed-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0.2rem; border-top: 1px solid var(--rule); }
.feed-row:first-child { border-top: 0; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); }
.feed-row .desc { font-size: 0.9rem; }
.feed-row .when { font-size: 0.7rem; color: var(--ink-faint); }
.feed-row .amt { margin-left: auto; font-family: var(--disp); font-weight: 700; color: var(--leaf-deep); }
.total-row { display: flex; justify-content: space-between; align-items: baseline; margin-top: 0.6rem; padding-top: 0.8rem; border-top: 2px solid var(--ink); }
.total-row .n { font-family: var(--disp); font-weight: 750; font-size: 1.5rem; }

.spin { display: inline-block; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: -0.15em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* PAMOJA ribbon — the three flags woven: green · gold · red · sky on black */
.weave { height: 6px; border-radius: 3px; margin: 1.2rem 0; background: repeating-linear-gradient(90deg, var(--sun) 0 26px, var(--ink) 26px 32px, var(--gold) 32px 50px, var(--ink) 50px 56px, var(--sun-deep) 56px 74px, var(--ink) 74px 80px, var(--sky) 80px 90px, var(--ink) 90px 96px); }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
