/* Videoqalereya — Desktop 4921:39746, card 5816:20045, mobile card 6470:24005. */

.aayda-gallery-video-page .aayda-gallery {
  padding: 49px 0 75px;
}

/* The tab strip is gallery.css's, unchanged: Figma's video page (11235:76602) draws the same News/Tab
   strip as the photo page (4921:39737) — the white pills with a green border were the static page's
   older design. */

.aayda-gallery-video__grid {
  display: flex;
  flex-direction: column;
  gap: var(--aayda-numbers-spacing-20);
  width: 100%;
  margin: 0 0 var(--aayda-numbers-spacing-40);
  padding: 0;
}

/* VIDEO-3: the card's height follows its content (the title wraps, the date row follows), so the
   item is a flex box the card fills; cards in one grid row still stretch to the same height. */
.aayda-gallery-video__item {
  display: flex;
  width: 100%;
  max-width: 370px;
}

.aayda-gallery-video__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  box-sizing: border-box;
  flex: 1 1 auto;
  width: 100%;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: #f8f8fa;
  border-radius: var(--aayda-radius-card);
  box-shadow: inset 0 0 0 var(--aayda-border-width-card) var(--aayda-colors-base-white);
}

/* The plain tile a card shows without a picture, or when its picture fails to load
   (js/pages/gallery-video.js): the detail player's own fallback colour (VIDEO-1), so the white
   play icon stays visible. A loaded picture covers it. */
.aayda-gallery-video__media {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  height: 206px;
  overflow: hidden;
  background-color: var(--aayda-colors-gray-800);
}

.aayda-gallery-video__image {
  position: absolute;
  top: -21.74%;
  left: 0;
  display: block;
  width: 110.27%;
  max-width: none;
  max-height: none;
  height: 143.48%;
  /* The design's crop box is kept; a real cover is cropped into it rather than stretched to it. */
  object-fit: cover;
}

/* VIDEO-3: the mobile card is the column's width (at most the design's 370px), so the icon is centred
   and the badge kept to the right edge rather than placed for 370px — at 375px the fixed card ran 11px
   past the screen. The desktop keeps the design's exact positions (below). */
.aayda-gallery-video__play {
  position: absolute;
  top: 71px;
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 60px;
  overflow: hidden;
  border-radius: 50%;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.aayda-gallery-video__play img {
  display: block;
  width: 60px;
  height: 60px;
  max-width: none;
}

.aayda-gallery-video__duration {
  position: absolute;
  top: 166px;
  right: 12px;
  box-sizing: border-box;
  padding: 3px var(--aayda-numbers-spacing-8);
  overflow: hidden;
  font-size: var(--aayda-typography-size-12);
  font-weight: var(--aayda-typography-weight-semi-bold);
  line-height: var(--aayda-typography-line-height-12);
  letter-spacing: var(--aayda-typography-letter-spacing-12);
  color: var(--aayda-colors-base-white);
  white-space: nowrap;
  background: rgba(17, 30, 58, 0.72);
  border-radius: 6px;
}

/* VIDEO-3: the title and the date row under it (technical specification §4). The title keeps the
   design's padding and type; it wraps to its full length instead of being cut at a fixed 66px, and
   the row sits at the card's foot, so a long title never overlaps the date or the action. */
.aayda-gallery-video__body {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  gap: var(--aayda-numbers-spacing-12);
  box-sizing: border-box;
  width: 100%;
  padding: var(--aayda-numbers-spacing-18) var(--aayda-numbers-spacing-20) var(--aayda-numbers-spacing-20);
}

.aayda-gallery-video__title {
  width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: var(--aayda-typography-size-18);
  font-weight: var(--aayda-typography-weight-bold);
  line-height: var(--aayda-typography-line-height-18);
  letter-spacing: var(--aayda-typography-letter-spacing-18);
  color: var(--aayda-colors-teal-900);
}

/* The date and "Ətraflı məlumat", in the photo cards' type and colours (gallery.css). */
.aayda-gallery-video__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--aayda-numbers-spacing-12);
  min-height: 30px;
  margin-top: auto;
}

.aayda-gallery-video__date {
  margin: 0;
  font-size: var(--aayda-typography-size-14);
  font-weight: var(--aayda-typography-weight-semi-bold);
  line-height: var(--aayda-typography-line-height-14);
  letter-spacing: var(--aayda-typography-letter-spacing-14);
  color: var(--aayda-colors-neutral-500);
  white-space: nowrap;
}

.aayda-gallery-video__more {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  margin-left: auto;
  color: var(--aayda-colors-blue-400);
}

.aayda-gallery-video__more-label {
  font-size: var(--aayda-typography-size-14);
  font-weight: var(--aayda-typography-weight-semi-bold);
  line-height: var(--aayda-typography-line-height-14);
  letter-spacing: var(--aayda-typography-letter-spacing-14);
  white-space: nowrap;
}

.aayda-gallery-video__more-arrow {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
}

.aayda-gallery-video__more-arrow img {
  display: block;
  width: 30px;
  height: 30px;
  max-width: none;
}

/* Keyboard focus at every width — the site's ring, as on the news cards (news-detail.css). */
.aayda-gallery-video__card: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-gallery-video-page .aayda-gallery__inner {
    width: calc(100% - 32px);
    max-width: 100%;
    min-width: 0;
  }

  .aayda-gallery-video__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--aayda-numbers-spacing-20);
    width: 100%;
    max-width: 100%;
  }

  .aayda-gallery-video__item,
  .aayda-gallery-video__card,
  .aayda-gallery-video__media {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .aayda-gallery-video__play {
    left: 50%;
    transform: translateX(-50%);
  }

  .aayda-gallery-video__duration {
    left: auto;
    right: var(--aayda-numbers-spacing-16);
  }

  .aayda-gallery-video-page .aayda-gallery__pagination,
  .aayda-gallery-video-page .aayda-gallery__pagination .aayda-pagination__list {
    width: 100%;
    max-width: 100%;
  }
}

@media (min-width: 1416px) {
  .aayda-gallery-video-page .aayda-gallery {
    padding: 68px 0 80px;
  }

  .aayda-gallery-video__grid {
    display: grid;
    grid-template-columns: 410px 410px 410px;
    gap: var(--aayda-numbers-spacing-24);
    width: 1272px;
    max-width: none;
    margin: 0 0 40px;
  }

  .aayda-gallery-video__item,
  .aayda-gallery-video__card {
    width: 410px;
    max-width: none;
  }

  .aayda-gallery-video__media {
    width: 410px;
    height: 242px;
  }

  .aayda-gallery-video__play {
    top: 89px;
    left: 173px;
    transform: none;
  }

  .aayda-gallery-video__duration {
    top: 201px;
    right: auto;
    left: 347px;
  }
}

/* ===========================================================================
 * Bug-fix 4, corrections 34 and 36 — the video cards are the photo gallery's card (owner:
 * "Videoqalereya və faydalı kartları fotoqalereyadakı kimi eyni olsun"). Figma's current video page
 * (13076:81436) draws its video cards as that same News Item — 408 × 397, the 400 × 245 picture inset
 * 4px with radius 12 — with the 60px play icon centred on the picture. Below 1416px the photo card's
 * mobile frame: 4px inset, a 220px picture, radius 12. The video-only parts stay: the play icon, the
 * duration badge (12px from the picture's right and bottom edges), the date and "Ətraflı məlumat".
 * The picture is covered into its box rather than placed with the old 410px card's offsets.
 *
 * The hover preview (correction 34) lies over the poster and shows only while it really plays; the play
 * icon and the badge stay on top of it.
 * =========================================================================== */
.aayda-gallery-video__card {
  padding: var(--aayda-numbers-spacing-4) var(--aayda-numbers-spacing-4) var(--aayda-numbers-spacing-12);
  background: var(--aayda-colors-neutral-surface-subtle);
}

.aayda-gallery-video__media {
  height: 220px;
  border-radius: var(--aayda-radius-image);
}

.aayda-gallery-video__image {
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.aayda-gallery-video__play {
  top: 50%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
}

.aayda-gallery-video__duration {
  top: auto;
  right: var(--aayda-numbers-spacing-12);
  bottom: var(--aayda-numbers-spacing-12);
  left: auto;
  z-index: 2;
}

.aayda-gallery-video__body {
  gap: var(--aayda-numbers-spacing-12);
  padding: var(--aayda-numbers-spacing-10) var(--aayda-numbers-spacing-12) 0;
}

.aayda-gallery-video__title {
  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);
  color: var(--aayda-colors-text-label);
}

.aayda-video-preview {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease-out;
}

[data-video-preview-playing="true"] .aayda-video-preview {
  opacity: 1;
}

@media (min-width: 768px) and (max-width: 1415px) {
  .aayda-gallery-video__play {
    transform: translate(-50%, -50%);
  }

  .aayda-gallery-video__duration {
    right: var(--aayda-numbers-spacing-12);
  }
}

@media (min-width: 1416px) {
  .aayda-gallery-video__grid {
    grid-template-columns: 408px 408px 408px;
  }

  .aayda-gallery-video__item,
  .aayda-gallery-video__card {
    width: 408px;
  }

  /* 397px is the card's least height, as the photo card's: a longer title grows it. */
  .aayda-gallery-video__card {
    min-height: 397px;
    padding: var(--aayda-numbers-spacing-4) var(--aayda-numbers-spacing-4) 17px;
    background: var(--aayda-colors-base-white);
  }

  .aayda-gallery-video__media {
    width: 400px;
    height: 245px;
  }

  .aayda-gallery-video__play {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }

  .aayda-gallery-video__duration {
    top: auto;
    right: var(--aayda-numbers-spacing-12);
    left: auto;
  }

  /* The photo card's title at 257px from the card's top and 18px from its left, its row at the foot. */
  .aayda-gallery-video__body {
    padding: var(--aayda-numbers-spacing-8) 14px 0;
  }

  .aayda-gallery-video__title {
    font-size: var(--aayda-typography-size-16);
    line-height: var(--aayda-typography-line-height-16);
    letter-spacing: var(--aayda-typography-letter-spacing-16);
    color: var(--aayda-colors-text);
  }
}

@media (prefers-reduced-motion: reduce) {
  .aayda-video-preview {
    transition: none;
  }
}

/* ===========================================================================
 * Bug-fix-3 (2026-11-23): the card as the photo and news cards (.aayda-news-page__card).
 *
 * YouTube's still (hqdefault, 480 × 360) is 4:3 with the 16:9 picture between two black bars, 12.5% of its
 * height each. Drawn a third taller than the picture box and centred, the bars fall outside the box, which
 * clips them, at every width; the editor's own cover keeps the rule above.
 *
 * From 1416px the card keeps the photo card's fill, so its 2px white stroke shows (the white fill hid it),
 * and takes the news card's hover: a white card, the picture's 300ms crop (the same values; a YouTube still
 * the same zoom over its taller box) and "Ətraflı məlumat" opening by 4px in the link's hover colour.
 * =========================================================================== */
.aayda-gallery-video__image.is-youtube-still {
  top: -16.667%;
  height: 133.334%;
}

@media (min-width: 1416px) {
  .aayda-gallery-video__card {
    background: var(--aayda-colors-neutral-surface-subtle);
  }

  .aayda-gallery-video__image {
    transition:
      width 300ms ease-in,
      height 300ms ease-in,
      top 300ms ease-in,
      left 300ms ease-in;
  }

  /*
   * bug-fix-5 BUG 9: the link is pushed to the card's right edge (margin-left: auto), so opening the 4px gap
   * widened it leftwards — the label slid back while the arrow stood still, the reverse of the site's
   * other cards (Figma News Item hover: the label stays, the arrow moves 4px on). The 4px is now held at
   * rest as right padding and handed to the gap on hover, so the box keeps its width and edges, the label
   * stays where it is, and the arrow slides 4px forward with it, in one 300ms ease-out.
   */
  .aayda-gallery-video__more {
    gap: 0;
    padding-right: var(--aayda-numbers-spacing-4);
    transition: gap 300ms ease-out, padding-right 300ms ease-out, color 300ms ease-out;
  }

  .aayda-gallery-video__card:hover,
  .aayda-gallery-video__card:focus-visible {
    background: var(--aayda-colors-base-white);
  }

  .aayda-gallery-video__card:hover .aayda-gallery-video__image,
  .aayda-gallery-video__card:focus-visible .aayda-gallery-video__image {
    top: -3.67%;
    left: -8.44%;
    width: 116.89%;
    height: 107.35%;
  }

  .aayda-gallery-video__card:hover .aayda-gallery-video__image.is-youtube-still,
  .aayda-gallery-video__card:focus-visible .aayda-gallery-video__image.is-youtube-still {
    top: -21.565%;
    height: 143.134%;
  }

  .aayda-gallery-video__card:hover .aayda-gallery-video__more,
  .aayda-gallery-video__card:focus-visible .aayda-gallery-video__more {
    gap: var(--aayda-numbers-spacing-4);
    padding-right: 0;
    color: var(--aayda-colors-news-link-hover);
  }
}
