/**
 * CKB / CP09 HOME-R3B — Homepage Editorial Layout Polish (Staging candidate).
 * 0.4.69. Visual only, HOME-scoped. No Event data, WPML, icon mapping, gallery
 * motion or publication-state changes. Keep 0.4.68 protected styles untouched.
 *
 * Breakpoints:
 *  >= 1101:  Date | (Category + Title) | Time/Place | arrow
 *  861–1100: Date | (Category + Title + Time/Place) | arrow
 *  <= 860:   compact mobile Date | (Category + Title + Time/Place) | arrow
 */

/* Reduce the visual vacuum between a short Upcoming list and the greeting. */
body.ckb-wp-shell[data-page="home"] .upcoming:not(.ckb-r010-no-events) {
  padding-bottom: clamp(40px, 4.2vw, 62px) !important;
}
body.ckb-wp-shell[data-page="home"] .ckb-p3-greeting {
  padding-top: clamp(36px, 3.5vw, 52px);
  padding-bottom: clamp(54px, 5.3vw, 84px);
}

/* Upcoming heading and its two existing links follow one consistent rhythm. */
body.ckb-wp-shell[data-page="home"] .upcoming .section-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  column-gap: 24px;
  row-gap: 12px;
  padding-bottom: 20px;
}
body.ckb-wp-shell[data-page="home"] .upcoming .section-heading > h2 {
  min-width: 0;
  grid-area: auto;
  margin: 0;
}
body.ckb-wp-shell[data-page="home"] .upcoming .section-heading-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px 18px;
}
body.ckb-wp-shell[data-page="home"] .upcoming .section-heading-actions .text-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding-bottom: 2px;
  font-size: 12px;
  letter-spacing: .025em;
  text-decoration: none;
  white-space: nowrap;
}

/* Existing markup; the category sits ABOVE the title, rather than using a
 * separate narrow column competing with long German headlines. */
@media (min-width: 1101px) {
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row {
    grid-template-columns: 118px minmax(0, 1fr) minmax(220px, 258px) 24px !important;
    grid-template-areas:
      "date type meta arrow"
      "date title meta arrow" !important;
    grid-template-rows: auto auto;
    gap: 6px clamp(18px, 1.85vw, 30px) !important;
    align-items: center;
    min-height: 132px;
    padding-block: 20px;
  }
}
@media (min-width: 861px) and (max-width: 1100px) {
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row {
    grid-template-columns: 102px minmax(0, 1fr) 24px !important;
    grid-template-areas:
      "date type arrow"
      "date title arrow"
      "date meta arrow" !important;
    grid-template-rows: auto auto auto;
    column-gap: 22px !important;
    row-gap: 6px !important;
    min-height: 118px;
    padding-block: 18px;
  }
}

@media (min-width: 861px) {
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row time {
    grid-area: date;
    display: inline-flex;
    flex-direction: row;
    align-items: baseline;
    align-self: center;
    justify-self: start;
    gap: 8px;
    min-width: 0;
    white-space: nowrap;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row time span {
    font-size: clamp(32px, 2.45vw, 38px);
    line-height: 1;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row time small {
    font-size: 12px !important;
    line-height: 1.2 !important;
    letter-spacing: .025em !important;
  }
}
body.ckb-wp-shell[data-page="home"] .upcoming .event-type {
  grid-area: type;
  justify-self: start;
  align-self: end;
  min-width: 0;
  margin: 0;
}
body.ckb-wp-shell[data-page="home"] .upcoming .event-type .ckb-b1-category-badge {
  max-width: 100%;
  font-size: 12px;
}
body.ckb-wp-shell[data-page="home"] .upcoming .event-row h3 {
  grid-area: title;
  align-self: start;
  min-width: 0;
  margin: 0;
  padding: 0 !important;
  font-size: clamp(22px, 1.7vw, 27px) !important;
  font-weight: 600;
  line-height: 1.22 !important;
  letter-spacing: -.018em;
  overflow-wrap: break-word;
  word-break: normal;
  text-wrap: pretty;
}
body.ckb-wp-shell[data-page="home"] .upcoming .event-meta {
  grid-area: meta;
  align-self: center;
  justify-self: stretch;
  min-width: 0;
  max-width: 100%;
  text-align: left !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  letter-spacing: .018em !important;
  font-weight: 500;
  overflow-wrap: break-word;
  word-break: normal;
}
body.ckb-wp-shell[data-page="home"] .upcoming .ckb-b1-event-weekday {
  font-weight: 700;
}
body.ckb-wp-shell[data-page="home"] .upcoming .event-arrow {
  grid-area: arrow;
  align-self: center;
  justify-self: end;
}

/* Read the institution's greeting as one balanced, compact follow-up section. */
@media (min-width: 861px) {
  body.ckb-wp-shell[data-page="home"] .ckb-p3-greeting-content {
    grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr);
    column-gap: clamp(32px, 4.5vw, 76px);
    align-items: start;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-p3-greeting h2 {
    font-size: clamp(36px, 3.55vw, 56px);
    line-height: 1.06;
    letter-spacing: -.035em;
    overflow-wrap: break-word;
    word-break: normal;
    text-wrap: balance;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-p3-greeting-detail {
    max-width: 560px;
    padding-top: 5px;
  }
}
body.ckb-wp-shell[data-page="home"] .ckb-p3-greeting-kicker {
  margin-bottom: 16px;
  letter-spacing: .07em;
}
body.ckb-wp-shell[data-page="home"] .ckb-p3-greeting-detail p {
  line-height: 1.6;
}
body.ckb-wp-shell[data-page="home"] .ckb-p3-greeting-link {
  min-height: 42px;
  font-size: 13px;
  letter-spacing: .015em;
}

/* Tablet and phone: compact the date; type/title/meta remain one visual group. */
@media (max-width: 860px) {
  body.ckb-wp-shell[data-page="home"] .upcoming:not(.ckb-r010-no-events) {
    padding-top: clamp(48px, 6vw, 64px) !important;
    padding-bottom: clamp(35px, 6vw, 52px) !important;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .section-heading {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "title" "actions" !important;
    row-gap: 12px;
    align-items: start;
    padding-bottom: 18px;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .section-heading h2 {
    grid-area: title;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .section-heading-actions {
    grid-area: actions;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 8px 16px;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .section-heading-actions .text-link {
    min-height: 40px;
    font-size: 12px !important;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row {
    grid-template-columns: 70px minmax(0, 1fr) 24px !important;
    grid-template-areas:
      "date type arrow"
      "date title arrow"
      "date meta arrow" !important;
    grid-template-rows: auto auto auto;
    column-gap: 14px !important;
    row-gap: 5px !important;
    min-height: 0;
    padding-block: 20px;
    align-items: start;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row time {
    grid-area: date;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
    min-width: 0;
    white-space: nowrap;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row time span {
    font-size: 31px !important;
    line-height: 1;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row time small {
    font-size: 11px !important;
    line-height: 1.2 !important;
    letter-spacing: 0 !important;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .event-type {align-self: start;}
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row h3 {
    font-size: clamp(19px, 4.9vw, 23px) !important;
    line-height: 1.22 !important;
    overflow-wrap: anywhere;
    text-wrap: auto;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .event-meta {
    align-self: start;
    justify-self: start;
    font-size: 12px !important;
    line-height: 1.5 !important;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-p3-greeting {
    padding-top: 32px;
    padding-bottom: 58px;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-p3-greeting h2 {
    font-size: clamp(34px, 6vw, 46px);
    line-height: 1.09;
    overflow-wrap: break-word;
    word-break: normal;
  }
}

@media (max-width: 360px) {
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row {
    grid-template-columns: 61px minmax(0, 1fr) 20px !important;
    column-gap: 10px !important;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .event-row time span {
    font-size: 29px !important;
  }
}
