:root {
  --bg-dark: #0b0f1a;
  --overlay: rgba(8, 12, 22, 0.55);
  --text: #eaf0ff;
  --muted: #b9c4e2;
  --accent1: #5ee7df;
  --accent2: #b490ca;
  --accent3: #ff7eb3;
  --success: #4ade80;
  --danger: #ff6b6b;
  --card: rgba(17, 23, 38, 0.75); /* #111726 with transparency */
  --glass: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.12);
  --shadow: 0 12px 40px rgba(0,0,0,0.35);
}

* { box-sizing: border-box }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Cairo", system-ui, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 600px at 20% 10%, #101528 0%, #0b0f1a 35%, #070a14 100%);
  overflow-x: hidden;
  min-height: 100vh;
}

#bgParticles {
  position: fixed;
  inset: 0;
  z-index: 0;
}

#confettiCanvas {
  position: fixed;
  inset: 0;
  z-index: 9999; /* طبقة علوية جداً */
  pointer-events: none; /* السماح بالنقر من خلالها */
}

.overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  backdrop-filter: none;
  z-index: 1;
}

.hero {
  min-height: 100vh;          /* ياخذ كامل ارتفاع الشاشة */
  display: flex;              /* باش نتحكم في التوسيط */
  flex-direction: column;     /* العناصر وحدة فوق وحدة */
  justify-content: center;    /* توسّط عمودي */
  align-items: center;        /* توسّط أفقي */
  text-align: center;         /* النصوص وسط */
  padding: 2rem;              /* مسافة داخلية */
  background: transparent;
  position: relative;
  z-index: 2;
}
 /* خلفية أنيقة */
img {
  max-width: 100%;   /* الصورة ما تتجاوزش عرض الحاوية */
  height: auto;      /* تحافظ على التناسب */
  border-radius: 12px; /* زوايا مدوّرة */
  box-shadow: 0 8px 20px rgba(0,0,0,0.35); /* ظل أنيق */
  transition: transform 0.3s ease, filter 0.3s ease;
}

img:hover {
  transform: scale(1.05);     /* تكبير بسيط عند المرور */
   filter: brightness(1.1);
    /* إضاءة خفيفة */
}

/* انفجار لوغو لطيف */
.logo-burst {
  position: absolute;
  top: 10vh;
  right: 8vw;
  width: 140px;
  height: 140px;
}
.burst-circle, .burst-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}
.burst-circle {
  background: radial-gradient(circle at 30% 30%, var(--accent1), transparent 60%);
  filter: blur(8px);
  animation: pulse 3s ease-in-out infinite;
}
.burst-ring {
  border: 2px solid var(--accent1);
  box-shadow: 0 0 15px rgba(94, 231, 223, 0.3);
  animation: ring 4s ease-in-out infinite;
}

.title {
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.15;
  letter-spacing: 0.5px;
  margin: 0 0 1rem;
  filter: drop-shadow(0 10px 25px rgba(94, 231, 223, 0.2));
}
.title-line { display: inline-block; margin: 0 0.2em; }
.letter {
  display: inline-block;
  transform: translateY(30px) scale(0.95);
  opacity: 0;
  animation: rise 0.8s cubic-bezier(.2,.7,.2,1) forwards;
}
.title-line .letter:nth-child(odd) { color: var(--accent1); }
.title-line .letter:nth-child(even) { color: var(--accent2); }
.title .accent { color: var(--accent3) }

.subtitle {
  max-width: 820px;
  margin: 0.75rem auto 2rem;
  color: var(--muted);
  font-size: clamp(1rem, 2.4vw, 1.25rem);
  opacity: 0;
  transform: translateY(10px);
  animation: fadeIn 0.9s ease 0.6s forwards;
}

/* عرض محاكاة التصغير */
.compress-showcase {
  width: min(100%, 980px);
  margin: 2rem auto;
  padding: 1rem 1.25rem;
  background: linear-gradient(180deg, var(--glass), transparent);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px) saturate(1.2);
}
.image-stack {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: center;
}
.image-card {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  transform-style: preserve-3d;
  box-shadow: 0 16px 30px rgba(0,0,0,0.35);
}
.image-card img {
  display: block;
  width: 100%;
  height: 260px;
  object-fit: cover;
  transition: filter 0.5s ease, transform 0.5s ease;
}
.image-card.original img { filter: contrast(1.05) saturate(1.15) }
.image-card.compressed img { filter: contrast(0.95) saturate(0.95) }
.image-card:hover img { transform: scale(1.03) }

.badge {
  position: absolute;
  bottom: 10px; left: 10px;
  background: rgba(11, 15, 26, 0.7);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.9rem;
  backdrop-filter: blur(6px);
}
.badge.success { color: var(--success) }

.arrow {
  font-size: 2rem;
  color: var(--accent1);
  filter: drop-shadow(0 6px 16px rgba(94, 231, 223, 0.45));
  animation: bounceX 1.8s ease-in-out infinite;
}

.cta-group {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin: 1rem 0 0.5rem;
  flex-wrap: wrap;
}
.cta {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  padding: 12px 18px;
  border-radius: 12px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}
.cta.primary {
  background: linear-gradient(120deg, var(--accent1), var(--accent3));
  color: #09101f;
  box-shadow: 0 12px 30px rgba(255, 126, 179, 0.35);
}
.cta.primary:hover { transform: translateY(-2px) scale(1.02) }
.cta.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.cta.ghost:hover { background: rgba(255,255,255,0.06) }

/* كاتب آلي */
.typewriter {
  margin-top: 1.2rem;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  color: var(--muted);
  min-height: 1.6em;
}
.cursor {
  display: inline-block;
  margin-inline-start: 4px;
  color: var(--accent3);
  animation: blink 1s step-end infinite;
}

/* تلميحات وصول */
.a11y-hints {
  position: fixed;
  bottom: 12px; right: 12px;
  font-size: 0.9rem;
  color: var(--muted);
  z-index: 3;
  opacity: 0.9;
}

/* --- تحسينات التجاوب (Responsive) --- */

@media (max-width: 768px) {
  .hero {
    padding: 4rem 1.5rem 2rem; /* زيادة المسافة العلوية */
    justify-content: flex-start;
    min-height: auto;
  }
}

@media (max-width: 820px) {
  .logo-burst { display: none }
  .image-stack {
    grid-template-columns: 1fr;
  }
  .arrow { display: none }
  .image-card img { height: auto; aspect-ratio: 16/9; }
}

@media (max-width: 480px) {
  .hero { padding: 3rem 1rem; }
  .title { font-size: 2rem; }
  img { border-radius: 8px; }
}

/* Animations */
@keyframes rise {
  0% { opacity: 0; transform: translateY(30px) scale(0.95) }
  100% { opacity: 1; transform: translateY(0) scale(1) }
}
@keyframes fadeIn {
  to { opacity: 1; transform: translateY(0) }
}
@keyframes pulse {
  0%, 100% { transform: scale(0.95); opacity: 0.7 }
  50% { transform: scale(1.15); opacity: 1 }
}
@keyframes ring {
  0%, 100% { transform: scale(0.9); opacity: 0.6 }
  50% { transform: scale(1.1); opacity: 1 }
}
@keyframes bounceX {
  0%, 100% { transform: translateX(0) }
  50% { transform: translateX(6px) }
}
@keyframes blink {
  0%, 100% { opacity: 0 }
  50% { opacity: 1 }
}

/* --- تنسيقات صفحة الضغط (New) --- */
.upload-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3rem 2rem;
  width: min(100%, 700px);
  text-align: center;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  position: relative;
  z-index: 2;
}

.upload-area {
  border: 2px dashed var(--accent1);
  border-radius: 16px;
  padding: 3rem 1rem;
  margin: 1rem 0 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(94, 231, 223, 0.03);
}
.upload-area:hover {
  background: rgba(94, 231, 223, 0.08);
  transform: translateY(-2px);
}
.icon-upload {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.file-list {
  margin-bottom: 1.5rem;
  color: var(--success);
}

/* --- شريط التقدم (Progress Bar) --- */
.progress-container {
  margin-top: 2rem;
  width: 100%;
  text-align: center;
}
.progress-bar {
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
  position: relative;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent1), var(--accent3));
  width: 0%;
  transition: width 0.1s linear;
  box-shadow: 0 0 12px var(--accent1);
}