/* Yol — Qalereya — Desktop 5903:19923 (grid 5903:19928), Mobile 5903:19939 */

.aayda-road-gallery-page {
  background-color: var(--aayda-colors-surface-disabled);
}

.aayda-road-gallery {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: 20px 16px 80px;
}

.aayda-road-gallery-page .aayda-breadcrumbs {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

/* Four levels wrap on a narrow screen rather than widening the page. */
.aayda-road-gallery-page .aayda-breadcrumbs__list {
  align-items: center;
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
}

/* This trail still wraps (its long crumb is an ancestor): its current crumb keeps the sizing it had before the shared
   breadcrumb became a single line (breadcrumbs.css), so it moves to a line of its own rather than shrinking. */
.aayda-road-gallery-page .aayda-breadcrumbs__item:last-child {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
}

.aayda-road-gallery-page .aayda-breadcrumbs__item {
  min-width: 0;
}

/* The road's name can be long: it wraps instead of running off the page. */
.aayda-road-gallery-page .aayda-breadcrumbs__item:nth-child(3) .aayda-breadcrumbs__link {
  white-space: normal;
  overflow-wrap: anywhere;
}

.aayda-road-gallery__content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  min-width: 0;
  margin-top: 38px;
}

.aayda-road-gallery__title {
  margin: 0;
  color: var(--aayda-colors-gray-800);
  font-family: var(--aayda-typography-font-primary);
  font-size: var(--aayda-typography-size-24);
  font-weight: var(--aayda-typography-weight-medium);
  line-height: var(--aayda-typography-line-height-heading-24);
  letter-spacing: var(--aayda-typography-letter-spacing-24);
  overflow-wrap: break-word;
}

.aayda-road-gallery__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 370×244 on the 402px design (5903:19967); the ratio holds at any width. */
.aayda-road-gallery__item {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  aspect-ratio: 370 / 244;
  border-radius: var(--aayda-radius-image);
}

.aayda-road-gallery__trigger {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  background: var(--aayda-colors-news-tab-active-fill);
  border: 0;
  border-radius: var(--aayda-radius-image);
  cursor: pointer;
}

/* Figma: object-fit cover — cropped to the tile, never stretched. */
.aayda-road-gallery__image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: cover;
  object-position: center;
}

.aayda-road-gallery__trigger:focus-visible {
  outline: var(--aayda-border-width-focus-ring) solid var(--aayda-colors-ring-focus);
  outline-offset: 2px;
}

@media (min-width: 768px) and (max-width: 1415px) {
  .aayda-road-gallery__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--aayda-numbers-spacing-20);
  }

  .aayda-road-gallery__item {
    aspect-ratio: 408 / 245;
  }
}

@media (min-width: 1416px) {
  .aayda-road-gallery {
    width: 1440px;
    max-width: 100%;
    margin: 0 auto;

    /* 84px as drawn at 1440px; between 1416px and 1440px it gives way so the 1272px grid never
       widens the page. */
    padding: 42px max(0px, min(84px, calc((100% - 1272px) / 2))) 142px;
  }

  .aayda-road-gallery-page .aayda-breadcrumbs__list {
    width: fit-content;
    max-width: 100%;
  }

  .aayda-road-gallery__content {
    gap: 41px;
    width: 1272px;
    margin-top: 61px;
  }

  .aayda-road-gallery__title {
    font-size: var(--aayda-typography-size-32);
    font-weight: var(--aayda-typography-weight-semi-bold);
    line-height: var(--aayda-typography-line-height-heading-32);
    letter-spacing: var(--aayda-typography-letter-spacing-32);
  }

  /* 5903:19928: three 408×245 tiles to a row, 24px apart both ways. */
  .aayda-road-gallery__grid {
    grid-template-columns: repeat(3, 408px);
    gap: 24px;
    width: 1272px;
  }

  .aayda-road-gallery__item {
    width: 408px;
    height: 245px;
    aspect-ratio: auto;
  }
}

/* Lightbox — Desktop 4921:39921, Mobile 5662:24357 */

.aayda-gallery-viewer[hidden] {
  display: none;
}

.aayda-gallery-viewer:not([hidden]) {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #000000;
  backdrop-filter: blur(12px);
}

.aayda-gallery-viewer__header {
  box-sizing: border-box;
  position: relative;
  display: flex;
  flex-shrink: 0;
  align-items: center;
  min-height: 72px;
  padding: 32px 13px 0;
}

.aayda-gallery-viewer__title {
  display: none;
}

.aayda-gallery-viewer__close {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.aayda-gallery-viewer__close img {
  display: block;
  width: 15px;
  height: 15px;
}

.aayda-gallery-viewer__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
}

.aayda-gallery-viewer__arrow {
  display: none;
}

.aayda-gallery-viewer__figure {
  box-sizing: border-box;
  position: absolute;
  top: 290px;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 237px;
  margin: 0;
  overflow: hidden;
  touch-action: none;
}

.aayda-gallery-viewer__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: fill;
  object-position: unset;
  image-rendering: auto;
  filter: none;
  transform: none;
  border-radius: var(--aayda-radius-image);
}

.aayda-gallery-viewer__counter {
  position: absolute;
  z-index: 2;
  top: 42px;
  left: 50%;
  margin: 0;
  color: var(--aayda-colors-base-white, #ffffff);
  font-family: var(--aayda-typography-font-primary);
  font-size: var(--aayda-typography-size-14);
  font-weight: var(--aayda-typography-weight-bold);
  line-height: var(--aayda-typography-line-height-14);
  letter-spacing: var(--aayda-typography-letter-spacing-14);
  text-align: center;
  white-space: nowrap;
  transform: translateX(-50%);
}

.aayda-gallery-viewer__thumbs {
  display: none;
}

.aayda-gallery-viewer__caption {
  box-sizing: border-box;
  flex-shrink: 0;
  width: 100%;
  margin: 0;
  padding: 20px 12px;
  overflow: hidden;
  color: var(--aayda-colors-base-white, #ffffff);
  font-family: var(--aayda-typography-font-primary);
  font-size: var(--aayda-typography-size-16);
  font-weight: var(--aayda-typography-weight-bold);
  line-height: var(--aayda-typography-line-height-16);
  letter-spacing: var(--aayda-typography-letter-spacing-16);
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(22, 22, 22, 0.72);
}

@media (min-width: 1416px) {
  .aayda-gallery-viewer {
    backdrop-filter: blur(20px);
  }

  .aayda-gallery-viewer__header {
    justify-content: space-between;
    width: 100%;
    height: 70px;
    min-height: 70px;
    padding: 10px 32px;
    background: #191919;
  }

  .aayda-gallery-viewer__title {
    display: block;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    color: var(--aayda-colors-base-white, #ffffff);
    font-family: var(--aayda-typography-font-primary);
    font-size: var(--aayda-typography-size-18);
    font-weight: var(--aayda-typography-weight-medium);
    line-height: var(--aayda-typography-line-height-18);
    letter-spacing: var(--aayda-typography-letter-spacing-18);
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .aayda-gallery-viewer__body {
    position: relative;
    flex: 1 1 auto;
    align-items: stretch;
    justify-content: flex-start;
    width: 1440px;
    max-width: 100%;
    /* The design frame is 1440 × 900 and its content stack about 850px tall. Up to 900px of viewport
       height nothing moves; on a taller viewport (a 4K or high-resolution display) the stack moves down
       by half the extra height, so it is centred instead of leaving the black area below it. The arrows
       are positioned from this box, so they move with the image. dvh overrides the vh fallback. */
    margin: max(0px, calc((100vh - 900px) / 2)) auto 0;
    margin: max(0px, calc((100dvh - 900px) / 2)) auto 0;
  }

  .aayda-gallery-viewer__arrow {
    position: absolute;
    z-index: 1;
    display: block;
    width: 56px;
    height: 56px;
  }

  .aayda-gallery-viewer__arrow img {
    display: block;
    width: 56px;
    height: 56px;
    max-width: none;
  }

  .aayda-gallery-viewer__arrow--prev {
    top: 350px;
    left: 84px;
  }

  .aayda-gallery-viewer__arrow--next {
    top: 352px;
    left: 1300px;
  }

  .aayda-gallery-viewer__figure {
    position: static;
    top: auto;
    left: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1056px;
    height: 566px;
    margin: 57px 192px 0;
    border-radius: var(--aayda-radius-image);
  }

  .aayda-gallery-viewer__counter {
    position: static;
    z-index: auto;
    top: auto;
    left: auto;
    width: 100%;
    margin: 24px 0 0;
    font-size: var(--aayda-typography-size-20);
    font-weight: var(--aayda-typography-weight-medium);
    line-height: var(--aayda-typography-line-height-20);
    letter-spacing: var(--aayda-typography-letter-spacing-20);
    transform: none;
  }

  /* Nine thumbnails fill the 1058px strip (4921:39933); more scroll sideways, and the script keeps
     the current one in view. */
  .aayda-gallery-viewer__thumbs {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
    /* 1058px, but never past the viewer's right edge: the row starts at 192px plus the photo's inset, so a
       portrait or square photo would otherwise push it off-screen between 1416px and about 1700px. The
       body is the viewer's full width up to 1440px, and the strip has no padding or border. */
    width: min(1058px, calc(100% - 192px - var(--aayda-gallery-thumbs-inset, 0px)));
    height: 81px;
    margin: 26px 192px 0;
    /* The first thumbnail starts on the shown photo's left edge: the figure's own 192px, plus how far
       the photo, drawn whole and centred, sits in from the frame (--aayda-gallery-thumbs-inset, measured
       by the page script; 0 until then). */
    margin-left: calc(192px + var(--aayda-gallery-thumbs-inset, 0px));
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .aayda-gallery-viewer__thumbs::-webkit-scrollbar {
    display: none;
  }

  .aayda-gallery-viewer__thumb {
    box-sizing: border-box;
    padding: 0;
    background: transparent;
    cursor: pointer;
    flex: 0 0 108px;
    width: 108px;
    height: 81px;
    overflow: hidden;
    border: 2px solid transparent;
    border-radius: var(--aayda-radius-button);
  }

  .aayda-gallery-viewer__thumb:nth-child(3n + 2) {
    flex-basis: 110px;
    width: 110px;
  }

  .aayda-gallery-viewer__thumb.is-current {
    border-color: var(--aayda-colors-blue-400);
  }

  .aayda-gallery-viewer__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center;
  }

  .aayda-gallery-viewer__caption {
    display: none;
  }

  /* Inset, because the strip clips what overflows it. */
  .aayda-gallery-viewer__thumb:focus-visible {
    outline: var(--aayda-border-width-focus-ring) solid var(--aayda-colors-base-white);
    outline-offset: calc(var(--aayda-border-width-focus-ring) * -1);
  }
}

/* Keyboard focus on the dark viewer: a white ring, which the site's navy one would not show on. */
.aayda-gallery-viewer__close:focus-visible,
.aayda-gallery-viewer__arrow:focus-visible {
  outline: var(--aayda-border-width-focus-ring) solid var(--aayda-colors-base-white);
  outline-offset: 2px;
  border-radius: 50%;
}
