/*
 * 45 SOUTH — CLEAN V2 / STEP 15
 * Responsive & Visual Polish
 *
 * Additive overrides. Keep the original visual identity,
 * custom film backgrounds and editorial project designs.
 */

/* ------------------------------------------
   1. General layout resilience
   ------------------------------------------ */

:where(
  .film-grid,
  .film-card,
  .film-card-caption,
  .film-info,
  .film-description,
  .film-credits,
  .gallery-grid,
  .gallery-item,
  .south-video-grid,
  .south-video-card
) {
  min-width: 0;
}

:where(
  .film-card-caption :is(h2,h3),
  .film-heading h1,
  .film-description,
  .country-heading h1,
  .footer-top h2
) {
  overflow-wrap: break-word;
}

:where(
  .film-grid,
  .gallery-grid,
  .south-video-grid
) > * {
  min-width: 0;
}

/* Visible focus for keyboard navigation. */

:where(
  .film-card,
  .gallery-item,
  .south-video-trigger,
  .back-link,
  .text-link,
  .category-filters a,
  .location-link,
  .footer-links a,
  .footer-links button,
  .footer-cta,
  .south-nav a,
  .south-nav button
):focus-visible {
  outline: 2px solid #f3f3f3;
  outline-offset: 4px;
}

/* ------------------------------------------
   2. Tablet refinements
   ------------------------------------------ */

@media (min-width: 801px) and (max-width: 1100px) {

  .film-grid {
    column-gap: 20px;
    row-gap: 46px;
  }

  .film-info {
    grid-template-columns:
      minmax(0, 1.4fr)
      minmax(220px, 1fr);

    gap: 6%;
  }

  .film-heading-main {
    gap: 28px;
  }

  .film-card-caption {
    align-items: flex-start;
  }

  .film-card-caption span {
    max-width: 47%;
  }
}

/* ------------------------------------------
   3. Mobile navigation
   ------------------------------------------ */

@media (max-width: 700px) {

  .south-header {
    height: auto;
    min-height: 78px;
    padding: 10px 5% 12px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    column-gap: 12px;
    row-gap: 2px;
    background:
      linear-gradient(
        to bottom,
        rgba(10, 10, 12, .95),
        rgba(10, 10, 12, .80)
      );
  }

  .south-header .south-logo img,
  .south-header .south-logo svg {
    display: block;
    width: auto;
    height: 38px;
    max-width: 140px;
    transform: none;
  }

  .south-header .header-actions {
    min-width: 0;
  }

  .south-header .south-nav {
    justify-content: flex-end;
    flex-wrap: wrap;
    column-gap: 13px;
    row-gap: 0;
  }

  .south-header .south-nav a,
  .south-header .south-nav button {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 7px 0;
    font-size: 10px;
    line-height: 1.25;
    white-space: nowrap;
    letter-spacing: .035em;
  }

  /* ----------------------------------------
     4. Portfolio and category filters
     ---------------------------------------- */

  .page-hero {
    padding-top: 160px;
    padding-bottom: 58px;
  }

  .page-hero h1 {
    font-size: clamp(43px, 10.5vw, 75px);
    line-height: 1.04;
    letter-spacing: -.055em;
    overflow-wrap: break-word;
  }

  .page-intro {
    font-size: 15px;
    line-height: 1.65;
  }

  .portfolio-section {
    padding-top: 35px;
    padding-bottom: 85px;
  }

  .category-filters {
    gap: 11px 18px;
    padding-bottom: 22px;
  }

  .category-filters a {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    line-height: 1.3;
    font-size: 10px;
  }

  .portfolio-toolbar {
    align-items: center;
    gap: 16px;
    padding: 22px 0 30px;
  }

  .portfolio-toolbar input {
    width: min(230px, 68%);
    min-width: 0;
    border-radius: 0;
    font-size: 12px;
  }

  .film-grid {
    row-gap: 39px;
  }

  .film-card-caption {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 7px 16px;
    padding-top: 14px;
  }

  .film-card-caption :is(h2,h3) {
    font-size: clamp(16px, 4.2vw, 20px);
    line-height: 1.35;
    max-width: 100%;
  }

  .film-card-caption span {
    max-width: 100%;
    font-size: 11px;
    line-height: 1.5;
  }

  /* ----------------------------------------
     5. Film details and credits
     ---------------------------------------- */

  .film-heading h1 {
    font-size: clamp(42px, 9vw, 72px);
    line-height: 1.08;
  }

  .film-heading-main {
    gap: 25px;
  }

  .back-link {
    font-size: 10px;
    margin-bottom: 43px;
  }

  .film-locations {
    gap: 8px;
  }

  .film-locations .location-link {
    min-height: 39px;
    padding: 8px 12px;
    gap: 8px;
    font-size: 11px;
    max-width: 100%;
  }

  .film-info {
    grid-template-columns: minmax(0, 1fr);
    gap: 38px;
    padding-top: 43px;
    padding-bottom: 78px;
  }

  .film-description {
    font-size: 15px;
    line-height: 1.8;
  }

  .film-description p {
    margin-bottom: 21px;
  }

  .film-description .eyebrow {
    margin-bottom: 22px;
  }

  .credit {
    grid-template-columns:
      minmax(90px, .85fr)
      minmax(0, 1.5fr);
    gap: 13px;
    overflow-wrap: break-word;
  }

  .film-credits dl {
    margin-top: 20px;
  }

  /* ----------------------------------------
     6. Gallery and film players
     ---------------------------------------- */

  .gallery-section {
    padding-top: 72px;
    padding-bottom: 80px;
  }

  .gallery-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .gallery-item {
    width: 100%;
    min-width: 0;
  }

  .south-film-players {
    padding-top: 18px;
    padding-bottom: 36px;
  }

  .south-video-grid {
    gap: 26px;
  }

  .south-video-trigger {
    width: 100%;
  }

  .related-section {
    padding-top: 78px;
    padding-bottom: 90px;
  }

  /* ----------------------------------------
     7. Contact and photo lightbox
     ---------------------------------------- */

  .contact-dialog {
    width: min(560px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    padding: 25px 19px;
  }

  .contact-dialog h2 {
    font-size: clamp(34px, 9vw, 50px);
  }

  .contact-dialog input,
  .contact-dialog textarea {
    font-size: 16px;
  }

  .photo-dialog[open] {
    padding: 50px 12px;
  }

  .photo-dialog img {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 100px);
    object-fit: contain;
  }

  .photo-dialog .photo-arrow {
    width: 38px;
    height: 52px;
    font-size: 27px;
  }

  /* ----------------------------------------
     8. Footer
     ---------------------------------------- */

  .footer-top {
    padding-top: 85px;
    padding-bottom: 88px;
  }

  .footer-top h2 {
    font-size: clamp(43px, 10.5vw, 77px);
    line-height: 1.08;
  }

  .footer-bottom {
    gap: 25px;
  }

  .footer-links {
    gap: 14px 22px;
  }

  .footer-links a,
  .footer-links button {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
  }
}

/* ------------------------------------------
   9. Narrow phone layout
   ------------------------------------------ */

@media (max-width: 400px) {

  .south-header {
    align-items: flex-start;
    row-gap: 2px;
  }

  .south-header .header-actions {
    width: 100%;
  }

  .south-header .south-nav {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .page-hero {
    padding-top: 178px;
  }

  .film-heading {
    padding-top: 175px;
  }

  .south-film-intro {
    transform: none;
  }

  .film-card-caption {
    display: block;
  }

  .film-card-caption span {
    display: block;
    text-align: left;
    margin-top: 7px;
  }

  .portfolio-toolbar input {
    width: 65%;
  }

  .country-heading {
    flex-wrap: wrap;
    gap: 12px;
  }

  .country-heading h1 {
    min-width: 0;
  }
}

/* ------------------------------------------
   10. Touch devices
   ------------------------------------------ */

@media (hover: none), (pointer: coarse) {

  .film-card-action {
    opacity: 1;
    transform: none;
    font-size: 10px;
    right: 12px;
    bottom: 12px;
    text-shadow: 0 1px 5px #000;
  }

  .film-card:hover .film-card-image img,
  .gallery-item:hover img {
    transform: none;
    opacity: 1;
  }

  .south-video-trigger:hover img {
    transform: none;
  }
}

/* ------------------------------------------
   11. Reduced motion
   ------------------------------------------ */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  .film-card-image img,
  .gallery-item img,
  .film-card-action,
  .south-video-trigger img,
  .south-video-play-icon {
    transition: none;
  }

  .film-card:hover .film-card-image img,
  .gallery-item:hover img {
    transform: none;
  }
}
