/* =========================================================
   Responsive guard - loaded last, on every page.
   Stops content from being wider than the screen and keeps
   sidebars inside the viewport. Safe to keep permanently.
   ========================================================= */

/* 1. Nothing may push the page wider than the screen.
      `clip` (not `hidden`) so sticky sidebars keep working. */
html,
body {
  max-width: 100%;
  overflow-x: clip;
}

/* 2. Media and embeds never exceed their container. */
img,
video,
canvas,
svg,
iframe,
embed,
object {
  max-width: 100%;
}
img,
video {
  height: auto;
}

/* 3. Long words, URLs and e-mail addresses wrap instead of stretching the layout. */
.site-main,
.article-layout__main,
.article-layout__sidebar,
.mncm-main,
.mncm-section,
.mn-perfume-page main {
  overflow-wrap: break-word;
  word-wrap: break-word;
}
h1,
h2,
h3 {
  overflow-wrap: break-word;
  hyphens: manual;
}

/* 4. Code blocks and wide tables scroll inside themselves. */
pre {
  max-width: 100%;
  overflow-x: auto;
}
@media (max-width: 760px) {
  .article-content table,
  .page-content table,
  .entry-content table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* 5. Perfume page: one sidebar rule at one breakpoint (three stylesheets
      used to disagree), columns that can shrink, and no negative margin
      pushing the sidebar off the right edge. */
.mn-perfume-page .article-layout,
.perfume-profile .article-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 300px);
  max-width: 100%;
}
.mn-perfume-page .article-layout__main,
.perfume-profile .article-layout__main,
.mn-perfume-page .article-layout__sidebar,
.perfume-profile .article-layout__sidebar {
  min-width: 0;
  max-width: 100%;
  margin-right: 0 !important;
}
@media (max-width: 900px) {
  .mn-perfume-page .article-layout,
  .perfume-profile .article-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }
  .mn-perfume-page .article-layout__sidebar,
  .perfume-profile .article-layout__sidebar {
    position: static;
    order: -1;
  }
}

/* 6. A sticky sidebar taller than the screen could not be scrolled to its
      end. Let it scroll within itself instead. */
@media (min-width: 901px) {
  .mn-perfume-page .sidebar-sticky,
  .perfume-profile .sidebar-sticky,
  .article-layout__sidebar .sidebar-sticky {
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* 7. Floating notices never exceed the screen width. */
.mn-consent,
.mn-buybar {
  max-width: 100vw;
}
