/* =========================
   GLOBAL RESET
   ========================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  max-width: 100vw; /* Use viewport width to prevent overflow */
  overflow-x: hidden !important; /* Force no horizontal scroll */
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Poppins', sans-serif;
  background-color: #f8faff;
  color: #1b2a41;
  scroll-behavior: smooth;
}

/* Bootstrap row fix */
.row {
  margin-left: 0;
  margin-right: 0;
}

/* Images fully responsive */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Containers spacing */
section,
.container,
.container-fluid {
  padding-left: 15px;
  padding-right: 15px;
  max-width: 100%; /* Ensure no container exceeds viewport */
  overflow-x: hidden; /* Prevent child overflow */
}

/* Additional overflow prevention for all key elements */
.hero, .intro, .activity-card, .feature-imgs, .card, .card-body, .page-title, h1, h2, h5, p {
  overflow-x: hidden;
  max-width: 100%;
  word-wrap: break-word; /* Break long words */
  overflow-wrap: break-word; /* Modern fallback */
}

/* =========================
   HERO SECTION
   ========================= */
.hero {
  height: 70vh;
  background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), 
              url('../../images/berber/berbbg.jpg') center/cover no-repeat;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  padding: 20px;
  overflow-x: hidden;
}

.hero h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 15px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* =========================
   INTRO SECTION
   ========================= */
/* =========================
   SPLIT INTRO SECTION - SMALL IMAGE
   ========================= */
.intro-split {
  padding: 50px 15px;
}

.split-img {
  width: 90%;       /* Smaller than full width */
  max-width: 400px; /* optional: set max width */
  height: auto;
  border-radius: 15px;
  object-fit: cover;
  display: block;
  margin-left: auto;  /* center the image */
  margin-right: auto;
}

/* Responsive adjustments for split intro */
@media (max-width: 992px) {
  .split-img {
    width: 90%;
    max-width: 350px;
  }
}

@media (max-width: 768px) {
  .intro-split {
    padding: 30px 15px;
  }

  .intro-split .row {
    flex-direction: column;
  }

  .intro-split .col-md-6 {
    max-width: 100%;
  }

  .split-img {
    width: 80%;      /* smaller on mobile */
    max-width: 300px;
    margin-bottom: 20px;
  }
}

/* =========================
   ACTIVITY CARDS
   ========================= */
.activity-card {
  background-color: #fffaf5;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
  transition: all 0.3s ease;
  height: 100%;
  max-width: 100%;
}

.activity-card:hover {
  transform: translateY(-5px);
}

.activity-card img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  max-width: 100%;
}

.activity-card-body {
  padding: 20px;
  text-align: center;
  max-width: 100%;
}

.activity-card-body h5 {
  color: #8B5E3C;
  margin-bottom: 10px;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.activity-card-body p {
  color: #555;
  font-size: 0.95rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* =========================
   FEATURE IMAGES
   ========================= */
.feature-imgs img {
  width: 100%;
  height: 500px;
  object-fit: cover;
  border-radius: 20px;
  max-width: 100%;
}

/* =========================
   PAGE TITLE
   ========================= */
.page-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 30px;
  position: relative;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
}

.page-title::after {
  content: '';
  width: 80px;
  height: 4px;
  background-color: #0d6efd;
  display: block;
  margin: 10px auto 0;
  border-radius: 2px;
}

/* =========================
   FOOTER BUTTON
   ========================= */
.footer-btn {
  display: block;
  margin: 40px auto;
  padding: 12px 30px;
  background-color: #8B5E3C;
  color: #fff;
  border-radius: 30px;
  text-align: center;
  max-width: 320px;
  text-decoration: none;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* =========================
   FAMILY ACTIVITIES
   ========================= */
.fixed-card-img {
  height: 250px;
  object-fit: cover;
  max-width: 100%;
}

.family-activities .card {
  height: 100%;
  border-radius: 15px;
  overflow: hidden;
  max-width: 100%;
}

/* Bootstrap overrides for better mobile control */
.col, .col-md-4 {
  padding-left: 0;
  padding-right: 0;
  max-width: 100%;
}

/* =========================
   RESPONSIVE
   ========================= */

/* Tablets */
@media (max-width: 992px) {
  .hero h1 {
    font-size: 2.3rem;
  }

  .feature-imgs img {
    height: 350px;
  }

  .container {
    padding-left: 10px;
    padding-right: 10px;
  }
}

/* Phones */
@media (max-width: 768px) {
  html, body {
    overflow-x: hidden !important;
  }

  .hero {
    height: 40vh;
    background-position: center top;
    padding: 10px; /* Reduced further */
  }

  .hero h1 {
    font-size: 1.8rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  .hero p {
    font-size: 1rem;
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Intro fix */
  .intro {
    max-width: 100%;
    padding: 20px 10px; /* Reduced padding */
    font-size: 1rem;
  }

  .intro p {
    text-align: left; /* Change to left-align on phones for better flow */
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Activity cards */
  .activity-card img,
  .fixed-card-img {
    height: 200px;
  }

  /* Feature images */
  .feature-imgs img {
    height: 260px;
  }

  /* Page title */
  .page-title {
    font-size: 1.6rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
  }

  /* Footer button */
  .footer-btn {
    width: 100%;
    max-width: 100%;
  }

  /* Containers */
  .container {
    padding-left: 5px;
    padding-right: 5px; /* Minimal padding to prevent overflow */
  }

  /* Cards */
  .card {
    max-width: 100%;
    margin: 0 auto;
  }

  .card-body {
    padding: 15px;
  }
}

/* Small phones */
@media (max-width: 480px) {
  .hero h1 {
    font-size: 1.5rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .intro {
    padding: 15px 5px;
  }

  .container {
    padding-left: 0;
    padding-right: 0; /* No padding on very small screens */
  }
}