.npcb-section {
  /* The theme's section padding, as every section on the page. */
  padding: var(--npc-section-py, 100px) 0;
}

/* A band gets the same padding as the soft background in base.css */
.npcb-section.is-bg-dark,
.npcb-section.is-bg-brand {
  border-radius: var(--npc-band-radius);
  padding: clamp(32px, 5vw, 64px) clamp(20px, 4.5vw, 56px);
}

.npcb-section.is-bg-dark {
  background: var(--npc-footer-bg);
  color: var(--npc-footer-color);
}

.npcb-section.is-bg-brand {
  background: var(--npc-primary);
  color: var(--npc-btn-color);
}

/* Background photo: a band like the dark one, the photo under a tint (::before) so text stays readable.
   The image and tint come inline from render.php / the editor. */
.npcb-section.has-image {
  position: relative;
  isolation: isolate;
  border-radius: var(--npc-band-radius);
  padding: clamp(32px, 5vw, 64px) clamp(20px, 4.5vw, 56px);
  background-image: var(--npcb-section-image);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.npcb-section.has-image::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--npcb-section-tint, rgba(0, 0, 0, .5));
  pointer-events: none;
}

.npcb-section.has-image.is-tone-dark {
  color: #fff;
}

/* The band is the whole row; the container inside holds the content, so no inset or rounding. Rows touch and pad
   as the theme's sections do, on the page and in the editor alike. */
.npcb-wrap > .npcb.npcb-section {
  margin: 0;
  padding-top: var(--npc-section-py, 100px);
  padding-bottom: var(--npc-section-py, 100px);
  padding-left: 0;
  padding-right: 0;
  border-radius: 0;
}

/* Light text on dark bands, including headings and links that blocks colour otherwise */
.npcb-section.is-bg-dark :is(h2, h3, h4, a),
.npcb-section.is-bg-brand :is(h2, h3, h4, a),
.npcb-section.is-tone-dark :is(h2, h3, h4, a) {
  color: inherit;
}

/* Light surfaces inside a dark band would inherit its light text and read blank */
.npcb-section:is(.is-bg-dark, .is-bg-brand, .is-tone-dark) :is(.npcb-card, .wp-block-details, .wp-block-table) {
  color: var(--npc-heading);
}

.npcb-section:is(.is-bg-dark, .is-bg-brand, .is-tone-dark) :is(.npcb-card, .wp-block-details, .wp-block-table) a {
  color: var(--npc-primary);
}

.npcb-section.is-bg-brand :is(.npcb-button, .wp-block-button__link) {
  background: var(--npc-btn-color);
  color: var(--npc-primary);
}

.npcb-section.is-width-narrow .npcb-section__inner {
  max-width: 820px;
  margin: 0 auto;
}

.npcb-section.is-heading-center .npcb-section__inner > :is(h2, h3) {
  text-align: center;
  max-width: 820px;
  margin-left: auto;
  margin-right: auto;
}

.npcb-section.is-width-narrow .npcb-section__inner > p {
  text-align: center;
}

.npcb-section__inner > :first-child { margin-top: 0; }
.npcb-section__inner > :last-child  { margin-bottom: 0; }

/* Nested npc blocks: a band inside a band would read as a box in a box */
.npcb-section .npcb.is-bg-soft {
  background: transparent;
  padding: 0;
}

/* Basic blocks. wp-block-library is dequeued, so core/image needs its layout here. */
.npcb-section__inner > :where(.wp-block-image) {
  margin: 0 0 24px;
}

.npcb-section .wp-block-image img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--npc-card-radius);
}

/* An image without its own size fills the content width (Full included), not its file's pixel width. */
.npcb-section__inner > .wp-block-image:not(.is-resized) img:not([style*="width"]) {
  width: 100%;
}

.npcb-section .wp-block-image.aligncenter img { margin-inline: auto; }
.npcb-section .wp-block-image.alignright img  { margin-left: auto; }

/* Shaped treatments over the photo (bgTreatment); intensity in --npc-treat. */
.npcb-section.has-image.is-treat-scrim::before {
  background:
    radial-gradient(ellipse 60% 70% at 50% 50%, rgba(0, 0, 0, calc(var(--npc-treat, .45) * 1.2)) 0%, rgba(0, 0, 0, calc(var(--npc-treat, .45) * .75)) 45%, rgba(0, 0, 0, 0) 80%),
    linear-gradient(rgba(0, 0, 0, calc(var(--npc-treat, .45) * .25)), rgba(0, 0, 0, calc(var(--npc-treat, .45) * .25)));
}

.npcb-section.has-image.is-treat-scrim :is(h2, h3, p) {
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 2px 18px rgba(0, 0, 0, .35);
}

.npcb-section.has-image.is-treat-panel .npcb-section__inner {
  padding: clamp(20px, 3vw, 32px);
  border-radius: 16px;
  background: rgba(20, 24, 28, var(--npc-treat, .45));
  -webkit-backdrop-filter: blur(8px) saturate(1.1);
  backdrop-filter: blur(8px) saturate(1.1);
}

.npcb-section.has-image.is-treat-bottom {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 320px;
}

.npcb-section.has-image.is-treat-bottom::before {
  background: linear-gradient(to top, rgba(0, 0, 0, calc(var(--npc-treat, .45) * 1.5)) 0%, rgba(0, 0, 0, calc(var(--npc-treat, .45) * .75)) 40%, rgba(0, 0, 0, 0) 75%);
}

/* A Content section's heading is a section title, as the theme's sections print theirs (core.css .npc-*__title), not the
   blocks' brand-coloured h2. */
.npcb-section .npcb-section__inner > h2 { margin-bottom: 1rem; }
