:root {
  --primary: #0077B6;
  --primary-dark: #005a8c;
  --charcoal: #1F2937;
  --light-gray: #F7F8FA;
  --accent: #E67E22;
  --success: #22C55E;
  --dark-bg: #111827;
  --dark-surface: #1F2937;
  --dark-text: #F9FAFB;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Tajawal", system-ui, sans-serif;
}

* {
  scroll-behavior: smooth;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.75;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font);
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: 0;
}

html[dir="ltr"] h1,
html[dir="ltr"] h2 {
  letter-spacing: -0.02em;
}

p {
  line-height: 1.8;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

/* Section eyebrow labels */
.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.4;
  margin-bottom: 1rem;
  color: var(--primary);
}

html[dir="ltr"] .eyebrow {
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

html[dir="rtl"] .eyebrow {
  letter-spacing: 0.04em;
  text-transform: none;
}

/* Soften forced uppercase on Arabic pages */
html[dir="rtl"] .uppercase {
  text-transform: none;
  letter-spacing: 0.02em;
}

.eyebrow-light {
  color: rgba(255, 255, 255, 0.7);
}

.eyebrow-hero {
  color: rgba(255, 255, 255, 0.8);
  padding: 0.5rem 1rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(4px);
  margin-bottom: 0;
}

::selection {
  background-color: rgba(0, 119, 182, 0.2);
  color: inherit;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 0;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.dark ::-webkit-scrollbar-thumb {
  background: #4b5563;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

*:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

img {
  opacity: 1;
  transition: opacity 0.3s ease;
}

/* Reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(36px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  will-change: opacity, transform;
}

.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-48px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  will-change: opacity, transform;
}

.reveal-right {
  opacity: 0;
  transform: translateX(48px);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
  will-change: opacity, transform;
}

html[dir="rtl"] .reveal-left {
  transform: translateX(48px);
}

html[dir="rtl"] .reveal-right {
  transform: translateX(-48px);
}

.reveal-left.revealed,
.reveal-right.revealed {
  opacity: 1;
  transform: translateX(0);
}

.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.32s; }
.reveal-delay-5 { transition-delay: 0.4s; }
.reveal-delay-6 { transition-delay: 0.48s; }

/* Section entrance */
.section-animate {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
}

.section-animate.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.section-animate .section-head {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s var(--ease-out) 0.1s, transform 0.8s var(--ease-out) 0.1s;
}

.section-animate.is-visible .section-head {
  opacity: 1;
  transform: translateY(0);
}

/* Loading screen */
#loading-screen {
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-bar {
  animation: loader-slide 1.2s ease-in-out infinite;
}

@keyframes loader-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* Hero */
.hero-bg {
  will-change: transform;
}

.hero-content {
  transition: opacity 0.15s linear;
}

.hero-enter {
  opacity: 0;
  transform: translateY(28px);
  animation: fade-up 0.9s var(--ease-out) forwards;
}

.hero-enter-1 { animation-delay: 0.35s; }
.hero-enter-2 { animation-delay: 0.5s; }
.hero-enter-3 { animation-delay: 0.65s; }
.hero-enter-4 { animation-delay: 0.8s; }

@keyframes fade-up {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.scroll-chevron {
  animation: bob 1.6s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

/* Navigation */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: transparent;
  transform: translateY(-100%);
  animation: slide-down 0.55s var(--ease-out) 0.2s forwards;
  transition: background-color 0.35s ease, box-shadow 0.35s ease, backdrop-filter 0.35s ease;
}

.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.dark .site-header.is-scrolled {
  background: rgba(17, 24, 39, 0.92);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06);
}

@keyframes slide-down {
  to { transform: translateY(0); }
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  display: block;
  flex-shrink: 0;
}

.site-header.is-scrolled .brand-logo {
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.nav-link {
  position: relative;
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
  transition: color 0.25s ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: #fff;
}

.site-header.is-scrolled .nav-link {
  color: rgba(31, 41, 55, 0.72);
}

.site-header.is-scrolled .nav-link:hover,
.site-header.is-scrolled .nav-link.is-active {
  color: var(--primary);
}

.dark .site-header.is-scrolled .nav-link {
  color: rgba(255, 255, 255, 0.72);
}

.dark .site-header.is-scrolled .nav-link:hover,
.dark .site-header.is-scrolled .nav-link.is-active {
  color: var(--primary);
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0.85rem;
  right: 0.85rem;
  bottom: 0.2rem;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s var(--ease-out);
}

.nav-link:hover::after,
.nav-link.is-active::after {
  transform: scaleX(1);
}

.nav-icon-btn,
.nav-lang-btn {
  padding: 0.55rem;
  color: #fff;
  transition: color 0.25s ease;
}

.nav-lang-btn {
  padding: 0.45rem 0.7rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.nav-icon-btn:hover,
.nav-lang-btn:hover {
  color: var(--accent);
}

.site-header.is-scrolled .nav-icon-btn,
.site-header.is-scrolled .nav-lang-btn {
  color: var(--charcoal);
}

.dark .site-header.is-scrolled .nav-icon-btn,
.dark .site-header.is-scrolled .nav-lang-btn {
  color: #fff;
}

.site-header.is-scrolled .nav-icon-btn:hover,
.site-header.is-scrolled .nav-lang-btn:hover {
  color: var(--primary);
}

/* Mobile menu */
#mobile-menu {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#mobile-menu.closed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#mobile-drawer {
  transition: transform 0.3s var(--ease-out);
}

html[dir="ltr"] #mobile-drawer {
  transform: translateX(-100%);
}

html[dir="rtl"] #mobile-drawer {
  transform: translateX(100%);
}

#mobile-menu:not(.closed) #mobile-drawer {
  transform: translateX(0);
}

/* FAQ accordion */
.faq-answer {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
}

.faq-item.open .faq-answer {
  max-height: 300px;
  opacity: 1;
}

.faq-item .faq-icon-plus { display: block; }
.faq-item .faq-icon-minus { display: none; }
.faq-item.open .faq-icon-plus { display: none; }
.faq-item.open .faq-icon-minus { display: block; }

/* Quote modal */
#quote-modal {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#quote-modal.closed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#quote-dialog {
  transform: scale(0.95) translateY(20px);
  transition: transform 0.3s var(--ease-out);
}

#quote-modal:not(.closed) #quote-dialog {
  transform: scale(1) translateY(0);
}

/* Gallery lightbox */
#lightbox {
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#lightbox.closed {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#lightbox-img {
  animation: lightbox-in 0.3s var(--ease-out);
}

@keyframes lightbox-in {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Back to top */
#back-to-top {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.8);
  transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, background-color 0.3s ease;
}

#back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* Floating action buttons */
#whatsapp-float,
#call-float {
  opacity: 0;
  transform: scale(0.5);
  animation: scale-in 0.45s var(--ease-out) 1.5s forwards;
}

@keyframes scale-in {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.float-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  text-decoration: none;
}

.float-btn-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 9999px;
  color: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  transition: transform 0.25s var(--ease-out), background-color 0.25s ease, box-shadow 0.25s ease;
}

.float-btn:hover .float-btn-inner {
  transform: scale(1.08);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.28);
}

.float-btn:active .float-btn-inner {
  transform: scale(0.95);
}

/* WhatsApp pulse only */
#whatsapp-float .float-pulse {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: #25D366;
  z-index: 1;
  animation: float-pulse 2s ease-out infinite;
  pointer-events: none;
}

#whatsapp-float .float-pulse-delay {
  animation-delay: 1s;
}

@keyframes float-pulse {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  70% {
    transform: scale(1.75);
    opacity: 0;
  }
  100% {
    transform: scale(1.75);
    opacity: 0;
  }
}

/* Call ringing animation */
#call-float .call-wave {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  border: 2px solid var(--primary);
  background: transparent;
  z-index: 1;
  pointer-events: none;
  animation: call-wave 2.4s ease-out infinite;
}

#call-float .call-wave-delay {
  animation-delay: 1.2s;
}

@keyframes call-wave {
  0% {
    transform: scale(1);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

#call-float .call-icon {
  transform-origin: 50% 50%;
  animation: call-ringing 1.8s ease-in-out infinite;
}

@keyframes call-ringing {
  0%, 15%, 100% {
    transform: rotate(0deg);
  }
  2% {
    transform: rotate(14deg);
  }
  4% {
    transform: rotate(-14deg);
  }
  6% {
    transform: rotate(12deg);
  }
  8% {
    transform: rotate(-12deg);
  }
  10% {
    transform: rotate(8deg);
  }
  12% {
    transform: rotate(-6deg);
  }
  14% {
    transform: rotate(0deg);
  }
}

#call-float:hover .call-icon {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  #whatsapp-float .float-pulse,
  #call-float .call-wave,
  #call-float .call-icon {
    animation: none !important;
  }
}

/* Process line */
.process-line-fill {
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform 2s var(--ease-out);
}

html[dir="rtl"] .process-line-fill {
  transform-origin: right center;
}

.process-line-fill.revealed {
  transform: scaleX(1);
}

.process-square {
  transform: scale(0);
  transition: transform 0.5s var(--ease-out);
}

.process-square.revealed {
  transform: scale(1);
}

/* Map filter */
.map-frame {
  filter: grayscale(100%) contrast(1.1);
}

/* Floating position helpers for RTL/LTR */
html[dir="ltr"] .float-start {
  right: 1.5rem;
  left: auto;
}

html[dir="ltr"] .float-end {
  left: 1.5rem;
  right: auto;
}

html[dir="rtl"] .float-start {
  left: 1.5rem;
  right: auto;
}

html[dir="rtl"] .float-end {
  right: 1.5rem;
  left: auto;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
