/* POLARIS TRAIL MAP v0.4.2
   Dedicated page only. This does NOT change site-wide Cocoon settings,
   archive cards, existing posts, GPX data, or other WordPress pages. */

/* Cocoon's two-column wrapper forces the iframe below its desktop breakpoint.
   Widen ONLY the fixed page that holds the map shortcode. */
body.polaris-trail-map-dedicated-page #content-in,
body.polaris-trail-map-dedicated-page .content-in {
  width: min(100%, 1260px) !important;
  max-width: 1260px !important;
  margin-left: auto !important;
  margin-right: auto !important;
  padding-left: 16px !important;
  padding-right: 16px !important;
  display: block !important;
  box-sizing: border-box !important;
}
body.polaris-trail-map-dedicated-page #main,
body.polaris-trail-map-dedicated-page .main {
  display: block !important;
  float: none !important;
  clear: both !important;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 auto !important;
  padding: 18px 22px 28px !important;
  box-sizing: border-box !important;
}
body.polaris-trail-map-dedicated-page #sidebar,
body.polaris-trail-map-dedicated-page .sidebar {
  display: none !important;
}
body.polaris-trail-map-dedicated-page .article,
body.polaris-trail-map-dedicated-page .entry-content,
body.polaris-trail-map-dedicated-page .article-body,
body.polaris-trail-map-dedicated-page .wp-block-shortcode {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  box-sizing: border-box !important;
}
body.polaris-trail-map-dedicated-page .entry-content {
  margin: 0 !important;
  padding: 0 !important;
}
body.polaris-trail-map-dedicated-page .polaris-trail-map-frame {
  width: 100% !important;
  max-width: none !important;
  margin-top: 12px !important;
  margin-bottom: 14px !important;
}
/* The map is a functional page, not a shareable blog entry. */
body.polaris-trail-map-dedicated-page .sns-share,
body.polaris-trail-map-dedicated-page .sns-follow,
body.polaris-trail-map-dedicated-page .author-info,
body.polaris-trail-map-dedicated-page .related-entries,
body.polaris-trail-map-dedicated-page .article-footer .sns-buttons,
body.polaris-trail-map-dedicated-page .breadcrumb {
  display: none !important;
}
body.polaris-trail-map-dedicated-page .entry-title {
  font-size: clamp(20px, 2.2vw, 27px) !important;
  line-height: 1.4 !important;
}
body.polaris-trail-map-dedicated-page .article-header {
  margin-bottom: 8px !important;
}
/* Avoid mobile sideways scroll and keep native iPhone bottom menu usable. */
@media (max-width: 767px) {
  body.polaris-trail-map-dedicated-page #content-in,
  body.polaris-trail-map-dedicated-page .content-in {
    width: 100% !important;
    padding-left: 8px !important;
    padding-right: 8px !important;
  }
  body.polaris-trail-map-dedicated-page #main,
  body.polaris-trail-map-dedicated-page .main {
    padding: 14px 8px 26px !important;
  }
}

/* v0.4.4: Match staging width even when Cocoon's parent is narrower.
   The prior v0.4.3 used `min(100% - 36px, 1154px)`: 100% was measured
   against a narrow parent. The 1154px cap could never make it wider.
   Instead, size from the browser viewport and center without relying on
   the parent width. Only this dedicated trail-map page is affected. */
@media screen and (min-width: 1100px) {
  body.polaris-trail-map-dedicated-page #content,
  body.polaris-trail-map-dedicated-page .content {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    overflow: visible !important;
    box-sizing: border-box !important;
  }

  body.polaris-trail-map-dedicated-page #content-in,
  body.polaris-trail-map-dedicated-page .content-in {
    /* Browser viewport, NOT 100% of a constrained Cocoon container. */
    width: min(1154px, calc(100vw - 40px)) !important;
    max-width: none !important;
    min-width: 0 !important;
    position: relative !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
  }

  body.polaris-trail-map-dedicated-page #main,
  body.polaris-trail-map-dedicated-page .main {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }
}
