/* Mobile fixes verified on 360–414 px viewports.
   Kept separate so they can be reverted without touching page layouts. */
@media (max-width:1199px){
  /* Home, light theme: once the mobile menu opens, use the same light
     palette as inner pages. The closed header stays transparent over the hero. */
  html:not([data-theme="dark"]) .header:not(.v2-scrolled):not(.v2-interior):has(#main-nav.open){
    background:var(--v1-menu-bg)!important;
    color:var(--v1-menu-text)!important;
    border-bottom-color:var(--v1-menu-border)!important;
  }
  html:not([data-theme="dark"]) .header:not(.v2-scrolled):not(.v2-interior):has(#main-nav.open)
  :is(.header-mark,.header-actions,#main-nav,.menu-button),
  html:not([data-theme="dark"]) .header:not(.v2-scrolled):not(.v2-interior):has(#main-nav.open)
  :is(.header-mark,.header-actions,#main-nav,.menu-button) *{
    color:var(--v1-menu-text)!important;
  }
  html:not([data-theme="dark"]) .header:not(.v2-scrolled):not(.v2-interior):has(#main-nav.open)
  #main-nav .nav-icon,
  html:not([data-theme="dark"]) .header:not(.v2-scrolled):not(.v2-interior):has(#main-nav.open)
  #main-nav .nav-icon *{
    color:var(--v1-menu-icon)!important;
  }
  html:not([data-theme="dark"]) .header:not(.v2-scrolled):not(.v2-interior):has(#main-nav.open)
  .header-mark img{
    filter:brightness(.65)!important;
  }
  html:not([data-theme="dark"]) .header:not(.v2-scrolled):not(.v2-interior)
  #main-nav.open .nav-submenu:not([hidden]){
    background:var(--v1-menu-bg)!important;
    border-color:var(--v1-menu-border)!important;
  }
  html:not([data-theme="dark"]) .header:not(.v2-scrolled):not(.v2-interior)
  #main-nav.open .nav-submenu:not([hidden]) :is(a,p[role="status"]){
    color:var(--v1-menu-text)!important;
  }

  /* Reliable touch area for the three compact header controls. */
  .header .portal-search-button{
    flex:0 0 44px;
    width:44px;
    max-width:44px;
    min-width:44px;
    height:44px;
    min-height:44px;
  }
  .header .theme-toggle,
  .header .menu-button{
    min-width:44px;
    min-height:44px;
  }
}

@media (max-width:600px){
  /* Show all newsletter months without making the whole row look cut off. */
  .newsletter-issues{
    display:flex;
    flex-wrap:wrap;
    overflow-x:visible;
    gap:7px;
  }
  .newsletter-issue{
    flex:1 1 auto;
    width:auto;
    min-height:44px;
    white-space:normal;
  }

  /* Links used as controls need a dependable touch target on phones. */
  .footer-compact-links a,
  .sitemap-group a{
    display:flex;
    align-items:center;
    min-height:44px;
    padding-block:8px;
  }
}

/* Stage 2: verified mobile layout and touch targets. Desktop is unchanged. */
@media (max-width:650px){
  /* The desktop priest selector has greater specificity than the old mobile
     rule. Force every archive entry into a single readable column. */
  main[data-page-slug="kaplani"] .clergy-group-rows .history-row:not(.history-row-reverse),
  main[data-page-slug="kaplani"] .clergy-group-rows .history-row.history-row-reverse{
    grid-template-columns:minmax(0,1fr)!important;
  }
  main[data-page-slug="kaplani"] .clergy-group-rows .history-row > .history-image-group,
  main[data-page-slug="kaplani"] .clergy-group-rows .history-row > .history-row-text{
    grid-column:1!important;
    grid-row:auto!important;
    width:100%;
    min-width:0;
  }
  main[data-page-slug="kaplani"] .clergy-group-rows .history-image-static img{
    margin-inline:auto;
  }

  /* The portal uses a 92% reading scale. Values of 48px below retain an
     effective touch target of at least 44px. */
  .header .header-mark{
    width:48px!important;
    min-width:48px!important;
    min-height:48px;
  }
  :is(a.text-link,button.text-link,.hero-info-link,.home-intentions-toggle,.news-open-title){
    display:inline-flex;
    align-items:center;
    min-height:48px;
    padding-block:8px;
  }
  .news-archive-controls label{
    display:inline-flex;
    align-items:center;
    gap:8px;
    min-height:48px;
  }
  .mass-hours-page details.mass-hours-section > summary{
    display:flex;
    align-items:center;
    min-height:48px;
    padding-block:8px;
  }
  .obituary-details{
    min-height:48px;
    padding:10px 4px;
  }
  .newsletter-actions a{
    display:inline-flex;
    align-items:center;
    min-height:48px;
    padding-block:10px;
  }
  .newsletter-year-label select{
    min-height:48px;
  }
  main[data-parish-information] :is([data-office-phone],[data-office-email]) a{
    display:inline-flex;
    align-items:center;
    min-height:48px;
    padding-block:8px;
  }
  :is(.footer-compact-bottom,.footer-bottom) a{
    display:flex;
    align-items:center;
    min-height:48px;
    padding-block:8px;
  }

  /* Login does not use the shared public navigation, but it loads this
     small stylesheet directly. */
  .account-page .theme-toggle{
    width:48px;
    height:48px;
    min-width:48px;
    min-height:48px;
  }
  .account-page .account-return{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:48px;
    padding-block:8px;
  }
}

/* Public mobile prose: keep Polish words intact. Long URLs and identifiers
   may still wrap as a last resort; explicit centered/right alignment remains. */
@media (max-width:767px), (orientation:landscape) and (max-height:600px) and (pointer:coarse) {
 body:not(.account-page) main,
 body:not(.account-page) main :is(p,li,dd,dt,h1,h2,h3,h4,h5,h6,summary,.news-plain-body,.weekly-body,.rich-align-justify,.history-row-text,.community-body,.community-description,.obituary-body) {
  -webkit-hyphens:none;
  hyphens:none;
  word-break:normal;
  overflow-wrap:break-word;
 }
 body:not(.account-page) main :is(p,li,.news-plain-body,.weekly-body,.rich-align-justify):not(.rich-align-center):not(.rich-align-right):not(.obituary-memorial-prayer):not(.obituary-original-line):not(.clergy-tribute-text) {
  text-align:start;
 }
 body:not(.account-page) main.mass-hours-page.container {
  width:calc(100% - 32px);
  max-width:1050px;
  margin-inline:auto;
 }
}
