/*
 * Neuigkeiten post body (issue #105): the v2 look for the core blocks
 * editors use inside a post. Site-wide block defaults (caption, pullquote,
 * separator, table font size) live in theme.json; this file only covers
 * what theme.json can't express or what must stay inside a Neuigkeit's
 * 700px reading column (templates/single.html's `wp:post-content`).
 *
 * Every rule is scoped to `.wp-block-post-content`. Pages built from
 * patterns render that wrapper too, so inc/post-content.php only enqueues
 * this file on single Neuigkeiten and in the editor while a Neuigkeit is
 * being edited (where the canvas root carries the same class).
 */

/* Paragraphs: body size with a slightly more open line height for long
 * reading, and in-text links that stay underlined (never colour alone,
 * WCAG 1.4.1) and darken to navy on hover/focus (both blue and navy are
 * well above AA against white and ice). */
.wp-block-post-content {
  font-size: var(--wp--preset--font-size--body);
  line-height: 1.7;
}

.wp-block-post-content a:where(:not(.wp-block-button__link):not(.wp-block-file__button)) {
  color: var(--wp--preset--color--blue);
  text-decoration: underline;
  text-decoration-thickness: 1px;
}

.wp-block-post-content a:where(:not(.wp-block-button__link):not(.wp-block-file__button)):hover,
.wp-block-post-content a:where(:not(.wp-block-button__link):not(.wp-block-file__button)):focus {
  color: var(--wp--preset--color--navy);
  text-decoration-thickness: 2px;
}

/* Headings (H2–H4): one step smaller than the page-level H1/H2 so a
 * subheading never competes with the article title (h1-article), with
 * more space above than below so it groups with the text it introduces. */
.wp-block-post-content :where(h2, h3, h4) {
  margin-top: calc(2 * var(--wp--style--block-gap));
  margin-bottom: 0;
}

.wp-block-post-content :where(h2, h3, h4) + * {
  margin-top: calc(0.5 * var(--wp--style--block-gap));
}

.wp-block-post-content > :where(h2, h3, h4):first-child {
  margin-top: 0;
}

.wp-block-post-content h2 {
  font-size: var(--wp--preset--font-size--h2-article);
  line-height: 1.2;
}

.wp-block-post-content h3 {
  font-size: var(--wp--preset--font-size--h3);
}

.wp-block-post-content h4 {
  font-size: var(--wp--preset--font-size--body);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Lists: indented markers in brand blue, a little air between items. */
.wp-block-post-content :where(ul, ol).wp-block-list {
  padding-left: 1.4em;
}

.wp-block-post-content .wp-block-list li + li {
  margin-top: 0.4em;
}

.wp-block-post-content .wp-block-list li::marker {
  color: var(--wp--preset--color--blue);
}

.wp-block-post-content ol.wp-block-list li::marker {
  font-weight: 700;
}

/* Images, galleries, media & text: the 15px card radius, dropped for
 * full-width images so they meet the viewport edges cleanly. Captions get
 * their colour/size from theme.json's `caption` element. */
.wp-block-post-content :where(.wp-block-image, .wp-block-media-text__media) img {
  border-radius: 15px;
}

.wp-block-post-content .wp-block-gallery .wp-block-image {
  overflow: hidden;
  border-radius: 15px;
}

.wp-block-post-content .wp-block-image.alignfull img {
  border-radius: 0;
}

.wp-block-post-content
  :where(.wp-block-image, .wp-block-gallery, .wp-block-table, .wp-block-embed)
  > .wp-element-caption {
  margin-top: 8px;
  margin-bottom: 0;
}

.wp-block-post-content .wp-block-gallery {
  gap: var(--wp--preset--spacing--grid-gap);
}

/* Quote: aligned with theme.json's defaults and the "Akzent"/"Kasten"
 * quote and "Navy-Fläche" pullquote variations (issue #42); only inner
 * spacing and the citation are set here. */
.wp-block-post-content .wp-block-quote cite,
.wp-block-post-content .wp-block-pullquote cite {
  display: block;
  margin-top: 8px;
  font-family: var(--wp--preset--font-family--default);
  font-size: var(--wp--preset--font-size--meta);
  font-style: normal;
  font-weight: 700;
  text-transform: none;
  color: var(--wp--preset--color--text-muted);
}

.wp-block-post-content .wp-block-pullquote {
  padding: var(--wp--preset--spacing--grid-gap) 0;
}

/* "Navy-Fläche": keep theme.json's inner padding (the rule above would
 * zero the sides) and lift the citation off text-muted, which fails
 * contrast on navy (ACCESSIBILITY.md). */
.wp-block-post-content .wp-block-pullquote.is-style-navy {
  padding: 32px;
}

.wp-block-post-content .wp-block-pullquote.is-style-navy cite {
  color: var(--wp--preset--color--blue-pale);
}

/* Post-body links are blue with a navy hover, both unreadable on navy. */
.wp-block-post-content .wp-block-pullquote.is-style-navy a,
.wp-block-post-content .wp-block-pullquote.is-style-navy a:hover,
.wp-block-post-content .wp-block-pullquote.is-style-navy a:focus {
  color: var(--wp--preset--color--white);
}

/* Tables: navy header row, fine ice-border row dividers, and ice zebra
 * rows for core's "Streifen" style. core's own `.wp-block-table` already
 * scrolls horizontally; the cell min-width keeps many-column tables
 * readable on mobile by scrolling the figure instead of squeezing cells. */
.wp-block-post-content .wp-block-table {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.wp-block-post-content .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
}

.wp-block-post-content .wp-block-table :where(th, td) {
  min-width: 7.5rem;
  padding: 12px 16px;
  text-align: left;
  border: 0;
  border-bottom: 1px solid var(--wp--preset--color--ice-border);
}

/* core's default "fixed width cells" layout ignores the cell min-width and
 * breaks words mid-letter on narrow screens; below 600px the table sizes
 * to its content instead and the figure scrolls. */
@media (max-width: 600px) {
  .wp-block-post-content .wp-block-table table.has-fixed-layout {
    table-layout: auto;
  }

  .wp-block-post-content .wp-block-table :where(th, td) {
    word-break: normal;
    overflow-wrap: normal;
  }
}

.wp-block-post-content .wp-block-table thead {
  border-bottom: 0;
}

.wp-block-post-content .wp-block-table thead th {
  background-color: var(--wp--preset--color--navy);
  color: var(--wp--preset--color--white);
  font-weight: 700;
}

.wp-block-post-content .wp-block-table tfoot {
  border-top: 0;
}

.wp-block-post-content .wp-block-table tfoot td {
  font-weight: 700;
}

.wp-block-post-content .wp-block-table.is-style-stripes {
  border-bottom: 0;
}

.wp-block-post-content .wp-block-table.is-style-stripes tbody tr:nth-child(odd) {
  background-color: var(--wp--preset--color--ice);
}

/* Separator: colour comes from theme.json (ice-border); the default style
 * stays core's short centred rule, "Breit" spans the column. */
.wp-block-post-content .wp-block-separator {
  margin-top: calc(2 * var(--wp--style--block-gap));
  margin-bottom: calc(2 * var(--wp--style--block-gap));
  border-top-width: 2px;
  opacity: 1;
}

/* File (PDF download, e.g. Spielbericht, Einladung): the same ice card as
 * the Ordnungen documents and the Mitglied werden download, with core's
 * download button as the primary pill button. */
.wp-block-post-content .wp-block-file {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 20px 24px;
  background-color: var(--wp--preset--color--ice);
  border: 1px solid var(--wp--preset--color--ice-border);
  border-radius: 15px;
}

.wp-block-post-content .wp-block-file > a:not(.wp-block-file__button) {
  flex: 1 1 220px;
  min-width: 0;
  font-weight: 700;
  overflow-wrap: break-word;
}

.wp-block-post-content .wp-block-file .wp-block-file__button {
  flex-shrink: 0;
  margin: 0;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background-color: var(--wp--preset--color--blue);
  color: var(--wp--preset--color--white);
  font-size: var(--wp--preset--font-size--meta);
  font-weight: 700;
  text-decoration: none;
}

.wp-block-post-content .wp-block-file .wp-block-file__embed {
  flex-basis: 100%;
  border-radius: 12px;
}

/* Embeds: rounded video frames; the consent placeholder itself is styled
 * in theme.css, since core/embed can appear outside posts too. */
.wp-block-post-content .wp-block-embed.is-type-video .wp-block-embed__wrapper {
  overflow: hidden;
  border-radius: 15px;
}

/* Columns, media & text: the grid gap between columns, and a gap above the
 * text once media & text stacks on mobile (core stacks it below 600px;
 * theme.css already stacks columns below 1200px). */
.wp-block-post-content .wp-block-columns {
  gap: var(--wp--preset--spacing--grid-gap);
}

.wp-block-post-content .wp-block-media-text .wp-block-media-text__content {
  padding: 0 var(--wp--preset--spacing--grid-gap);
}

@media (max-width: 600px) {
  .wp-block-post-content .wp-block-media-text.is-stacked-on-mobile .wp-block-media-text__content {
    padding: var(--wp--preset--spacing--grid-gap) 0 0;
  }
}

/* Details (Aufklappbereich): an ice card with a bold, clearly clickable
 * summary. */
.wp-block-post-content .wp-block-details {
  padding: 16px 24px;
  background-color: var(--wp--preset--color--ice);
  border: 1px solid var(--wp--preset--color--ice-border);
  border-radius: 15px;
}

.wp-block-post-content .wp-block-details summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--wp--preset--color--navy);
}

.wp-block-post-content .wp-block-details[open] summary {
  margin-bottom: 8px;
}
