:root {
  --red: #c8102e;
  --black: #0b0b0b;
  --muted: #7a7f85;
  --bg: #f7f7f8;
  --card: #ffffff;
  --radius: 22px;
  --container: 1200px;
  --ease: cubic-bezier(.2,.9,.2,1);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color-scheme: light;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout */
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: linear-gradient(180deg, var(--bg), #ffffff); color: var(--black); line-height: 1.55; }
.container { max-width: var(--container); margin: 0 auto; padding: 0 22px; }

/* Preloader */
.preloader { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: #fff; z-index: 9999; }
.prelogo { width: 84px; opacity: .95; transition: transform .5s var(--ease); }

/* Header */
.site-header { position: sticky; top: 12px; z-index: 80; backdrop-filter: blur(9px); background: linear-gradient(180deg, rgba(255,255,255,0.86), rgba(255,255,255,0.6)); border-radius: 18px; box-shadow: 0 10px 50px rgba(15,15,15,0.06); padding: 10px 12px; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 18px; max-width: var(--container); margin: 0 auto; padding: 10px 40px; }
.brand { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.logo { width: 65px; height: 65px; object-fit: contain; border-radius: 20px; }
.brand-text { display: flex; flex-direction: column; }
.site-title { font-weight: 800; font-size: 1.05rem; }
.site-sub { font-size: .78rem; color: var(--muted); }

/* Nav */
.nav { display: flex; gap: 16px; align-items: center; }
.nav-link { color: var(--muted); text-decoration: none; padding: 15px 22px; border-radius: 20px; transition: all .22s var(--ease); font-weight: 600; }
.nav-link:hover { color: var(--black); background: rgba(200,200,200,0.06); transform: translateY(-3px); }

/* Header actions */
.header-actions { display: flex; align-items: center; gap: 10px; }
.lang-toggle { background: transparent; border: 1px solid #eee; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-weight: 700; transition: all .22s var(--ease); }
.lang-toggle:hover { transform: translateY(-3px); }
.burger { display: none; background: transparent; border: 0; cursor: pointer; padding: 8px; }
.burger span { display: block; width: 25px; height: 3px; background: #111; margin: 6px 0; border-radius: 4px; }

/* Hero */
.hero { position: relative; padding: 72px 0 64px; overflow: hidden; background: linear-gradient(180deg, #ffffff, #f9f9f9); }
.hero-overlay { position: absolute; inset: 0; background: radial-gradient(400px 200px at 10% 20%, rgba(200,16,46,0.06), transparent 20%), linear-gradient(180deg, rgba(255,255,255,0.2), transparent 30%); pointer-events: none; }
.hero-grid { display: grid; grid-template-columns: 1fr 400px; gap: 36px; align-items: center; }
.hero-copy { max-width: 70%; }
.hero-title { font-size: 2.2rem; line-height: 1.03; margin: 0 0 12px; font-weight: 1000; }
.hero-lead { color: var(--muted); margin: 0 0 20px; }
.hero-cta { display: flex; gap: 12px; }
.btn { display: inline-block; padding: 12px 18px; border-radius: 12px; text-decoration: none; cursor: pointer; font-weight: 1000; transition: transform .22s var(--ease), box-shadow .22s var(--ease); }
.primary { background: var(--red); color: #fff; box-shadow: 0 12px 26px rgba(200,16,46,0.14); }
.primary:hover { transform: translateY(-6px); box-shadow: 0 18px 40px rgba(200,16,46,0.18); }
.ghost { background: transparent; border: 1px solid rgba(0,0,0,0.06); color: var(--black); }
.hero-features { display: flex; gap: 12px; margin-top: 18px; list-style: none; padding: 0; }
.chip { background: #fff; padding: 12px 12px; border-radius: 999px; box-shadow: 0 6px 18px rgba(15,15,15,0.04); font-weight: 600; color: var(--muted); }

/* Media */
.media-card { border-radius: 16px; overflow: hidden; box-shadow: 0 20px 60px rgba(10,10,10,0.08); position: relative; }
.media-img { width: 100%; height: auto; max-height: 320px; object-fit: cover; display: block; }
.media-badge { position: absolute; left: 14px; bottom: 14px; background: rgba(0,0,0,0.6); color: #fff; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: .9rem; }

/* Sections */
.section { padding: 64px 0; }
.white { background: transparent; }
.gray { background: linear-gradient(180deg, #fafafa, #fff); }
.section-title { font-size: 1.10rem; margin-bottom: 18px; font-weight: 800; }

/* About */
.section-grid { display: grid; grid-template-columns: 1fr 400px; gap: 30px; align-items: center; }
.about-card { padding: 10px; border-radius: 10px; }
.stats { display: flex; gap: 6px; margin-top: 6px; }
.stat { background: linear-gradient(180deg, #fff, #fff); padding: 6px; border-radius: 6px; min-width: 80px; box-shadow: 0 6px 20px rgba(8,8,8,0.04); text-align: center; }
.stat-num { font-size: 1.0rem; font-weight: 700; color: var(--red); }
.stat-label { color: var(--muted); font-weight: 400; }

/* Services */
.services-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 18px; margin-top: 10px; }
.service { background: var(--card); padding: 20px; border-radius: 20px; box-shadow: 0 20px 36px rgba(10,10,10,0.04); transition: transform .22s var(--ease); }
.service:hover { transform: translateY(-8px); }

/* Projects */
.projects-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 18px; margin-top: 12px; }
.project-card { border-radius: 20px; overflow: hidden; background: var(--card); box-shadow: 0 12px 36px rgba(10,10,10,0.05); }
.project-card img { width: 100%; height: 400px; object-fit: cover; }
.project-body { padding: 15px; }

/* Contact */
.contact-grid { display: grid; grid-template-columns: 420px 1fr; gap: 26px; align-items: start; }
.contact-panel { background: #fff; padding: 22px; border-radius: 12px; box-shadow: 0 10px 36px rgba(10,10,10,0.04); }
.contact-actions { display: flex; gap: 12px; margin-top: 12px; }
.contact-form { background: var(--card); padding: 20px; border-radius: 12px; box-shadow: 0 12px 36px rgba(10,10,10,0.04); }
.contact-form input, .contact-form textarea { width: 100%; padding: 12px; border-radius: 10px; border: 1px solid #f0f0f0; margin-top: 10px; font-size: 1rem; }

/* Social Icons */
.socials a { text-decoration: none; color: var(--muted); font-weight: 600; }
.socials a i { margin-right: 6px; color: var(--red); transition: color 0.25s ease; }
.socials a:hover i { color: #000; }

/* Footer */
.site-footer { padding: 24px 0; border-top: 1px solid #f0f0f0; background: transparent; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .95rem; }

/* Back to top */
.back-top { position: fixed; right: 18px; bottom: 18px; background: var(--black); color: #fff; border-radius: 10px; padding: 10px 12px; border: none; cursor: pointer; box-shadow: 0 10px 30px rgba(10,10,10,0.18); display: none; z-index: 100; }

/* Reveal animation */
.reveal { opacity: 0; transform: translateY(18px) scale(.995); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.active { opacity: 1; transform: none; }

/* Motion-only append — preserves all colors/layout, only adds more polished animations */

/* Respect users' motion preferences */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Gentle global micro-motion for interactive polish (no color changes) */
* {
  will-change: transform, opacity, filter;
  transition-property: transform, opacity, box-shadow, filter;
  transition-duration: 240ms;
  transition-timing-function: var(--ease);
}

/* Reveal animation (improved variant, keeps existing .reveal behavior) */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(22px) scale(.997); }
  60%  { opacity: 1; transform: translateY(-6px) scale(1.001); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.reveal { opacity: 0; transform: translateY(18px) scale(.995); }
.reveal.active { animation: fadeUp 700ms var(--ease) both; }

/* Stagger helpers: use nth-child where possible to give cascading reveals */
.container .reveal:nth-child(1)  { animation-delay: 0ms;  }
.container .reveal:nth-child(2)  { animation-delay: 80ms; }
.container .reveal:nth-child(3)  { animation-delay: 160ms; }
.container .reveal:nth-child(4)  { animation-delay: 240ms; }
.container .reveal:nth-child(5)  { animation-delay: 320ms; }
.container .reveal:nth-child(6)  { animation-delay: 400ms; }

/* Hero micro-animations */
.hero-title { transition: transform 540ms var(--ease), opacity 540ms var(--ease); }
.hero-title.revealed { transform: translateY(0); opacity: 1; }

/* Type-cursor polish if used */
.type-cursor { animation: blink 900ms steps(2) infinite; }
@keyframes blink { 0%,60% { opacity: 1 } 61%,100% { opacity: 0 } }

/* Floating media card: gentle slow float + hover lift */
@keyframes floatSlow { 0% { transform: translateY(0) } 50% { transform: translateY(-10px) } 100% { transform: translateY(0) } }
.hero-media .media-card { animation: floatSlow 7.5s ease-in-out infinite; transform-origin: center; }
.hero-media .media-card:hover { transform: translateY(-8px) scale(1.02); box-shadow: 0 42px 84px rgba(10,10,10,0.08); }

/* Hero chips entrance staggering */
.hero-features .chip { opacity: 0; transform: translateY(8px) scale(.995); }
.hero-features .chip:nth-child(1).active { animation: fadeUp .56s var(--ease) both; animation-delay: 120ms; }
.hero-features .chip:nth-child(2).active { animation: fadeUp .56s var(--ease) both; animation-delay: 220ms; }
.hero-features .chip:nth-child(3).active { animation: fadeUp .56s var(--ease) both; animation-delay: 320ms; }

/* Buttons: subtle hover lift + pressed feedback */
.btn { transition-duration: 220ms; transition-timing-function: cubic-bezier(.2,.9,.25,1); }
.btn:hover { transform: translateY(-4px) scale(1.01); box-shadow: 0 18px 40px rgba(0,0,0,0.06); }
.btn:active { transform: translateY(0) scale(.995); }

/* Nav link underline slide (motion only) */
.nav-link { position: relative; overflow: visible; }
.nav-link::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 8px;
  height: 2px;
  background: rgba(200,16,46,0.12); /* keeps color tone but very subtle */
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 320ms var(--ease), opacity 220ms var(--ease);
  opacity: 0;
  border-radius: 2px;
}
.nav-link:hover::after, .nav-link:focus::after { transform: scaleX(1); opacity: 1; }

/* Services and project cards entrance pop */
.service, .project-card { transform-origin: center; will-change: transform, opacity; }
.service.active, .project-card.active { animation: fadeUp 640ms var(--ease) both; }

/* Stat numbers pulse in with scale */
@keyframes popIn { from { opacity: 0; transform: scale(.92); } 70% { transform: scale(1.06); } to { opacity:1; transform: scale(1); } }
.stat-num { display: inline-block; }
.stat-num.animated { animation: popIn 700ms var(--ease) both; }

/* Back-to-top smoother reveal (no color change) */
.back-top { transition: opacity 280ms var(--ease), transform 280ms var(--ease); opacity: 0; transform: translateY(8px); pointer-events: none; }
.back-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* Tiny attention animation for contact actions */
.contact-actions .btn { transition: transform 360ms var(--ease); }
.contact-actions .btn:hover { transform: translateY(-6px) rotate(-0.2deg); }

/* Small decorative tilt on hover for images (keeps size/shape) */
.media-img { transition: transform 520ms var(--ease), filter 420ms var(--ease); }
.media-img:hover { transform: scale(1.01) rotate(-0.2deg); filter: saturate(1.03); }

/* Keep RTL behavior consistent with motion */
[dir="rtl"] .nav-link::after { left: auto; right: 14px; transform-origin: right center; }

/* Final safety: reduce motion intensity on small screens */
@media (max-width: 720px) {
  .hero-media .media-card { animation: none; }
  .hero-features .chip { transition: none; }
  .nav-link::after { display: none; }
}

/* Responsive */
@media (max-width: 1100px) {
  .hero-grid { grid-template-columns: 1fr; }
  .section-grid { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: repeat(2,1fr); }
  .projects-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .nav { display: none; }
  .burger { display: block; }
  .brand-text { display: none; }
  .logo { width: 48px; height: 48px; }
  .hero-title { font-size: 1.6rem; }
  .services-grid { grid-template-columns: 1fr; }
  .media-img { max-height: 280px; }
}

/* RTL adjustments */
:root[dir="rtl"] .nav-link { text-align: right; }
:root[dir="rtl"] .hero-features { direction: rtl; }
