/* ================================================
   service.css — MOBILE FIXED VERSION
   Laptop/Tablet view unchanged. Mobile fully fixed.
   ================================================ */

:root {
  --bg:        #f4f6f8;
  --white:     #ffffff;
  --ink:       #111827;
  --navy:      #0f1f38;
  --navy2:     #172d4e;
  --accent:    #d4261e;
  --accent-lt: #f04040;
  --gold:      #c8930a;
  --muted:     #6b7280;
  --border:    #e2e8f0;
  --ff-h:      'Rajdhani', sans-serif;
  --ff-b:      'Nunito Sans', sans-serif;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.08);
  --shadow-md: 0 8px 28px rgba(0,0,0,.13);
  --radius:    8px;
  --transition: .28s ease;
}

/* ------------------------------------------------
   SITE MAIN
   ------------------------------------------------ */
.site-main { padding: 48px 0 64px; }

.layout-grid {
  display: grid;
  gap: 32px;
  align-items: start;
}

/* ------------------------------------------------
   PAGE BANNER
   ------------------------------------------------ */
.page-banner {
  background: var(--navy);
  position: relative;
  padding: 56px 0 48px;
  overflow: hidden;
}
.page-banner::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 40px 40px;
}
.page-banner::after {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
}
.page-banner h1 {
  font-family: var(--ff-h);
  font-size: clamp(36px, 6vw, 64px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--white);
  position: relative;
  z-index: 1;
  padding-left: 24px;
  border-left: none;
}
.page-banner h1::before {
  content: 'SERVICES';
  position: absolute;
  right: 0; top: 50%;
  transform: translateY(-50%);
  font-size: clamp(60px, 10vw, 120px);
  font-weight: 700;
  color: rgba(255,255,255,.04);
  letter-spacing: 4px;
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

/* ------------------------------------------------
   SERVICE IMAGES (side-by-side grid, top of page)
   ------------------------------------------------ */
.service-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 44px;
}

/* ------------------------------------------------
   IMAGE WRAP — shared by service-images & service-row
   ------------------------------------------------ */
.img-wrap {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  /* FIX: use width:100% + min-height instead of aspect-ratio alone
     so image never overflows its column */
  width: 100%;
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow-md);
  /* Prevent the wrap itself from shrinking below content */
  min-width: 0;
}
.img-wrap img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform .5s ease;
}
.img-wrap:hover img {
  transform: scale(1.06);
}
.img-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(15,31,56,.85) 0%,
    rgba(15,31,56,.1) 55%,
    transparent 100%
  );
  display: flex;
  align-items: flex-end;
  padding: 18px 20px;
  opacity: 0;
  transition: opacity var(--transition);
}
.img-wrap:hover .img-overlay { opacity: 1; }
.img-overlay span {
  font-family: var(--ff-h);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--white);
}

/* ------------------------------------------------
   SERVICE DETAILS — ZIG-ZAG ROWS
   ------------------------------------------------ */
.service-details {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-bottom: 40px;
}

.service-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  align-items: center;
  /* FIX: ensure children can never overflow the row */
  min-width: 0;
}

/* Reverse: flip column order without rtl trick (rtl causes text direction bugs on mobile) */
.service-row.reverse {
  /* Use column-reverse on the grid children instead of direction:rtl */
  direction: ltr; /* always ltr — safe */
}
.service-row.reverse .img-wrap  { order: 2; }
.service-row.reverse .service-content { order: 1; }

/* ------------------------------------------------
   SERVICE CONTENT TEXT
   ------------------------------------------------ */
.service-content {
  /* FIX: prevent text block from overflowing */
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}
.service-content h3 {
  font-size: 28px;
  color: var(--navy);
  margin-bottom: 10px;
  font-family: var(--ff-h);
  text-transform: uppercase;
}
.service-content p {
  font-size: 20px;
  color: var(--ink);
  line-height: 1.7;
  margin-bottom: 12px;
}
.service-content p:last-child { margin-bottom: 0; }

/* ------------------------------------------------
   MARKETS WE SERVE
   ------------------------------------------------ */
.markets-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 36px 36px 32px;
  /* FIX: was margin:32px which caused horizontal overflow */
  margin: 0 0 32px 0;
  border-top: 4px solid var(--primary);
}
.markets-section h2 {
  font-family: var(--ff-h);
  font-size: 26px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--navy);
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}
.markets-section h2::before {
  content: '';
  display: block;
  width: 4px; height: 26px;
  background: var(--primary);
  border-radius: 2px;
  flex-shrink: 0;
}
.markets-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 32px;
}
.markets-cols li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 14.5px;
  font-weight: 400;
  color: var(--ink);
  border-bottom: 1px dashed var(--border);
  transition: color var(--transition), padding-left var(--transition);
  cursor: default;
}
.markets-cols li:last-child { border-bottom: none; }
.markets-cols li i {
  font-size: 10px;
  color: var(--primary);
  flex-shrink: 0;
  transition: transform var(--transition);
}
.markets-cols li:hover { color: var(--primary); padding-left: 6px; }
.markets-cols li:hover i { transform: translateX(3px); }

/* ------------------------------------------------
   CTA SECTION
   ------------------------------------------------ */
.cta-section {
  background: var(--navy);
  padding: 60px 0;
  text-align: center;
}
.cta-content h2 {
  font-family: var(--ff-h);
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: 12px;
}
.cta-content p {
  font-size: 16px;
  color: #94a3b8;
}

/* ================================================
   TABLET  768px – 1024px
   ================================================ */
@media (min-width: 768px) and (max-width: 1024px) {
  .service-content p {
    font-size: 16px;
  }
}

/* ================================================
   MOBILE  ≤ 767px  — ALL FIXES HERE
   ================================================ */
@media (max-width: 767px) {

  /* Banner */
  .page-banner {
    padding: 40px 0 36px;
  }
  /* Hide overflow ghost text on very small screens */
  .page-banner h1::before {
    display: none;
  }

  /* Site main breathing room */
  .site-main {
    padding: 28px 0 48px;
  }

  /* Container full-width safety */
  .container {
    padding: 0 16px;
  }

  /* ── SERVICE IMAGES (top 2 images) ──
     Stack them vertically, full width */
  .service-images {
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 28px;
  }

  /* ── IMAGE WRAP ──
     Remove fixed aspect-ratio; let height be natural */
  .img-wrap {
    aspect-ratio: 16 / 9; /* wider ratio looks better stacked */
    width: 100%;
  }

  /* ── SERVICE ROW (zig-zag) ──
     Single column, image on top, text below */
  .service-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* ── REVERSE ROW ──
     Reset order so image still comes first on mobile */
  .service-row.reverse .img-wrap    { order: 0; }
  .service-row.reverse .service-content { order: 1; }

  /* ── SERVICE CONTENT TEXT ── */
  .service-content {
    padding: 0;
  }
  .service-content h3 {
    font-size: 22px;
    margin-bottom: 8px;
  }
  .service-content p {
    font-size: 14.5px;
    line-height: 1.65;
  }

  /* ── MARKETS SECTION ──
     Single column list, tighter padding */
  .markets-section {
    padding: 24px 20px 20px;
    margin: 0 0 24px 0;
  }
  .markets-section h2 {
    font-size: 20px;
    margin-bottom: 16px;
  }
  .markets-cols {
    grid-template-columns: 1fr; /* single column on mobile */
    gap: 0;
  }

  .markets-cols ul:first-child{
    margin-bottom: 0; 
    padding-bottom: 0;
  }

  .markets-cols ul:last-child{
    margin-top: 0; 
    padding-top: 0;
  }

  .markets-cols ul:first-child li:last-child{
    border-bottom: 1px dashed var(--border);
  }

  .markets-cols li {
    font-size: 14px;
    padding: 9px 0;
  }

  /* ── SERVICE DETAILS gap ── */
  .service-details {
    gap: 28px;
  }

  /* ── CTA ── */
  .cta-section {
    padding: 40px 0;
  }
  .cta-content h2 {
    font-size: 22px;
  }
  .cta-content p {
    font-size: 14px;
  }
}

/* ================================================
   EXTRA SMALL  ≤ 400px
   ================================================ */
@media (max-width: 400px) {
  .img-wrap {
    aspect-ratio: 3 / 2;
  }
  .markets-section {
    padding: 20px 14px 16px;
  }
  .service-content p {
    font-size: 13.5px;
  }
}

/* Make the li clickable looking */
.market-item {
  cursor: pointer;
  user-select: none;
}

/* Highlight the active / clicked item */
.market-item.active {
  color: var(--accent);
  padding-left: 6px;
  font-weight: 600;
}
.market-item.active i {
  color: var(--accent);
  transform: translateX(3px) rotate(90deg); /* arrow points down when open */
}

/* The image panel — sits between li and next li in the DOM */
.market-image-panel {
  display: none;           /* hidden by default */
  width: 100%;
  overflow: hidden;
  border-radius: var(--radius);
  margin: 0;
  max-height: 0;
  transition: max-height 0.35s ease, margin 0.35s ease;
}

/* When open */
.market-image-panel.open {
  display: block;
  max-height: 400px;       /* enough for any image */
  margin: 8px 0 4px;
}

.market-image-panel img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: var(--radius);
  display: block;
  box-shadow: var(--shadow-md);
  /* Fade-in effect */
  animation: panelFadeIn 0.3s ease both;
}

@keyframes panelFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* On desktop — panels work in both columns equally */
/* On mobile (single column) — same behaviour, full width */
@media (max-width: 767px) {
  .market-image-panel.open {
    max-height: 300px;
  }
  .market-image-panel img {
    height: 180px;
  }
}
