/* Morse Policy Forum | v0.16.81 | Site-wide Command Header content grid
 * One canonical, responsive horizontal width for the Header, module page
 * sections, research pages, and member surfaces. All styling is frontend-only;
 * individual reading columns, cards, forms, tables, and the Morse PDF stage
 * deliberately retain their own interior dimensions.
 */
:root {
  --mpfm-site-content-width: min(94vw, 1520px);
  --mpfm-site-content-max: 1520px;
}
/* The Command Header provides the site-wide alignment reference. */
body .mmf-command-site-header .mmf-command-shell {
  box-sizing: border-box;
  width: var(--mpfm-site-content-width);
  max-width: none;
}
/* Divi pages frequently set a row width of 85–95%. Only the rows containing
 * complete Morse page modules (or the native directory/portal) are restored
 * to the full available section width. Theme Builder header/footer rows and
 * unrelated Divi content stay untouched. */
@supports selector(:has(*)) {
  body.page .et_pb_row:has(.mmf-module-shell[class*="mmf-module-shell-mpf-"][class*="-page"]),
  body.page .et_pb_row:has(.mhd-root),
  body.page .et_pb_row:has(.mpfm-portal),
  body.page .et_pb_row:has(.mpfm-public-directory) {
    width: 100% !important;
    max-width: 100% !important;
  }
}
/* Section-based page modules: preserve the full-width background/hero and
 * standardize only the centered section content, at the same width as Header. */
body .mmf-module-shell-mpf-about-page .mpfa-wrap,
body .mmf-module-shell-mpf-committee-monitor-page .mpfcm-wrap,
body .mmf-module-shell-mpf-congress-navigation-page .mpfnav-wrap,
body .mmf-module-shell-mpf-congress-page .mpfcong-wrap,
body .mmf-module-shell-mpf-congressional-library-page .mpfclib-wrap,
body .mmf-module-shell-mpf-congressional-newsletters-page .mpfcnl-wrap,
body .mmf-module-shell-mpf-contact-page .mpfc-wrap,
body .mmf-module-shell-mpf-editorial-standards-page .mpfm-wrap,
body .mmf-module-shell-mpf-events-page .mpfevents-wrap,
body .mmf-module-shell-mpf-governance-institutions-page .mpfgi-wrap,
body .mmf-module-shell-mpf-humanitarian-policy-page .mpfhp-wrap,
body .mmf-module-shell-mpf-interviews-page .mpfi-wrap,
body .mmf-module-shell-mpf-legislative-watch-page .mpflw-wrap,
body .mmf-module-shell-mpf-media-page .mpfm-wrap,
body .mmf-module-shell-mpf-methodology-page .mpfm-wrap,
body .mmf-module-shell-mpf-mission-page .mpfm-wrap,
body .mmf-module-shell-mpf-partners-page .mpfp-wrap,
body .mmf-module-shell-mpf-policy-essays-page .mpfpe-wrap,
body .mmf-module-shell-mpf-policy-memos-page .mpfpm-wrap,
body .mmf-module-shell-mpf-policy-network-page .mpfe-wrap,
body .mmf-module-shell-mpf-press-page .mpfpress-wrap,
body .mmf-module-shell-mpf-representative-lookup-page .mpfrl-wrap,
body .mmf-module-shell-mpf-research-library-page .mpfrl-wrap,
body .mmf-module-shell-mpf-research-page .mpfres-wrap,
body .mmf-module-shell-mpf-sanctions-compliance-page .mpfsc-wrap,
body .mmf-module-shell-mpf-syria-middle-east-page .mpfsme-wrap,
body .mmf-module-shell-mpf-topics-page .mpftopics-wrap,
body .mmf-module-shell-mpf-us-foreign-policy-page .mpfusfp-wrap,
body .mmf-module-shell-mpf-videos-page .mpfv-wrap,
body .mmf-module-shell-mpf-white-papers-page .mpfwp-wrap {
  box-sizing: border-box;
  width: var(--mpfm-site-content-width) !important;
  max-width: var(--mpfm-site-content-width) !important;
  min-width: 0;
  margin-left: auto !important;
  margin-right: auto !important;
}

/* Home Command Dashboard. Do not change its intentional full-bleed banner. */
body .mmf-module-shell-morse-home-dashboard .mhd-root .mhd-shell {
  box-sizing: border-box;
  width: var(--mpfm-site-content-width) !important;
  max-width: var(--mpfm-site-content-width) !important;
  margin-inline: auto !important;
}
/* The home banner's interior padding uses --mhd-max for alignment. */
body .mmf-module-shell-morse-home-dashboard .mhd-root {
  --mhd-max: var(--mpfm-site-content-max) !important;
}
/* Optional standalone modules: align their outer grid, never stretch cards. */
body .mmf-module-shell-mpf-team-cards .mpft-wrap {
  box-sizing: border-box;
  width: var(--mpfm-site-content-width) !important;
  max-width: var(--mpfm-site-content-width) !important;
  margin-inline: auto !important;
}
/* Additional standalone editorial and discovery modules. Their own visual
 * padding and narrower reading columns are preserved. */
body .mmf-module-shell-policy-hero .mmf-policy-hero-inner,
body .mmf-module-shell-forum-hero .mmfh-inner,
body .mmf-module-shell-forum-activity .mmfa-shell,
body .mmf-module-shell-tech-dashboard .mmftd-inner {
  box-sizing: border-box;
  width: min(100%, var(--mpfm-site-content-width)) !important;
  max-width: var(--mpfm-site-content-width) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
/* The technical dashboard has internal side padding. Keep the width available
 * on small screens without letting the grid overflow its background. */
body .mmf-module-shell-tech-dashboard .mmf-tech-dashboard-v2 {
  padding-left: min(3vw, 24px);
  padding-right: min(3vw, 24px);
}
/* Newsletter releases: this is an index, not the U.S. Letter print canvas. */
body .mmf-module-shell-congress-newsletter-releases .mmf-cnr {
  padding-left: max(3vw, calc((100vw - var(--mpfm-site-content-max)) / 2));
  padding-right: max(3vw, calc((100vw - var(--mpfm-site-content-max)) / 2));
}
body .mmf-module-shell-congress-newsletter-releases .mmf-cnr-inner {
  width: 100% !important;
  max-width: var(--mpfm-site-content-max) !important;
  margin-inline: auto !important;
}
/* Footer background continues edge-to-edge; its columns align to the Header. */
body .mmf-comprehensive-footer {
  padding-left: max(3vw, calc((100vw - var(--mpfm-site-content-max)) / 2));
  padding-right: max(3vw, calc((100vw - var(--mpfm-site-content-max)) / 2));
}
body .mmf-comprehensive-footer .mmff-shell {
  width: 100% !important;
  max-width: var(--mpfm-site-content-max) !important;
  margin-inline: auto !important;
}

/* Native membership and public member directory render outside page modules. */
body .mpfm-portal,
body .mpfm-public-directory {
  box-sizing: border-box;
  width: var(--mpfm-site-content-width) !important;
  max-width: var(--mpfm-site-content-width) !important;
  margin-left: auto !important;
  margin-right: auto !important;
}
/* v0.16.87: Directory route already renders in the plugin's full-width
 * template. Its v0.15.53 viewport breakout (left:50%; -50vw) must not be
 * combined with the v0.16.81 header-width rule above: that combination
 * offsets the whole directory to the right and crops its search/cards.
 * Limit these corrections to the actual directory route. */
body.mpfm-public-member-directory-route .mpfm-public-directory {
  position: relative;
  left: auto !important;
  right: auto !important;
  width: var(--mpfm-site-content-width) !important;
  max-width: var(--mpfm-site-content-width) !important;
  margin: 0 auto !important;
  padding: clamp(22px, 3.5vw, 52px) 0 clamp(38px, 5vw, 70px);
  overflow-x: visible;
}
body.mpfm-public-member-directory-route .mpfm-public-directory :is(
  .mpfm-public-directory-hero,
  .mpfm-public-directory-toolbar,
  .mpfm-public-directory-grid,
  .mpfm-empty-state
) {
  box-sizing: border-box;
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0;
  margin-left: auto !important;
  margin-right: auto !important;
}
body.mpfm-public-member-directory-route .mpfm-public-directory-hero-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: clamp(20px, 3vw, 42px);
}
body.mpfm-public-member-directory-route .mpfm-public-directory-hero-copy {
  flex: 1 1 360px;
  min-width: 0;
}
body.mpfm-public-member-directory-route .mpfm-public-directory-join {
  box-sizing: border-box;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 54px;
  max-width: 100%;
  padding: 15px 24px;
  border-radius: 15px;
  border: 1px solid #458be0;
  background: linear-gradient(135deg, #123f78, #2463ae);
  box-shadow: 0 12px 24px rgba(18, 63, 120, .20);
  color: #fff !important;
  text-decoration: none;
  font-weight: 850;
  font-size: 14px;
  line-height: 1.25;
  white-space: nowrap;
  transition: background .18s ease, transform .18s ease, box-shadow .18s ease;
}
body.mpfm-public-member-directory-route .mpfm-public-directory-join:hover {
  background: linear-gradient(135deg, #155097, #2e73c7);
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(18, 63, 120, .25);
}
body.mpfm-public-member-directory-route .mpfm-public-directory-join:focus-visible {
  outline: 3px solid #d7a747;
  outline-offset: 3px;
}
body.mpfm-public-member-directory-route .mpfm-public-directory-join-arrow {
  font-size: 20px;
  font-weight: 600;
}
@media (max-width: 680px) {
  body.mpfm-public-member-directory-route .mpfm-public-directory-hero-content { align-items: stretch; }
  body.mpfm-public-member-directory-route .mpfm-public-directory-hero-copy { flex-basis: 100%; }
  body.mpfm-public-member-directory-route .mpfm-public-directory-join {
    width: 100%;
    padding-inline: 16px;
    white-space: normal;
  }
}
@media (prefers-reduced-motion: reduce) {
  body.mpfm-public-member-directory-route .mpfm-public-directory-join { transition: none; }
}

/* Public member profiles are virtual WordPress routes. Their top-level
 * information/feed grid should align with the same site-wide envelope. */
body.mpfm-public-profile-route .mpfm-public-profile-page {
  box-sizing: border-box;
  width: var(--mpfm-site-content-width) !important;
  max-width: var(--mpfm-site-content-width) !important;
  margin-inline: auto !important;
}
/* Native publication directory inherits its page module's aligned section
 * container; its old 1260px maximum no longer narrows the archive cards. */
body .mpfm-r-native-archive .mpfm-r-directory {
  width: 100% !important;
  max-width: 100% !important;
}
/* Ordinary (non-Divi-builder) WordPress static pages also follow the header.
 * This targets only the principal article container, not wide backgrounds. */
body.page:not(.et_pb_pagebuilder_layout) #main-content > .container {
  box-sizing: border-box;
  width: var(--mpfm-site-content-width) !important;
  max-width: var(--mpfm-site-content-width) !important;
  margin-inline: auto !important;
}

/* Research publication single: title and summary/collection follow the
 * Command Header, while the PDF reader retains its separately requested
 * full-width canvas. Narrow text paragraphs inside cards stay readable. */
body .mpfm-r-article .mpfm-r-article-top {
  padding-left: max(3vw, calc((100vw - var(--mpfm-site-content-max)) / 2)) !important;
  padding-right: max(3vw, calc((100vw - var(--mpfm-site-content-max)) / 2)) !important;
}
body .mpfm-r-article .mpfm-r-overview-grid {
  width: var(--mpfm-site-content-width) !important;
  max-width: var(--mpfm-site-content-width) !important;
}
body .mpfm-r-article .mpfm-r-reader-shell > .mpfm-r-html-content {
  box-sizing: border-box;
  width: var(--mpfm-site-content-width);
  max-width: var(--mpfm-site-content-width);
}
/* Editorial article layout: align its overall hero/body grid, preserving
 * the existing comfortable inner article line length and sidebar geometry. */
body .mmf-article-command .mmf-article-hero-inner,
body .mmf-article-command .mmf-article-shell {
  width: var(--mpfm-site-content-width) !important;
  max-width: var(--mpfm-site-content-width) !important;
}
/* Narrow viewport safety: none of the site-level grid layouts may create a
 * horizontal scrollbar. Individual tables and PDFs keep their native scroll. */
@media (max-width: 760px) {
  body .mpfm-portal,
  body .mpfm-public-directory { min-width: 0; }
  body .mpfm-r-article .mpfm-r-article-top {
    padding-left: 3vw !important;
    padding-right: 3vw !important;
  }
}
@media print {
  /* Print canvases, particularly US Letter newsletters, are intentionally
   * excluded from screen width normalization. */
  body .mmf-command-site-header .mmf-command-shell { width: auto; }
}
