/* ============================================================
   SurveyPlus KSA — Projects Frontend v4
   Mobile-first | Flexbox only (no Grid for layout)
   Tested: 320px / 375px / 480px / 768px / 1024px / 1440px
   ALL styles scoped to .spx — zero conflicts
   ============================================================ */

/* SCOPED RESET */
.spx { box-sizing: border-box; width: 100%; overflow: hidden; font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f8fafd; }
.spx *, .spx *::before, .spx *::after { box-sizing: border-box; }
.spx img { display: block; max-width: 100%; }

/* ── HEADER ─────────────────────────────── */
.spx-head { background: #fff; text-align: center; padding: 60px 20px 40px; border-bottom: 1px solid #edf2f8; }
.spx-ey { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 14px; }
.spx-el { width: 32px; height: 2px; background: #2ecc8e; border-radius: 2px; flex-shrink: 0; }
.spx-et { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: #1aab6d; text-transform: uppercase; }
.spx-head h2 { font-size: clamp(22px, 5vw, 44px); font-weight: 800; color: #0d2350; line-height: 1.1; margin: 0 0 10px; padding: 0; }
.spx-head h2 b { color: #1aab6d; font-weight: 800; }
.spx-head > p { font-size: clamp(13px, 2vw, 15px); color: #5a6e82; max-width: 500px; margin: 0 auto; line-height: 1.7; padding: 0; }

/* ── PROJECTS LIST ───────────────────────── */
.spx-list { padding: 40px 20px; display: flex; flex-direction: column; gap: 48px; }

/* ── PROJECT BLOCK ───────────────────────── */
/* Default: single column (mobile) */
.spx-block { display: flex; flex-direction: column; gap: 24px; width: 100%; }

/* 768px+: two columns side by side */
@media (min-width: 768px) {
  .spx-list  { padding: 56px 40px; }
  .spx-block { flex-direction: row; align-items: flex-start; gap: 40px; }
  .spx-block.rev { flex-direction: row-reverse; }
  .spx-media { flex: 0 0 48%; max-width: 48%; min-width: 0; }
  .spx-info  { flex: 1 1 0%; min-width: 0; }
}
@media (min-width: 1100px) {
  .spx-list  { padding: 64px 80px; max-width: 1400px; margin: 0 auto; }
  .spx-block { gap: 56px; }
}

/* ── SLIDESHOW ───────────────────────────── */
.spx-media { display: flex; flex-direction: column; gap: 8px; width: 100%; min-width: 0; }

.spx-slider {
  position: relative;
  width: 100%;
  /* Aspect ratio fallback for older browsers */
  padding-top: 75%; /* 4:3 */
  border-radius: 16px;
  overflow: hidden;
  background: #0d2350;
  box-shadow: 0 16px 48px rgba(13,35,80,.15);
}
/* Modern browsers use aspect-ratio */
@supports (aspect-ratio: 4/3) {
  .spx-slider { padding-top: 0; aspect-ratio: 4 / 3; }
}

.spx-track {
  position: absolute;
  inset: 0;
  display: flex;
  height: 100%;
  transition: transform .62s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}
/* When aspect-ratio is supported, track fills naturally */
@supports (aspect-ratio: 4/3) {
  .spx-track { position: relative; inset: auto; }
}

.spx-slide { flex: 0 0 100%; height: 100%; position: relative; overflow: hidden; }
.spx-slide img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.spx-shade { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10,22,40,.48) 0%, transparent 55%); z-index: 1; pointer-events: none; }
.spx-badge { position: absolute; top: 12px; left: 12px; z-index: 2; background: #2ecc8e; color: #041a0a; font-size: 9px; font-weight: 800; letter-spacing: .08em; padding: 4px 10px; border-radius: 20px; text-transform: uppercase; }

/* Prev / Next */
.spx-btn {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,.2); border: 1px solid rgba(255,255,255,.3);
  color: #fff; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .2s;
  user-select: none; -webkit-user-select: none;
  line-height: 1;
}
.spx-btn:hover { background: rgba(255,255,255,.36); }
.spx-prev { left: 10px; }
.spx-next { right: 10px; }

/* Dots */
.spx-dots { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 2; display: flex; gap: 5px; }
.spx-dot { width: 6px; height: 6px; border-radius: 50%; background: rgba(255,255,255,.4); cursor: pointer; transition: all .28s; flex-shrink: 0; }
.spx-dot.on { width: 16px; border-radius: 3px; background: #2ecc8e; }

/* Thumbnails — always horizontal row, auto columns */
.spx-thumbs { display: flex; gap: 6px; width: 100%; }
.spx-tn { flex: 1 1 0%; min-width: 0; cursor: pointer; border-radius: 7px; overflow: hidden; border: 2px solid transparent; transition: border-color .2s; }
.spx-tn.on { border-color: #2ecc8e; }
.spx-tn-img { width: 100%; aspect-ratio: 16/9; overflow: hidden; }
@supports not (aspect-ratio: 16/9) {
  .spx-tn-img { position: relative; padding-top: 56.25%; }
  .spx-tn-img img { position: absolute; inset: 0; }
}
.spx-tn-img img { width: 100%; height: 100%; object-fit: cover; transition: transform .28s; }
.spx-tn:hover .spx-tn-img img { transform: scale(1.06); }

/* ── INFO COLUMN ─────────────────────────── */
.spx-info { display: flex; flex-direction: column; gap: 14px; width: 100%; min-width: 0; }
.spx-num { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: #1aab6d; text-transform: uppercase; }
.spx-info h3 { font-size: clamp(20px, 3vw, 28px); font-weight: 800; color: #0d2350; line-height: 1.2; margin: 0; padding: 0; word-wrap: break-word; }
.spx-info h3 b { color: #1aab6d; font-weight: 800; }
.spx-loc { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: #5a6e82; line-height: 1.45; }
.spx-loc svg { flex-shrink: 0; margin-top: 1px; }
.spx-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.spx-tag { font-size: 10px; font-weight: 700; letter-spacing: .05em; padding: 4px 10px; border-radius: 20px; text-transform: uppercase; white-space: nowrap; }
.tg { background: #e0f7ed; color: #0d6b3a; }
.tn { background: #e8eef8; color: #0d2350; }
.spx-desc { font-size: clamp(13px, 1.6vw, 14px); color: #5a6e82; line-height: 1.82; margin: 0; padding: 0; word-wrap: break-word; }
.spx-desc-ar { font-size: clamp(12px, 1.4vw, 13px); color: #8a9db8; direction: rtl; text-align: right; line-height: 1.75; border-top: 1px solid #e8f0f7; padding-top: 10px; }

/* Meta grid — always 2 cols, collapses at very small */
.spx-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.spx-mb { flex: 1 1 calc(50% - 4px); min-width: 120px; background: #f0f4f8; border-radius: 10px; padding: 10px 14px; }
.spx-ml { font-size: 10px; font-weight: 700; color: #8a9db8; letter-spacing: .07em; text-transform: uppercase; margin-bottom: 3px; }
.spx-mv { font-size: 13px; font-weight: 600; color: #0d2350; word-break: break-word; }

/* CTA Buttons */
.spx-btns { display: flex; flex-wrap: wrap; gap: 10px; }
.spx-wa {
  display: inline-flex; align-items: center; gap: 8px;
  background: #25d366; color: #fff !important;
  font-size: 13px; font-weight: 700;
  padding: 11px 20px; border-radius: 9px;
  text-decoration: none !important; line-height: 1;
  transition: background .2s, transform .15s; flex-shrink: 0;
}
.spx-wa:hover { background: #1db954; transform: translateY(-2px); color: #fff !important; }
.spx-wa svg { width: 15px; height: 15px; fill: #fff; flex-shrink: 0; display: block; }
.spx-more {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: #0d2350 !important;
  font-size: 13px; font-weight: 600;
  padding: 11px 18px; border-radius: 9px;
  border: 1.5px solid #dbe6f0;
  text-decoration: none !important; line-height: 1;
  transition: all .2s;
}
.spx-more:hover { border-color: #1aab6d; color: #1aab6d !important; }

/* Very small screens: stack buttons */
@media (max-width: 380px) {
  .spx-btns { flex-direction: column; }
  .spx-wa, .spx-more { justify-content: center; width: 100%; text-align: center; }
}

/* ── REVEAL ANIMATION ────────────────────── */
.spx-block { opacity: 0; transform: translateY(32px); transition: opacity .65s ease, transform .65s ease; }
.spx-block.spx-vis { opacity: 1; transform: translateY(0); }

/* ── DIVIDER ─────────────────────────────── */
.spx-div { height: 1px; background: linear-gradient(90deg, transparent, #dce8f2 25%, #dce8f2 75%, transparent); margin: 0 20px; }
@media (min-width: 768px) { .spx-div { margin: 0 40px; } }

/* ── BOTTOM CTA ──────────────────────────── */
.spx-cta { background: #0d2350; padding: 60px 20px; text-align: center; position: relative; overflow: hidden; }
.spx-cta-glow { position: absolute; bottom: -60px; left: 50%; transform: translateX(-50%); width: 500px; height: 300px; background: radial-gradient(circle, rgba(46,204,142,.07), transparent 70%); pointer-events: none; }
.spx-cta-inner { max-width: 520px; margin: 0 auto; position: relative; z-index: 1; }
.spx-cta h3 { font-size: clamp(20px, 4vw, 32px); font-weight: 800; color: #fff; margin: 0 0 10px; padding: 0; line-height: 1.2; }
.spx-cta h3 em { color: #2ecc8e; font-style: normal; }
.spx-cta > .spx-cta-inner > p { font-size: clamp(13px, 2vw, 15px); color: #7a93b8; line-height: 1.7; margin: 0 0 24px; padding: 0; }
.spx-cta-btns { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; }
.spx-cta-wa {
  display: inline-flex; align-items: center; gap: 8px;
  background: #25d366; color: #fff !important;
  font-size: clamp(13px, 2vw, 14px); font-weight: 700;
  padding: 13px 26px; border-radius: 10px;
  text-decoration: none !important; line-height: 1;
  transition: background .2s, transform .15s;
}
.spx-cta-wa:hover { background: #1db954; transform: translateY(-2px); color: #fff !important; }
.spx-cta-wa svg { width: 17px; height: 17px; fill: #fff; flex-shrink: 0; display: block; }
.spx-cta-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; color: #2ecc8e !important;
  font-size: clamp(13px, 2vw, 14px); font-weight: 600;
  padding: 13px 26px; border-radius: 10px;
  border: 1px solid rgba(46,204,142,.38);
  text-decoration: none !important; line-height: 1;
  transition: background .2s;
}
.spx-cta-ghost:hover { background: rgba(46,204,142,.08); }

@media (max-width: 420px) {
  .spx-cta-btns { flex-direction: column; align-items: stretch; }
  .spx-cta-wa, .spx-cta-ghost { justify-content: center; }
}
