/*
 * Quadrant Trading LLC — Styles
 * ==============================
 * Responsive, RTL-ready CSS for the bilingual landing page.
 *
 * Key design tokens:
 *   --navy:       #1B2F5E  (primary brand color)
 *   --navy-dark:  #111D3A  (darker shade for gradients/footer)
 *   --steel:      #B0BEC5  (light steel gray accent)
 *   --steel-light:#E8ECF0  (very light gray background)
 *   --white:      #FFFFFF
 *
 * Fonts:
 *   English — Barlow (headings), Inter (body)
 *   Arabic  — Cairo (headings + body, applied via .lang-ar on <body>)
 */

/* --------------------------------------------------------
   RESET & BASE
   -------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --navy: #1B2F5E;
  --navy-dark: #111D3A;
  --navy-medium: #263F73;
  --steel: #B0BEC5;
  --steel-light: #E8ECF0;
  --white: #FFFFFF;
  --text-dark: #1A1A2E;
  --text-muted: #555E6D;
  --success: #16A34A;
  --error: #DC2626;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.10);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.14);
  --transition: 0.3s ease;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background: var(--white);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Arabic font override — applied via JS when language is set to AR */
body.lang-ar {
  font-family: 'Cairo', sans-serif;
}

body.lang-ar h1,
body.lang-ar h2,
body.lang-ar h3,
body.lang-ar h4 {
  font-family: 'Cairo', sans-serif;
}

img {
  max-width: 100%;
  display: block;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition);
}

ul {
  list-style: none;
}

h1,
h2,
h3,
h4 {
  font-family: 'Barlow', sans-serif;
  font-weight: 700;
  line-height: 1.2;
}

/* --------------------------------------------------------
   CONTAINER
   -------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --------------------------------------------------------
   SECTION BASE
   -------------------------------------------------------- */
.section {
  padding: 80px 0;
}

.section-title {
  font-size: 2rem;
  color: var(--navy);
  text-align: center;
  margin-bottom: 16px;
  position: relative;
}

/* Decorative underline below section titles */
.section-title::after {
  content: '';
  display: block;
  width: 60px;
  height: 3px;
  background: var(--navy);
  margin: 12px auto 0;
  border-radius: 2px;
}

/* --------------------------------------------------------
   SCROLL ANIMATION
   Elements start invisible and slide up when they
   enter the viewport (handled by Intersection Observer).
   -------------------------------------------------------- */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------
   1. NAVIGATION BAR
   -------------------------------------------------------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  transition: box-shadow var(--transition);
}

/* Shadow appears when page is scrolled (class added via JS) */
.navbar.scrolled {
  box-shadow: var(--shadow-sm);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

/* Logo */
.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-text {
  font-family: 'Barlow', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--navy);
  letter-spacing: 2px;
}

.logo-img {
  max-width: 15%;
  height: auto;
  /* Add an absolute max for very wide screens */
  max-width: clamp(120px, 15vw, 200px);
}

/* Nav links list */
.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--text-dark);
  position: relative;
  padding: 4px 0;
}

/* Hover underline effect */
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--navy);
  transition: width var(--transition);
}

.nav-links a:hover::after {
  width: 100%;
}

/* Nav controls wrapper (lang toggle + hamburger) */
.nav-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Language toggle button */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 1.5px solid var(--navy);
  border-radius: 20px;
  background: transparent;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.825rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}

.lang-toggle:hover {
  background: var(--navy);
}

.lang-toggle:hover .lang-option,
.lang-toggle:hover .lang-separator {
  color: var(--white);
}

.lang-option {
  color: var(--text-muted);
  transition: color var(--transition);
}

.lang-separator {
  color: var(--steel);
  font-weight: 400;
}

.lang-option.lang-active {
  color: var(--navy);
}

.lang-toggle:hover .lang-option.lang-active {
  color: var(--white);
}

/* Hamburger — hidden on desktop */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.hamburger-line {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--navy);
  border-radius: 2px;
  transition: transform var(--transition), opacity var(--transition);
}

/* Hamburger open state — X shape */
.hamburger.open .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.open .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger.open .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* --------------------------------------------------------
   2. HERO
   -------------------------------------------------------- */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  background: var(--navy-dark);
  overflow: hidden;
}

/* Slideshow Container */
.hero-slideshow {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
}

.hero-slideshow img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* img 1 is solid in background, img 2 fades in and out over it. 
   6s total cycle: 3s per image (2s holding solid, 1s crossfading) */
.hero-slideshow img:nth-child(2) {
  opacity: 0;
  animation: heroCrossfade 6s infinite ease-in-out;
}

@keyframes heroCrossfade {

  0%,
  33.33% {
    opacity: 0;
  }

  50%,
  83.33% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

/* Dark overlay (for when a background image is added) */
.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(17, 29, 58, 0.55);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 120px 24px 80px;
  max-width: 800px;
  margin: 0 auto;
}

.hero h1 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  color: var(--white);
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.hero-sub {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: rgba(255, 255, 255, 0.82);
  max-width: 640px;
  margin: 0 auto 36px;
  line-height: 1.8;
}

.hero-cta {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------
   BUTTONS
   -------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  font-family: 'Barlow', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.03em;
}

body.lang-ar .btn {
  font-family: 'Cairo', sans-serif;
}

.btn-primary {
  background: var(--white);
  color: var(--navy);
  border-color: var(--white);
}

.btn-primary:hover {
  background: transparent;
  color: var(--white);
}

.btn-secondary {
  background: transparent;
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.5);
}

.btn-secondary:hover {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.1);
}

/* --------------------------------------------------------
   3. ABOUT
   -------------------------------------------------------- */
.about {
  background: var(--white);
}

.about-text {
  text-align: center;
  max-width: 740px;
  margin: 0 auto 48px;
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.9;
  padding-top: 24px;
}

.trust-badges {
  display: flex;
  justify-content: center;
  gap: 40px;
  flex-wrap: wrap;
}

.badge-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  flex: 0 1 220px;
}

.badge-icon {
  width: 36px;
  height: 36px;
  color: var(--navy);
}

.badge-item span {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
}

/* --------------------------------------------------------
   4. SERVICES
   -------------------------------------------------------- */
.services {
  background: var(--steel-light);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 48px;
}

.service-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 36px 28px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition);
}

.service-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
}

.service-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  color: var(--navy);
}

.service-icon svg {
  width: 100%;
  height: 100%;
}

.service-card h3 {
  font-size: 1.15rem;
  color: var(--navy);
  margin-bottom: 12px;
}

.service-card p {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.7;
}

.services-note {
  text-align: center;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 36px;
}

/* --------------------------------------------------------
   5. WHY US
   -------------------------------------------------------- */
.why-us {
  background: var(--white);
}

.why-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 32px;
  margin-top: 48px;
  max-width: 860px;
  margin-left: auto;
  margin-right: auto;
}

.why-item {
  padding: 28px;
  border-left: 3px solid var(--navy);
  background: var(--steel-light);
  border-radius: 0 var(--radius) var(--radius) 0;
  transition: transform var(--transition);
}

.why-item:hover {
  transform: translateX(4px);
}

.why-item h4 {
  font-size: 1.05rem;
  color: var(--navy);
  margin-bottom: 8px;
}

.why-item p {
  font-size: 0.925rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* RTL override: flip the accent border to the right side */
html[dir="rtl"] .why-item {
  border-left: none;
  border-right: 3px solid var(--navy);
  border-radius: var(--radius) 0 0 var(--radius);
}

html[dir="rtl"] .why-item:hover {
  transform: translateX(-4px);
}

/* --------------------------------------------------------
   6. CONTACT
   -------------------------------------------------------- */
.contact {
  background: var(--steel-light);
}

.contact-intro {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 48px;
  font-size: 1.05rem;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 48px;
  align-items: start;
}

/* Form */
.contact-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group-full {
  grid-column: 1 / -1;
}

.contact-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-dark);
}

.optional {
  font-weight: 400;
  color: var(--text-muted);
}

.contact-form input,
.contact-form select,
.contact-form textarea {
  padding: 12px 14px;
  border: 1.5px solid var(--steel);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 0.925rem;
  color: var(--text-dark);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

body.lang-ar .contact-form input,
body.lang-ar .contact-form select,
body.lang-ar .contact-form textarea {
  font-family: 'Cairo', sans-serif;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27, 47, 94, 0.08);
}

/* Validation error state */
.contact-form input:invalid:not(:placeholder-shown),
.contact-form select:invalid:not(:placeholder-shown) {
  border-color: var(--error);
}

.contact-form textarea {
  resize: vertical;
  min-height: 100px;
}

.btn-submit {
  grid-column: 1 / -1;
  padding: 14px 40px;
  background: var(--navy);
  color: var(--white);
  border: 2px solid var(--navy);
  font-size: 1rem;
  letter-spacing: 0.04em;
}

.btn-submit:hover {
  background: var(--navy-dark);
  border-color: var(--navy-dark);
}

/* Success message */
.form-success {
  display: none;
  grid-column: 1 / -1;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: #F0FDF4;
  border: 1px solid #BBF7D0;
  border-radius: var(--radius);
  color: var(--success);
}

.form-success.show {
  display: flex;
}

.form-success svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.form-success p {
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Contact details sidebar */
.contact-details {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.contact-detail-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.contact-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.contact-detail-item strong {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.contact-detail-item a,
.contact-detail-item span {
  font-size: 0.925rem;
  color: var(--navy);
  font-weight: 500;
}

.contact-detail-item a:hover {
  color: var(--navy-medium);
}

/* --------------------------------------------------------
   7. FOOTER
   -------------------------------------------------------- */
.footer {
  background: var(--navy-dark);
  color: rgba(255, 255, 255, 0.7);
  padding: 40px 0 28px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.footer-logo .logo-text {
  color: var(--white);
  font-size: 1.25rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.footer-links a {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.65);
  transition: color var(--transition);
}

.footer-links a:hover {
  color: var(--white);
}

.footer-social svg {
  width: 20px;
  height: 20px;
  fill: rgba(255, 255, 255, 0.65);
  transition: fill var(--transition);
}

.footer-social:hover svg {
  fill: var(--white);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.825rem;
}

.footer-license {
  color: rgba(255, 255, 255, 0.45);
}

/* --------------------------------------------------------
   RTL OVERRIDES
   Additional tweaks for right-to-left layout beyond
   the automatic mirroring from dir="rtl".
   -------------------------------------------------------- */
html[dir="rtl"] .nav-links a::after {
  left: auto;
  right: 0;
}

/* --------------------------------------------------------
   MOBILE RESPONSIVE
   -------------------------------------------------------- */

/* Tablet (≤ 900px) */
@media (max-width: 900px) {
  .services-grid {
    grid-template-columns: 1fr;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
  }

  .why-grid {
    grid-template-columns: 1fr;
    max-width: 480px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-form {
    grid-template-columns: 1fr;
  }
}

/* Mobile (≤ 768px) */
@media (max-width: 768px) {
  .section {
    padding: 56px 0;
  }

  .section-title {
    font-size: 1.6rem;
  }

  /* Nav: show hamburger, hide links by default */
  .hamburger {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--white);
    padding: 24px 0;
    gap: 0;
    box-shadow: var(--shadow-md);
    transform: translateY(-120%);
    opacity: 0;
    transition: transform 0.35s ease, opacity 0.35s ease;
    pointer-events: none;
    z-index: 999;
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
  }

  .nav-links a {
    display: block;
    padding: 14px 24px;
    font-size: 1rem;
  }

  .nav-links a::after {
    display: none;
  }

  /* Hero */
  .hero-content {
    padding: 100px 20px 60px;
  }

  .hero-cta {
    flex-direction: column;
    align-items: center;
  }

  .hero-cta .btn {
    width: 100%;
    max-width: 280px;
  }

  /* Footer */
  .footer-top {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }

  .footer-bottom {
    flex-direction: column;
    text-align: center;
  }
}

/* Small mobile (≤ 480px) */
@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .trust-badges {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }
}