
/* =========================================================
   IFK Mariefred – Mobil finjustering 2026-08-14
   Laddas efter style.css och PWA-lagren.
   Fokus: 360–430 px utan att ändra desktop-layouten.
   ========================================================= */

@media (max-width:760px){

  /* ---------- Globalt ---------- */
  html,body{
    width:100%;
    max-width:100%;
    overflow-x:hidden;
  }

  body{
    -webkit-text-size-adjust:100%;
    padding-bottom:74px;
  }

  main{
    width:100%;
    max-width:100%;
    overflow-x:hidden;
  }

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

  .container{
    width:calc(100% - 28px) !important;
    max-width:none !important;
    margin-left:auto !important;
    margin-right:auto !important;
  }

  .section{
    padding-top:42px;
    padding-bottom:42px;
  }

  .page-hero,
  .page-hero.compact{
    min-height:auto !important;
    padding:40px 0 34px !important;
  }

  .page-hero h1{
    max-width:100%;
    font-size:clamp(34px,10vw,46px) !important;
    line-height:.98 !important;
    overflow-wrap:anywhere;
  }

  .page-hero p{
    max-width:100%;
    font-size:14px;
    line-height:1.5;
  }

  .section-head{
    align-items:flex-end;
    gap:12px;
  }

  .section-head h2{
    font-size:clamp(28px,8vw,38px);
    line-height:1;
  }

  .section-head>a{
    flex:0 0 auto;
    font-size:9px;
  }

  .season-switcher{
    width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
    padding-bottom:3px;
  }

  .season-switcher::-webkit-scrollbar{display:none}

  .season-switcher a{
    min-width:64px;
    min-height:38px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    white-space:nowrap;
  }

  /* ---------- Header ---------- */
  .site-header{
    width:100%;
  }

  .nav-wrap{
    min-height:70px;
  }

  .club-logo-wrap{
    width:48px !important;
    height:52px !important;
    flex-basis:48px !important;
  }

  .club-logo{
    max-width:48px !important;
    height:48px !important;
    max-height:48px !important;
  }

  .brand-text b{
    font-size:11px;
    letter-spacing:.045em;
  }

  .brand-text small{
    font-size:8px;
  }

  .menu-btn{
    min-width:42px;
    min-height:42px;
  }

  /* ---------- Matcher-lista ---------- */
  .match-list{
    display:grid;
    gap:9px;
  }

  .match-row{
    width:100%;
    min-width:0;
    display:grid !important;
    grid-template-columns:58px minmax(0,1fr) auto !important;
    gap:10px !important;
    align-items:center;
    padding:12px !important;
  }

  .match-row .datebox{
    width:54px;
    min-width:54px;
  }

  .match-row .match-info{
    min-width:0;
  }

  .match-row .match-info b,
  .match-row .match-info strong{
    display:block;
    max-width:100%;
    overflow-wrap:anywhere;
    font-size:11px;
    line-height:1.25;
  }

  .match-row .match-info span,
  .match-row .match-info small{
    display:block;
    max-width:100%;
    margin-top:3px;
    overflow-wrap:anywhere;
    font-size:8px;
  }

  .match-score{
    min-width:52px;
    text-align:right;
    font-size:19px !important;
    white-space:nowrap;
  }

  /* ---------- Publik matchsida ---------- */
  .match-top,
  .match-topbar{
    min-width:0;
  }

  .match-topbar{
    display:grid !important;
    grid-template-columns:1fr !important;
    gap:10px !important;
  }

  .match-back{
    width:max-content;
    max-width:100%;
  }

  .match-card-modern,
  .match-status-card,
  .match-info-card,
  .match-nav-card{
    min-width:0;
    overflow:hidden;
  }

  .match-card-main{
    padding:18px 14px !important;
  }

  .match-card-meta{
    flex-wrap:wrap;
    gap:6px 10px;
  }

  .match-center-score,
  .big-result{
    font-size:clamp(42px,14vw,64px) !important;
    line-height:.95;
  }

  .match-side{
    min-width:0;
  }

  .match-side strong,
  .match-side b{
    overflow-wrap:anywhere;
  }

  .match-summary-grid{
    grid-template-columns:1fr !important;
    gap:10px !important;
  }

  .match-subnav{
    display:flex;
    width:100%;
    overflow-x:auto;
    gap:7px;
    padding-bottom:4px;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }

  .match-subnav::-webkit-scrollbar{display:none}

  .match-subnav a{
    flex:0 0 auto;
    min-height:38px;
    display:flex;
    align-items:center;
    white-space:nowrap;
  }

  .match-lineup-layout{
    grid-template-columns:1fr !important;
    gap:16px !important;
  }

  .public-pitch-wrap{
    width:100%;
    max-width:100%;
    overflow:hidden;
  }

  .match-public-pitch{
    width:100% !important;
    max-width:100% !important;
    min-height:520px !important;
  }

  .match-player-node{
    transform:translate(-50%,-50%) scale(.86);
    transform-origin:center;
  }

  .public-bench{
    width:100%;
  }

  .public-bench-list{
    display:grid !important;
    grid-template-columns:1fr 1fr !important;
    gap:7px !important;
  }

  .public-bench-player{
    min-width:0;
    padding:8px !important;
  }

  .public-bench-player strong{
    overflow-wrap:anywhere;
    font-size:9px;
  }

  .match-report-copy{
    font-size:15px;
    line-height:1.65;
  }

  .match-timeline{
    width:100%;
  }

  .timeline-event{
    grid-template-columns:42px 28px minmax(0,1fr) !important;
    gap:8px !important;
  }

  .timeline-content{
    min-width:0;
  }

  .timeline-content strong,
  .timeline-content p{
    overflow-wrap:anywhere;
  }

  .match-gallery-grid{
    grid-template-columns:1fr 1fr !important;
    gap:8px !important;
  }

  .match-navigation{
    grid-template-columns:1fr !important;
    gap:8px !important;
  }

  /* ---------- Laget ---------- */
  .players.full{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:12px !important;
  }

  .players.full .player{
    min-width:0;
  }

  .players.full .player h3{
    max-width:100%;
    font-size:14px;
    line-height:1.1;
    overflow-wrap:anywhere;
  }

  .players.full .player p{
    font-size:9px;
  }

  .staff-grid{
    grid-template-columns:1fr !important;
    gap:10px !important;
  }

  .staff{
    min-width:0;
  }

  .team-stats-link{
    width:100%;
    justify-content:center;
  }

  /* ---------- Spelarprofil ---------- */
  .player-profile{
    padding-top:34px;
    padding-bottom:34px;
  }

  .profile-grid{
    grid-template-columns:1fr !important;
    gap:22px !important;
  }

  .profile-photo{
    width:min(78vw,330px);
    margin:0 auto;
  }

  .profile-copy{
    min-width:0;
    text-align:left;
  }

  .profile-number{
    font-size:42px !important;
  }

  .profile-copy h1{
    max-width:100%;
    font-size:clamp(38px,12vw,52px) !important;
    line-height:.95 !important;
    overflow-wrap:anywhere;
  }

  .profile-box{
    width:100%;
  }

  .player-stat-cards,
  .player-stat-cards.player-stat-cards-v2{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }

  .player-stat-cards article{
    min-width:0;
    padding:12px !important;
  }

  .player-stat-cards strong{
    font-size:23px !important;
  }

  .player-profile-v2-summary{
    grid-template-columns:1fr !important;
  }

  .player-profile-panel{
    padding:16px !important;
  }

  .player-position-row{
    grid-template-columns:minmax(78px,1fr) 1.5fr 24px !important;
    gap:7px !important;
  }

  .player-matchlog-list{
    display:grid;
    gap:8px;
  }

  .player-matchlog-row,
  .player-matchlog-row-v2{
    grid-template-columns:1fr auto !important;
    gap:8px 10px !important;
    padding:12px !important;
  }

  .player-matchlog-row>div:first-child{
    min-width:0;
  }

  .player-matchlog-row strong{
    overflow-wrap:anywhere;
  }

  .player-matchlog-role,
  .player-matchlog-numbers{
    grid-column:1/-1 !important;
  }

  .player-matchlog-numbers{
    display:flex;
    flex-wrap:wrap;
    gap:5px;
  }

  /* ---------- Statistik ---------- */
  .stats-overview-cards{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }

  .stats-overview-cards article{
    min-width:0;
    padding:12px !important;
  }

  .stats-dashboard-grid{
    grid-template-columns:1fr !important;
    gap:12px !important;
  }

  .stats-team-card,
  .stats-form-card{
    padding:16px !important;
  }

  .stats-team-record{
    grid-template-columns:repeat(3,minmax(0,1fr)) !important;
    gap:6px !important;
  }

  .stats-team-record article{
    min-width:0;
    padding:9px !important;
  }

  .stats-team-record strong{
    font-size:20px !important;
  }

  .stats-kpi-grid{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:6px !important;
  }

  .stats-kpi-grid article{
    min-width:0;
    padding:10px !important;
  }

  .stats-kpi-grid strong{
    max-width:100%;
    font-size:18px !important;
    overflow-wrap:anywhere;
  }

  .stats-v2-toplists,
  .stats-toplists-grid{
    grid-template-columns:1fr !important;
    gap:12px !important;
  }

  .stats-toplist{
    min-width:0;
  }

  .stats-bar-row{
    grid-template-columns:24px minmax(0,1fr) auto !important;
    gap:8px !important;
  }

  .stats-table-scroll{
    width:100%;
    max-width:100%;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    padding-bottom:6px;
  }

  .stats-table-scroll table{
    min-width:860px;
  }

  .stats-table-scroll::after{
    content:"Svep i sidled för fler kolumner →";
    position:sticky;
    left:0;
    display:block;
    width:max-content;
    margin-top:7px;
    color:#7c8991;
    font-size:8px;
    font-weight:700;
  }

  /* ---------- Galleri ---------- */
  .insta-grid,
  .gallery-grid,
  .match-gallery-grid{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
    gap:8px !important;
  }

  .insta-item,
  .gallery-item{
    min-width:0;
  }

  .insta-item img,
  .gallery-item img{
    width:100%;
    height:auto;
    aspect-ratio:1/1;
    object-fit:cover;
  }

  /* ---------- Träningar ---------- */
  .schedule{
    display:grid;
    gap:8px;
  }

  .schedule-row{
    grid-template-columns:56px minmax(0,1fr) auto !important;
    gap:9px !important;
    min-width:0;
    padding:10px !important;
  }

  .schedule-row>div:nth-child(2){
    min-width:0;
  }

  .schedule-row>div:nth-child(2) b,
  .schedule-row>div:nth-child(2) span{
    max-width:100%;
    overflow-wrap:anywhere;
  }

  .schedule-row time{
    font-size:11px;
    white-space:nowrap;
  }

  /* ---------- Spelsätt / formation ---------- */
  .formation-layout{
    grid-template-columns:1fr !important;
    gap:18px !important;
  }

  .formation-copy{
    min-width:0;
  }

  .pitch-wrap{
    width:100%;
    max-width:100%;
    overflow:hidden;
  }

  .pitch{
    width:100% !important;
    max-width:100% !important;
    min-height:520px !important;
  }

  .pitch-player{
    transform:translate(-50%,-50%) scale(.88);
    transform-origin:center;
  }

  /* ---------- Startsidan: sista säkerhetslagret ---------- */
  .home-sections{
    width:100%;
    max-width:100%;
    overflow:hidden;
  }

  .split-home{
    grid-template-columns:1fr !important;
    gap:16px !important;
  }

  .play-card{
    min-width:0;
  }

  .news-grid{
    grid-template-columns:1fr !important;
  }

  .photo-stream .insta-grid{
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }

  .players-carousel{
    max-width:100%;
    overflow:hidden;
  }

  /* ---------- Touch ---------- */
  a,
  button,
  input,
  select,
  textarea{
    touch-action:manipulation;
  }

  .btn,
  .mobile-bottom-nav a,
  .mobile-bottom-nav button{
    min-height:44px;
  }
}

/* Smalare telefoner: 360–390 px */
@media (max-width:390px){

  .container{
    width:calc(100% - 24px) !important;
  }

  .page-hero h1{
    font-size:36px !important;
  }

  .match-row{
    grid-template-columns:52px minmax(0,1fr) !important;
  }

  .match-row .match-score{
    grid-column:2;
    justify-self:start;
    text-align:left;
    margin-top:2px;
  }

  .players.full{
    gap:9px !important;
  }

  .players.full .player h3{
    font-size:12px;
  }

  .public-bench-list{
    grid-template-columns:1fr !important;
  }

  .stats-team-record{
    grid-template-columns:1fr 1fr 1fr !important;
  }

  .stats-team-record strong{
    font-size:18px !important;
  }

  .match-gallery-grid,
  .gallery-grid,
  .insta-grid{
    gap:6px !important;
  }

  .schedule-row{
    grid-template-columns:50px minmax(0,1fr) !important;
  }

  .schedule-row time{
    grid-column:2;
    justify-self:start;
  }
}

/* Release 4.0 – touch polish */
@media(max-width:760px){
  input,select,textarea{font-size:16px}
  a,button{-webkit-tap-highlight-color:transparent}
  .container{padding-left:max(15px,env(safe-area-inset-left));padding-right:max(15px,env(safe-area-inset-right))}
}
