/* Custom Homepage Styling for BESTEC Marine Engineering */

:root {
  --primary-navy: #092a4b;
  --primary-blue: #1c64a1;
  --accent-blue: #22b6ef;
  --accent-red: #e30613;
  --accent-gold: #ffc107;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --bg-light: #f8fafc;

  /* iOS Safe Area Insets for iPhone 16 / Dynamic Island & Home Indicator Support */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
}

html {
  box-sizing: border-box;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: clip;
  max-width: 100vw;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text-dark);
  background-color: #ffffff;
  overflow-x: clip;
  max-width: 100vw;
  width: 100%;
  margin: 0;
  padding: 0;
  /* Support iPhone 16 landscape safe side paddings */
  padding-left: var(--sal);
  padding-right: var(--sar);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Header & Topbar - Dynamic Safe Area for Dynamic Island Notch */
header {
  width: 100%;
  background-color: #07223d;
  padding-top: var(--sat);
  /* Dynamic Island top inset padding */
}

.top-bar-bg {
  background-color: #092a4b;
}

/* Navigation bar sticky safe positioning */
nav.sticky {
  position: sticky;
  top: 0;
  z-index: 50;
}

.nav-link {
  position: relative;
  font-weight: 500;
  transition: color 0.2s ease;
  min-height: 44px;
  /* Accessible touch target */
  display: inline-flex;
  align-items: center;
}

.nav-link:hover,
.nav-link.active {
  color: #1c64a1;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0.25rem;
  right: 0.25rem;
  height: 2px;
  background-color: #1c64a1;
  border-radius: 2px;
}

/* Dropdown Menu */
.nav-dropdown {
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.group:hover .nav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* Touch Target Minimum Standard (44x44 points for mobile accessibility) */
.touch-target,
#mobile-menu-btn,
.filter-btn,
#backToTopBtn,
#whatsappFloatingBtn,
.material-tag {
  min-width: 44px;
  min-height: 44px;
}

/* Hero Section with Dynamic Viewport Height (100dvh for iOS Safari) */
.home-hero-section {
  position: relative;
  min-height: calc(85dvh - var(--sat));
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #092a4b;
  overflow: hidden;
}

.hero-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  opacity: 0;
  transition: opacity 1.2s ease-in-out, transform 7s ease-out;
  transform: scale(1.05);
}

.hero-slide.active {
  opacity: 1;
  transform: scale(1);
}

.home-hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(9, 42, 75, 0.88) 0%, rgba(9, 42, 75, 0.65) 60%, rgba(0, 0, 0, 0.75) 100%);
  z-index: 2;
}

.home-hero-content {
  position: relative;
  z-index: 10;
  text-align: center;
}

.home-hero-title {
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  letter-spacing: -0.02em;
  font-size: clamp(1.65rem, 4vw + 1rem, 3.25rem);
  line-height: 1.2;
}

.home-hero-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.85rem 2rem;
  min-height: 44px;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.home-hero-btn--discover {
  background: linear-gradient(135deg, #1c64a1 0%, #0d47a1 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.home-hero-btn--discover:hover {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
  color: #ffffff;
}

.home-hero-btn--contact {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.home-hero-btn--contact:hover {
  background: #ffffff;
  color: #092a4b;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

/* Service Cards & Layout Containment */
.service-card {
  background: #ffffff;
  border-radius: 1rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  /* Prevents card overflow in flex/grid */
}

.service-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  border-color: #cbd5e1;
}

.service-image-box {
  position: relative;
  height: 220px;
  overflow: hidden;
  background-color: #092a4b;
}

.service-image-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.service-card:hover .service-image-box img {
  transform: scale(1.08);
}

.service-copy {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.icon-badge.blue {
  background-color: #eff6ff;
  color: #2563eb;
}

.icon-badge.green {
  background-color: #ecfdf5;
  color: #059669;
}

.icon-badge.yellow {
  background-color: #fefce8;
  color: #d97706;
}

.icon-badge.cyan {
  background-color: #ecfeff;
  color: #0891b2;
}

.icon-badge.indigo {
  background-color: #eef2ff;
  color: #4f46e5;
}

.icon-badge.emerald {
  background-color: #f0fdf4;
  color: #16a34a;
}

.icon-badge.amber {
  background-color: #fffbeb;
  color: #b45309;
}

.icon-badge.red {
  background-color: #fef2f2;
  color: #dc2626;
}

.service-link {
  color: #1c64a1;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 1rem;
  min-height: 44px;
  transition: all 0.2s ease;
}

.service-link:hover {
  color: #2563eb;
  transform: translateX(4px);
}

/* Parallax Stats */
.parallax-hero-section {
  position: relative;
  background-attachment: fixed;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.stat-card {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 0.75rem;
  padding: 1.75rem 1rem;
  transition: all 0.3s ease;
  min-width: 0;
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Why Choose Us Feature Cards */
.about-feature {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  transition: all 0.3s ease;
  min-width: 0;
}

.about-feature:hover {
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.25);
}

/* Marquee Slider */
.client-marquee-wrapper {
  overflow: hidden;
  position: relative;
  width: 100%;
  padding: 1.5rem 0;
  mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.client-marquee-track {
  display: flex;
  width: max-content;
  animation: marqueeScroll 25s linear infinite;
}

.client-marquee-track:hover {
  animation-play-state: paused;
}

.client-marquee-slide {
  display: flex;
  align-items: center;
  gap: 2.5rem;
  padding-right: 2.5rem;
}

.cert-card {
  height: 90px;
  width: auto;
  max-width: 180px;
  object-fit: contain;
  filter: grayscale(20%);
  background: #ffffff;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  transition: all 0.3s ease;
}

.cert-card:hover {
  filter: grayscale(0%);
  transform: scale(1.08);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.08);
  border-color: #3b82f6;
}

@keyframes marqueeScroll {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

/* Gallery & Hero Custom Styles */
.gallery-hero-badge {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  min-height: 36px;
}

.material-tag {
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  padding: 0.45rem 0.95rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 40px;
  /* Touch target enhancement */
  transition: all 0.25s ease;
}

.material-tag:hover {
  background: rgba(30, 41, 59, 0.9);
  border-color: rgba(249, 115, 22, 0.6);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.15);
}

.material-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: #f97316;
  box-shadow: 0 0 8px rgba(249, 115, 22, 0.8);
  flex-shrink: 0;
}

.gallery-card {
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  min-width: 0;
}

.gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.05);
  border-color: #cbd5e1;
}

.gallery-card .card-img-container img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.gallery-card:hover .card-img-container img {
  transform: scale(1.08);
}

.filter-btn {
  transition: all 0.2s ease;
  font-weight: 500;
  border-radius: 9999px;
  min-height: 44px;
  padding: 0.5rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-btn.active {
  background-color: #07223d;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(7, 34, 61, 0.25);
}

/* Lightbox Modal */
.lightbox-modal {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  padding-top: var(--sat);
  padding-bottom: var(--sab);
}

.lightbox-modal.active {
  opacity: 1;
  visibility: visible;
}

/* Back to Top Button - Dynamic iOS Safe-Area-Inset-Bottom Positioning */
#backToTopBtn {
  position: fixed;
  bottom: calc(25px + var(--sab));
  right: max(20px, calc(15px + var(--sar)));
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  background: #1c64a1;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

#backToTopBtn.show {
  opacity: 1;
  visibility: visible;
}

#backToTopBtn:hover {
  background: #2563eb;
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.4);
}

/* WhatsApp Floating Button - Dynamic iOS Safe-Area-Inset-Bottom Positioning */
#whatsappFloatingBtn {
  position: fixed;
  bottom: calc(85px + var(--sab));
  right: max(20px, calc(15px + var(--sar)));
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  background: #25d366;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.35);
  cursor: pointer;
  z-index: 99;
  transition: all 0.3s ease;
}

#whatsappFloatingBtn:hover {
  background: #20ba59;
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

/* ==========================================================================
   Responsive Breakpoints & Layout Fine-Tuning
   ========================================================================== */

/* Small Phones (< 390px e.g. 320px - 375px) */
@media screen and (max-width: 389px) {
  .gallery-hero-badge {
    font-size: 0.65rem;
    padding: 0.35rem 0.65rem;
  }

  .material-tag {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    min-height: 38px;
  }

  .home-hero-btn {
    width: 100%;
  }
}

/* Standard Mobile / iPhone 16 Specs (390px - 430px, e.g. 393 x 852 px) */
@media screen and (min-width: 390px) and (max-width: 430px) {
  .hero-slide-content {
    padding-left: max(1rem, var(--sal));
    padding-right: max(1rem, var(--sar));
  }

  .material-tag {
    font-size: 0.8rem;
    padding: 0.4rem 0.8rem;
  }
}

/* Tablet Devices (768px - 1023px) */
@media screen and (min-width: 768px) and (max-width: 1023px) {
  .parallax-hero-section {
    background-attachment: scroll;
    /* Smoother scrolling on touch tablets */
  }
}

/* Desktop Devices (1024px+) */
@media screen and (min-width: 1024px) {

  /* Prevent background image distortion on high-res displays */
  .home-hero-section {
    min-height: 75vh;
  }
}

/* iPhone Landscape Orientation Fixes */
@media screen and (max-height: 500px) and (orientation: landscape) {
  header {
    padding-top: 0;
  }

  .home-hero-section {
    min-height: 120vh;
    padding-top: max(2rem, var(--sat));
    padding-bottom: max(2rem, var(--sab));
  }
}

/* ==========================================================================
   PAGE HERO TYPOGRAPHY SYSTEM
   Matches homepage reference: font-size, weight, line-height, spacing, color
   Used across: About Us pages, Service pages, Certification, QEHS
   ========================================================================== */

/* Hero Section Wrapper */
.page-hero-section {
  position: relative;
  background-color: #020617;
  /* slate-950 */
  overflow: hidden;
  padding-top: 2rem;
  padding-bottom: 3.5rem;
}

@media (min-width: 640px) {
  .page-hero-section {
    padding-top: 2.5rem;
    padding-bottom: 4rem;
  }
}

@media (min-width: 1024px) {
  .page-hero-section {
    padding-top: 3rem;
    padding-bottom: 5rem;
  }
}

/* Inner content container — same grid as homepage .container */
.page-hero-inner {
  position: relative;
  z-index: 10;
  max-width: 80rem;
  /* 1280px — max-w-7xl */
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .page-hero-inner {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .page-hero-inner {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* Breadcrumb Navigation — matches homepage heading level positioning */
.page-hero-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  /* 12px */
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  /* slate-400 */
  margin-bottom: 0.875rem;
  /* 14px */
}

@media (min-width: 640px) {
  .page-hero-breadcrumb {
    margin-bottom: 1rem;
  }
}

.page-hero-breadcrumb a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease;
}

.page-hero-breadcrumb a:hover {
  color: #60a5fa;
  /* blue-400 */
}

.page-hero-breadcrumb .sep {
  color: #475569;
  /* slate-600 */
}

.page-hero-breadcrumb .current {
  color: #ffffff;
  font-weight: 700;
}

/* Pill Badge — same style as homepage hero badge */
.page-hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  /* 10px */
  padding: 0.375rem 1rem;
  /* 6px 16px */
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
  /* 12px — same as homepage hero-badge */
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #e2e8f0;
  /* slate-200 */
  margin-bottom: 1rem;
  box-shadow: 0 4px 15px rgba(0, 168, 255, 0.15);
  min-height: 36px;
}

@media (min-width: 640px) {
  .page-hero-pill {
    margin-bottom: 1.25rem;
  }
}

.page-hero-pill .pill-dot {
  width: 0.625rem;
  /* 10px */
  height: 0.625rem;
  border-radius: 50%;
  background-color: #34d399;
  /* emerald-400 */
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  flex-shrink: 0;
}

/* H1 Page Title — matches homepage hero-title: 46px / weight 800 / line-height 1.18 */
.page-hero-title {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 2rem;
  /* 32px mobile */
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-shadow: 0 4px 18px rgba(0, 0, 0, 0.7);
  margin: 0;
}

@media (min-width: 640px) {
  .page-hero-title {
    font-size: 2.5rem;
    /* 40px */
  }
}

@media (min-width: 1024px) {
  .page-hero-title {
    font-size: 2.875rem;
    /* ~46px — matches homepage hero-title exactly */
  }
}

/* Gradient Accent Line — brand blue-to-green underline */
.page-hero-accent {
  height: 6px;
  width: 6rem;
  /* 96px — w-24 */
  background: linear-gradient(90deg, #2563eb 0%, #10b981 100%);
  border-radius: 9999px;
  margin-top: 0.875rem;
  margin-bottom: 0.875rem;
  box-shadow: 0 0 12px rgba(28, 100, 161, 0.6);
}

@media (min-width: 640px) {
  .page-hero-accent {
    margin-top: 1rem;
    margin-bottom: 1rem;
  }
}

/* Subtitle / Description — matches homepage hero-desc: 16.5px / 1.6 line-height */
.page-hero-desc {
  font-size: 1rem;
  /* 16px mobile */
  font-weight: 400;
  line-height: 1.6;
  /* matches homepage hero-desc exactly */
  color: #cbd5e1;
  /* slate-300 — identical to homepage */
  max-width: 45rem;
  /* ~720px — matches homepage hero-desc max-width */
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  margin-bottom: 1.5rem;
}

@media (min-width: 640px) {
  .page-hero-desc {
    font-size: 1.0625rem;
    /* 17px */
    margin-bottom: 1.75rem;
  }
}

@media (min-width: 1024px) {
  .page-hero-desc {
    font-size: 1.0625rem;
    /* 17px — close to homepage 16.5px */
  }
}

/* Section heading H2 inside page body — matches homepage section-header style */
.page-section-heading {
  font-size: 1.625rem;
  /* 26px */
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: #0f172a;
  /* slate-900 */
  margin-bottom: 0.5rem;
}

@media (min-width: 768px) {
  .page-section-heading {
    font-size: 2rem;
    /* 32px */
  }
}

/* Body paragraph text — matches homepage body text style */
.page-body-text {
  font-size: 0.875rem;
  /* 14px */
  line-height: 1.8;
  color: rgba(10, 37, 64, 0.80);
}

/* Small-screens pill text wrapping fix */
@media (max-width: 389px) {
  .page-hero-pill {
    font-size: 0.65rem;
    padding: 0.35rem 0.65rem;
    letter-spacing: 0.08em;
  }

  .page-hero-title {
    font-size: 1.75rem;
  }
}

/* Mobile Responsive Card & Layout Safety */
@media (max-width: 640px) {
  .hero-badges-desktop {
    display: none !important;
  }

  .p-6,
  .p-8,
  .p-10,
  .px-8,
  .px-10 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}