.teachers {
  background-color: #ffffff;
  padding: 120px 0px;
  position: relative;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
}

.teachers__container {
  max-width: 1440px;
  margin: 0 auto;
}

.teachers__header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin: 0 auto 64px auto;
  max-width: 1120px;
}

.teachers__heading {
  font-size: 32px;
  font-weight: normal;
  line-height: 40px;
  color: #333333;
  margin: 0 0 8px 0;
  font-family: 'schibsted_grotesk_demi', 'Verdana';
}

.teachers__description {
  font-size: 16px;
  font-weight: normal;
  line-height: 28px;
  color: #707070;
  margin: 0 0 24px 0;
  font-family: 'avenir_next_worldmedium', 'Verdana';
}

.teachers__tabs {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}

.teachers__select-wrap {
  display: none;
}

.teachers__tab {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: 1px solid #707070;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  font-weight: normal;
  line-height: 20px;
  color: #333333;
  white-space: nowrap;
  font-family: 'avenir_next_worlddemi', 'Verdana';
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.teachers__tab:hover {
  border-color: #333333;
}

.teachers__tab--active {
  background: #000000;
  border-color: #333333;
  color: #ffffff;
}

.teachers__content {
  position: relative;
}

/* ---- Cards carousel (mirrors the home "subjects" carousel) ---- */
/* Wrapper stays at the 1120 content column and anchors the arrows to its edges;
   the track inside breaks out to full-bleed. Section padding (40px ≤1200) keeps
   the arrows on-screen at mid widths. */
.teachers__carousel {
  --gh-carousel-gutter: max(40px, calc(50vw - 560px));
  position: relative;
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
}

/* Circular scroll arrows — white disc, soft shadow, centred on the content
   column edges and vertically over the card image. Hidden until JS finds the
   active group loops. */
.teachers__arrow {
  position: absolute;
  top: 38%;
  transform: translateY(-50%);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: #ffffff;
  color: #333333;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: opacity 0.15s ease, box-shadow 0.15s ease;
}

.teachers__arrow[hidden] {
  display: none;
}

.teachers__arrow:hover {
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
}

.teachers__arrow--prev {
  left: -28px;
}

.teachers__arrow--next {
  right: -28px;
}

.teachers__arrow:disabled {
  opacity: 0;
  pointer-events: none;
}

/* Full-bleed (100vw) horizontal track; the inline padding indents the first
   card back to the 1120 content column, cards are a fixed 352px. teachers.js
   builds a looped (cloned) track when the group overflows, and centres groups
   that fit. Below 768px this becomes the 2-column grid. */
.teachers__grid {
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 32px;
  width: 100vw;
  position: relative;
  left: 50%;
  right: 50%;
  margin-left: -50vw;
  margin-right: -50vw;
  padding: 0 var(--gh-carousel-gutter);
  box-sizing: border-box;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-padding-left: var(--gh-carousel-gutter);
  scrollbar-width: none;
  -ms-overflow-style: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.teachers__grid::-webkit-scrollbar {
  display: none;
}

.teachers__grid.is-centered {
  justify-content: center;
}

.teachers__grid.is-switching {
  opacity: 0;
  transform: translateY(8px);
}

@media (prefers-reduced-motion: reduce) {
  .teachers__grid {
    transition: none;
  }
}

.teachers__group {
  display: none;
  opacity: 0;
}

.teachers__group--active {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  justify-content: center;
  gap: 32px 32px;
  flex-wrap:wrap;
  padding-bottom: 0px;
  animation: slideUp 0.4s ease-out forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.teachers__card {
  flex: 0 0 352px;
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.teachers__image {
  position: relative;
  width: 352px;
  height: 360px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(88.96deg, rgb(227, 241, 195) 3.91%, rgb(200, 228, 135) 59.72%, rgb(191, 251, 251) 123.35%);
}

.teachers__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.teachers__name {
  font-size: 24px;
  font-weight: normal;
  line-height: 32px;
  color: #333333;
  margin: 32px 0 8px 0;
  font-family: 'schibsted_grotesk_demi', 'Verdana';
}

.teachers__title {
  font-size: 14px;
  font-weight: normal;
  line-height: 24px;
  color: #707070;
  margin: 0;
  font-family: 'avenir_next_worldmedium', 'Verdana';
}

.teachers__subtitle {
  font-size: 14px;
  font-weight: 500;
  line-height: 24px;
  color: #707070;
  margin: 0;
  font-family: 'avenir_next_worldmedium', 'Verdana';
}

/* Tablet band (769–1199px): the content column can't hold a whole number of
   352px cards, so the left-anchored track piles all the slack on the right —
   card 1 flush to the gutter, a fat partial on the right, a sliver on the left
   (the asymmetry seen at 1024/iPad Pro). Re-pad the *looping* track so its
   resting pair sits centred: teachers.js still rests at scrollLeft = loopWidth,
   which lands card 0's left edge on padding-left, so a padding of half the
   leftover space centres the two-card block — no JS change. scroll-padding-left
   matches so every snapped card centres the pair too. Result: two cards centred
   with equal peeks of the previous/next card on both sides. Groups that fit keep
   .is-centered (excluded here) and stay balanced via justify-content:center. */
@media (min-width: 769px) and (max-width: 1199px) {
  .teachers__grid:not(.is-centered) {
    /* (100vw − 736px two-card block) / 2, floored at the 40px gutter for safety. */
    padding-inline: max(40px, calc(50vw - 368px));
    scroll-padding-left: max(40px, calc(50vw - 368px));
  }
}

/* From ~1000px up the peeks are wide enough (~112px at 1024) to seat the arrows
   inside them, so pull them off the edge. Below 1000px (iPad Air / iPad Pro 11
   portrait) the two cards nearly fill the width, so the arrows keep their default
   edge overlay over the outer card corners. */
@media (min-width: 1000px) and (max-width: 1199px) {
  .teachers__arrow--prev {
    left: 60px;
  }

  .teachers__arrow--next {
    right: 60px;
  }
}

/* Responsive design */
@media (max-width: 1200px) {
  .teachers {
    padding: 80px 40px;
  }

  .teachers__heading {
    font-size: 28px;
    line-height: 36px;
  }
  /* Cards stay a fixed 352px here — the carousel scrolls (see teachers.js). */
}

@media (max-width: 768px) {
  .teachers {
    padding: 60px 40px;
  }

  .teachers__header {
    margin-bottom: 40px;
  }

  /* .teachers__heading {
    font-size: 24px;
    line-height: 32px;
  } */

  .teachers__tabs {
    display: none;
  }

  /* Sticks below the site header while the section is in view (its containing
     block is .teachers__container). --gh-header-h is published by mega-menu.js. */
  .teachers__select-wrap {
    display: block;
    position: sticky;
    top: var(--gh-header-h, 48px);
    z-index: 20;
    width: 100%;
    margin: 0 0 24px;
    background: #ffffff;
  }

  /* Carousel collapses to the 2-column grid; arrows hidden. */
  .teachers__arrow {
    display: none;
  }

  .teachers__carousel {
    max-width: none;
    margin: 0;
  }

  .teachers__grid,
  .teachers__grid.is-centered {
    width: auto;
    left: auto;
    right: auto;
    margin-left: 0;
    margin-right: 0;
    padding: 0;
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: visible;
    gap: 20px;
  }

  .teachers__select-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #cccccc;
    border-radius: 8px;
    background-color: #ffffff;
    font-size: 14px;
    line-height: 20px;
    color: #333333;
    font-family: 'avenir_next_worlddemi', 'Verdana';
    cursor: pointer;
    transition: border-color 0.15s ease;
  }
  .teachers__select-trigger[aria-expanded="true"] {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    border-color: var(--gh-green) !important;
  }
  .teachers__select-trigger:hover {
    border-color: #333333;
  }

  .teachers__select-trigger:focus-visible {
    outline: none;
    border-color: #333333;
  }

  .teachers__select-group {
    font-family: 'avenir_next_worlddemi', 'Verdana';
    font-weight: normal;
  }

  .teachers__select-arrow {
    flex-shrink: 0;
    transition: transform 0.2s ease;
  }

  .teachers__select-trigger[aria-expanded="true"] .teachers__select-arrow {
    transform: rotate(180deg);
  }

  .teachers__select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0px;
    border: 1px solid #cccccc;
    border-radius: 0 0 8px 8px;
    background-color: #ffffff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    overflow: hidden;
  }

  .teachers__select-option {
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    background-color: #ffffff;
    text-align: left;
    font-size: 14px;
    line-height: 20px;
    color: #333;
    font-family: 'avenir_next_worldmedium', 'Verdana';
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
  }

  .teachers__select-option:hover {
    background-color: #f5f5f5;
    color: #333333;
  }

  .teachers__select-option--active {
    background-color: #f5f5f5;
    color: #333333;
    font-family: 'avenir_next_worlddemi', 'Verdana';
  }

  .teachers__group--active {
    gap: 20px;
  }

  .teachers__card {
    flex: 0 0 calc(49% - 10px);
    gap: 0px;
  }

  .teachers__image {
    width: 100%;
    height: auto;
  }

  .teachers__name {
    font-size: 20px;
    line-height: 28px;
    margin: 16px 0 8px 0;
  }
}

@media (max-width: 480px) {
  .teachers {
    padding: 40px 20px;
  }

  /* Extra breathing room above the (sticky) filter dropdown on small screens.
     Set above the header's 40px bottom margin so it wins the margin-collapse. */
  .teachers__select-wrap {
    margin-top: 64px;
  }

  /* .teachers__heading {
    font-size: 20px;
    line-height: 28px;
  } */

  /* .teachers__description {
    font-size: 14px;
    line-height: 22px;
  } */

  .teachers__select-trigger {
    font-size: 13px;
    padding: 8px 12px;
  }

  .teachers__select-option {
    font-size: 13px;
    padding: 10px 12px;
  }

  .teachers__group--active {
    gap: 16px;
  }

  .teachers__card {
    flex: 0 0 calc(49% - 8px);
    gap: 0px;
  }

  .teachers__image {
    width: 100%;
    height: auto;
  }

  .teachers__name {
    font-size: 16px;
    line-height: 24px;
    margin: 16px 0 8px 0;
  }

  .teachers__title,
  .teachers__subtitle {
    font-size: 12px;
    line-height: 20px;
  }
}

@media (min-width: 1025px) {
	.teachers__heading {
		font-size: 40px;
		line-height: 48px;
	}
}
