/* Shared section rhythm for pages, templates, patterns and the block editor.
 * These margins override WordPress's zero block gap and older component rules.
 * Only the introduction-to-collection boundary changes; card internals do not.
 */
:is(.cse-site, .editor-styles-wrapper) {
  --cse-section-content-gap: 44px;
}

:is(.cse-site, .editor-styles-wrapper)
:is(h2, h3, p, .cse-section-heading, .cse-section-top,
    .cse-journal-sectionhead, .cse-service-value-copy, .cse-contributor-archive-heading)
+ :is(.cse-grid, .cse-people-grid, .cse-area-grid, .cse-video-gallery,
      .cse-comparison-gallery, .cse-contact-faq-grid, .cse-error-actions,
      .cse-stories, .cse-test-steps, .cse-facts-grid, .cse-office-grid,
      .cse-branch-visit-grid, .cse-read-next-grid, .cse-topic-grid,
      .cse-tool-mosaic, .cse-collection-grid, .cse-journal-video-grid,
      .cse-tools-grid, .cse-reading-grid, .cse-tool-how-grid,
      .cse-recommended-grid, .cse-contributor-articles, .cse-media-feed,
      .cse-media-downloads, .cse-card, .cse-review-box, .cse-media-empty,
      .cse-test-authority, .cse-feature-table-wrap, .cse-journal-archive,
      .cse-tools-directory, .cse-contributor-filters, .wp-block-columns,
      .wp-block-query, .wp-block-post-template) {
  margin-block-start: var(--cse-section-content-gap) !important;
}

/* Put the gap on the collection so margins cannot double up in flex/grid. */
:is(.cse-site, .editor-styles-wrapper)
:is(h2, h3, p, .cse-section-heading, .cse-section-top,
    .cse-journal-sectionhead, .cse-service-value-copy, .cse-contributor-archive-heading):has(+ :is(.cse-grid, .cse-people-grid, .cse-area-grid, .cse-video-gallery,
          .cse-comparison-gallery, .cse-contact-faq-grid, .cse-error-actions,
          .cse-stories, .cse-test-steps, .cse-facts-grid, .cse-office-grid,
          .cse-branch-visit-grid, .cse-read-next-grid, .cse-topic-grid,
          .cse-tool-mosaic, .cse-collection-grid, .cse-journal-video-grid,
          .cse-tools-grid, .cse-reading-grid, .cse-tool-how-grid,
          .cse-recommended-grid, .cse-contributor-articles, .cse-media-feed,
          .cse-media-downloads, .cse-card, .cse-review-box, .cse-media-empty,
          .cse-test-authority, .cse-feature-table-wrap, .cse-journal-archive,
          .cse-tools-directory, .cse-contributor-filters, .wp-block-columns,
          .wp-block-query, .wp-block-post-template)) {
  margin-block-end: 0 !important;
}

/* Keep the last line of grouped introductions from adding another gap. */
:is(.cse-site, .editor-styles-wrapper)
:is(.cse-section-heading, .cse-section-top, .cse-journal-sectionhead,
    .cse-service-value-copy, .cse-contributor-archive-heading) > :last-child {
  margin-block-end: 0;
}

@media (max-width: 900px) {
  :is(.cse-site, .editor-styles-wrapper) { --cse-section-content-gap: 36px; }
}
@media (max-width: 600px) {
  :is(.cse-site, .editor-styles-wrapper) { --cse-section-content-gap: 28px; }
}

/* Text needs its own rhythm even when Gutenberg's block gap is zero. */
:is(.cse-site main, .editor-styles-wrapper) p + p {
  margin-block-start: 1.1em;
}
:is(.cse-site, .editor-styles-wrapper)
:is(.cse-prose, .cse-guide-section, .cse-news-post-content, .cse-meta-panel,
    .cse-tool-explainer, .cse-profile-panel, .cse-coverage-note) > p {
  margin-block: 0 1.25em;
  line-height: 1.85;
}
:is(.cse-site, .editor-styles-wrapper)
:is(.cse-prose, .cse-guide-section, .cse-news-post-content, .cse-meta-panel,
    .cse-tool-explainer, .cse-profile-panel, .cse-coverage-note) > p + p {
  margin-block-start: 1.25em !important;
}
:is(.cse-site, .editor-styles-wrapper)
:is(.cse-prose, .cse-guide-section, .cse-news-post-content, .cse-meta-panel,
    .cse-tool-explainer, .cse-profile-panel) > :is(h2, h3) {
  margin-block-end: 18px;
}
:is(.cse-site, .editor-styles-wrapper)
:is(.cse-prose, .cse-guide-section, .cse-news-post-content, .cse-meta-panel,
    .cse-tool-explainer, .cse-profile-panel) > :is(ul, ol, figure) {
  margin-block: 22px;
}
:is(.cse-site, .editor-styles-wrapper)
:is(.cse-prose, .cse-guide-section, .cse-news-post-content, .cse-meta-panel,
    .cse-tool-explainer, .cse-profile-panel, .cse-coverage-note) > :last-child {
  margin-block-end: 0;
}
/* Keep labels, hours, form headings and other compact information compact. */
:is(.cse-site, .editor-styles-wrapper)
:is(.cse-branch-hours-row, .cse-contributor-card, .cse-form-heading,
    .cse-person-card, .cse-doctor-card, .cse-test-facts, .cse-trust-strip) > p + p {
  margin-block-start: 6px;
}

/* Notes are attached to their section, with a clear separator and readable type. */
:is(.cse-site, .editor-styles-wrapper) p.cse-disclaimer,
:is(.cse-site, .editor-styles-wrapper) p.cse-editorial-note {
  display: block;
  width: 100%;
  max-width: 92ch;
  margin: 26px 0 0 !important;
  padding: 16px 0 0;
  border-top: 1px solid #cbded8;
  font-size: .8rem !important;
  font-weight: 400;
  line-height: 1.75 !important;
  color: #50686d;
  text-wrap: pretty;
}
:is(.cse-site, .editor-styles-wrapper) .cse-story-section .cse-disclaimer {
  color: #d6e6e3;
  border-color: #638780;
}

/* One copy column plus actions, including older flat CTA blocks already saved. */
:is(.cse-site, .editor-styles-wrapper) .cse-cta {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(240px, .85fr);
  column-gap: clamp(28px, 4vw, 56px);
  row-gap: 16px;
  align-items: center;
}
:is(.cse-site, .editor-styles-wrapper) .cse-cta > :is(p, h2, h3) {
  grid-column: 1;
  margin: 0 !important;
}
:is(.cse-site, .editor-styles-wrapper) .cse-cta > .wp-block-buttons {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}
:is(.cse-site, .editor-styles-wrapper) .cse-cta:has(> h2) > .wp-block-buttons {
  grid-row: 1 / span 4;
}
:is(.cse-site, .editor-styles-wrapper) .cse-cta > .wp-block-group {
  min-width: 0;
}
:is(.cse-site, .editor-styles-wrapper) .cse-cta > .wp-block-group:first-child {
  grid-column: 1;
}
:is(.cse-site, .editor-styles-wrapper) .cse-cta .cse-eyebrow {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 18px !important;
  white-space: normal;
  word-break: normal;
  overflow-wrap: normal;
}
:is(.cse-site, .editor-styles-wrapper) .cse-cta > .cse-eyebrow { margin: 0 !important; }
:is(.cse-site, .editor-styles-wrapper) .cse-cta h2 {
  max-width: 24ch;
  margin-block: 0 16px;
}
:is(.cse-site, .editor-styles-wrapper) .cse-cta .wp-block-buttons {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin: 0;
}
:is(.cse-site, .editor-styles-wrapper) .cse-cta .wp-block-button,
:is(.cse-site, .editor-styles-wrapper) .cse-cta .wp-block-button__link {
  width: 100%;
}
@media (max-width: 900px) {
  :is(.cse-site, .editor-styles-wrapper) .cse-cta { grid-template-columns: 1fr; row-gap: 26px; }
  :is(.cse-site, .editor-styles-wrapper) .cse-cta > .wp-block-buttons { grid-column: 1 !important; grid-row: auto !important; }
  :is(.cse-site, .editor-styles-wrapper) .cse-cta .wp-block-buttons { flex-direction: row; flex-wrap: wrap; }
  :is(.cse-site, .editor-styles-wrapper) .cse-cta .wp-block-button { flex: 1 1 200px; }
}
@media (max-width: 600px) {
  :is(.cse-site, .editor-styles-wrapper) .cse-cta { padding: 30px 24px; }
  :is(.cse-site, .editor-styles-wrapper) .cse-cta .wp-block-buttons { flex-direction: column; }
  :is(.cse-site, .editor-styles-wrapper) .cse-cta .wp-block-button { flex: 0 1 auto; }
}

/* Permanent artwork, no loading animation or pretend patient/news content. */
:is(.cse-site, .editor-styles-wrapper) .cse-placeholder-card {
  overflow: hidden;
  min-width: 0;
  border: 1px solid #cedfd9;
  border-radius: 20px;
  background: #fff;
}
:is(.cse-site, .editor-styles-wrapper) .cse-placeholder-card > img,
:is(.cse-site, .editor-styles-wrapper) .cse-placeholder-image img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}
:is(.cse-site, .editor-styles-wrapper) .cse-placeholder-image { margin: 0; }
:is(.cse-site, .editor-styles-wrapper) .cse-placeholder-copy { padding: 24px; }
:is(.cse-site, .editor-styles-wrapper) .cse-placeholder-copy h3 { font-size: 1.2rem; line-height: 1.4; margin: 12px 0; }
:is(.cse-site, .editor-styles-wrapper) .cse-placeholder-copy > p:last-child { font-size: .91rem; line-height: 1.75; margin: 0; }
:is(.cse-site, .editor-styles-wrapper) .cse-placeholder-label {
  display: inline-block;
  font-size: .7rem !important;
  font-weight: 400;
  line-height: 1.6 !important;
  letter-spacing: .035em;
  color: #4f6e64;
  background: #edf5f0;
  padding: 5px 9px;
  border-radius: 6px;
  margin: 0 0 12px !important;
}
:is(.cse-site, .editor-styles-wrapper) .cse-placeholder-intro { margin-bottom: var(--cse-section-content-gap); }
:is(.cse-site, .editor-styles-wrapper) .cse-comparison-placeholder figcaption > p:last-child { margin: 0; }
:is(.cse-site, .editor-styles-wrapper) .cse-video-placeholder .cse-placeholder-image img { aspect-ratio: 3 / 4; object-fit: contain; background: #f0edf7; }
:is(.cse-site, .editor-styles-wrapper) .cse-staff-placeholder .cse-placeholder-image img { aspect-ratio: 1; object-fit: contain; background: #eaf5ef; }
