/* ===========================================================
   Darul Falah Islamic Centre — Donation Kiosk
   Brand: green #1f6e3f · gold #ecc940 · muted gold #c9a55c
          cream #faf6ec · dark forest #1a2a1f
   Fonts: Cormorant Garamond (display) · Cinzel (labels) · Inter (UI)
   =========================================================== */

:root {
  --green: #1f6e3f;
  --green-deep: #16542f;
  --green-dark: #0f3d22;
  --gold: #ecc940;
  --gold-muted: #c9a55c;
  --cream: #faf6ec;
  --cream-2: #fdf8ee;
  --ink: #1a2a1f;
  --ink-soft: #4a5a4f;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, sans-serif;
  color: var(--ink);
  background: var(--cream);
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Warm background with a faint dome halo for depth */
body {
  background:
    radial-gradient(120% 80% at 50% -10%, rgba(236, 201, 64, 0.10), transparent 55%),
    radial-gradient(90% 70% at 50% 115%, rgba(31, 110, 63, 0.08), transparent 60%),
    linear-gradient(180deg, var(--cream-2), var(--cream));
}

/* ---------- Screen switching ---------- */
.screen { display: none; height: 100vh; padding: clamp(24px, 4vh, 56px) clamp(24px, 5vw, 90px); }
.screen.active { display: flex; flex-direction: column; }

/* ---------- Header ---------- */
.head { text-align: center; flex-shrink: 0; }
.logo {
  width: clamp(96px, 12vh, 168px);
  height: auto;
  margin: 0 auto clamp(8px, 1.4vh, 18px);
  display: block;
}
.eyebrow {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--green);
  font-size: clamp(11px, 1.5vw, 17px);
  padding-left: 0.32em; /* optical centering for letter-spacing */
}
.head h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  color: var(--ink);
  font-size: clamp(26px, 4vw, 52px);
  line-height: 1.05;
  margin-top: 4px;
}
.subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-style: italic;
  color: var(--ink-soft);
  font-size: clamp(18px, 2.4vw, 30px);
}

/* Gold diamond divider */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--gold-muted);
  margin: clamp(6px, 1.2vh, 14px) auto;
  font-size: clamp(12px, 1.4vw, 16px);
}
.divider span {
  display: block;
  height: 1px;
  width: clamp(40px, 8vw, 90px);
  background: linear-gradient(90deg, transparent, var(--gold-muted));
}
.divider span:last-child { background: linear-gradient(90deg, var(--gold-muted), transparent); }

/* ---------- Amount grid ---------- */
.grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 1fr;
  gap: clamp(12px, 2vw, 26px);
  align-content: stretch;
  padding: clamp(12px, 2.2vh, 28px) 0;
  min-height: 0;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  color: var(--cream);
  background: linear-gradient(160deg, var(--green) 0%, var(--green-deep) 60%, var(--green-dark) 100%);
  box-shadow:
    0 10px 22px rgba(15, 61, 34, 0.28),
    0 2px 0 rgba(255, 255, 255, 0.06) inset;
  overflow: hidden;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
/* Gold hairline frame echoing the logo's arches */
.tile::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(236, 201, 64, 0.45);
  border-radius: 14px;
  pointer-events: none;
}
.tile .amt {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: clamp(38px, 6.5vw, 82px);
  line-height: 1;
  font-feature-settings: "lnum" 1, "tnum" 1; /* uniform-height, tabular figures */
}
.cur {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  letter-spacing: 0.18em;
  font-size: clamp(10px, 1.2vw, 14px);
  color: var(--gold);
  text-transform: uppercase;
  margin-top: 6px;
}
.tile:active {
  transform: translateY(5px) scale(0.99);
  box-shadow: 0 4px 12px rgba(15, 61, 34, 0.3);
}
.tile:active::before { border-color: var(--gold); }

/* Custom-amount tile — inverted (cream + gold) to read as a distinct action */
.tile-custom {
  background: linear-gradient(160deg, #ffffff, var(--cream));
  color: var(--green);
  box-shadow: 0 10px 22px rgba(201, 165, 92, 0.24), 0 2px 0 rgba(255, 255, 255, 0.6) inset;
}
.tile-custom::before { border-color: var(--gold-muted); }
.tile-custom .amt-custom {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: clamp(30px, 5vw, 62px);
  line-height: 1;
  color: var(--green);
}
.tile-custom .cur { color: var(--gold-muted); }
.tile-custom:active::before { border-color: var(--gold); }

/* ---------- Specific-fund band (Sadaqah / Zakat) ---------- */
.funds { flex-shrink: 0; margin-top: clamp(10px, 2vh, 22px); }
.funds-label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-muted);
  font-size: clamp(11px, 1.4vw, 15px);
  margin-bottom: clamp(8px, 1.4vh, 14px);
}
.funds-label span {
  height: 1px;
  width: clamp(28px, 6vw, 70px);
  background: linear-gradient(90deg, transparent, var(--gold-muted));
}
.funds-label span:last-child { background: linear-gradient(90deg, var(--gold-muted), transparent); }
.funds-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: clamp(12px, 2vw, 26px);
}
.fund-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 18px;
  cursor: pointer;
  color: var(--cream);
  background: linear-gradient(160deg, var(--green) 0%, var(--green-deep) 70%, var(--green-dark) 100%);
  box-shadow: 0 10px 22px rgba(15, 61, 34, 0.26);
  padding: clamp(16px, 3vh, 30px) 10px;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.fund-tile::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(236, 201, 64, 0.55);
  border-radius: 12px;
  pointer-events: none;
}
.fund-tile:active { transform: translateY(4px); box-shadow: 0 4px 12px rgba(15, 61, 34, 0.3); }
.fund-tile:active::before { border-color: var(--gold); }
.fund-name {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: clamp(30px, 4.2vw, 56px);
  line-height: 1;
}

/* ---------- Footer ---------- */
.foot {
  flex-shrink: 0;
  text-align: center;
  color: var(--ink-soft);
  font-size: clamp(12px, 1.5vw, 17px);
  letter-spacing: 0.02em;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.foot .sep { color: var(--gold-muted); }
.foot .tag { font-style: italic; font-family: 'Cormorant Garamond', serif; font-size: clamp(14px, 1.7vw, 20px); }

/* ---------- Centered screens (pay / done / error) ---------- */
.center {
  margin: auto;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(10px, 1.8vh, 20px);
  max-width: 780px;
}
.center h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
  font-size: clamp(28px, 4.4vw, 54px);
  color: var(--ink);
}
.center .display { color: var(--green); }
.center .lead {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(19px, 2.6vw, 30px);
  color: var(--ink-soft);
}
.hint {
  font-family: 'Inter', sans-serif;
  color: var(--ink-soft);
  font-size: clamp(15px, 1.9vw, 21px);
}
.pay-amount {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  color: var(--green);
  font-size: clamp(56px, 11vw, 128px);
  line-height: 1;
}

/* ---------- Buttons ---------- */
.btn {
  margin-top: clamp(12px, 2vh, 24px);
  border: none;
  border-radius: 14px;
  padding: clamp(14px, 1.8vh, 20px) clamp(32px, 5vw, 52px);
  font-family: 'Cinzel', serif;
  font-weight: 600;
  letter-spacing: 0.08em;
  font-size: clamp(15px, 2vw, 22px);
  background: var(--green);
  color: var(--cream);
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(15, 61, 34, 0.25);
}
.btn:active { transform: translateY(3px); }
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1.5px solid var(--gold-muted);
  box-shadow: none;
}
.btn[disabled] {
  opacity: 0.4;
  box-shadow: none;
  cursor: default;
}

/* ---------- Custom-amount keypad ---------- */
.keypad-wrap {
  margin: auto;
  width: min(92vw, 540px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.keypad-amount {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  color: var(--green);
  font-size: clamp(56px, 12vh, 104px);
  line-height: 1.1;
  font-feature-settings: "lnum" 1, "tnum" 1;
  margin-top: 4px;
}
.keypad-hint {
  font-family: 'Inter', sans-serif;
  color: var(--ink-soft);
  font-size: clamp(13px, 1.7vw, 18px);
  margin-bottom: clamp(10px, 2vh, 20px);
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(10px, 1.6vh, 18px);
  width: 100%;
}
.key {
  border: 1px solid rgba(201, 165, 92, 0.5);
  border-radius: 16px;
  background: linear-gradient(160deg, #ffffff, var(--cream));
  color: var(--green);
  font-family: 'Cormorant Garamond', serif;
  font-weight: 700;
  font-size: clamp(28px, 4.5vh, 46px);
  font-feature-settings: "lnum" 1, "tnum" 1;
  padding: clamp(12px, 2.4vh, 24px) 0;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(31, 61, 34, 0.08);
  transition: transform 0.06s ease, background 0.06s ease;
}
.key:active {
  transform: translateY(3px);
  background: var(--green);
  color: var(--cream);
}
.key-alt {
  font-family: 'Cinzel', serif;
  font-size: clamp(15px, 2.2vh, 24px);
  letter-spacing: 0.04em;
  color: var(--gold-muted);
  background: var(--cream-2);
}
.keypad-actions {
  display: flex;
  gap: 16px;
  width: 100%;
  margin-top: clamp(14px, 2.4vh, 26px);
}
.keypad-actions .btn { flex: 1; margin-top: 0; }

/* ---------- Status badges ---------- */
.badge {
  width: clamp(96px, 15vh, 156px);
  height: clamp(96px, 15vh, 156px);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: clamp(52px, 8vh, 92px);
  font-weight: 700;
  color: var(--cream);
}
.badge-ok {
  background: radial-gradient(circle at 35% 30%, #2f9e5a, var(--green-deep));
  box-shadow: 0 0 0 8px rgba(31, 110, 63, 0.12), 0 12px 30px rgba(15, 61, 34, 0.3);
  color: var(--gold);
}
.badge-err {
  background: radial-gradient(circle at 35% 30%, #c9584f, #9a3a33);
  box-shadow: 0 0 0 8px rgba(154, 58, 51, 0.12);
}

/* ---------- Arch spinner (dome-inspired) ---------- */
.arch-spinner {
  width: clamp(78px, 12vh, 116px);
  height: clamp(78px, 12vh, 116px);
  border: 7px solid rgba(31, 110, 63, 0.15);
  border-top-color: var(--green);
  border-right-color: var(--gold);
  border-radius: 50%;
  animation: spin 1.1s linear infinite;
  margin-bottom: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Landscape TVs: keep header tight so the grid stays generous */
@media (min-aspect-ratio: 16/10) and (max-height: 900px) {
  .logo { width: clamp(80px, 14vh, 130px); }
  .head h1 { font-size: clamp(24px, 3vw, 40px); }
}
