/* General styles for alignment and responsiveness */
body {
    margin: 0;
    padding: 0;
    font-family: Arial, sans-serif;
    line-height: 1.6;
    color: #333;
}

header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
    padding: 10px 20px;
}

header .header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

header .logo {
    height: 50px;
}

header nav ul {
    list-style: none;
    display: flex;
    gap: 15px;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

header nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

header nav ul li a.active {
    color: #007bff;
}

/* Ensure sections are properly spaced */
section {
    padding: 40px 20px;
    margin: 0 auto;
    max-width: 1200px;
    text-align: center;
}

section h2 {
    margin-bottom: 20px;
    font-size: 2rem;
    position: relative;
}

/* Ensure no decorative pseudo-images are displayed anywhere by default. */
section h2::before { display: none !important; content: none !important; background-image: none !important; }
.decorated::before { display: none !important; content: none !important; background-image: none !important; }

/* Optional decorative heading. Apply class="decorated" to an h2 to show the image. Hidden on small screens. */
.decorated::before {
    /* intentionally left blank - decorative image disabled */
    display: none !important;
    content: none !important;
}

/* Hide decorative icon on smaller screens to avoid repeated image placement */
@media (max-width: 900px) {
    section h2::before { display: none; }
    .decorated::before { display: none; }
}

/* Ensure content fills spacing nicely */
section p {
    margin: 0 auto;
    max-width: 800px;
    line-height: 1.8;
}

/* Responsive images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    image-rendering: auto;
}

/* Responsive video */
.video-container {
    position: relative;
    overflow: hidden;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Footer styles */
footer {
    background-color: #f8f9fa;
    text-align: center;
    padding: 10px 0;
    border-top: 1px solid #ddd;
}

footer p {
    margin: 12px 0;
}

/* Make the layout responsive */
@media (max-width: 768px) {
    header .header-container {
        flex-direction: column;
        align-items: center;
    }

    header nav ul {
        flex-direction: column;
        gap: 10px;
        width: 100%;
        justify-content: center;
    }

    section {
        padding: 15px;
    }

    .hero .video-container {
        height: 50vh;
    }

    .hero-text {
        width: calc(100% - 28px);
        padding: 14px;
    }

    .hero h1 {
        font-size: 2rem;
        top: 40%;
    }

    .hero p {
        font-size: 1rem;
        top: 50%;
    }
}

/* General header styles */
.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #ddd;
}

.header-container .logo {
    display: block;
    width: auto;
    max-height: 56px;
    height: auto;
    z-index: 1001;
}

@media (max-width: 480px) {
    .header-container .logo {
        height: 42px;
    }
}

.header-container nav ul {
    list-style: none;
    display: flex;
    gap: 15px;
    margin: 0;
    padding: 0;
}

.header-container nav ul li a {
    text-decoration: none;
    color: #333;
    font-weight: bold;
}

@media (max-width: 768px) {
    .header-container { gap: 12px; }
    .header-container nav { width: 100%; }
    .header-container nav ul { justify-content: center; }
}

/* Added styles for the hero carousel */
.hero .carousel-inner img {
    height: 500px;
    object-fit: cover;
}

.hero .carousel-control-prev-icon,
.hero .carousel-control-next-icon {
    background-color: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
}

/* Hero section styles */
.hero {
    position: relative;
    text-align: center;
    color: white;
}

.hero .video-container {
    position: relative;
    overflow: hidden;
    height: 60vh; /* use viewport height so it scales on large screens */
    min-height: 320px;
}

.hero .video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.6);
}

.hero-text {
    position: absolute;
    z-index: 2;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: calc(100% - 40px);
    max-width: 960px;
    padding: 20px;
    text-align: center;
    box-sizing: border-box;
}

.hero-text h1 {
    margin: 0 0 10px;
    font-size: clamp(1.5rem, 4vw, 3rem);
    text-shadow: 0 2px 6px rgba(0,0,0,0.6);
}

.hero-text p {
    margin: 0;
    font-size: clamp(1rem, 2.2vw, 1.5rem);
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
}

/* ensure hero has safe area padding on phones with notches */
@supports (padding: max(0px)) {
  .hero-text { padding-top: calc(env(safe-area-inset-top) + 12px); padding-bottom: calc(env(safe-area-inset-bottom) + 12px); }
}

/* play-on-scroll helper classes */
.video-play-hint {
    display: none; /* shown via JS only when needed */
    position: absolute;
    bottom: 18px;
    right: 18px;
    background: rgba(11,44,95,0.85);
    color: #fff;
    padding: 10px 14px;
    border-radius: 22px;
    font-size: 0.95rem;
    z-index: 4;
}

@media (max-width: 800px) {
    .video-play-hint { display: block; }
}

/* Make sections use full width spacing on large screens */
@media (min-width: 992px) {
    section {
        padding: 60px 80px;
    }
}

/* Gallery section styles */
.gallery {
    padding: 20px;
    text-align: center;
}

.gallery h2 {
    margin-bottom: 20px;
}

.gallery-images {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.gallery-images img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Feature section (used on homepage instead of gallery) */
.feature {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: center;
  margin: 40px 0;
}
.feature .media {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  min-height: 220px;
}
.feature .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
@media (min-width: 900px) {
  .feature { grid-template-columns: 1fr 1fr; }
  .feature:nth-child(even) { grid-template-columns: 1fr 1fr; }
  .feature .media { min-height: 320px; }
}

/* Page-specific section styles */
.about img,
.contact img,
.leadership img,
.subsidiaries img {
    width: 100%;
    height: auto;
    margin-top: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.about,
.contact,
.leadership,
.subsidiaries {
    padding: 20px;
    text-align: center;
}

.vision-mission,
.focus-areas {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    align-items: center;
}

@media (min-width: 900px) {
    .vision-mission,
    .focus-areas {
        grid-template-columns: 1fr 1fr;
    }
    .vision-mission p, .focus-areas p {
        text-align: left;
    }
}

.focus-areas ul {
    list-style: none;
    padding: 0;
}

.focus-areas ul li {
    background: #fff;
    margin: 8px 0;
    padding: 12px 14px;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    word-break: break-word;
}

/* Focus areas: responsive two-column with service grid */
.focus-inner {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

.service-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}

@media (min-width: 900px) {
    .service-grid {
        gap: 22px;
    }
}

.service-card {
    background: #ffffff;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(10, 30, 60, 0.06);
    text-align: left;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    line-height: 1.6;
}
.service-card h3 { margin-top: 0; margin-bottom: 8px; font-size: 1.1rem; }
.service-card p { margin: 0; color: #444; }
@media (min-width: 900px) {
    .focus-inner { grid-template-columns: 1fr 1fr; }
    .service-grid { grid-template-columns: repeat(2, 1fr); }
    .service-card { min-height: 160px; }
}
@media (max-width: 420px) {
    .service-card h3 { font-size: 1rem; }
    .service-card p { font-size: 0.95rem; }
}

/* Leader avatar styles */
.leader { overflow: auto; padding: 18px 0; }
.leader .avatar {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  margin: 0 18px 8px 8px;
  float: right;
}
.leader .avatar-left { float: left; margin: 0 8px 8px 18px; }

@media (max-width: 600px) {
  .leader .avatar, .leader .avatar-left { width: 120px; height: 120px; }
}

@media (max-width: 900px) {
  .leader .avatar, .leader .avatar-left { float: none; display: block; margin: 0 auto 12px; }
  .feature { grid-template-columns: 1fr; }
}

/* Add hover effect for logo and home button */
header .logo:hover,
header nav ul li a:hover {
    color: #007bff;
    cursor: pointer;
}

/* Make headings more prominent on desktop */
h2 {
    font-size: clamp(1.25rem, 2.2vw, 1.75rem);
    margin-bottom: 12px;
}

/* Improve headings spacing and section rhythm */
section h1, section h2 { margin-top: 0; }

/* Remove lazy-load blur effect so images are not blurred */
img[loading="lazy"] { transition: opacity .2s ease; filter: none; }
img[loading="lazy"][data-loaded="true"] { filter: none; opacity: 1; }

/* Buttons and links */
.btn-primary {
    display: inline-block;
    background: #0b2c5f;
    color: #fff;
    padding: 10px 18px;
    border-radius: 6px;
    text-decoration: none;
}

/* Small polish for buttons and links */
a.btn-primary { text-decoration: none; }

/* Improve spacing for leadership articles */
.leader {
    text-align: left;
    margin-top: 24px;
}

.leader img {
    max-width: 220px;
    float: right;
    margin-left: 20px;
    border-radius: 8px;
}

/* Accessibility: focus states */
a:focus {
    outline: 3px solid rgba(0,123,255,0.25);
    outline-offset: 2px;
}

/* Header placeholder to avoid layout shift while header is injected */
#site-header { min-height: 68px; }
#site-header .header-container { position: sticky; top: 0; z-index: 999; background: #f8f9fa; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }

/* Ensure gallery images in subsidiaries wrap nicely */
.subsidiaries .gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }

/* Improve alignment for vision-mission text blocks */
.vision-mission { gap: 20px; }
.vision-mission h2, .vision-mission p { text-align: left; }
@media (max-width: 900px) { .vision-mission h2, .vision-mission p { text-align: center; } }

/* Tidy up spacing on small screens */
@media (max-width: 480px) {
    header .header-container { padding: 10px 12px; }
    .hero-text { padding: 12px; }
    .feature .content { padding: 12px; }
    .service-card { padding: 14px; }
}

/* Hero: adjust text vertical position on short viewports to avoid overflow */
@media (max-height: 600px) {
  .hero-text { top: 42%; transform: translate(-50%, -42%); }
  .hero-text h1 { font-size: 1.6rem; }
}

/* Ensure carousels and large images do not create excessive vertical scroll on medium screens */
@media (max-width: 1024px) {
  .hero .carousel-inner img { height: auto; }
}

/* small utility: full-width CTA center */
.cta-center { display: flex; justify-content: center; }

/* Make focus copy padding and alignment nicer */
.focus-copy { padding: 6px 4px; }
.focus-copy p { margin-bottom: 0; }
@media (max-width: 900px) { .focus-copy { text-align: center; } }

/* Make header sticky to improve navigation on scroll */
#site-header .header-container { position: sticky; top: 0; z-index: 999; background: #f8f9fa; box-shadow: 0 2px 6px rgba(0,0,0,0.04); }

/* Slightly tighter hero text for large screens so it doesn't feel sparse */
@media (min-width: 1200px) {
  .hero-text { max-width: 820px; padding: 16px; }
}

/* Ensure focus-copy body text doesn't overflow when paired with service grid */
.focus-copy p { margin-bottom: 0; }

/* Prevent very long list items from stretching layout */
.focus-areas ul li { word-break: break-word; }

/* Larger hero on desktop for better visual impact */
@media (min-width: 1200px) {
  .hero .video-container { height: 65vh; min-height: 420px; }
  .hero-text { max-width: 900px; }
}

/* Make carousel images responsive without forcing large fixed heights on medium screens */
.hero .carousel-inner img { width: 100%; height: auto; object-fit: cover; }

/* More breathing room on desktop for focus areas */
@media (min-width: 1200px) {
  .focus-inner { grid-template-columns: 1fr 1fr; gap: 48px; }
  .service-grid { grid-template-columns: repeat(2, 1fr); gap: 28px; }
}

/* Header placeholder to avoid layout shift - ensure equals header height */
#site-header { min-height: 72px; }
#site-header .header-container { padding: 10px 20px; }

/* Ensure hero text never overflows on short viewports */
@media (max-height: 640px) {
  .hero-text { top: 44%; transform: translate(-50%, -44%); padding: 12px; }
}

/* Improve logo visibility on small devices (iPhone) */
#site-header .header-container {
    padding-top: calc(env(safe-area-inset-top) + 10px);
    padding-bottom: calc(env(safe-area-inset-bottom) + 10px);
    background-color: rgba(248,249,250,0.98); /* slightly translucent to play nice with video */
    z-index: 1100;
}

/* Default logo styling (keeps existing look on desktop) */
.header-container .logo {
    max-height: 56px;
    height: auto;
    display: block;
}

/* Mobile-specific logo enhancements for clarity */
@media (max-width: 900px) {
    .header-container .logo {
        max-height: 64px; /* slightly larger on mobile */
        padding: 6px;      /* add small white padding background */
        background: #fff;  /* ensure contrast if logo has transparent areas */
        border-radius: 8px;
        box-shadow: 0 6px 18px rgba(0,0,0,0.12);
        margin-right: 8px;
    }
    /* ensure header items do not overlap the logo */
    .header-container { align-items: center; gap: 12px; }
    .header-container nav { width: 100%; }
}

/* Make header fully opaque for strong contrast on small devices */
@media (max-width: 900px) {
    #site-header .header-container {
        background-color: #ffffff !important;
        padding-top: calc(env(safe-area-inset-top) + 8px);
        padding-bottom: calc(env(safe-area-inset-bottom) + 8px);
        box-shadow: 0 6px 18px rgba(0,0,0,0.12);
        z-index: 1200;
    }

    /* Make logo slightly larger and ensure clear background */
    .header-container .logo {
        max-height: 72px !important;
        padding: 6px !important;
        background: #ffffff !important;
        border-radius: 8px;
        box-shadow: 0 6px 18px rgba(0,0,0,0.12);
    }

    /* Ensure nav centers below/next to logo without overlapping */
    .header-container { align-items: center; gap: 10px; }
    .header-container nav { width: 100%; }
    .header-container nav ul { justify-content: center; }
}

/* Mobile: use full-screen off-canvas nav for robustness */
@media (max-width: 900px) {
  .hamburger { display: inline-flex !important; z-index: 2000 !important; }
  /* hide inline nav by default */
  .nav-wrap nav { display: none !important; }
  /* open state becomes full-screen overlay */
  .nav-wrap.open nav {
    display: flex !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(255,255,255,0.98) !important;
    padding-top: calc(env(safe-area-inset-top) + 60px) !important;
    padding-bottom: calc(env(safe-area-inset-bottom) + 20px) !important;
    align-items: flex-start !important;
    justify-content: center !important;
    flex-direction: column !important;
    gap: 18px !important;
    z-index: 1999 !important;
  }
  .nav-wrap.open nav ul { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 0; }
  .nav-wrap.open nav ul li a { font-size: 1.05rem; padding: 12px 18px; color: #111; }
}

/* ensure hamburger clickable area is generous */
.hamburger { touch-action: manipulation; }

/* Header / navigation: unify appearance and remove hover surprises */
.header-inner { padding-right: 88px; }

/* Improve hamburger visibility and touch target on small screens */
@media (max-width: 900px) {
  .hamburger {
    width: 52px !important;
    height: 52px !important;
    padding: 8px !important;
    border-radius: 999px !important;
    background: #ffffff !important; /* solid background for contrast */
    box-shadow: 0 8px 28px rgba(0,0,0,0.18) !important;
    border: 1px solid rgba(0,0,0,0.06) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    right: 12px !important;
    top: 12px !important;
    z-index: 4000 !important; /* sit above video and overlays */
    -webkit-tap-highlight-color: rgba(0,0,0,0);
  }

  .hamburger .hamburger-bar {
    width: 26px !important;
    height: 3px !important;
    background: #0b2c5f !important; /* dark brand color for contrast */
    transition: transform .18s ease, opacity .12s ease, background .12s ease !important;
    border-radius: 2px !important;
  }

  .hamburger:focus { outline: 3px solid rgba(11,44,95,0.12) !important; outline-offset: 2px !important; }

  /* Animated open state: convert bars to X for clarity */
  .hamburger[aria-expanded="true"] { background: #0b2c5f !important; }
  .hamburger[aria-expanded="true"] .hamburger-bar { background: #ffffff !important; }
  .hamburger[aria-expanded="true"] .hamburger-bar:nth-child(1) { transform: translateY(6px) rotate(45deg) !important; }
  .hamburger[aria-expanded="true"] .hamburger-bar:nth-child(2) { opacity: 0 !important; }
  .hamburger[aria-expanded="true"] .hamburger-bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg) !important; }
}

/* Ensure nav lists align consistently and links look the same on all devices */
.nav-wrap nav ul,
.header-container nav ul {
    display: flex;
    gap: 14px;
    margin: 0;
    padding: 0;
    align-items: center;
}

/* Common link style for desktop and mobile overlay */
.nav-wrap nav a,
.header-container nav ul li a {
    color: #111;
    background: transparent;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    display: inline-block;
    transition: none; /* remove hover transitions that cause confusion */
}

/* Remove hover visual changes to avoid confusion */
.nav-wrap nav a:hover,
.header-container nav ul li a:hover,
header .logo:hover {
    color: #111 !important;
    background: transparent !important;
    text-decoration: none !important;
    cursor: pointer;
}

/* Clear active state: underline instead of color/hover */
.nav-wrap nav a.active,
.header-container nav ul li a.active {
    text-decoration: underline;
    color: #0b2c5f;
}

/* Desktop alignment: place nav to the right of the brand with consistent spacing */
@media (min-width: 901px) {
    .header-inner { align-items: center; }
    .brand { margin-right: 20px; }
    .nav-wrap { margin-left: auto; }
}

/* Mobile alignment: center overlay links and ensure ample tap area */
@media (max-width: 900px) {
    .nav-wrap.open nav ul { align-items: center; width: 100%; }
    .nav-wrap.open nav a { width: 90%; text-align: center; border-radius: 8px; }
}

/* Prevent logo hover color change elsewhere */
header .logo:hover { opacity: 1; }