/* Scripps Tweaks: wysiwyg-spacing. A Wysiwyg block can carry data-stw-above and data-stw-below (the editor's "Space above this
   block" and "Space below this block", in pixels). These rules make the gap between two blocks exactly that, whatever the
   theme would have put there. They only match a block that has an attribute, so a block with the choice left on "Theme
   default" is untouched. !important is deliberate: the theme sets each page type's gaps with long selectors (:has() chains
   for what comes before and after a block), and an editor's explicit choice has to win over all of them.

   Blocks are laid out in four ways, so each has its own rules:
   1. Story pages (Robust Storytelling, RFS, Cores, Research Units) and the science landing page: every block sits in a
      .robustStory__module (or .scienceLanding__module) item. The row gap (--module-gap, 72px) is the base, and a block's own
      spacing is a margin-block-start on its item, so a gap of N is a margin of N minus the row gap.
   1b. Faculty pages: the same, with .facultyBio__module items and their 92px row gap.
   2. Department pages: a flex column with the same row gap on .singleDepartment__bodyMain, handled the same way, and the 24px
      the theme puts under a Wysiwyg block that is followed by another is taken away where the choice replaces it.
   3. Every other page (standard pages, news, events, video, podcast): the space is a margin under each block (a background
      colour band keeps it as padding inside the band), so the gap is that margin.
   Space above does nothing for the first block of a page (nothing above it to measure from: the theme's own space stays).
   When both blocks speak (the first says "Space below", the second "Space above"), the second block's "Space above" wins, and a
   section's Space above (the section-background fix) counts the same way. */

/* 1. Story pages and the science landing page */
:is(.robustStory__module, .scienceLanding__module):not(:first-child):has(> flynt-component[data-stw-above='0']) {
  margin-block-start: calc(0px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):not(:first-child):has(> flynt-component[data-stw-above='16']) {
  margin-block-start: calc(16px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):not(:first-child):has(> flynt-component[data-stw-above='24']) {
  margin-block-start: calc(24px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):not(:first-child):has(> flynt-component[data-stw-above='32']) {
  margin-block-start: calc(32px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):not(:first-child):has(> flynt-component[data-stw-above='48']) {
  margin-block-start: calc(48px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):not(:first-child):has(> flynt-component[data-stw-above='64']) {
  margin-block-start: calc(64px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):not(:first-child):has(> flynt-component[data-stw-above='96']) {
  margin-block-start: calc(96px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):has(> flynt-component[data-stw-below='0']) + :is(.robustStory__module, .scienceLanding__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(0px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):has(> flynt-component[data-stw-below='16']) + :is(.robustStory__module, .scienceLanding__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(16px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):has(> flynt-component[data-stw-below='24']) + :is(.robustStory__module, .scienceLanding__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(24px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):has(> flynt-component[data-stw-below='32']) + :is(.robustStory__module, .scienceLanding__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(32px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):has(> flynt-component[data-stw-below='48']) + :is(.robustStory__module, .scienceLanding__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(48px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):has(> flynt-component[data-stw-below='64']) + :is(.robustStory__module, .scienceLanding__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(64px - var(--module-gap)) !important;
}

:is(.robustStory__module, .scienceLanding__module):has(> flynt-component[data-stw-below='96']) + :is(.robustStory__module, .scienceLanding__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(96px - var(--module-gap)) !important;
}

/* 1b. Faculty pages */
:is(.facultyBio__module):not(:first-child):has(> flynt-component[data-stw-above='0']) {
  margin-block-start: calc(0px - 92px) !important;
}

:is(.facultyBio__module):not(:first-child):has(> flynt-component[data-stw-above='16']) {
  margin-block-start: calc(16px - 92px) !important;
}

:is(.facultyBio__module):not(:first-child):has(> flynt-component[data-stw-above='24']) {
  margin-block-start: calc(24px - 92px) !important;
}

:is(.facultyBio__module):not(:first-child):has(> flynt-component[data-stw-above='32']) {
  margin-block-start: calc(32px - 92px) !important;
}

:is(.facultyBio__module):not(:first-child):has(> flynt-component[data-stw-above='48']) {
  margin-block-start: calc(48px - 92px) !important;
}

:is(.facultyBio__module):not(:first-child):has(> flynt-component[data-stw-above='64']) {
  margin-block-start: calc(64px - 92px) !important;
}

:is(.facultyBio__module):not(:first-child):has(> flynt-component[data-stw-above='96']) {
  margin-block-start: calc(96px - 92px) !important;
}

:is(.facultyBio__module):has(> flynt-component[data-stw-below='0']) + :is(.facultyBio__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(0px - 92px) !important;
}

:is(.facultyBio__module):has(> flynt-component[data-stw-below='16']) + :is(.facultyBio__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(16px - 92px) !important;
}

:is(.facultyBio__module):has(> flynt-component[data-stw-below='24']) + :is(.facultyBio__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(24px - 92px) !important;
}

:is(.facultyBio__module):has(> flynt-component[data-stw-below='32']) + :is(.facultyBio__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(32px - 92px) !important;
}

:is(.facultyBio__module):has(> flynt-component[data-stw-below='48']) + :is(.facultyBio__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(48px - 92px) !important;
}

:is(.facultyBio__module):has(> flynt-component[data-stw-below='64']) + :is(.facultyBio__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(64px - 92px) !important;
}

:is(.facultyBio__module):has(> flynt-component[data-stw-below='96']) + :is(.facultyBio__module):not(:has(> flynt-component[data-stw-above])):not(:has(> flynt-component[data-stw-sec-above])) {
  margin-block-start: calc(96px - 92px) !important;
}

/* 2. Department pages */
.singleDepartment__bodyMain > flynt-component[data-stw-below],
.singleDepartment__bodyMain > flynt-component:has(+ flynt-component[data-stw-above]) {
  margin-block-end: 0 !important; /* (the 24px the theme puts under a Wysiwyg block followed by another would add to the gap in this flex column) */
}

.singleDepartment__bodyMain > flynt-component:not(:first-child)[data-stw-above='0'] {
  margin-block-start: calc(0px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component:not(:first-child)[data-stw-above='16'] {
  margin-block-start: calc(16px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component:not(:first-child)[data-stw-above='24'] {
  margin-block-start: calc(24px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component:not(:first-child)[data-stw-above='32'] {
  margin-block-start: calc(32px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component:not(:first-child)[data-stw-above='48'] {
  margin-block-start: calc(48px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component:not(:first-child)[data-stw-above='64'] {
  margin-block-start: calc(64px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component:not(:first-child)[data-stw-above='96'] {
  margin-block-start: calc(96px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component[data-stw-below='0'] + flynt-component:not([data-stw-above]) {
  margin-block-start: calc(0px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component[data-stw-below='16'] + flynt-component:not([data-stw-above]) {
  margin-block-start: calc(16px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component[data-stw-below='24'] + flynt-component:not([data-stw-above]) {
  margin-block-start: calc(24px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component[data-stw-below='32'] + flynt-component:not([data-stw-above]) {
  margin-block-start: calc(32px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component[data-stw-below='48'] + flynt-component:not([data-stw-above]) {
  margin-block-start: calc(48px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component[data-stw-below='64'] + flynt-component:not([data-stw-above]) {
  margin-block-start: calc(64px - var(--module-gap)) !important;
}

.singleDepartment__bodyMain > flynt-component[data-stw-below='96'] + flynt-component:not([data-stw-above]) {
  margin-block-start: calc(96px - var(--module-gap)) !important;
}

/* 3. Everything else: the margin under the block above (or under this block), or the padding inside a colour band */
flynt-component[data-stw-below='0']:not([data-theme]):not(:has(+ flynt-component[data-stw-above])):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 0px !important;
}

flynt-component[data-stw-below='16']:not([data-theme]):not(:has(+ flynt-component[data-stw-above])):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 16px !important;
}

flynt-component[data-stw-below='24']:not([data-theme]):not(:has(+ flynt-component[data-stw-above])):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 24px !important;
}

flynt-component[data-stw-below='32']:not([data-theme]):not(:has(+ flynt-component[data-stw-above])):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 32px !important;
}

flynt-component[data-stw-below='48']:not([data-theme]):not(:has(+ flynt-component[data-stw-above])):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 48px !important;
}

flynt-component[data-stw-below='64']:not([data-theme]):not(:has(+ flynt-component[data-stw-above])):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 64px !important;
}

flynt-component[data-stw-below='96']:not([data-theme]):not(:has(+ flynt-component[data-stw-above])):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 96px !important;
}

flynt-component:not([data-theme]):has(+ flynt-component[data-stw-above='0']):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 0px !important;
}

flynt-component:not([data-theme]):has(+ flynt-component[data-stw-above='16']):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 16px !important;
}

flynt-component:not([data-theme]):has(+ flynt-component[data-stw-above='24']):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 24px !important;
}

flynt-component:not([data-theme]):has(+ flynt-component[data-stw-above='32']):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 32px !important;
}

flynt-component:not([data-theme]):has(+ flynt-component[data-stw-above='48']):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 48px !important;
}

flynt-component:not([data-theme]):has(+ flynt-component[data-stw-above='64']):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 64px !important;
}

flynt-component:not([data-theme]):has(+ flynt-component[data-stw-above='96']):not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  margin-block-end: 96px !important;
}

flynt-component[data-stw-below='0'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-end: 0px !important;
}

flynt-component[data-stw-below='16'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-end: 16px !important;
}

flynt-component[data-stw-below='24'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-end: 24px !important;
}

flynt-component[data-stw-below='32'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-end: 32px !important;
}

flynt-component[data-stw-below='48'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-end: 48px !important;
}

flynt-component[data-stw-below='64'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-end: 64px !important;
}

flynt-component[data-stw-below='96'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-end: 96px !important;
}

flynt-component[data-stw-above='0'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-start: 0px !important;
}

flynt-component[data-stw-above='16'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-start: 16px !important;
}

flynt-component[data-stw-above='24'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-start: 24px !important;
}

flynt-component[data-stw-above='32'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-start: 32px !important;
}

flynt-component[data-stw-above='48'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-start: 48px !important;
}

flynt-component[data-stw-above='64'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-start: 64px !important;
}

flynt-component[data-stw-above='96'][data-theme]:not(.robustStory__module > *):not(.scienceLanding__module > *):not(.facultyBio__module > *):not(.singleDepartment__bodyMain > *) {
  padding-block-start: 96px !important;
}
