/*
 * EAM redesign: Journal (page 311, /publications/journal/). Rulebook P-07.
 * RS: clone:src/app/journals/page.tsx (light hero, "In this section" links, featured panel),
 * clone:src/app/about-us/who-we-are/mission-priorities/page.tsx (text sections).
 *
 * Page layout only. The hero, its "On this page" card, buttons, CTA band colours and type come
 * from the shared files (components.css, forms.css, base.css). Rows by uniqueID:
 *   311_hero01-aa         hero (shared light hero)
 *   311_about01-aa        "About the Journal" (white)
 *   311_oa01-aa           "Open Access, from PsychOpen" (tint band)
 *   311_predecessor01-aa  "Predecessor: MPR-online" (white) -> text card (P-07: "BlogAside or a text card")
 *   311_cta01-aa          "Read the latest issue" (white row, indigo panel) -> featured panel with the
 *                         journal cover (P-07, R-22; the cover image is added by
 *                         scripts/redesign/pages/00311-journal.mjs)
 */

/* 1. Predecessor: MPR-online as a text card (S-06 text card: hairline, card shadow, square). */
body.eam-redesign .kadence-column311_predecessor02-bb > .kt-inside-inner-col {
  max-width: var(--rd-measure);
  padding: var(--rd-space-m);
  border: var(--rd-border-width) solid var(--rd-border-light);
  border-radius: var(--rd-radius);
  background: var(--rd-color-surface);
  box-shadow: var(--rd-shadow-card);
}

/* Its H3 was 50/60 (eam-site-polish.css:852-863 sized it like the old 50px section titles), bigger
 * than the H1. As a card title it takes the RS card title size: 24/31.2, 18 at <= 820. */
body.eam-redesign .wp-block-kadence-advancedheading.kt-adv-heading311_predecessor03-cc[data-kb-block] {
  margin: 0 0 var(--rd-space-xs);
  font-size: var(--rd-fs-h4);
  line-height: var(--rd-lh-h4);
}

body.eam-redesign .wp-block-kadence-advancedheading.kt-adv-heading311_predecessor04-dd[data-kb-block] {
  margin-bottom: var(--rd-space-base);
}

/* 2. The predecessor row and the CTA row are both explicit white rows (.kt-row-has-bg), so base.css
 * cannot collapse them: 48 + 48 = 96px. One section gap between them. */
body.eam-redesign .kb-row-layout-id311_cta01-aa > .kt-row-column-wrap {
  padding-top: 0;
}

/* 3. "Read the latest issue" as a featured panel: text left (as every CTA band), the journal cover
 * on the right. The 1fr rows above and below keep the text centred when the cover is taller. */
body.eam-redesign .kadence-column311_cta02-bb > .kt-inside-inner-col:has(> .wp-block-image) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto auto auto 1fr;
  column-gap: var(--rd-space-xl);
  align-items: start;
}

body.eam-redesign .kadence-column311_cta02-bb > .kt-inside-inner-col > * {
  grid-column: 1;
}

body.eam-redesign .kadence-column311_cta02-bb > .kt-inside-inner-col > .kt-adv-heading311_cta03-cc {
  grid-row: 2;
}

body.eam-redesign .kadence-column311_cta02-bb > .kt-inside-inner-col > .kt-adv-heading311_cta04-dd {
  grid-row: 3;
}

body.eam-redesign .kadence-column311_cta02-bb > .kt-inside-inner-col > .kb-btns311_cta05-ee {
  grid-row: 4;
}

body.eam-redesign .kadence-column311_cta02-bb > .kt-inside-inner-col > .wp-block-image {
  grid-column: 2;
  grid-row: 1 / -1;
  align-self: center;
  width: 200px;
  margin: 0;
}

/* Kadence is a classic theme, so WordPress prints the centred image as
 * div.wp-block-image > figure.aligncenter (core's legacy wrapper); Kadence's
 * `.single-content .wp-block-image figure` adds a 32px bottom margin. */
body.eam-redesign .kadence-column311_cta02-bb .wp-block-image figure,
body.eam-redesign .kadence-column311_cta02-bb figure.wp-block-image {
  display: block;
  margin: 0;
}

/* The cover's top half is indigo like the panel: a white edge and a lifted shadow keep it a separate object. */
body.eam-redesign .kadence-column311_cta02-bb .wp-block-image img {
  display: block;
  width: 100%;
  height: auto;
  border: var(--rd-space-2xs) solid var(--rd-white);
  border-radius: var(--rd-radius);
  box-shadow: var(--rd-shadow-l);
}

@media (max-width: 820px) {
  body.eam-redesign .kadence-column311_predecessor02-bb > .kt-inside-inner-col {
    padding: var(--rd-space-base);
  }

  body.eam-redesign .kadence-column311_cta02-bb > .kt-inside-inner-col:has(> .wp-block-image) {
    column-gap: var(--rd-space-m);
  }

  /* Shrinks towards 120px on small tablets so "Visit the Journal" stays on one line down to 481px. */
  body.eam-redesign .kadence-column311_cta02-bb > .kt-inside-inner-col > .wp-block-image {
    width: clamp(120px, 24vw, 160px);
  }
}

/* Phones: one column, the cover first (its place in the content), smaller. */
@media (max-width: 480px) {
  body.eam-redesign .kadence-column311_cta02-bb > .kt-inside-inner-col:has(> .wp-block-image) {
    display: flex;
    flex-direction: column;
  }

  body.eam-redesign .kadence-column311_cta02-bb > .kt-inside-inner-col > .wp-block-image {
    align-self: flex-start;
    width: 128px;
    margin-bottom: var(--rd-space-base);
  }
}
