/*
 * Article blocks (docs/design-system.md#article-blocks), shared by the frontend and the
 * block editor. Token values live in theme.json: only the generated --wp--* properties are
 * used here. :is(.entry-content, .is-root-container) targets the content column on the
 * frontend and the post canvas in the editor (add_editor_style prefixes
 * .editor-styles-wrapper); :is() keeps class specificity above core block styles.
 * Frontend-only structure (wide breakout, table scroll wrapper) stays in style.css.
 */

/* Reading text and vertical rhythm: body text is softer than headings on the dark surface */
:is(.entry-content, .is-root-container) {
  color: var(--wp--preset--color--text-body);
  font-size: var(--wp--custom--text--article);
  line-height: 1.7;
  overflow-wrap: break-word;
}
:is(.entry-content, .is-root-container) strong {
  color: var(--wp--preset--color--text-primary);
  font-weight: 600;
}
:is(.entry-content, .is-root-container) > * {
  margin-block: 0;
}
:is(.entry-content, .is-root-container) > * + * {
  margin-top: 1.25em;
}

/* Headings: family, color, sizes and weights of H2 and H3 come from theme.json elements */
:is(.entry-content, .is-root-container) h2 {
  margin-top: var(--wp--preset--spacing--space-7);
}
:is(.entry-content, .is-root-container) :is(h3, h4, h5, h6) {
  margin-top: var(--wp--preset--spacing--space-6);
}
/* H4–H6 have no role of their own: body size in the heading family and line-height. */
:is(.entry-content, .is-root-container) :is(h4, h5, h6) {
  font-size: 1em;
  line-height: 1.25;
}
:is(.entry-content, .is-root-container) :is(h2, h3, h4, h5, h6) + * {
  margin-top: var(--wp--preset--spacing--space-3);
}
:is(.entry-content, .is-root-container) > :first-child {
  margin-top: 0;
}

/* Links: underlined in running text; long URLs break anywhere */
:is(.entry-content, .is-root-container) a:not(.wp-element-button) {
  color: var(--wp--preset--color--action);
  text-decoration: underline 1px;
  text-underline-offset: 0.15em;
  overflow-wrap: anywhere;
}
:is(.entry-content, .is-root-container) a:not(.wp-element-button):hover {
  color: var(--wp--preset--color--action-hover);
  text-decoration-thickness: 2px;
}

/* Lists */
:is(.entry-content, .is-root-container) :is(ul, ol) {
  padding-left: 1.5em;
}
:is(.entry-content, .is-root-container) li::marker {
  color: var(--wp--preset--color--action);
}
:is(.entry-content, .is-root-container) li + li,
:is(.entry-content, .is-root-container) li > :is(ul, ol) {
  margin-top: var(--wp--preset--spacing--space-2);
}

/* Quote and pullquote */
:is(.entry-content, .is-root-container) .wp-block-quote {
  padding: var(--wp--preset--spacing--space-5);
  border-left: var(--wp--custom--border--strong) solid
    var(--wp--preset--color--action);
  border-radius: 0 var(--wp--custom--radius--md) var(--wp--custom--radius--md) 0;
  background: var(--wp--preset--color--surface-action);
  color: var(--wp--preset--color--text-primary);
  font-weight: 600;
}
/* The editor canvas has no base reset: browser margins of quotes and figures are removed here. */
:is(.entry-content, .is-root-container) :is(blockquote, figure) {
  margin-inline: 0;
}
:is(.entry-content, .is-root-container) blockquote :is(p, cite) {
  margin-block: 0;
}
:is(.entry-content, .is-root-container) blockquote p + p {
  margin-top: 1.25em;
}
:is(.entry-content, .is-root-container) blockquote cite {
  display: block;
  margin-top: var(--wp--preset--spacing--space-2);
  color: var(--wp--preset--color--text-secondary);
  font-size: var(--wp--preset--font-size--text-sm);
  font-style: normal;
  font-weight: 400;
  line-height: 1.5;
}
:is(.entry-content, .is-root-container) .wp-block-pullquote {
  padding: var(--wp--preset--spacing--space-6) 0;
  border-block: var(--wp--custom--border--thin) solid
    var(--wp--preset--color--border);
  color: var(--wp--preset--color--text-primary);
  font-family: var(--wp--preset--font-family--poppins);
  font-size: var(--wp--preset--font-size--heading-sm);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
:is(.entry-content, .is-root-container) .wp-block-pullquote cite {
  font-family: var(--wp--preset--font-family--editorial-sans);
  letter-spacing: normal;
}
/* Core centers pullquotes; the reading column is left aligned unless the editor chose an alignment. */
:is(.entry-content, .is-root-container)
  .wp-block-pullquote:not([class*="has-text-align-"]) {
  text-align: start;
}

/* Code: blocks scroll locally without wrapping; inline code follows the text around it */
:is(.entry-content, .is-root-container) .wp-block-code {
  max-width: 100%;
  overflow-x: auto;
  padding: var(--wp--preset--spacing--space-4)
    var(--wp--preset--spacing--space-5);
  border: var(--wp--custom--border--thin) solid var(--wp--preset--color--border);
  border-radius: var(--wp--custom--radius--md);
  background: var(--wp--preset--color--surface-code);
  color: var(--wp--preset--color--text-body);
  font: 400 var(--wp--preset--font-size--text-sm) / 1.6
    var(--wp--preset--font-family--monospace);
  white-space: pre;
  tab-size: 4;
}
:is(.entry-content, .is-root-container) .wp-block-code code {
  font: inherit;
  white-space: pre;
  overflow-wrap: normal;
}
:is(.entry-content, .is-root-container) .wp-block-preformatted {
  font-family: var(--wp--preset--font-family--monospace);
  font-size: var(--wp--preset--font-size--text-sm);
  line-height: 1.6;
  overflow-wrap: anywhere;
}
:is(.entry-content, .is-root-container) :not(pre) > code {
  padding: 0 0.25em;
  background: var(--wp--preset--color--surface-code);
  font-family: var(--wp--preset--font-family--monospace);
  font-size: 0.875em;
  overflow-wrap: anywhere;
}

/* Tables: natural column widths, no zebra; the frontend scroll wrapper is in style.css */
:is(.entry-content, .is-root-container) .wp-block-table table {
  width: auto;
  min-width: 100%;
  table-layout: auto;
  border-collapse: collapse;
  font-size: var(--wp--preset--font-size--text-base);
  line-height: 1.5;
}
:is(.entry-content, .is-root-container) .wp-block-table :is(thead, tfoot) {
  border: 0;
}
:is(.entry-content, .is-root-container) .wp-block-table table :is(th, td) {
  padding: var(--wp--preset--spacing--space-3)
    var(--wp--preset--spacing--space-4);
  border: 0;
  border-bottom: var(--wp--custom--border--thin) solid
    var(--wp--preset--color--border);
  vertical-align: top;
  word-break: normal;
}
:is(.entry-content, .is-root-container) .wp-block-table table th {
  border-bottom-color: var(--wp--preset--color--border-control);
  background: var(--wp--preset--color--surface-raised);
  color: var(--wp--preset--color--text-primary);
  font-weight: 600;
}
:is(.entry-content, .is-root-container)
  .wp-block-table
  th:not([class*="has-text-align-"]) {
  text-align: start;
}

/* Images and captions (caption size and color come from theme.json) */
:is(.entry-content, .is-root-container) figcaption {
  margin-top: var(--wp--preset--spacing--space-3);
  margin-bottom: 0;
}
:is(.entry-content, .is-root-container) .wp-block-image img {
  height: auto;
  max-width: 100%;
  border-radius: var(--wp--custom--radius--md);
}
:is(.entry-content, .is-root-container) .aligncenter {
  margin-inline: auto;
}
@media (min-width: 40em) {
  :is(.entry-content, .is-root-container) .alignleft {
    float: left;
    max-width: 50%;
    margin: 0.25em var(--wp--preset--spacing--space-5)
      var(--wp--preset--spacing--space-3) 0;
  }
  :is(.entry-content, .is-root-container) .alignright {
    float: right;
    max-width: 50%;
    margin: 0.25em 0 var(--wp--preset--spacing--space-3)
      var(--wp--preset--spacing--space-5);
  }
}

/* Separator */
:is(.entry-content, .is-root-container) .wp-block-separator {
  height: 0;
  margin-block: var(--wp--preset--spacing--space-7);
  border: 0;
  border-top: var(--wp--custom--border--thin) solid
    var(--wp--preset--color--border);
  opacity: 1;
}

/* Buttons block: secondary button */
:is(.entry-content, .is-root-container) .wp-block-button__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--wp--custom--target-min);
  padding: 0.625rem 1.5rem;
  border: var(--wp--custom--border--thin) solid var(--wp--preset--color--action);
  border-radius: var(--wp--custom--radius--pill);
  background: transparent;
  color: var(--wp--preset--color--text-primary);
  font: 700 var(--wp--preset--font-size--text-base) / 1.5
    var(--wp--preset--font-family--poppins);
  letter-spacing: 0.01em;
  text-decoration: none;
}
:is(.entry-content, .is-root-container) .wp-block-button__link:hover {
  border-color: var(--wp--preset--color--action-hover);
  background: var(--wp--preset--color--surface-action);
  color: var(--wp--preset--color--text-primary);
}

/* Editor only: full width is not supported, so it previews as wide (see style.css) */
.is-root-container > .alignfull {
  max-width: var(--wp--style--global--wide-size);
  margin-inline: auto;
}
