/* ECS-210 — staggered course/session date rendering.
 * Loaded only on class nodes whose field_sessions_source == 'salesforce' and
 * whose cadence is not CONSECUTIVE_DAYS. */

.cadence-date {
  display: block;
}

.cadence-sessions {
  display: block;
  margin-top: 2px;
  font-size: 0.92em;
  color: #555;
  line-height: 1.25;
}

.cadence-exception {
  display: block;
  margin-top: 2px;
  font-size: 0.88em;
  color: #6b6b6b;
  line-height: 1.25;
}

/* Legacy .field--name-field-date-range is inline-block; the multi-line
 * staggered content needs block flow to line up like the legacy single-range
 * render. */
.node--type-class .field--name-field-date-range:has(> .cadence-date) {
  display: block;
}

/* The search-index / teaser card in _classListing.scss anchors the "Register
 * Now" button at `top: 7.5em; right: 0`, which assumes a fixed content
 * height. Staggered cards add ~1 extra line, pushing content past that
 * anchor and overlapping the button. When staggered content is present,
 * re-anchor the button to the bottom of the card instead.
 *
 * The theme rule uses `.node--view-mode-teaser` / `.node--view-mode-search-index`
 * so those classes are duplicated here to win the specificity tie against the
 * theme's compiled CSS (which loads after module CSS in Drupal's cascade). */
#view-classes-page_1 .node--type-class.node--view-mode-teaser:has(.cadence-date) > .field--name-field-registration-form-link,
#view-classes-page_1 .node--type-class.node--view-mode-teaser:has(.cadence-date) > .field--name-field-registration-form,
#view-classes-page_1 .node--type-class.node--view-mode-search-index:has(.cadence-date) > .field--name-field-registration-form-link,
#view-classes-page_1 .node--type-class.node--view-mode-search-index:has(.cadence-date) > .field--name-field-registration-form,
#view-private-classes-page_1 .node--type-class.node--view-mode-search-index:has(.cadence-date) > .field--name-field-registration-form-link,
#view-private-classes-page_1 .node--type-class.node--view-mode-search-index:has(.cadence-date) > .field--name-field-registration-form {
  top: auto;
  bottom: 1.5em;
  right: 0;
}

/* ECS-210 — pin the Register Now button to the bottom-right of each
 * "Upcoming Classes" card on the course detail page and make cards in a
 * row equal-height so buttons line up across the row. Without this,
 * cards with extra content (e.g. staggered sessions' "(N sessions |
 * Weekly)" line) push the floated button down and it stops aligning
 * with siblings. */
.field--name-dynamic-block-fieldnode-available-classes-for-course .view-content {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
}
.field--name-dynamic-block-fieldnode-available-classes-for-course .views-row {
  display: flex;
  flex-direction: column;
}
.field--name-dynamic-block-fieldnode-available-classes-for-course .node--type-class.node--view-mode-teaser {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.field--name-dynamic-block-fieldnode-available-classes-for-course .node--type-class.node--view-mode-teaser > .field--name-field-registration-form-link,
.field--name-dynamic-block-fieldnode-available-classes-for-course .node--type-class.node--view-mode-teaser > .field--name-field-registration-form {
  margin-top: auto !important;
  align-self: flex-end;
  float: none !important;
}
