/* Extracurricular Hero */
.extracurricular-hero {
  padding: 10rem 0 5rem;
  text-align: center;
  background-color: var(--light-secondary); /* A very light, subtle off-white */
}

.extracurricular-hero .section-title {
  color: var(--text-dark);
  /* RESPONSIVE: Ensure title text wraps on smaller screens */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.extracurricular-hero .section-title::after {
  background-color: var(--primary-color);
}

/* Leadership Section */
.leadership-section {
  padding: 5rem 0;
  background-color: var(--light-color); /* A very subtle, almost white color */
}

.roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
  /* RESPONSIVE: Ensure grid items adapt and center */
  justify-items: center; /* Center items within their grid cells */
}

.role-card {
  display: flex;
  flex-direction: column;
  background: var(--light-color); /* Light background for cards */
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  transition: var(--transition);
  border: var(--glass-border); /* Subtle border for definition */
  /* RESPONSIVE: Ensure cards take full width of their minmax and limit max width */
  width: 100%;
  max-width: 450px; /* Limit max width for readability on larger screens */
}

.role-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
  border: var(--glass-border-hover); /* Subtle border change on hover */
}

.role-header {
  padding: 1.5rem 1.5rem 0;
  /* RESPONSIVE: Ensure content within header doesn't overflow */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.role-title {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-dark);
  /* RESPONSIVE: Ensure text wraps */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.role-organization {
  color: var(--primary-color);
  font-weight: 600;
  margin-bottom: 0.5rem;
  /* RESPONSIVE: Ensure text wraps */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.role-duration {
  color: var(--gray-color);
  font-size: 0.9rem;
  margin-bottom: 1rem;
  /* RESPONSIVE: Ensure text wraps */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.role-content {
  padding: 0 1.5rem 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.role-responsibilities {
  margin-bottom: 1.5rem;
  flex-grow: 1;
}

.role-responsibilities li {
  margin-bottom: 0.5rem;
  position: relative;
  padding-left: 1.5rem;
  color: var(--gray-color);
  /* RESPONSIVE: Ensure list item text wraps */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.role-responsibilities li::before {
  content: "•";
  color: var(--accent-color-orange);
  font-weight: bold;
  position: absolute;
  left: 0;
}

.role-image {
  margin-top: 1rem;
  /* RESPONSIVE: Ensure image container fits without overflow */
  width: 100%;
  overflow: hidden; /* Hide any overflow if image aspect ratio is off */
}

.role-image img {
  width: 100%;
  height: 300px; /* Fixed height for consistency, object-fit handles ratio */
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  object-fit: cover;
  /* RESPONSIVE: Ensure image maintains aspect ratio and scales within container */
  max-width: 100%;
  display: block; /* Remove extra space below image */
}

/* Events Section */
.events-section {
  padding: 5rem 0;
  background-color: var(--light-secondary); /* A very light, subtle off-white */
}

.events-timeline {
  position: relative;
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 0;
  /* RESPONSIVE: Add horizontal padding to prevent overflow on very small screens */
  padding-left: 1rem;
  padding-right: 1rem;
}

.events-timeline::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50px; /* This is the fixed left position of the line for desktop */
  width: 3px;
  height: 100%;
  background-color: var(--primary-color);
  /* No change to this rule for responsiveness. Mobile adjustments are in media queries. */
}

.event-item {
  position: relative;
  margin-bottom: 3rem;
  /* Initial padding for desktop to align content to the right of the line */
  padding-left: calc(50px + 30px); /* Line position + desired gap */
  /* RESPONSIVE: Ensure content inside event-item handles overflow */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.event-date {
  position: absolute;
  top: 0;
  /* Positioning for desktop: to the left of the timeline line */
  left: 0; /* Align to the start of the event-item's container */
  width: 100px; /* Original width */
  padding: 0.5rem 1rem;
  background-color: var(--accent-color-blue);
  color: var(--light-color);
  border-radius: 20px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow);
}

.event-content {
  background: var(--light-color);
  padding: 1.5rem;
  border-radius: 20px;
  box-shadow: var(--shadow);
  transition: var(--transition);
  /* RESPONSIVE: Ensure content fits within its card */
  width: 100%;
  box-sizing: border-box; /* Include padding in width */
}

.event-content:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.event-title {
  font-size: 1.5rem;
  margin-bottom: 0.8rem;
  color: var(--text-dark);
  /* RESPONSIVE: Ensure text wraps */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.event-description {
  margin-bottom: 1.5rem;
  color: var(--gray-color);
  line-height: 1.7;
  /* RESPONSIVE: Ensure text wraps */
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.event-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  /* RESPONSIVE: Ensure highlights wrap without overflow */
  justify-content: flex-start; /* Align items to start (default for this layout) */
}

.highlight {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background-color: var(--primary-light);
  color: var(--text-dark);
  padding: 0.5rem 1.2rem;
  border-radius: 20px;
  font-size: 0.9rem;
  /* RESPONSIVE: Ensure highlight text wraps if needed */
  white-space: normal; /* Allow text to wrap within highlight pill */
  word-wrap: break-word;
  overflow-wrap: break-word;
  flex-shrink: 0; /* Prevent shrinking too much */
}

.highlight i {
  color: var(--primary-dark);
}

.event-image {
  margin-top: 1rem;
  /* RESPONSIVE: Ensure image container fits without overflow */
  width: 100%;
  overflow: hidden;
}

.event-image img {
  width: 100%;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow);
  object-fit: cover;
  /* RESPONSIVE: Ensure image maintains aspect ratio and scales within container */
  max-width: 100%;
  display: block;
  height: auto; /* Allow height to adjust naturally with width */
}

/* Responsive Styles */
@media (max-width: 992px) {
  /* No specific changes here for responsiveness, already handled by `auto-fit` and general adjustments */
}

@media (max-width: 768px) {
  .extracurricular-hero {
    padding: 8rem 0 3rem;
  }

  .roles-grid {
    grid-template-columns: repeat(
      auto-fit,
      minmax(280px, 1fr)
    ); /* Adjusted minmax for smaller tablets */
  }

  /* Timeline adjustments for tablets and smaller screens */
  .events-timeline::before {
    left: 20px; /* Line position for tablets and mobile */
  }

  .event-item {
    padding-left: calc(
      20px + 25px
    ); /* Line position + adjusted gap for content */
  }

  .event-date {
    left: -15px; /* Position relative to the timeline line */
    width: 70px; /* Smaller width for mobile */
    padding: 0.4rem 0.8rem; /* Smaller padding */
    font-size: 0.8rem; /* Smaller font size */
  }
}

@media (max-width: 576px) {
  .roles-grid {
    grid-template-columns: 1fr; /* Stack leadership roles vertically on small phones */
  }

  .role-card {
    margin: 0 auto; /* Center individual role cards when stacked */
    max-width: 350px; /* Limit max width for better readability on small screens */
  }

  /* Further timeline adjustments for very small screens */
  .events-timeline {
    padding-left: 0.5rem; /* Reduce padding to give more space for content */
    padding-right: 0.5rem;
  }

  .events-timeline::before {
    left: 15px; /* Adjust line position */
  }

  .event-item {
    padding-left: calc(15px + 20px); /* Adjusted padding for content */
  }

  .event-date {
    left: -10px; /* Adjust date position */
    width: 60px; /* Further reduce date width */
    font-size: 0.75rem; /* Further reduce date font size */
    padding: 0.3rem 0.6rem; /* Adjust date padding */
  }

  .event-content {
    padding: 1rem; /* Reduce content padding */
  }

  .event-title {
    font-size: 1.3rem; /* Smaller title font size */
  }

  .event-description {
    font-size: 0.95rem; /* Smaller description font size */
  }

  .highlight {
    font-size: 0.8rem; /* Smaller highlight text */
    padding: 0.4rem 0.8rem; /* Smaller highlight padding */
  }
}

/* Specific adjustments for very small mobile devices like iPhone SE (375px width) */
@media (max-width: 375px) {
  .extracurricular-hero {
    padding: 6rem 0 2rem;
  }

  .roles-grid {
    grid-template-columns: 1fr; /* Ensure single column */
  }

  .role-card {
    max-width: 300px; /* Even smaller max-width */
  }

  .role-title {
    font-size: 1.3rem;
  }

  .role-organization {
    font-size: 0.95rem;
  }

  .role-responsibilities li {
    font-size: 0.9rem;
  }

  .events-timeline::before {
    left: 10px; /* Minimal left margin for the line */
  }

  .event-item {
    padding-left: calc(10px + 15px); /* Minimal padding for event content */
  }

  .event-date {
    left: -5px; /* Minimal left offset for the date */
    width: 55px; /* Smallest date width */
    font-size: 0.7rem; /* Smallest date font size */
    padding: 0.3rem 0.5rem;
  }

  .event-content {
    padding: 0.8rem; /* Minimal content padding */
  }

  .event-title {
    font-size: 1.2rem;
  }

  .event-description {
    font-size: 0.85rem;
  }

  .highlight {
    font-size: 0.75rem;
    padding: 0.3rem 0.7rem;
  }
}
