.gallery-section {
  background: var(--background-medium, #f8fafc);
  padding: 96px 0;
  min-height: 943px;
  position: relative;
}

.gallery-section__container {
  width: min(1290px, calc(100% - 48px));
  margin: 0 auto;
  padding: 0;
}

.gallery-section__header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 48px;
}

.gallery-section__eyebrow {
  align-items: center;
  align-self: flex-start;
  backdrop-filter: blur(4px);
  background: rgba(21, 50, 75, 0.7);
  border: 1px solid var(--accent-secondary, #5fa8d3);
  border-radius: 60px;
  color: var(--text-light-secondary, #dde5ec);
  display: inline-flex;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 700;
  gap: 10px;
  line-height: 1.1;
  letter-spacing: var(--eyebrow-letter-spacing, 0.012em);
  padding: var(--xs, 12px);
  width: fit-content;
}

.gallery-section__eyebrow-dot {
  background: var(--accent-secondary, #5fa8d3);
  border-radius: 999px;
  display: block;
  height: 8px;
  width: 8px;
}

.gallery-section__title {
  color: var(--accent-primary, #15324b);
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5.2vw, 3.82rem);
  font-weight: 400;
  line-height: 1.1;
  margin: 0;
}

.gallery-section__subtitle {
  color: var(--text-dark-secondary, #5c6b78);
  font-family: var(--font-primary);
  font-size: var(--body-regular-font-size, 16px);
  line-height: 1.6;
  margin: 0;
  max-width: 720px;
}

.gallery-section__viewport {
  overflow: hidden;
  width: 100%;
}

.gallery-section__track {
  display: flex;
  gap: 30px;
  transition: none;
  will-change: transform;
}

.gallery-section__card {
  border-radius: 24px;
  box-shadow: 0 5px 10px -5px rgba(0, 0, 0, 0.05);
  flex: 0 0 410px;
  width: 410px;
  height: 530px;
  min-width: 0;
  overflow: hidden;
  position: relative;
  transition: transform 300ms ease, box-shadow 300ms ease;
}

.gallery-section__media {
  border-radius: 12px;
  height: 400px;
  overflow: hidden;
  position: relative;
  transition: height 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.gallery-section__image,
.gallery-section__image-placeholder {
  display: block;
  height: 100%;
  object-fit: cover;
  left: 0;
  position: absolute;
  top: 0;
  transition:
    width 420ms cubic-bezier(0.22, 1, 0.36, 1),
    height 420ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1);
  width: 100%;
}

.gallery-section__image-placeholder {
  background: #c4c4c4;
}

.gallery-section__content {
  backdrop-filter: blur(4px);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  left: 50%;
  padding: 16px;
  position: absolute;
  top: 400px;
  transform: translateX(-50%);
  width: 346px;
  z-index: 2;
  transition: background 300ms ease, top 300ms ease;
}

.gallery-section__content {
  background: rgba(241, 252, 255, 0.75);
}

.gallery-section__card.is-selected .gallery-section__content {
  background: rgba(0, 8, 61, 0.55);
}

.gallery-section__card-title {
  font-family: var(--font-primary);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.3;
  margin: 0;
  color: var(--text-dark-secondary, #5c6b78);
  transition: color 260ms ease;
}

.gallery-section__card-description {
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.6;
  margin: 0;
  color: var(--text-dark-secondary, #5c6b78);
  transition: color 260ms ease;
}

.gallery-section__card-link {
  color: var(--accent-primary, #15324b);
  display: inline-flex;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-top: 4px;
  position: relative;
  z-index: 3;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 260ms ease, opacity 260ms ease;
}

.gallery-section__card-link:hover,
.gallery-section__card-link:focus-visible {
  color: var(--accent-secondary, #5fa8d3);
}

.gallery-section__card.is-selected .gallery-section__media {
  height: 530px;
}

.gallery-section__card.is-selected .gallery-section__image {
  width: 480px;
  height: 600px;
  max-width: none;
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}

.gallery-section__card.is-selected .gallery-section__card-title,
.gallery-section__card.is-selected .gallery-section__card-description {
  color: var(--text-light, #f1fcff);
}

.gallery-section__card.is-selected .gallery-section__card-link {
  color: var(--text-light, #f1fcff);
}

@media (hover: hover) and (pointer: fine) {
  .gallery-section__card:not(.is-selected):hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 32px -18px rgba(0, 0, 0, 0.3);
  }

  .gallery-section__card:not(.is-selected):hover .gallery-section__image,
  .gallery-section__card:not(.is-selected):hover .gallery-section__image-placeholder {
    transform: scale(1.04);
  }
}

.gallery-section.is-instant .gallery-section__media,
.gallery-section.is-instant .gallery-section__image,
.gallery-section.is-instant .gallery-section__content,
.gallery-section.is-instant .gallery-section__card-title,
.gallery-section.is-instant .gallery-section__card-description {
  transition: none !important;
}

.gallery-section__controls {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-top: 48px;
}

/* About page reveal pre-hide: JS timeline animates these to opacity 1. */
body.page-template-about .gallery-section__eyebrow,
body.page-template-about .gallery-section__title,
body.page-template-about .gallery-section__subtitle,
body.page-template-about .gallery-section__viewport,
body.page-template-about .gallery-section__controls {
  opacity: 0;
}

.gallery-section__arrow {
  background: transparent;
  border: none;
  cursor: pointer;
  display: inline-flex;
  flex-shrink: 0;
  height: 40px;
  overflow: visible;
  padding: 0;
  width: 40px;
}

.gallery-section__arrow[disabled] {
  cursor: not-allowed;
  opacity: 0.45;
}

.gallery-section__arrow svg {
  display: block;
  height: 40px;
  overflow: visible;
  shape-rendering: geometricPrecision;
  transition: transform 220ms ease, filter 220ms ease;
  width: 40px;
}

@media (hover: hover) and (pointer: fine) {
  .gallery-section__arrow:hover:not([disabled]) svg,
  .gallery-section__arrow:focus-visible:not([disabled]) svg {
    filter: drop-shadow(0 6px 10px rgba(21, 50, 75, 0.22));
    transform: translateX(2px);
  }

  .gallery-section__arrow--prev:hover:not([disabled]) svg,
  .gallery-section__arrow--prev:focus-visible:not([disabled]) svg {
    transform: translateX(-2px);
  }
}

@media (max-width: 1140px) {
  .gallery-section {
    min-height: 0;
  }

  .gallery-section__container {
    width: min(100%, calc(100% - 40px));
  }

  .gallery-section__card {
    flex-basis: calc((100% - 30px) / 2);
    width: auto;
    height: auto;
  }

  .gallery-section__media {
    height: auto;
    aspect-ratio: 4 / 3;
    border-radius: 18px 18px 0 0;
  }

  .gallery-section__content {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    width: 100%;
    border-radius: 0 0 12px 12px;
    padding: 14px;
    gap: 6px;
  }

  .gallery-section__card.is-selected .gallery-section__media {
    height: auto;
  }

  .gallery-section__card.is-selected .gallery-section__image {
    position: static;
    width: 100%;
    height: 100%;
    max-width: 100%;
    left: auto;
    top: auto;
    transform: none;
  }
}

@media (max-width: 768px) {

  .gallery-section__image {
    object-position: center 20%;
  }

  .gallery-section {
    padding: 64px 0;
    min-height: 0;
  }

  .gallery-section__header {
    gap: 14px;
    margin-bottom: 24px;
  }

  .gallery-section__container {
    width: calc(100% - 20px);
  }

  .gallery-section__track {
    gap: 16px;
  }

  .gallery-section__card {
    flex-basis: 100%;
    border-radius: 18px;
    height: auto;
  }

  .gallery-section__media {
    height: auto;
    aspect-ratio: 4 / 3;
    border-radius: 18px 18px 0 0;
  }

  .gallery-section__content {
    position: static;
    left: auto;
    top: auto;
    transform: none;
    width: 100%;
    border-radius: 0 0 12px 12px;
    padding: 14px;
    gap: 6px;
  }

  .gallery-section__card-title {
    font-size: 22px;
  }

  .gallery-section__card-description {
    font-size: 15px;
    line-height: 1.5;
  }

  .gallery-section__card-link {
    display: inline-block;
    font-size: 15px;
    font-weight: 800;
    margin-top: 8px;
    padding: 4px 0;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    touch-action: manipulation;
  }

  .gallery-section__card.is-selected .gallery-section__media {
    height: auto;
  }

  .gallery-section__card.is-selected .gallery-section__image {
    position: static;
    width: 100%;
    height: 100%;
    max-width: 100%;
    left: auto;
    top: auto;
    transform: none;
  }

  .gallery-section__controls {
    margin-top: 24px;
  }
}

@media (max-width: 520px) {
  .gallery-section {
    padding: 56px 0;
  }

  .gallery-section__container {
    width: calc(100% - 16px);
  }

  .gallery-section__title {
    font-size: clamp(34px, 10vw, 42px);
  }

  .gallery-section__subtitle {
    font-size: 15px;
    line-height: 1.5;
  }

  .gallery-section__card-title {
    font-size: 20px;
  }

  .gallery-section__card-description {
    font-size: 14px;
  }

  .gallery-section__card-link {
    font-size: 14px;
    margin-top: 6px;
  }
}
