/* Tablet layout only; preserve phone <=700px and wide desktop >=1301px.
 * Loaded by the shared public head, independent of whether ads are enabled.
 */
@media (min-width:701px) and (max-width:1300px) {
  html, body {
    height:auto !important;
    min-height:100%;
  }
  body { min-height:100vh; min-height:100dvh; }

  /* No centred single-row menu spilling off either edge on a tablet. */
  body { padding-top:0 !important; }
  body .top-wrapper,
  body .top-bar,
  body .top-wrapper nav {
    position:relative !important;
    top:auto !important;
    width:100% !important;
    max-width:100% !important;
    height:auto !important;
    transform:none !important;
  }
  body .top-bar { display:flex; flex-wrap:wrap; gap:8px 16px; }
  body #main-nav {
    display:flex !important;
    flex-wrap:wrap !important;
    justify-content:center !important;
    align-items:center;
    gap:4px 10px !important;
    width:100%;
    margin:0 !important;
    padding:8px 16px !important;
    height:auto !important;
  }
  body #main-nav > li { flex:0 0 auto; margin:0; }
  body #main-nav > li > a {
    display:flex !important;
    align-items:center;
    min-height:44px;
    padding:6px 8px;
    white-space:nowrap;
  }
  body .horizontal-scroll-menu,
  body .mobile-menu-toggle { display:none !important; }
  body .revija-submenu {
    position:relative !important;
    top:auto !important;
    flex-wrap:wrap;
    justify-content:center;
    height:auto !important;
    max-width:100%;
  }
  body .main-header { margin-top:0 !important; }

  body.home-page .home-shell,
  body.section-page .section-shell,
  body.revija-page .revija-shell {
    width:calc(100% - 40px) !important;
    max-width:1000px !important;
    margin-inline:auto !important;
    padding-inline:0 !important;
    box-sizing:border-box;
  }

  body .home-editorial-grid,
  body .section-editorial-grid,
  body .section-top-grid,
  body .revija-editorial-grid {
    display:flex !important;
    flex-direction:column !important;
    gap:24px;
  }
  body .home-editorial-grid > *,
  body .section-editorial-grid > *,
  body .section-top-grid > *,
  body .revija-editorial-grid > * {
    width:100% !important;
    max-width:100% !important;
    min-width:0 !important;
    box-sizing:border-box;
  }
  body .home-center-column, body .section-main-area,
  body .section-center, body .revija-center { order:1; }
  body .home-sidebar, body .section-sidebar,
  body .revija-sidebar { order:2; border-left:0; }
  body .home-left-rail, body .section-left-rail,
  body .revija-left-rail { order:3; border-left:0; padding-left:0; }
  body .section-revija { order:4; }

  body .home-sidebar-stack,
  body .section-sidebar-stack,
  body .revija-sidebar-stack {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:20px;
    align-items:start;
  }
  body.home-page .home-sidebar-stack .ad-banner img,
  body.section-page .section-sidebar-stack .ad-banner img,
  body.revija-page .revija-sidebar-stack .ad-banner img {
    max-height:350px !important;
    object-fit:contain !important;
  }

  /* Former narrow rails become cards, not full-width enlarged posters. */
  body .home-left-rail,
  body .section-left-rail,
  body .revija-left-rail {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:20px;
    align-items:start;
  }
  body .home-left-rail > *,
  body .section-left-rail > *,
  body .revija-left-rail > * { min-width:0; max-width:100%; }
  body .home-left-rail > h1,
  body .section-left-rail > h1,
  body .revija-left-rail > h1 { grid-column:1 / -1; }
  body .home-left-rail > link,
  body .section-left-rail > link,
  body .revija-left-rail > link { display:none; }
  body .home-radio-card { grid-template-columns:minmax(0,1fr); }
  body.home-page .home-left-rail img,
  body.section-page .section-left-rail img,
  body.revija-page .revija-left-rail img {
    width:100% !important;
    height:auto !important;
    max-height:300px !important;
    object-fit:contain !important;
  }
  body.home-page .home-left-rail picture,
  body.section-page .section-left-rail picture,
  body.revija-page .revija-left-rail picture { height:auto !important; }
  body.home-page .home-rail-media,
  body.section-page .section-rail-media { aspect-ratio:auto !important; }

  body.home-page .home-lead-media,
  body.section-page .section-lead-media { aspect-ratio:auto !important; }
  body.home-page .home-lead-media picture,
  body.section-page .section-lead-media picture { height:auto !important; }
  body.home-page .home-lead-media img,
  body.section-page .section-lead-media img {
    width:100% !important;
    height:auto !important;
    max-height:420px !important;
    object-fit:contain !important;
  }
  body .article-lead-figure img {
    height:auto !important;
    max-height:480px;
    object-fit:contain;
  }

  body .home-revija-grid,
  body .section-revija-grid {
    grid-template-columns:repeat(2,minmax(0,1fr)) !important;
  }
  body .home-editorial-story,
  body .section-story,
  body .home-feed-card,
  body .revija-list-item {
    min-width:0;
    max-width:100%;
  }

  body.article-page-body .article-card {
    width:calc(100% - 40px) !important;
    max-width:900px;
    grid-template-columns:minmax(0,1fr) !important;
  }
  body.article-page-body .article-main {
    width:100%;
    max-width:800px;
    min-width:0;
    margin-inline:auto;
  }
  body.article-page-body .article-ad-rail {
    position:static !important;
    width:100%;
    min-width:0;
    grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  }
  body.article-page-body .article-body {
    overflow-wrap:anywhere;
    line-height:1.7;
  }
  body.article-page-body .article-related-grid {
    grid-template-columns:minmax(0,1fr);
  }

  /* Let the slot fit the layout; do not resize the ad creative/iframe. */
  body .home-editorial-grid > .google-auto-placed,
  body .section-editorial-grid > .google-auto-placed,
  body .section-top-grid > .google-auto-placed,
  body .revija-editorial-grid > .google-auto-placed,
  body .article-card > .google-auto-placed {
    min-width:0 !important;
    max-width:100% !important;
    grid-column:1 / -1 !important;
  }
  body .footer {
    clear:both;
    width:100%;
  }
  body .footer-container {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:24px;
    padding:30px 24px;
  }
  body .footer-column { min-width:0; }
}
