:root {
  --navy-1: #070f26;
  --navy-2: #0c1a3d;
  --gold: #d6b25e;
  --gold-2: #f3dc9a;
  --gold-3: #a8822f;
  --cream-1: #fffaf0;
  --cream-2: #f5e8c8;
  --green-1: #134a37;
  --green-2: #0a2c21;
  --ink: #1b2340;
  --header-h: 12.5vh;
  --pad: 0.7vw;
  --gap: 0.55vw;
}

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

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: radial-gradient(ellipse at 50% -10%, #1a2c5c 0%, var(--navy-2) 35%, var(--navy-1) 100%);
  font-family: 'Montserrat', system-ui, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
body.idle { cursor: none; }

/* subtle gold dust */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; opacity: .5;
  background-image:
    radial-gradient(1px 1px at 12% 20%, rgba(243,220,154,.7), transparent 60%),
    radial-gradient(1px 1px at 72% 12%, rgba(243,220,154,.6), transparent 60%),
    radial-gradient(1.5px 1.5px at 88% 44%, rgba(243,220,154,.5), transparent 60%),
    radial-gradient(1px 1px at 30% 70%, rgba(243,220,154,.5), transparent 60%),
    radial-gradient(1px 1px at 55% 88%, rgba(243,220,154,.4), transparent 60%);
}

/* ================= HEADER ================= */
#wall-header {
  position: relative; height: var(--header-h);
  display: flex; align-items: center; justify-content: center;
}
.header-skyline {
  position: absolute; left: 1.2vw; bottom: 1.6vh; width: 19vw; height: 7.5vh;
  color: var(--gold); filter: drop-shadow(0 0 6px rgba(214,178,94,.45));
}
.header-skyline svg { width: 100%; height: 100%; }
.header-fireworks { position: absolute; color: var(--gold-2); animation: twinkle 3.2s ease-in-out infinite; filter: drop-shadow(0 0 8px rgba(243,220,154,.7)); }
.header-fireworks svg { width: 100%; height: 100%; }
.fw-a { left: 23vw; top: 1.2vh; width: 4vh; height: 4vh; animation-delay: .4s; }
.fw-b { right: 18vw; top: 1vh; width: 4.2vh; height: 4.2vh; animation-delay: 1.3s; }
.fw-c { right: 12.5vw; top: .6vh; width: 6.5vh; height: 6.5vh; animation-delay: 2.1s; }
@keyframes twinkle { 0%,100% { opacity: .55; transform: scale(.88) rotate(0deg); } 50% { opacity: 1; transform: scale(1.06) rotate(12deg); } }

.header-title-block { text-align: center; z-index: 1; }
#wall-title {
  font-family: 'Cinzel', serif; font-weight: 800; letter-spacing: .06em;
  font-size: 5.6vh; line-height: 1;
  background: linear-gradient(180deg, #fff3c8 0%, var(--gold-2) 35%, var(--gold) 65%, var(--gold-3) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,.5));
}
#wall-subtitle {
  margin-top: .9vh; font-size: 1.85vh; letter-spacing: .32em; font-weight: 500; color: #e9e3d2;
}
#live-pill {
  position: absolute; right: 1.2vw; top: 2vh;
  display: flex; align-items: center; gap: .6vh;
  padding: .6vh 1.4vh; border-radius: 99px; border: 1.5px solid rgba(243,220,154,.6);
  color: #fff; font-size: 1.6vh; font-weight: 600; letter-spacing: .08em; background: rgba(0,0,0,.25);
}
#live-count { color: var(--gold-2); font-weight: 500; }
#live-count:not(:empty)::before { content: '·'; margin-right: .6vh; color: #fff8; }
.live-dot { width: 1.2vh; height: 1.2vh; border-radius: 50%; background: #2bd96b; box-shadow: 0 0 10px #2bd96b; animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.header-swoosh {
  position: absolute; left: 0; right: 0; bottom: .3vh; height: 3vh; pointer-events: none;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1000 30' preserveAspectRatio='none'%3E%3Cpath d='M0 26 C250 26 330 6 500 10 C680 14 760 26 1000 18' fill='none' stroke='%23d6b25e' stroke-width='1.6'/%3E%3Cpath d='M0 29 C260 28 340 12 500 15 C690 18 770 28 1000 24' fill='none' stroke='%23d6b25e' stroke-opacity='.45' stroke-width='1'/%3E%3C/svg%3E") center/100% 100% no-repeat;
}

/* ================= STAGE ================= */
#wall-stage {
  position: relative; height: calc(100vh - var(--header-h));
  margin: 0 var(--pad) var(--pad);
}
#wall-grid { position: absolute; inset: 0; }

/* ================= CARDS ================= */
.pledge-card, .decor-tile {
  position: absolute; left: 0; top: 0;
  border-radius: 0.55vw; overflow: hidden;
  container-type: size;
  transition:
    left .9s cubic-bezier(.65,0,.25,1), top .9s cubic-bezier(.65,0,.25,1),
    width .9s cubic-bezier(.65,0,.25,1), height .9s cubic-bezier(.65,0,.25,1),
    opacity .6s ease;
}
.pledge-card.no-anim, .decor-tile.no-anim { transition: none !important; }

.theme-cream, .theme-photo {
  background: linear-gradient(160deg, var(--cream-1) 0%, #fbf1da 45%, var(--cream-2) 100%);
  border: 1.5px solid rgba(214,178,94,.85);
  box-shadow: 0 4px 14px rgba(0,0,0,.45), inset 0 0 0 3px rgba(255,255,255,.5), inset 0 0 26px rgba(214,178,94,.18);
}
.theme-green {
  background: radial-gradient(ellipse at 30% 20%, var(--green-1) 0%, var(--green-2) 80%);
  border: 1.5px solid rgba(214,178,94,.9);
  box-shadow: 0 4px 14px rgba(0,0,0,.5), inset 0 0 0 3px rgba(214,178,94,.12);
  color: #fbf0d6;
}
.theme-green::after { /* gold dune lines */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 26%; pointer-events: none; opacity: .9;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40' preserveAspectRatio='none'%3E%3Cpath d='M0 34 C50 20 90 18 130 26 C160 32 180 30 200 22' fill='none' stroke='%23d6b25e' stroke-width='1.4'/%3E%3Cpath d='M0 38 C60 28 100 26 140 32 C170 36 185 35 200 30' fill='none' stroke='%23d6b25e' stroke-opacity='.5' stroke-width='1'/%3E%3C/svg%3E") bottom/100% 100% no-repeat;
}

.card-msg {
  position: absolute; left: 7cqmin; right: 7cqmin; top: 7cqmin; bottom: max(24cqh, 7cqmin + 14px);
  display: flex; align-items: center; justify-content: flex-start;
  font-family: 'Caveat', cursive; font-weight: 600; line-height: 1.08;
  font-size: 20px; color: inherit; overflow: hidden;
}
.msg-text { display: block; width: 100%; overflow-wrap: normal; white-space: pre-line; }
.msg-text.brk { overflow-wrap: anywhere; }
.theme-cream .card-msg { color: var(--ink); }
.is-ar .card-msg { font-family: 'Aref Ruqaa', 'Tajawal', serif; font-weight: 700; line-height: 1.35; text-align: right; }
.is-ar.theme-photo .card-msg { line-height: 1.25; }

.card-sig {
  position: absolute; left: 7cqmin; bottom: 6cqmin; max-width: 58%;
  font-size: clamp(9px, min(9cqh, 6.5cqw), 22px); font-weight: 600; letter-spacing: .02em;
  color: #444a60; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.theme-green .card-sig { color: #e8d9b0; }

.card-icon {
  position: absolute; right: 6cqmin; bottom: 5cqmin;
  width: min(30cqh, 24cqw); height: min(30cqh, 24cqw);
  color: var(--gold); display: block; pointer-events: none;
}
.theme-cream .card-icon { color: #c49a3c; }
.card-icon svg { width: 100%; height: 100%; display: block; overflow: visible; }
.card-icon.icon-flag { width: min(30cqh, 24cqw); height: min(21cqh, 17cqw); bottom: 7cqmin; }
.icon-wide .card-icon { width: 62%; height: 24cqh; right: 4cqmin; bottom: 3cqmin; opacity: .9; }
.theme-green .card-icon { color: var(--gold-2); filter: drop-shadow(0 0 4px rgba(214,178,94,.35)); }
.theme-green.icon-wide::after { display: none; }

/* photo card */
.theme-photo .card-photo {
  position: absolute; left: 0; right: 0; top: 0; height: 62%;
  overflow: hidden; border-bottom: 1.5px solid rgba(214,178,94,.85);
  background: #d9cfb8;
}
.card-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.theme-photo .card-body { position: absolute; left: 0; right: 0; top: 62%; bottom: 0; container-type: size; }
.theme-photo .card-name {
  position: absolute; left: 6cqw; top: 6cqh; right: 6cqw;
  font-weight: 700; font-size: clamp(10px, min(19cqh, 9cqw), 30px); color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.theme-photo .card-msg { left: 6cqw; right: 30cqw; top: 30cqh; bottom: 7cqh; align-items: flex-start; color: #2c3350; }
.theme-photo .card-icon { width: min(40cqh, 22cqw); height: min(40cqh, 22cqw); right: 5cqw; bottom: 7cqh; }
.theme-photo .card-icon.icon-flag { height: min(28cqh, 15cqw); }
.theme-photo.icon-wide .card-icon { width: 30cqw; height: 34cqh; }

/* decor / CTA tiles that fill holes */
.decor-tile {
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4cqmin;
  border: 1.5px dashed rgba(214,178,94,.55);
  background: linear-gradient(160deg, rgba(19,74,55,.55), rgba(10,44,33,.55));
  color: var(--gold-2); text-align: center;
}
.decor-tile svg { width: min(38cqh, 34cqw); height: min(38cqh, 34cqw); opacity: .85; }
.decor-tile .decor-text { font-family: 'Cinzel', serif; font-weight: 700; font-size: clamp(9px, min(11cqh, 8cqw), 26px); letter-spacing: .08em; line-height: 1.2; padding: 0 6cqmin; }
.decor-tile.ornament { background: linear-gradient(160deg, rgba(255,250,240,.08), rgba(214,178,94,.06)); border-style: solid; border-color: rgba(214,178,94,.35); }
.decor-tile.ornament svg { opacity: .6; }

/* states */
.pledge-card.enter { opacity: 0; transform: scale(.6); }
.pledge-card.appear { animation: appear .8s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes appear { from { opacity: 0; transform: scale(.5) rotate(-3deg); } to { opacity: 1; transform: none; } }
.pledge-card.awaiting { opacity: 0 !important; pointer-events: none; }
.pledge-card.leaving { opacity: 0 !important; transform: scale(.7); transition: opacity .5s, transform .5s; }
.pledge-card.spot { z-index: 60; will-change: transform; box-shadow: 0 0 0 2px var(--gold-2), 0 0 60px 10px rgba(243,220,154,.45), 0 30px 80px rgba(0,0,0,.7); }
.pledge-card.landed { z-index: 5; animation: landed 7s ease-out forwards; }
@keyframes landed {
  0% { box-shadow: 0 0 0 3px var(--gold-2), 0 0 40px 8px rgba(243,220,154,.7); }
  100% { box-shadow: 0 4px 14px rgba(0,0,0,.45), 0 0 0 0 rgba(243,220,154,0); }
}

/* ================= QR PANEL (fixed) ================= */
#qr-panel {
  position: absolute; right: 0; bottom: 0; width: 21.5%; height: 54%;
  z-index: 20; border-radius: .8vw; overflow: hidden;
  background: linear-gradient(180deg, var(--cream-1), var(--cream-2));
  border: 2px solid var(--gold);
  box-shadow: 0 8px 30px rgba(0,0,0,.6), 0 0 0 4px rgba(214,178,94,.18);
  display: flex; flex-direction: column;
}
.qr-head {
  display: flex; align-items: center; gap: 1.4vh; padding: 1.6vh 1.6vh;
  background: radial-gradient(ellipse at 20% 30%, var(--green-1), var(--green-2));
  border-bottom: 2px solid var(--gold); color: var(--gold-2);
}
.qr-phone { width: 6vh; height: 6vh; flex: none; border: 1.5px solid rgba(243,220,154,.6); border-radius: 1vh; padding: .7vh; }
.qr-phone svg { width: 100%; height: 100%; }
.qr-head h2 { font-family: 'Cinzel', serif; font-weight: 700; font-size: 2.9vh; line-height: 1.1; letter-spacing: .05em; }
.qr-steps { list-style: none; padding: 1.4vh 2vh .6vh; font-size: 1.75vh; font-weight: 600; color: var(--ink); }
.qr-steps li { display: flex; align-items: center; gap: 1vh; margin-bottom: .6vh; }
.qr-steps li::before { content: ''; width: 1.2vh; height: 1.2vh; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 2px rgba(214,178,94,.3); flex: none; }
#qr-box {
  flex: 1; min-height: 0; margin: .6vh auto .4vh; aspect-ratio: 1; max-width: 86%;
  background: #fff; border: 1.5px solid #cfc6b0; border-radius: .5vw; padding: .8vh;
}
#qr-box svg { width: 100%; height: 100%; display: block; }
#qr-url { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 1vh; padding-right: 1vh; text-align: center; font-size: 1.35vh; color: #6b6450; padding-bottom: 1vh; font-weight: 600; letter-spacing: .02em; }

/* ================= SPOTLIGHT ================= */
#spotlight {
  position: fixed; inset: 0; z-index: 50; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 50%, rgba(10,20,50,.55) 0%, rgba(3,7,20,.88) 70%);
  transition: opacity .6s ease;
}
#spotlight.on { opacity: 1; }
.spot-burst {
  position: absolute; left: 50%; top: 50%; width: 140vmax; height: 140vmax; transform: translate(-50%,-50%);
  background: repeating-conic-gradient(from 0deg, rgba(243,220,154,.09) 0deg 6deg, transparent 6deg 18deg);
  mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  -webkit-mask-image: radial-gradient(circle, #000 0%, transparent 55%);
  animation: spin 40s linear infinite;
}
@keyframes spin { to { transform: translate(-50%,-50%) rotate(360deg); } }
.spot-label {
  position: absolute; left: 0; right: 0; top: 9vh; text-align: center;
  font-family: 'Cinzel', serif; font-weight: 700; font-size: 3.4vh; letter-spacing: .3em; color: var(--gold-2);
  text-shadow: 0 0 20px rgba(243,220,154,.6); transform: translateY(-20px); opacity: 0; transition: all .6s ease .2s;
}
#spotlight.on .spot-label { transform: none; opacity: 1; }

#fs-btn {
  position: fixed; left: 1vw; bottom: 1vh; z-index: 80; width: 40px; height: 40px; border-radius: 10px;
  border: 1px solid rgba(243,220,154,.5); background: rgba(0,0,0,.4); color: var(--gold-2); font-size: 20px; cursor: pointer;
  transition: opacity .4s;
}
body.idle #fs-btn { opacity: 0; pointer-events: none; }

#measurer { position: fixed; left: -10000px; top: 0; visibility: hidden; pointer-events: none; }

/* photo card – landscape slot: photo on the left */
.theme-photo.photo-side .card-photo { right: auto; width: 42%; height: 100%; border-bottom: none; border-right: 1.5px solid rgba(214,178,94,.85); }
.theme-photo.photo-side .card-body { top: 0; left: 42%; }
.theme-photo.photo-side .card-name { top: 9cqh; font-size: clamp(10px, min(13cqh, 10cqw), 30px); }
.theme-photo.photo-side .card-msg { top: 28cqh; bottom: 10cqh; right: 26cqw; }
.theme-photo.photo-side .card-icon { width: min(26cqh, 20cqw); height: min(26cqh, 20cqw); bottom: 8cqh; }
