/* Align button rows on the original block layouts. WordPress gives paragraph
   blocks vertical margins even when those paragraphs are used as buttons. */
body .nmw-design .wp-block-group.flex.flex-wrap.gap-3 > p.nmw-link,
.editor-styles-wrapper .nmw-design .wp-block-group.flex.flex-wrap.gap-3 > p.nmw-link {
  display: inline-flex;
  align-items: stretch;
  justify-content: center;
  min-height: 48px;
  margin: 0 !important;
  text-align: center;
  line-height: 1.25;
}
body .nmw-design .wp-block-group.flex.flex-wrap.gap-3 > p.nmw-link > a,
.editor-styles-wrapper .nmw-design .wp-block-group.flex.flex-wrap.gap-3 > p.nmw-link > a {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding-block: 10px;
  text-align: center;
}
body .nmw-page .wp-block-buttons,
.editor-styles-wrapper .nmw-page .wp-block-buttons {
  align-items: stretch;
  gap: 12px;
}
body .nmw-page .wp-block-buttons > .wp-block-button,
.editor-styles-wrapper .nmw-page .wp-block-buttons > .wp-block-button {
  display: flex;
  align-items: stretch;
  margin: 0;
}
body .nmw-page .wp-block-buttons .wp-block-button__link,
.editor-styles-wrapper .nmw-page .wp-block-buttons .wp-block-button__link {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.3;
}

/* Older imported pages contain the Table of Contents as an editable Group
   before the article. Keep it alongside the article and sticky on desktop. */
@media (min-width: 901px) {
  body .nmw-page > .nmw-content-layout:has(> .nmw-toc) {
    display: grid !important;
    grid-template-columns: minmax(205px, 240px) minmax(0, 1fr) !important;
    align-items: start;
    gap: clamp(28px, 4vw, 52px) !important;
    max-width: 1180px !important;
    margin: 42px auto !important;
  }
  body .nmw-page > .nmw-content-layout:has(> .nmw-toc) > .nmw-toc {
    position: sticky !important;
    top: 24px;
    align-self: start;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
  }
  body .nmw-page > .nmw-content-layout:has(> .nmw-toc) > .nmw-article {
    min-width: 0;
  }
  body .nmw-page > .nmw-content-layout:has(> .nmw-toc) > .nmw-toc ul {
    columns: 1;
  }
}
body .nmw-page .nmw-toc .wp-block-buttons {
  display: flex;
  margin-top: 18px;
}
body .nmw-page .nmw-toc .wp-block-buttons .wp-block-button__link {
  width: 100%;
}
@media (max-width: 900px) {
  body .nmw-page > .nmw-content-layout:has(> .nmw-toc) {
    display: block !important;
    max-width: 100% !important;
    margin: 24px auto !important;
  }
  body .nmw-page > .nmw-content-layout:has(> .nmw-toc) > .nmw-toc {
    position: static !important;
    max-height: none;
    overflow: visible;
    margin-bottom: 34px;
  }
}
@media print {
  body .nmw-page > .nmw-content-layout:has(> .nmw-toc) {
    display: block !important;
  }
  body .nmw-page .nmw-toc {
    display: none !important;
  }
}
