:root {
  --bg: #0b0f1a;
  --bg-2: #11172a;
  --card: #161d33;
  --card-2: #1c2542;
  --text: #f4f6fb;
  --text-dim: #a7b0c8;
  --muted: #6b7493;
  --brand: #ff7a18;
  --brand-2: #ffb56b;
  --accent: #6fb3ff;
  --success: #4ade80;
  --border: rgba(255,255,255,0.08);
  --shadow: 0 12px 40px -10px rgba(0,0,0,0.45);
  --radius: 14px;
  --hero-h: 78vh;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Heebo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

/* ============ HERO ============ */
.hero {
  position: relative;
  height: var(--hero-h);
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.hero-bg {
  position: absolute;
  inset: -3%;
  background-size: cover;
  background-position: center;
  filter: blur(2px) saturate(1.05);
  transform: scale(1.05);
  animation: heroPan 30s ease-in-out infinite alternate;
  z-index: -2;
}
@keyframes heroPan {
  from { transform: scale(1.05) translate(0,0); }
  to   { transform: scale(1.12) translate(-2%, -1%); }
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(11,15,26,0.35), rgba(11,15,26,0.85) 60%, var(--bg) 100%),
    linear-gradient(180deg, rgba(255,122,24,0.08), transparent 40%);
  z-index: -1;
}
.hero-inner {
  max-width: 720px;
  padding: 32px 24px;
  animation: fadeUp 0.9s ease both;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(8px);
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.4px;
  margin-bottom: 22px;
}
.eyebrow .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(255,122,24,0.18);
}
.hero h1 {
  font-size: clamp(48px, 8vw, 96px);
  font-weight: 800;
  margin: 0 0 16px;
  line-height: 1;
  letter-spacing: -2px;
  background: linear-gradient(180deg, #fff 0%, #ffd9b3 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .subtitle {
  font-size: clamp(16px, 1.6vw, 19px);
  color: var(--text-dim);
  max-width: 520px;
  margin: 0 auto 32px;
  line-height: 1.6;
}
.hero-stats {
  display: inline-flex;
  gap: 32px;
  padding: 18px 28px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 16px;
  backdrop-filter: blur(10px);
}
.hero-stats > div {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero-stats strong {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}
.hero-stats span {
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 1px;
  margin-top: 4px;
}
.hero-scroll {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--text-dim);
  animation: bobble 2s ease-in-out infinite;
  opacity: 0.6;
}
@keyframes bobble {
  0%,100% { transform: translate(-50%, 0); }
  50%     { transform: translate(-50%, 6px); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============ TOOLBAR (sticky) ============ */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(11,15,26,0.85);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.toolbar-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.toolbar .left, .toolbar .right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.counter {
  color: var(--text-dim);
  font-size: 14px;
  padding-inline-start: 8px;
  border-inline-start: 1px solid var(--border);
  margin-inline-start: 4px;
}
.counter span {
  color: var(--brand);
  font-weight: 700;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  background: transparent;
  color: var(--text);
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease;
  user-select: none;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { flex-shrink: 0; }
.btn.ghost { background: rgba(255,255,255,0.04); }
.btn.ghost:hover { background: rgba(255,255,255,0.08); }
.btn.outline { background: rgba(255,255,255,0.02); }
.btn.outline:hover { border-color: rgba(255,255,255,0.2); background: rgba(255,255,255,0.06); }
.btn.primary {
  background: linear-gradient(135deg, var(--brand) 0%, #ff5e00 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 20px -6px rgba(255,122,24,0.6);
}
.btn.primary:hover {
  box-shadow: 0 10px 28px -6px rgba(255,122,24,0.75);
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* ============ GALLERY ============ */
.gallery {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 16px 60px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px;
}
@media (min-width: 768px) {
  .gallery { gap: 14px; padding: 36px 24px 80px; }
}
@media (min-width: 1100px) {
  .gallery { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
}

.tile {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card);
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  isolation: isolate;
}
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  box-shadow: inset 0 0 0 0 transparent;
  transition: box-shadow 0.2s ease;
  pointer-events: none;
}
.tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease, opacity 0.4s ease;
  opacity: 0;
}
.tile img.loaded { opacity: 1; }
.tile:hover { transform: translateY(-2px); }
.tile:hover img { transform: scale(1.06); }
.tile:hover::after { box-shadow: inset 0 0 0 2px rgba(255,255,255,0.18); }

.tile .check {
  position: absolute;
  top: 10px;
  inset-inline-start: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  border: 2px solid rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  color: transparent;
  transition: all 0.18s ease;
  backdrop-filter: blur(4px);
  z-index: 2;
}
.tile:hover .check {
  background: rgba(0,0,0,0.65);
  border-color: #fff;
}
.tile.selected .check {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(255,122,24,0.25);
}
.tile.selected {
  transform: translateY(-2px) scale(0.98);
}
.tile.selected::after {
  box-shadow: inset 0 0 0 3px var(--brand);
}

/* ============ FOOTER ============ */
.foot {
  text-align: center;
  padding: 30px 16px 60px;
  color: var(--muted);
  font-size: 13px;
}

/* ============ LIGHTBOX ============ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.96);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.lightbox.open { display: flex; animation: lbFade 0.25s ease; }
@keyframes lbFade { from { opacity: 0; } to { opacity: 1; } }

.lb-img-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 60px 80px;
  overflow: hidden;
}
.lb-img-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.7);
}
.lb-close, .lb-prev, .lb-next {
  position: absolute;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
  backdrop-filter: blur(6px);
}
.lb-close:hover, .lb-prev:hover, .lb-next:hover {
  background: rgba(255,255,255,0.16);
  transform: scale(1.08);
}
.lb-close { top: 20px; inset-inline-end: 20px; }
/* In RTL, "prev" = right side, "next" = left side */
.lb-prev { top: 50%; inset-inline-end: 20px; transform: translateY(-50%); }
.lb-next { top: 50%; inset-inline-start: 20px; transform: translateY(-50%); }
.lb-prev:hover, .lb-next:hover { transform: translateY(-50%) scale(1.08); }
.lb-bar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 18px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  border-radius: 999px;
}
.lb-counter {
  color: var(--text-dim);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.lb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(255,255,255,0.05);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  transition: all 0.15s ease;
}
.lb-toggle:hover { background: rgba(255,255,255,0.12); }
.lb-toggle.selected {
  background: var(--brand);
  border-color: var(--brand);
}

@media (max-width: 640px) {
  .lb-img-wrap { padding: 50px 12px 90px; }
  .lb-close { top: 12px; inset-inline-end: 12px; width: 42px; height: 42px; }
  .lb-prev { inset-inline-end: 8px; }
  .lb-next { inset-inline-start: 8px; }
  .lb-prev, .lb-next { width: 42px; height: 42px; }
}

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card-2);
  color: #fff;
  padding: 14px 22px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.25s ease;
  z-index: 200;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============ DOWNLOAD MODAL ============ */
.download-modal {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 16, 0.85);
  backdrop-filter: blur(6px);
  z-index: 150;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.download-modal.open { display: flex; animation: lbFade 0.2s ease; }
.dm-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 36px 28px 24px;
  text-align: center;
  max-width: 360px;
  width: 100%;
  box-shadow: var(--shadow);
}
.dm-card h3 {
  margin: 18px 0 8px;
  font-size: 20px;
  font-weight: 700;
}
.dm-card p {
  margin: 0 0 22px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
}
.dm-spinner {
  width: 56px;
  height: 56px;
  border: 4px solid rgba(255,122,24,0.2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }
.dm-card.done .dm-spinner {
  border: 4px solid var(--success);
  border-radius: 50%;
  animation: none;
  position: relative;
}
.dm-card.done .dm-spinner::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--success);
}

/* ============ MOBILE TWEAKS ============ */
@media (max-width: 600px) {
  :root { --hero-h: 72vh; }
  .hero h1 { letter-spacing: -1px; }
  .toolbar-inner { padding: 12px 16px; gap: 10px; }
  .toolbar .left, .toolbar .right { gap: 6px; }
  .btn { padding: 9px 14px; font-size: 13px; }
  .btn.outline span { display: none; } /* keep icon only on mobile */
  .counter { font-size: 13px; padding-inline-start: 6px; }
}
