/*
 * IRF v438 — Global responsive foundation
 * Targets CSS viewport width, not operating-system or brand.
 * Covers macOS Retina / More Space, Windows laptops, 2K/4K displays,
 * tablets and mobile devices without changing site content.
 */

:root{
  --irf-v438-gutter:clamp(14px,2.2vw,48px);
  --irf-v438-content:1600px;
  --irf-v438-wide:1760px;
  --irf-v438-card-gap:clamp(12px,1.15vw,24px);
}

html{
  width:100%;
  max-width:100%;
  -webkit-text-size-adjust:100%;
  text-size-adjust:100%;
}

body{
  width:100%;
  max-width:100%;
  overflow-x:clip;
}

img,picture,video,canvas,iframe,svg{
  max-width:100%;
}

img,picture,video,canvas{
  height:auto;
}

input,textarea,select,button{
  max-width:100%;
}

table{
  max-width:100%;
}

.header,
.footer,
.site-footer,
.ifx-site-footer{
  max-width:100%;
}

.header{
  padding-inline:var(--irf-v438-gutter)!important;
}

.header .logo,
.header .nav,
.header .header-tools,
.header .header-search-form{
  min-width:0;
}

.header .logo img{
  max-width:100%;
  height:auto;
}

.footer-main,
.footer-stats,
.ifx-footer-main-dynamic{
  width:min(calc(100% - (var(--irf-v438-gutter) * 2)),var(--irf-v438-content));
  margin-inline:auto!important;
}

/* Prevent fixed-width media from forcing horizontal scrolling. */
.movie-card,
.news-card,
.film-card,
.gallery-card,
.item-card,
.ifx-interview-card,
.ifx-mini-card,
.winner-card,
.bf-card,
.mission-card,
.stat-card{
  min-width:0;
  max-width:100%;
}

/* Wide monitors: expand real content instead of leaving a narrow laptop layout. */
@media (min-width:1600px){
  :root{
    --irf-v438-content:1680px;
  }

  body .header{
    width:min(100%,1920px)!important;
    margin-inline:auto!important;
  }

  body .main-grid,
  body .main-grid-content,
  body .news-page,
  body .listing-page,
  body .films-container,
  body .films-page,
  body .gallery-page-body,
  body .gallery-layout,
  body .festival-page,
  body .ifx-page-shell,
  body .bf-page,
  body .best-film-body,
  body .contact-section,
  body .irf-v434-about,
  body .frontend-archive,
  body .frontend-page{
    width:min(calc(100% - 96px),var(--irf-v438-content))!important;
    max-width:var(--irf-v438-content)!important;
    margin-inline:auto!important;
  }

  /* The six cards immediately after the home banner. */
  html body .featured-movies{
    width:min(calc(100% - 96px),var(--irf-v438-wide))!important;
    max-width:var(--irf-v438-wide)!important;
    margin-inline:auto!important;
  }

  html body .featured-movies .movies-grid{
    display:grid!important;
    grid-template-columns:repeat(6,minmax(0,1fr))!important;
    gap:var(--irf-v438-card-gap)!important;
    width:100%!important;
    max-width:100%!important;
  }

  html body .featured-movies .movie-card,
  html body .featured-movies .irf-v270-home-interview-card{
    width:100%!important;
    min-width:0!important;
    height:clamp(185px,10vw,245px)!important;
    min-height:clamp(185px,10vw,245px)!important;
    max-height:245px!important;
  }

  html body .featured-movies .movie-badge{
    max-width:calc(100% - 20px)!important;
    font-size:clamp(12px,.68vw,15px)!important;
  }

  body .latest-news,
  body .iran-films-section,
  body .foreign-films-section,
  body .topics-section,
  body .cinema-showcase{
    width:min(calc(100% - 96px),var(--irf-v438-wide))!important;
    max-width:var(--irf-v438-wide)!important;
    margin-inline:auto!important;
  }

  body .latest-news .news-grid{
    grid-template-columns:repeat(4,minmax(0,1fr))!important;
    gap:var(--irf-v438-card-gap)!important;
  }

  body .cards-grid,
  body .films-grid,
  body .festival-films-grid,
  body .ifx-card-grid,
  body .winner-grid,
  body .bf-grid,
  body .criteria-grid,
  body .ifx-theme-grid,
  body .ifx-stat-grid{
    gap:var(--irf-v438-card-gap)!important;
  }
}

@media (min-width:2200px){
  :root{
    --irf-v438-content:1840px;
    --irf-v438-wide:1920px;
  }

  html body .featured-movies .movie-card,
  html body .featured-movies .irf-v270-home-interview-card{
    height:255px!important;
    min-height:255px!important;
    max-height:255px!important;
  }

  body .section-header h2,
  body .films-section-head h2,
  body .section-heading h2,
  body .ifx-section-head h2{
    font-size:clamp(28px,1.45vw,36px)!important;
  }
}

/* Windows laptops and MacBook-sized viewports. */
@media (min-width:1025px) and (max-width:1599px){
  body .header{
    gap:clamp(10px,1vw,20px)!important;
    padding-inline:clamp(16px,2vw,32px)!important;
  }

  body .header .nav{
    min-width:0!important;
  }

  body .header .header-search-form{
    width:clamp(150px,15vw,240px)!important;
  }

  body .main-grid,
  body .news-page,
  body .films-container,
  body .gallery-page-body,
  body .festival-page,
  body .ifx-page-shell,
  body .bf-page{
    width:min(calc(100% - 36px),1440px)!important;
    margin-inline:auto!important;
  }
}

/* Tablet and compact desktop windows. */
@media (min-width:769px) and (max-width:1100px){
  :root{
    --irf-v438-gutter:18px;
  }

  body .header{
    gap:12px!important;
    padding-inline:18px!important;
  }

  body .header .nav{
    flex:1 1 auto!important;
    overflow-x:auto!important;
    overflow-y:hidden!important;
    white-space:nowrap!important;
    scrollbar-width:none;
  }

  body .header .nav::-webkit-scrollbar{
    display:none;
  }

  body .header .header-search-form{
    width:clamp(130px,18vw,210px)!important;
  }

  body .main-grid,
  body .gallery-layout,
  body .film-detail-grid,
  body .festival-intro,
  body .ifx-featured-panel,
  body .ifx-hero-card,
  body .team-section{
    grid-template-columns:1fr!important;
  }

  body .cards-grid,
  body .films-grid,
  body .festival-films-grid,
  body .ifx-card-grid,
  body .winner-grid,
  body .bf-grid,
  body .criteria-grid,
  body .ifx-theme-grid,
  body .ifx-stat-grid,
  body .mission-grid,
  body .stats-section{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:16px!important;
  }

  body .footer-main,
  body .ifx-footer-main-dynamic{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }

  body .footer-stats{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
  }
}

/* Phones and small tablets. */
@media (max-width:768px){
  :root{
    --irf-v438-gutter:12px;
  }

  html,body{
    overflow-x:hidden!important;
  }

  body .header{
    width:100%!important;
    max-width:100%!important;
    padding-inline:12px!important;
  }

  body .header .logo,
  body .header .header-tools,
  body .header .nav{
    max-width:100%!important;
  }

  body .section,
  body .news-page,
  body .listing-page,
  body .films-container,
  body .films-page,
  body .gallery-page-body,
  body .festival-page,
  body .ifx-page-shell,
  body .bf-page,
  body .contact-section,
  body .irf-v434-about{
    max-width:100%!important;
  }

  body .main-grid,
  body .gallery-layout,
  body .film-detail-grid,
  body .festival-intro,
  body .festival-news-gallery,
  body .ifx-featured-panel,
  body .ifx-hero-card,
  body .team-section,
  body .irf-v434-custom-inner{
    grid-template-columns:1fr!important;
  }

  body .cards-grid,
  body .films-grid,
  body .festival-films-grid,
  body .ifx-card-grid,
  body .winner-grid,
  body .bf-grid,
  body .criteria-grid,
  body .ifx-theme-grid,
  body .ifx-stat-grid,
  body .mission-grid,
  body .stats-section,
  body .news-page .cards-grid{
    grid-template-columns:1fr!important;
    gap:14px!important;
  }

  body .footer-main,
  body .ifx-footer-main-dynamic,
  body .footer-stats{
    width:calc(100% - 24px)!important;
    grid-template-columns:1fr!important;
    gap:18px!important;
    padding-inline:0!important;
  }

  body .footer-col,
  body .footer-stat{
    min-width:0!important;
  }

  body table{
    display:block;
    width:100%!important;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
  }

  body iframe,
  body video{
    width:100%!important;
  }

  body input:not([type="checkbox"]):not([type="radio"]),
  body textarea,
  body select{
    width:100%;
    min-width:0;
  }

  @media (pointer:coarse){
    body button,
    body .btn,
    body .button,
    body input[type="submit"],
    body .login-btn,
    body .gold-btn,
    body .ghost-btn{
      min-height:44px;
    }
  }
}

@media (max-width:480px){
  body .section-header,
  body .films-section-head,
  body .section-heading,
  body .ifx-section-head{
    gap:10px!important;
    align-items:flex-start!important;
  }

  body .section-header h2,
  body .films-section-head h2,
  body .section-heading h2,
  body .ifx-section-head h2{
    font-size:clamp(20px,6vw,27px)!important;
    line-height:1.45!important;
  }

  body .hero-title,
  body .listing-hero h1,
  body .films-hero h1,
  body .gallery-hero h1,
  body .festival-title,
  body .ifx-hero-copy h1{
    overflow-wrap:anywhere;
  }
}
