/* === JM 4.1.11 sitewide spacing rhythm === */

:root {
  --jm-gutter: clamp(1.25rem, 4vw, 2rem);
  --jm-measure: 72rem;
  --jm-section-y: clamp(3.5rem, 6vw, 5.5rem);
  --jm-stack: 1.25rem;
}

/* ---------- Shared content rail ---------- */
.jm-page,
.jm-band,
.jm-guide,
.jm-about,
.jm-speak-topics {
  box-sizing: border-box;
}

.jm-page {
  padding: var(--jm-section-y) 0 !important;
}
.jm-band {
  padding: var(--jm-section-y) 0 !important;
  position: relative;
  overflow: visible !important;
}
.jm-guide {
  padding: var(--jm-section-y) max(1.25rem, calc((100% - var(--jm-measure)) / 2)) !important;
}
.jm-about {
  padding: 0 !important;
}

/* Direct text children sit on the content rail */
.jm-page > :where(.wp-block-heading, .wp-block-paragraph, .wp-block-buttons, .wp-block-list, .wp-block-html, .jm-contact, form, ul, .jm-topic-grid, .jm-kicker),
.jm-band > :where(.wp-block-heading, .wp-block-paragraph, .wp-block-buttons, .wp-block-list),
.jm-speak-topics > :where(.wp-block-heading, .wp-block-paragraph, .wp-block-list, .wp-block-html, ul, .jm-topic-grid, .jm-kicker),
.jm-page > .wp-block-column {
  width: min(var(--jm-measure), calc(100% - 2 * var(--jm-gutter))) !important;
  max-width: 100%;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box;
}

.jm-band > .wp-block-columns,
.jm-page > .wp-block-columns,
.jm-guide > .wp-block-columns,
.jm-about > .wp-block-columns,
.jm-band--ideas .jm-row,
.jm-band--ideas .jm-essays,
.jm-contact-grid {
  width: min(var(--jm-measure), calc(100% - 2 * var(--jm-gutter))) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  max-width: 100%;
}

/* Vertical section labels: sibling only, never crush content */
.jm-band > .jm-index,
.jm-band > .is-layout-flow > .jm-index:first-child {
  position: static !important;
  writing-mode: horizontal-tb !important;
  transform: none !important;
  left: auto !important;
  top: auto !important;
  margin: 0 auto 1.5rem !important;
  width: min(var(--jm-measure), calc(100% - 2 * var(--jm-gutter))) !important;
  max-width: 100%;
  letter-spacing: 0.16em;
  color: var(--muted);
}
@media (min-width: 1280px) {
  .jm-band > .jm-index,
  .jm-band > .is-layout-flow > .jm-index:first-child {
    position: absolute !important;
    writing-mode: vertical-rl !important;
    transform: rotate(180deg) !important;
    left: max(0.5rem, calc((100% - var(--jm-measure)) / 2 - 1.75rem)) !important;
    top: var(--jm-section-y) !important;
    width: auto !important;
    margin: 0 !important;
    white-space: nowrap;
  }
  .jm-band > .wp-block-columns,
  .jm-band--ideas .jm-row,
  .jm-band--ideas .jm-essays {
    padding-left: 2.5rem;
  }
}

/* Indexes trapped inside columns should stay normal text */
.jm-band .wp-block-column > .jm-index {
  position: static !important;
  writing-mode: horizontal-tb !important;
  transform: none !important;
  margin: 0 0 1rem !important;
  max-width: none !important;
  width: auto !important;
}

/* ---------- Hero ---------- */
body .jm-hero .wp-block-columns.jm-hero__grid.is-layout-flex,
body .jm-hero .wp-block-columns.jm-hero__grid,
.jm-hero .wp-block-columns.jm-hero__grid {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 0 !important;
  align-items: stretch !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}
@media (min-width: 960px) {
  body .jm-hero .wp-block-columns.jm-hero__grid.is-layout-flex,
  body .jm-hero .wp-block-columns.jm-hero__grid {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr) !important;
  }
}
.jm-hero .wp-block-columns.jm-hero__grid > .wp-block-column {
  flex-basis: auto !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
}
.jm-hero .wp-block-columns.jm-hero__grid > .wp-block-column:first-child,
.jm-hero .jm-hero__copy {
  padding: 4.5rem var(--jm-gutter) 3rem !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
}
@media (min-width: 960px) {
  .jm-hero .wp-block-columns.jm-hero__grid > .wp-block-column:first-child,
  .jm-hero .jm-hero__copy {
    padding: 5.5rem 3rem 4.5rem max(1.5rem, calc((100vw - var(--jm-measure)) / 2 + 1.25rem)) !important;
  }
}
.jm-hero h1 {
  max-width: min(30rem, 100%) !important;
  width: auto !important;
  margin-top: 1rem !important;
  line-height: 1.14 !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}
.jm-hero .jm-hero-lede {
  max-width: 34rem !important;
  margin-top: 1.25rem !important;
}
.jm-hero .wp-block-column:last-child {
  padding: 0 !important;
}
.jm-hero .wp-block-column:last-child img {
  width: 100% !important;
  height: 100% !important;
  min-height: 26rem;
  object-fit: cover !important;
  object-position: center 18% !important;
}
@media (min-width: 960px) {
  .jm-hero .wp-block-column:last-child img { min-height: 36rem; }
}

/* Hero CTA row */
.jm-hero__actions {
  display: flex !important;
  flex-wrap: wrap !important;
  align-items: center !important;
  gap: 1rem 1.5rem !important;
  margin-top: 2rem !important;
  width: auto !important;
  max-width: 100% !important;
}
.jm-hero__actions > .wp-block-column {
  flex: 0 0 auto !important;
  width: auto !important;
  padding: 0 !important;
  margin: 0 !important;
}
.jm-hero__actions .wp-block-buttons { margin: 0 !important; }
.jm-hero__actions .jm-textlink { margin: 0 !important; }

/* ---------- Splits / grids ---------- */
.jm-split {
  display: grid !important;
  gap: 2.5rem !important;
  align-items: start !important;
}
@media (min-width: 900px) {
  .jm-split {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) !important;
    gap: 3.5rem !important;
  }
}
.jm-split h1,
.jm-split h2 {
  margin-top: 0.35rem;
  max-width: 18ch;
  line-height: 1.15;
}
.jm-split .jm-lede,
.jm-split .jm-muted {
  max-width: 38rem;
  margin-top: var(--jm-stack);
  line-height: 1.65;
}
.jm-split .wp-block-image img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}
.jm-page .jm-split .wp-block-image img {
  aspect-ratio: 5 / 4;
}

.jm-grid-2 {
  display: grid !important;
  gap: 2rem 2.5rem !important;
}
@media (min-width: 768px) {
  .jm-grid-2 { grid-template-columns: 1fr 1fr !important; }
}
.jm-grid-2 h2 { margin-top: 0; }
.jm-grid-2 .jm-muted { margin-top: 0.85rem; line-height: 1.6; }

.jm-themes {
  display: grid !important;
  gap: 2rem !important;
}
@media (min-width: 900px) {
  .jm-themes {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 0 !important;
  }
  .jm-themes > .wp-block-column {
    padding: 1.75rem 2rem !important;
    text-align: center;
  }
  .jm-themes > .wp-block-column + .wp-block-column {
    border-left: 1px solid var(--line);
  }
}
.jm-themes .jm-icon { margin-inline: auto; margin-bottom: 1rem; }
.jm-themes h3 { margin-top: 0.35rem; }
.jm-themes .jm-muted { margin-top: 0.75rem; }

.jm-engage {
  display: grid !important;
  gap: 1.75rem !important;
}
@media (min-width: 1024px) {
  .jm-engage {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 0 !important;
  }
  .jm-engage > .wp-block-column {
    padding: 1.25rem 1.5rem !important;
  }
  .jm-engage > .wp-block-column + .wp-block-column {
    border-left: 1px solid var(--line);
  }
}
.jm-engage > .wp-block-column {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  padding: 1rem !important;
  background: transparent !important;
}
.jm-engage .jm-kicker { order: -1; margin-bottom: 0.5rem; }
.jm-engage h3 { margin: 0.25rem 0; }
.jm-engage .jm-muted { margin: 0.5rem 0 0.75rem; line-height: 1.55; }

/* ---------- Guide band ---------- */
.jm-guide > .wp-block-columns {
  width: 100% !important;
  margin: 0 !important;
}
.jm-guide__grid {
  display: grid !important;
  gap: 2.5rem !important;
  align-items: center !important;
}
@media (min-width: 1024px) {
  .jm-guide__grid {
    grid-template-columns: 0.85fr 1.25fr 0.95fr !important;
    gap: 2.75rem !important;
  }
}
.jm-guide h2 { margin-top: 0.5rem; }
.jm-guide .wp-block-list { margin-top: 1.25rem; }
.jm-guide__form .jm-form,
.jm-guide .jm-form {
  display: flex !important;
  flex-direction: column !important;
  gap: 0.75rem !important;
  max-width: 22rem;
  width: 100%;
}
.jm-guide .jm-form input,
.jm-guide .jm-form button,
.jm-guide .jm-form .jm-btn {
  width: 100% !important;
  min-height: 2.85rem;
  flex: none !important;
}
.jm-guide .jm-fine {
  margin-top: 0.85rem;
  max-width: 22rem;
  line-height: 1.5;
}

/* ---------- Essays ---------- */
.jm-essays {
  display: grid !important;
  gap: 2rem !important;
}
@media (min-width: 900px) {
  .jm-essays {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 2rem !important;
  }
}
.jm-page .jm-essays {
  /* writing page: 3 + orphan */
}
.jm-essay-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 0 !important;
}
.jm-essay-card .wp-block-image,
.jm-essay-card figure {
  margin: 0 0 1rem !important;
}
.jm-essay-card .wp-block-image img,
.jm-essays .wp-block-image img {
  width: 100% !important;
  aspect-ratio: 16 / 10 !important;
  height: auto !important;
  object-fit: cover !important;
}
.jm-essay-card .jm-kicker {
  margin: 0 0 0.45rem !important;
}
.jm-essay-card h3 {
  margin: 0 !important;
  max-width: none !important;
  font-size: clamp(1.2rem, 1.6vw, 1.45rem);
  line-height: 1.25;
}
.jm-essay-card .jm-muted {
  margin-top: 0.7rem !important;
  font-size: 0.92rem;
  line-height: 1.55;
}
.jm-essay-card .jm-textlink {
  margin-top: 0.85rem !important;
}

.jm-band--ideas .jm-row {
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-end !important;
  gap: 1rem !important;
  margin-bottom: 1.75rem !important;
}
.jm-band--ideas .jm-row > .wp-block-column {
  flex: 1 1 auto;
  padding: 0 !important;
  width: auto !important;
}
.jm-band--ideas .jm-row > .wp-block-column:last-child {
  flex: 0 0 auto;
  text-align: right;
}

/* ---------- About ---------- */
.jm-about__grid {
  display: grid !important;
  gap: 0 !important;
  width: 100% !important;
  max-width: none !important;
  margin: 0 !important;
}
@media (min-width: 900px) {
  .jm-about__grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr) !important;
  }
}
.jm-about__grid > .wp-block-column {
  margin: 0 !important;
  padding: 0 !important;
}
.jm-about__grid > .wp-block-column:last-child {
  padding: clamp(2.5rem, 5vw, 4rem) clamp(1.5rem, 4vw, 3.5rem) !important;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.jm-about .wp-block-image img {
  width: 100%;
  height: 100%;
  min-height: 24rem;
  object-fit: cover;
  object-position: top;
  aspect-ratio: auto;
}
.jm-about h2 {
  max-width: 16ch;
  margin-top: 0.75rem;
  line-height: 1.15;
}
.jm-about .wp-block-list {
  margin-top: 1.75rem;
}

/* ---------- Inner pages ---------- */
.jm-page > .jm-kicker { margin-bottom: 0.35rem; }
.jm-page > .wp-block-heading { margin-top: 0.35rem; max-width: 18ch; }
.jm-page > .jm-lede {
  margin-top: 1.15rem !important;
  max-width: 40rem;
  line-height: 1.65;
}
.jm-page > .wp-block-buttons { margin-top: 1.75rem !important; }
.jm-page--sections {
  padding-top: calc(var(--jm-section-y) * 0.85) !important;
}
.jm-page--sections > .wp-block-heading {
  margin-bottom: 0.75rem;
}
.jm-page--sections > .jm-muted {
  max-width: 44rem;
  margin-bottom: 2rem !important;
  line-height: 1.65;
}

.jm-topic-grid {
  display: grid !important;
  gap: 0 !important;
  margin-top: 1.25rem !important;
  padding: 0 !important;
  list-style: none !important;
}
@media (min-width: 800px) {
  .jm-topic-grid { grid-template-columns: 1fr 1fr !important; }
}
.jm-topic-grid li {
  margin: 0 !important;
  padding: 1.15rem 1.25rem !important;
  border-top: 1px solid var(--line);
  line-height: 1.45;
}
.jm-speak-topics {
  padding-bottom: calc(var(--jm-section-y) + 0.5rem) !important;
}

.jm-contact-grid {
  display: grid !important;
  gap: 2.5rem !important;
}
@media (min-width: 900px) {
  .jm-contact-grid {
    grid-template-columns: 1.3fr 0.8fr !important;
    gap: 4rem !important;
  }
}
.jm-contact {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}
.jm-contact label { gap: 0.45rem; }
.jm-contact input,
.jm-contact textarea {
  padding: 0.85rem 0.95rem;
  line-height: 1.4;
}
.jm-contact .jm-btn { margin-top: 0.35rem; width: 100%; }

.jm-cred-grid {
  width: min(var(--jm-measure), calc(100% - 2 * var(--jm-gutter))) !important;
  margin: 1.5rem auto 2rem !important;
}
.jm-creds .wp-block-buttons {
  width: min(var(--jm-measure), calc(100% - 2 * var(--jm-gutter))) !important;
  margin: 0 auto !important;
}

/* Undo earlier conflicting padding hacks */
.jm-themes > .wp-block-column,
.jm-engage > .wp-block-column {
  box-sizing: border-box;
}
.jm-speak-topics { padding-inline: 0 !important; }
