/*
 * CKB-R003.5-P1-02 / Homepage Visual Polish R1 - review release
 * Scope: body.ckb-wp-shell[data-page="home"] ; no global edits.
 * Applies after the existing theme stack, on top of Home-R3B/R3C.
 * No DOM changes, content rewriting, third-party fonts, image cropping,
 * Event queries, WPML routing, consent, email or registration changes.
 */

/* Desktop and tablet: treat News as one editorial line, rather than a block. */
@media (min-width: 641px) {
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-ticker {
    padding-top: 17px;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-ticker > a {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr) auto;
    align-items: baseline;
    column-gap: clamp(12px, 1.25vw, 22px);
    row-gap: 0;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-title {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: clamp(15px, 1.08vw, 18px);
    line-height: 1.36;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-ticker time {
    white-space: nowrap;
    text-align: right;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-ticker + .hero {
    padding-top: 25px;
  }
  body.ckb-wp-shell[data-page="home"] .hero .poster-link > .ckb-icon-r2-marker {
    min-height: 33px;
    margin-bottom: 7px;
    gap: 8px;
    font-size: 13px;
  }
  body.ckb-wp-shell[data-page="home"] .hero .ckb-icon-r2-glyph {
    flex: 0 0 31px;
    width: 31px;
    height: 31px;
    background: transparent;
    border-color: transparent;
  }
  body.ckb-wp-shell[data-page="home"] .hero .ckb-icon-r2-art {
    width: 27px;
    height: 27px;
  }
  body.ckb-wp-shell[data-page="home"] .hero .ckb-icon-r2-label {
    padding-bottom: 0;
    max-width: calc(100% - 42px);
  }
  body.ckb-wp-shell[data-page="home"] .hero .ckb-icon-r2-label::after {
    display: none;
  }
}

/* Phone: keep one short news entry, rather than an editorial headline block. */
@media (max-width: 640px) {
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-ticker {
    padding-top: 10px;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-ticker > a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    grid-template-areas: "news-type news-date" "news-title news-title";
    align-items: baseline;
    column-gap: 10px;
    row-gap: 3px;
    line-height: 1.35;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-type {
    grid-area: news-type;
    min-width: 0;
    font-size: 10.5px;
    letter-spacing: .02em;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-ticker time {
    grid-area: news-date;
    font-size: 10px;
    white-space: nowrap;
    text-align: right;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-title {
    grid-area: news-title;
    display: -webkit-box;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    flex-basis: auto !important;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow-wrap: break-word;
    font-size: 13.5px;
    line-height: 1.38;
    font-weight: 600;
  }
  body.ckb-wp-shell[data-page="home"] .ckb-b1p3-news-ticker + .hero {
    padding-top: 12px !important;
  }
  body.ckb-wp-shell[data-page="home"] .gallery-heading {
    margin-bottom: 8px !important;
  }
  /* Category icon remains visible and source-bound; its visual container recedes. */
  body.ckb-wp-shell[data-page="home"] .hero .poster-link > .ckb-icon-r2-marker {
    min-height: 29px;
    margin-bottom: 6px;
    font-size: 12.5px;
    line-height: 1.25;
    gap: 7px;
  }
  body.ckb-wp-shell[data-page="home"] .hero .ckb-icon-r2-glyph {
    flex: 0 0 29px;
    width: 29px;
    height: 29px;
    background: transparent;
    border-color: transparent;
  }
  body.ckb-wp-shell[data-page="home"] .hero .ckb-icon-r2-art {
    width: 26px;
    height: 26px;
  }
  body.ckb-wp-shell[data-page="home"] .hero .ckb-icon-r2-label {
    padding-bottom: 0;
    max-width: calc(100% - 36px);
  }
  body.ckb-wp-shell[data-page="home"] .hero .ckb-icon-r2-label::after {
    display: none;
  }
  /* Preserve full dates. Do not fake shorter dates with CSS-generated content. */
  body.ckb-wp-shell[data-page="home"] .poster-copy {
    padding-top: 7px !important;
    gap: 4px !important;
  }
  body.ckb-wp-shell[data-page="home"] .poster-date {
    font-size: 12px !important;
    line-height: 1.38 !important;
    letter-spacing: .025em !important;
  }
  body.ckb-wp-shell[data-page="home"] .poster-title {
    font-size: 20px !important;
    line-height: 1.16 !important;
    letter-spacing: -.018em;
  }
  body.ckb-wp-shell[data-page="home"] .poster-meta {
    font-size: 11.5px !important;
    line-height: 1.4 !important;
    letter-spacing: .035em !important;
  }
  /* Bring the next task closer; do not touch actual Event rows. */
  body.ckb-wp-shell[data-page="home"] .upcoming:not(.ckb-r010-no-events) {
    padding-top: 29px !important;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .section-heading {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "title actions" !important;
    align-items: end;
    column-gap: 12px;
    row-gap: 8px;
    padding-bottom: 14px;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .section-heading h2 {
    grid-area: title;
    margin: 0;
    font-size: clamp(30px, 8.4vw, 35px) !important;
    line-height: 1.06 !important;
    min-width: 0;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .section-heading-actions {
    grid-area: actions;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0 10px;
    align-self: end;
    min-width: 0;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .section-heading-actions .text-link {
    min-height: 44px !important;
    font-size: 10.5px !important;
    white-space: nowrap;
  }
}

/* Extra-narrow phones: give links their own line instead of overlap. */
@media (max-width: 360px) {
  body.ckb-wp-shell[data-page="home"] .upcoming .section-heading {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "title" "actions" !important;
  }
  body.ckb-wp-shell[data-page="home"] .upcoming .section-heading-actions {
    justify-content: flex-start;
  }
}
