* {
  box-sizing: border-box;
}

:host {
  --sticky-top: 1rem;
}

@media (min-width: 75rem) {
  :host {
    --sticky-top: 136px;
  }
}

h1, 
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
}

img {
  max-width: 100%;
}

.hide-visually {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  white-space: nowrap;
  clip-path: inset(100%);
  clip: rect(0 0 0 0);
}

.gd-gallery-and-text {
  display: flex;
  position: relative;
  gap: 1rem;
  padding: 1rem;
  width: calc(100% + 2rem);
  margin-left: -1rem;
  background: var(--background);
}

@media (min-width: 60em) {
  .gd-gallery-and-text__gallery {
    position: sticky;
    top: var(--sticky-top);
    height: max-content;
    flex-basis: calc(100% - var(--content-width));
    max-width: calc(100% - var(--content-width));
  }
  
  .gd-gallery-and-text__text {
    position: sticky;
    top: var(--sticky-top);
    height: max-content;
    max-width: var(--content-width);
    flex-basis: var(--content-width);
    padding: 1rem;
  }

  .gd-gallery-and-text--image-right {
    flex-direction: row;
  }

  .gd-gallery-and-text--image-left {
    flex-direction: row-reverse;
  }
}

/* Main Image */

figure {
  margin: 0;
}

.gd-gallery-and-text__gallery-button:has(.gd-gallery-and-text__main-image) {
  width: 100%;
}

.gd-gallery-and-text__main-image {
  object-fit: cover;
  width: 100%;
  border-radius: 30px;
  aspect-ratio: 1.1 / 1;

  &.gd-gallery-and-text__main-image--s {
    max-height: 600px;
  }
  &.gd-gallery-and-text__main-image--m {
    max-height: 700px;
  }
  &.gd-gallery-and-text__main-image--l {
    max-height: 800px;
  }

  @media (max-width: 59.999em) {
    &.gd-gallery-and-text__main-image--s {
      max-height: 400px;
    }
    &.gd-gallery-and-text__main-image--m {
      max-height: 500px;
    }
    &.gd-gallery-and-text__main-image--l {
      max-height: 600px;
    }
  }
}

.gd-gallery-and-text--zoom .gd-gallery-and-text__main-image {
  cursor: zoom-in;
}

/* Filmstrip */

.gd-gallery-and-text__filmstrip {

  --margin-bottom: 1rem;

  .splide__arrow {
    transform: translateY(calc(-50% - var(--margin-bottom) / 2));
    width: 2.8rem;
    height: 2.8rem;
  }
}

.gd-gallery-and-text__gallery-button {
  border: none;
  padding: 0;
  background: none;
  cursor: pointer;
  margin: 0;
  height: 100%;
  width: 100%;
}

.gd-gallery-and-text__gallery-button:has(.gd-gallery-and-text__filmstrip-image) {
  padding-bottom: var(--margin-bottom);
}

.gd-gallery-and-text__filmstrip-list {
  list-style: none;
  margin: 0;
}

.gd-gallery-and-text__filmstrip-image {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  height: 100%;
  width: 100%;
  border-radius: 30px;
  box-shadow: 0px var(--margin-bottom) 9px -15px rgb(0 0 0 / 13%);
}

.gd-gallery-and-text--zoom .gd-gallery-and-text__filmstrip-image {
  cursor: zoom-in;
}

.gd-gallery-and-text__filmstrip--hide-nav {
  .splide__arrows {
    display: none;
  }

  .gd-gallery-and-text__filmstrip {
    pointer-events: none;
  }
}
  
/* Text */
.gd-gallery-and-text__text {
  &.gd-gallery-and-text__text--left {
    text-align: left;
  }
  &.gd-gallery-and-text__text--center {
    text-align: center;
  }
  &.gd-gallery-and-text__text--right {
    text-align: right;
  }
}

.gd-gallery-and-text__heading {
  margin-top: 0;
}

.gd-gallery-and-text__body {
  color: inherit;
}

/* Dialog */

.gd-gallery-and-text__dialog {
  border: none;
  padding: 0;
  cursor: pointer;
  max-height: 100vh;
  background-color: transparent;

  &::backdrop {
    background-color: rgba(161, 161, 161, 0.5);
  }
}

.gd-gallery-and-text__dialog-content {
  position: relative;
}

.gd-gallery-and-text__dialog-footer {
  position: absolute;
  bottom: 1.25rem;
  left: 0;
  right: 0;
}


.gd-gallery-and-text__dialog-image {
  height: 100%;
  width: auto;
  margin: 0 auto;
  max-height: calc(100vh - 3rem);
  object-fit: cover;
  display: block;
  cursor: zoom-in;
  transition: transform 0.3s ease;
  transform-origin: center center;
  will-change: transform;
}

.gd-gallery-and-text__dialog-image.is-zoomed {
  cursor: zoom-out;
  transform: scale(2.5);
}

.gd-gallery-and-text__dialog-controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin-bottom: 1rem;

  button {
    background-color: #fff;
    border-radius: 50%;
    aspect-ratio: 1 / 1;
    border: 1px solid #000;
    position: static;
    transform: none;
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
}

@media (max-width: 59.999em) {
  .gd-gallery-and-text {
    flex-direction: column-reverse;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: auto;
  }
}

/* Credits */
.gd-gallery-and-text__credits {
  margin-top: 1.25rem;
  display: flex;
}

.gd-gallery-and-text__credits-title {
  display: inline-block;
  transform: rotate(-90deg);
  white-space: nowrap;
  text-transform: uppercase;
  padding: 0.5rem 0;
  height: 50px;
  margin: auto 0;
  margin-left: -1.5rem;
  margin-right: -1rem;
}

.gd-gallery-and-text__credits-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid #000;
  min-height: 115px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.gd-gallery-and-text__credits-item {
  padding-left: 0.5rem;
  color: black;
  font-size: 1rem;
  line-height: 2;

  p {
    margin: 0;
  }

  a {
    color: inherit;
  }
}


/* Splide */

.splide__arrow {
  width: 3rem;
  height: 3rem;
  background-color: #fff;
  opacity: 1;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  padding: 0 !important;

  svg {
    fill: none;
    height: inherit;
    width: inherit;
    transform: none;
    padding: 0.6rem;
  }
}