/* --- Certification Section Layout --- */
.certifications-section {
  width: 100%;
  background-color: #FFFFFF;
  padding: 0 0 80px; /* Set padding-top to 0 to remove space below hero section */
}

/* Eliminate bottom margin of the hero content block to sit flush with tabs */
.hero-content-block {
  margin-bottom: 0 !important;
}

.certifications-container {
  max-width: 1374px; /* Matches the top-bar and navbar container alignment */
  width: 100%;
  margin: 0 auto;
  padding: 0 20px;
}

/* --- Tab Buttons Styles --- */
certification-tabs {
  display: block;
  width: 100%;
}

.tabs-header-bar {
  display: flex;
  flex-direction: row;
  width: 100%;
  background-color: #F8FAFC;
  margin-bottom: 40px;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar Firefox */
}

.tabs-header-bar::-webkit-scrollbar {
  display: none; /* Hide scrollbar Chrome/Safari/Opera */
}

.tab-btn {
  flex: 1;
  min-width: 200px;
  padding: 24px 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  border: none;
  cursor: pointer;
  background-color: #E2E8F0; /* Clean grayish background for inactive */
  color: #64748B; /* Darker slate gray text for contrast */
  transition: all 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  white-space: nowrap;
}

.tab-btn:hover {
  background-color: #CBD5E1;
  color: #0F172A;
}

.tab-btn.active {
  background-color: #0052ED; /* USAII Accent Blue */
  color: #FFFFFF;
}

/* --- Mobile Dropdown Styles --- */
.tabs-mobile-dropdown {
  display: none; /* Hidden on desktop and tablet by default */
  position: relative;
  width: 100%;
  margin-bottom: 30px;
  z-index: 1000;
}

.dropdown-trigger {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background-color: #0052ED; /* USAII Blue */
  color: #FFFFFF;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-align: left;
  transition: background-color 0.2s ease;
}

.dropdown-trigger:hover {
  background-color: #0652C0;
}

.dropdown-trigger .arrow-icon {
  width: 20px;
  height: 20px;
  stroke: #FFFFFF;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.tabs-mobile-dropdown.open .arrow-icon {
  transform: rotate(180deg);
}

.dropdown-options {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  background-color: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-top: none;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 1001;
}

.tabs-mobile-dropdown.open .dropdown-options {
  display: flex;
}

.dropdown-option-btn {
  width: 100%;
  padding: 16px 20px;
  background-color: #FFFFFF;
  border: none;
  border-bottom: 1px solid #F1F5F9;
  text-align: left;
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dropdown-option-btn:last-child {
  border-bottom: none;
}

.dropdown-option-btn:hover {
  background-color: #F8FAFC;
  color: #0052ED;
}

.dropdown-option-btn.active {
  background-color: #F1F7FF;
  color: #0052ED;
  font-weight: 600;
}

/* --- Grid Container Styles --- */
certification-grid {
  display: none; /* Controlled by active class in JS */
  width: 100%;
}

certification-grid.active {
  display: grid;
}

/* Grid columns sizing based on card counts */
certification-grid.cols-4 {
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

certification-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

certification-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

certification-grid.cols-1 {
  display: flex;
  justify-content: center;
  width: 100%;
}

certification-grid.cols-1 > certification-card {
  max-width: 450px; /* Limit single centered card to a premium width */
  width: 100%;
}

/* --- Card Component Styles --- */
certification-card {
  display: block;
  position: relative;
  width: 100%;
  height: 380px; /* Fixed height so width enlarges to cover the space without height increasing too */
  overflow: hidden;
  background-color: #F1F5F9;
  cursor: pointer;
  border-right: 4px solid #0052ED; /* Reduced width vertical line on the right edge of the card container */
}

/* Background image wrapper for zoom animation */
.cert-card-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 1;
}

certification-card:hover .cert-card-bg {
  transform: scale(1.06);
}

/* Dark gradient overlay behind card contents */
.cert-card-shade {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.4) 100%);
  z-index: 2;
  pointer-events: none;
}

/* Floating blue box at the bottom of the card with beveled top-left corner */
.cert-card-overlay {
  position: absolute;
  left: 16px; /* Restored left padding/gap */
  right: -4px;   /* Set to -4px to overlap the right-side border and eliminate subpixel rendering gaps */
  bottom: 16px; /* Restored bottom padding/gap */
  background-color: #0052ED; /* USAII Blue */
  padding: 24px 20px 20px; /* Adjusted padding to accommodate the bevel */
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 160px; /* Ensures consistent layout across different descriptions */
  clip-path: polygon(0 20px, 20px 0, 100% 0, 100% 100%, 0 100%); /* Diagonal cut on the top-left corner */
}

certification-card:hover .cert-card-overlay {
  transform: translateY(-6px);
  box-shadow: 0 12px 24px rgba(0, 82, 237, 0.35);
}

.cert-card-title {
  font-family: 'Outfit', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #FFFFFF;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.cert-card-subtitle {
  font-family: 'Outfit', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #FFFFFF;
  margin-bottom: 8px;
  line-height: 1.3;
}

.cert-card-desc {
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 300;
  color: #FFFFFF;
  opacity: 0.92;
  line-height: 1.45;
  text-align: left;
}

/* --- Responsive Adaptations --- */
@media (max-width: 1024px) {
  .certifications-section {
    padding: 40px 0 60px;
  }

  .tabs-header-bar {
    overflow-x: visible; /* No scrollbar on tablet; stretch evenly */
  }

  .tab-btn {
    min-width: 0; /* Override the 200px desktop min-width */
    flex: 1; /* Split screen width evenly */
    white-space: normal; /* Wrap text on smaller screens */
    padding: 20px 8px;
    font-size: 14px;
    line-height: 1.25;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  certification-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  certification-grid.cols-3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }

  /* Make the 3rd card in a 3-card grid span 2 columns on tablet so it enlarges to fit */
  certification-grid.cols-3 > certification-card:last-child:nth-child(odd) {
    grid-column: span 2;
  }

  .explore-certs-cta {
    margin-top: 60px;
  }

  .explore-certs-title {
    font-size: 28px;
  }

  .explore-certs-desc {
    font-size: 15px;
    margin-bottom: 26px;
  }
}

@media (max-width: 768px) {
  .certifications-section {
    padding: 30px 0 50px;
  }
  
  /* Hide the horizontal header bar on mobile and display the custom dropdown selector instead */
  .tabs-header-bar {
    display: none !important;
  }

  .tabs-mobile-dropdown {
    display: block;
  }

  certification-grid.cols-4,
  certification-grid.cols-3,
  certification-grid.cols-2 {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 16px;
  }

  /* Reset grid-column span for 3-card last child on mobile so it is full width */
  certification-grid.cols-3 > certification-card:last-child:nth-child(odd) {
    grid-column: auto;
  }
  
  certification-grid.cols-4 > certification-card,
  certification-grid.cols-3 > certification-card,
  certification-grid.cols-2 > certification-card,
  certification-grid.cols-1 > certification-card {
    max-width: 380px;
    width: 100%;
    height: 340px; /* Tighter height for mobile screens */
  }

  /* Optimize card typography sizes for mobile viewports */
  .cert-card-title {
    font-size: 18px;
    margin-bottom: 4px;
  }

  .cert-card-subtitle {
    font-size: 13px;
    margin-bottom: 6px;
  }

  .cert-card-desc {
    font-size: 11px;
    line-height: 1.4;
  }

  .explore-certs-cta {
    margin-top: 50px;
  }

  .explore-certs-title {
    font-size: 24px;
  }

  .explore-certs-desc {
    font-size: 13.5px;
    margin-bottom: 24px;
  }

  .explore-certs-btn {
    padding: 12px 24px;
    font-size: 14px;
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
  }

  .cert-card-overlay {
    min-height: 140px;
    padding: 20px 16px 16px;
    clip-path: polygon(0 16px, 16px 0, 100% 0, 100% 100%, 0 100%); /* Slightly smaller bevel to match text scale */
  }
}

/* --- Explore Certifications CTA Section --- */
.explore-certs-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: 70px;
  width: 100%;
  box-sizing: border-box;
  padding: 0 20px;
}

.explore-certs-title {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 600;
  color: #0F172A;
  margin: 0 0 12px 0;
  line-height: 1.3;
}

.explore-certs-desc {
  font-family: 'Outfit', sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #475569;
  max-width: 800px;
  margin: 0 auto 30px;
  line-height: 1.6;
}

.explore-certs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  background-color: transparent;
  border: 1px solid #0052ED; /* Outlined Blue Border */
  color: #0052ED; /* Blue Text */
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 2px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  gap: 10px;
  cursor: pointer;
  box-sizing: border-box;
}

.explore-certs-btn:hover {
  background-color: #0052ED;
  color: #FFFFFF;
  transform: translateY(-1px);
}

.explore-certs-btn:active {
  transform: translateY(0);
}

.explore-arrow {
  width: 16px;
  height: 16px;
  stroke: #0052ED;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease, stroke 0.2s ease;
}

.explore-certs-btn:hover .explore-arrow {
  stroke: #FFFFFF;
  transform: translateX(3px);
}


