/* Shared card geometry and mobile editorial alignment.
   Keep round navigation controls and accessibility affordances intact. */

/* Rectangular card surfaces throughout Arabic and French editions. */
body.tm-design-system :is(
  [class*="-card"],
  [class*="__card"],
  [class*="-tile"],
  [class*="__tile"],
  .tm-magazine-issue,
  .tm-magazine-cover-wrap,
  .tm-magazine-current-info,
  .tm-gallery-slide,
  .tm-gallery-page-hero,
  .tm-home-gallery__item,
  .tm-home-publication-card__cover,
  .tm-image-gallery__photo,
  .tm-image-gallery__thumb,
  .tm-films-catalog-section__poster,
  .tm-jury-deck__poster,
  .tm-story__cover,
  .tm-story__article,
  .tm-commission-card__media,
  .tm-program-embedded .ev-card,
  .tm-program-embedded .venue,
  .tm-venue-gallery__photo,
  .tm-cine-pocket-banner__artwork,
  .tm-awarded-film,
  .tm-reels__media,
  .tm-reels__card-button,
  .tm-workshop-modal__hero,
  .tm-media-release-card,
  .tm-timimoun-place-card,
  .tm-about-page .tm-commission-card,
  .tm-home-honor-card__button,
  .tm-home-gallery__item > button
) { border-radius: 0 !important; }

/* Media inside cards should not retain rounded corners from older CSS. */
body.tm-design-system :is(
  [class*="-card"],
  [class*="__card"],
  [class*="-tile"],
  [class*="__tile"],
  .tm-magazine-issue,
  .tm-gallery-slide,
  .tm-home-gallery__item,
  .tm-films-catalog-section__poster,
  .tm-jury-deck__poster,
  .tm-home-publication-card__cover,
  .tm-image-gallery__thumb,
  .tm-reels__media,
  .tm-cine-pocket-banner__artwork,
  .tm-commission-card
) :is(img,picture) { border-radius: 0 !important; }

/* Keep portrait avatars and circular controls circular: they are not cards. */
body.tm-design-system :is([class*="__avatar"], [class*="-avatar"], [class*="__avatar"] img) {
  border-radius: 50% !important;
}

/* Give the home jury rail exactly the same poster geometry as the films rail. */
@media (max-width: 820px) {
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-juries__inner {
    min-width: 0 !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-juries__carousel-wrap {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    gap: 12px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    overflow: hidden !important;
    margin: 0 !important;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-juries__carousel,
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-juries__carousel.tm-mobile-carousel {
    box-sizing: border-box !important;
    display: flex !important;
    flex-flow: row nowrap !important;
    grid-column: 1 / -1;
    grid-row: 1;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    gap: 14px !important;
    margin: 0 !important;
    padding: 4px 10px 12px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scroll-snap-type: x mandatory !important;
    scroll-padding-inline: 10px !important;
    overscroll-behavior-x: contain !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y !important;
    scrollbar-width: none;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-juries__carousel::-webkit-scrollbar {
    display: none;
  }
  /* Navigation stays reachable; only the poster rail scrolls. */
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-juries__arrow {
    position: static !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    grid-row: 2;
    top: auto !important;
    inset-inline: auto !important;
    right: auto !important;
    left: auto !important;
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    background: #fff !important;
    color: #111318 !important;
    border: 1px solid #bbb6b1 !important;
    border-radius: 50% !important;
    box-shadow: none !important;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-juries__prev {
    grid-column: 1;
    justify-self: end;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-juries__next {
    grid-column: 2;
    justify-self: start;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-juries__arrow[disabled] {
    opacity: .32 !important;
    pointer-events: none;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-juries__arrow:focus-visible {
    outline: 3px solid #6d91aa;
    outline-offset: 3px;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-jury-card {
    flex: 0 0 min(70vw, 250px) !important;
    width: min(70vw, 250px) !important;
    max-width: min(70vw, 250px) !important;
    min-width: 0 !important;
    height: auto !important;
    aspect-ratio: 2 / 3 !important;
    scroll-snap-align: start !important;
    scroll-snap-stop: normal;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-jury-card__button {
    width: 100% !important;
    height: 100% !important;
    aspect-ratio: 2 / 3 !important;
    overflow: hidden !important;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-juries .tm-home-jury-card__button > img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center !important;
  }

  /* The gallery title and the 'all photos' link remain on a single line. */
  body.tm-design-system .tm-home-blocks > .tm-home-gallery .tm-home-editorial-head__kicker {
    display: none !important;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-gallery .tm-home-gallery__head {
    display: flex !important;
    flex-flow: row nowrap !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: clamp(8px, 2vw, 14px) !important;
    width: 100% !important;
    min-width: 0 !important;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-gallery .tm-home-editorial-head__copy {
    display: block !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    width: auto !important;
    max-width: none !important;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-gallery .tm-home-gallery__head h2 {
    font-size: clamp(20px, 5.9vw, 30px) !important;
    line-height: 1.25 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    overflow-wrap: normal !important;
  }
  body.tm-design-system .tm-home-blocks > .tm-home-gallery .tm-home-editorial-head__link {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    align-self: center !important;
    flex: 0 0 auto !important;
    width: auto !important;
    min-height: 40px !important;
    margin: 0 !important;
    padding: 8px 10px !important;
    gap: 5px !important;
    font-size: clamp(11px, 3.15vw, 13px) !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
  }
  body.tme-english.tm-design-system .tm-home-blocks > .tm-home-gallery .tm-home-gallery__head h2 {
    font-size: clamp(17px, 5vw, 26px) !important;
  }
  body.tme-english.tm-design-system .tm-home-blocks > .tm-home-gallery .tm-home-editorial-head__link {
    font-size: clamp(10px, 2.65vw, 12px) !important;
    padding-inline: 7px !important;
    gap: 3px !important;
  }
}

@media (max-width: 355px) {
  body.tm-design-system .tm-home-blocks > .tm-home-gallery .tm-home-gallery__head h2 {
    font-size: 20px !important;
  }
  body.tme-english.tm-design-system .tm-home-blocks > .tm-home-gallery .tm-home-gallery__head h2 {
    font-size: 16px !important;
  }
}
