/**
 * Chester long-form article prose.
 *
 * Implementation note
 * -------------------
 * Published production posts are Custom HTML with a `.chester-article` root,
 * embedded <style>, and (sometimes) FAQ <script>. Those keep their own CSS.
 *
 * Native Gutenberg posts have no such wrapper. This file styles them through
 * `.chester-article-content:not(.chester-article-content--legacy)`.
 *
 * Visual rules are extracted from the reference article
 * (jak-wybrac-dobrego-barbera-we-wroclawiu-9-konkretnych-kryteriow):
 * Manrope, ~980px measure, 16px/1.72 body, white H2/H3, custom list dots,
 * underlined white links. One-off pieces (lead card, FAQ accordion, custom
 * comparison table, extra radial wash) stay in those posts and are not copied.
 *
 * :where() keeps element selectors at zero specificity so `.chester-article *`
 * from embedded CSS still wins if a legacy post is ever missing the PHP flag.
 */

.chester-article-content:not(.chester-article-content--legacy) {
  --chester-prose-max: 980px;
  --chester-prose-text: rgba(255, 255, 255, 0.72);
  --chester-prose-text-strong: #fff;
  --chester-prose-text-muted: rgba(255, 255, 255, 0.52);
  --chester-prose-border: rgba(255, 255, 255, 0.12);
  --chester-prose-surface: rgba(255, 255, 255, 0.035);
  --chester-prose-section: clamp(42px, 6vw, 72px);
  --chester-prose-radius: 18px;

  display: block;
  color: var(--chester-prose-text);
  font-family: var(--ff-body);
  font-size: 16px;
  line-height: 1.72;
  overflow-wrap: break-word;
}

.editor-styles-wrapper {
  --chester-prose-max: 980px;
  --chester-prose-text: rgba(255, 255, 255, 0.72);
  --chester-prose-text-strong: #fff;
  --chester-prose-text-muted: rgba(255, 255, 255, 0.52);
  --chester-prose-border: rgba(255, 255, 255, 0.12);
  --chester-prose-surface: rgba(255, 255, 255, 0.035);
  --chester-prose-section: clamp(42px, 6vw, 72px);
  --chester-prose-radius: 18px;
}

.chester-article-content:not(.chester-article-content--legacy) :where(p, h2, h3, h4, ul, ol, blockquote, hr, .wp-block-quote, .wp-block-pullquote, .wp-block-separator),
.editor-styles-wrapper :where(p, h2, h3, h4, ul, ol, blockquote, hr, .wp-block-quote, .wp-block-pullquote, .wp-block-separator) {
  max-width: var(--chester-prose-max);
}

.chester-article-content:not(.chester-article-content--legacy) :where(p),
.editor-styles-wrapper :where(p) {
  margin: 0 0 18px;
  color: var(--chester-prose-text);
  line-height: 1.72;
}

.chester-article-content:not(.chester-article-content--legacy) > :where(p:first-of-type),
.editor-styles-wrapper .is-root-container > :where(p:first-of-type) {
  margin-bottom: 22px;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(17px, 1.2vw, 20px);
  line-height: 1.72;
}

.chester-article-content:not(.chester-article-content--legacy) :where(p:last-child),
.editor-styles-wrapper :where(p:last-child) {
  margin-bottom: 0;
}

.chester-article-content:not(.chester-article-content--legacy) :where(strong, b),
.editor-styles-wrapper :where(strong, b) {
  color: var(--chester-prose-text-strong);
  font-weight: 700;
}

.chester-article-content:not(.chester-article-content--legacy) :where(em, i),
.editor-styles-wrapper :where(em, i) {
  font-style: italic;
}

.chester-article-content:not(.chester-article-content--legacy) :where(a:not(.btn):not(.btn-link):not(.wp-block-button__link)),
.editor-styles-wrapper :where(a:not(.wp-block-button__link)) {
  color: var(--chester-prose-text-strong);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  overflow-wrap: anywhere;
  transition: opacity 180ms ease;
}

.chester-article-content:not(.chester-article-content--legacy) :where(a:not(.btn):not(.btn-link):not(.wp-block-button__link):hover),
.chester-article-content:not(.chester-article-content--legacy) :where(a:not(.btn):not(.btn-link):not(.wp-block-button__link):focus-visible),
.editor-styles-wrapper :where(a:not(.wp-block-button__link):hover) {
  opacity: 0.72;
}

.chester-article-content:not(.chester-article-content--legacy) :where(h2, h3, h4),
.editor-styles-wrapper :where(h2, h3, h4) {
  color: var(--chester-prose-text-strong);
  font-weight: 620;
  letter-spacing: -0.035em;
  overflow-wrap: break-word;
}

.chester-article-content:not(.chester-article-content--legacy) :where(h2),
.editor-styles-wrapper :where(h2) {
  margin: var(--chester-prose-section) 0 18px;
  font-size: clamp(28px, 3vw, 44px);
  line-height: 1.08;
}

.chester-article-content:not(.chester-article-content--legacy) :where(h3),
.editor-styles-wrapper :where(h3) {
  margin: 34px 0 12px;
  font-size: clamp(21px, 2vw, 28px);
  line-height: 1.16;
}

.chester-article-content:not(.chester-article-content--legacy) :where(h4),
.editor-styles-wrapper :where(h4) {
  margin: 28px 0 10px;
  font-size: clamp(18px, 1.6vw, 22px);
  line-height: 1.22;
}

.chester-article-content:not(.chester-article-content--legacy) :where(h2):first-child,
.chester-article-content:not(.chester-article-content--legacy) :where(h3):first-child,
.chester-article-content:not(.chester-article-content--legacy) :where(h4):first-child {
  margin-top: 0;
}

.chester-article-content:not(.chester-article-content--legacy) :where(ul, ol),
.editor-styles-wrapper :where(ul, ol) {
  display: grid;
  gap: 10px;
  max-width: var(--chester-prose-max);
  margin: 18px 0 24px;
  padding: 0;
  list-style: none;
}

.chester-article-content:not(.chester-article-content--legacy) :where(li),
.editor-styles-wrapper :where(li) {
  position: relative;
  color: var(--chester-prose-text);
  line-height: 1.65;
}

.chester-article-content:not(.chester-article-content--legacy) :where(ul > li),
.editor-styles-wrapper :where(ul > li) {
  padding-left: 22px;
}

.chester-article-content:not(.chester-article-content--legacy) :where(ul > li)::before,
.editor-styles-wrapper :where(ul > li)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.78em;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #fff;
  opacity: 0.72;
}

.chester-article-content:not(.chester-article-content--legacy) :where(ol),
.editor-styles-wrapper :where(ol) {
  counter-reset: chester-prose;
}

.chester-article-content:not(.chester-article-content--legacy) :where(ol > li),
.editor-styles-wrapper :where(ol > li) {
  padding-left: 28px;
  counter-increment: chester-prose;
}

.chester-article-content:not(.chester-article-content--legacy) :where(ol > li)::before,
.editor-styles-wrapper :where(ol > li)::before {
  content: counter(chester-prose) ".";
  position: absolute;
  left: 0;
  top: 0;
  color: #fff;
  font-size: 0.92em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chester-article-content:not(.chester-article-content--legacy) :where(ul ul, ol ol, ul ol, ol ul),
.editor-styles-wrapper :where(ul ul, ol ol, ul ol, ol ul) {
  margin: 10px 0 4px;
  gap: 8px;
}

.chester-article-content:not(.chester-article-content--legacy) :where(blockquote, .wp-block-quote, .wp-block-pullquote),
.editor-styles-wrapper :where(blockquote, .wp-block-quote, .wp-block-pullquote) {
  margin: 28px 0;
  padding: 8px 0 8px 22px;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, 0.35);
  color: rgba(255, 255, 255, 0.82);
}

.chester-article-content:not(.chester-article-content--legacy) :where(blockquote p, .wp-block-quote p),
.editor-styles-wrapper :where(blockquote p, .wp-block-quote p) {
  margin: 0 0 10px;
  font-size: clamp(17px, 1.1vw, 19px);
  line-height: 1.55;
}

.chester-article-content:not(.chester-article-content--legacy) :where(blockquote cite, .wp-block-quote cite, .wp-block-pullquote cite),
.editor-styles-wrapper :where(blockquote cite, .wp-block-quote cite, .wp-block-pullquote cite) {
  display: block;
  margin-top: 8px;
  color: var(--chester-prose-text-muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-pullquote),
.editor-styles-wrapper :where(.wp-block-pullquote) {
  padding: 22px 0;
  border-left: 0;
  border-top: 1px solid var(--chester-prose-border);
  border-bottom: 1px solid var(--chester-prose-border);
  text-align: left;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-pullquote p) {
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: #fff;
}

.chester-article-content:not(.chester-article-content--legacy) :where(hr, .wp-block-separator),
.editor-styles-wrapper :where(hr, .wp-block-separator) {
  width: 100%;
  max-width: var(--chester-prose-max);
  height: 1px;
  margin: clamp(32px, 5vw, 56px) 0;
  padding: 0;
  border: 0;
  background: var(--chester-prose-border);
}

.chester-article-content:not(.chester-article-content--legacy) :where(figure, .wp-block-image, .wp-block-gallery, .wp-block-video, .wp-block-embed) {
  margin: 28px 0;
  max-width: 100%;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-image img, .wp-block-video video, p > img, figure > img) {
  width: 100%;
  height: auto;
  border: 1px solid var(--chester-prose-border);
  border-radius: var(--chester-prose-radius);
  background: var(--chester-prose-surface);
}

.chester-article-content:not(.chester-article-content--legacy) :where(figcaption, .wp-element-caption),
.editor-styles-wrapper :where(figcaption, .wp-element-caption) {
  margin-top: 10px;
  color: var(--chester-prose-text-muted);
  font-size: 14px;
  line-height: 1.5;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-gallery) {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-gallery .wp-block-image),
.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-gallery figure) {
  margin: 0;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-table),
.chester-article-content:not(.chester-article-content--legacy) :where(figure.wp-block-table) {
  margin: 26px 0 28px;
  max-width: 100%;
  overflow-x: auto;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-embed, .wp-block-video) {
  max-width: 100%;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-embed__wrapper) {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--chester-prose-border);
  border-radius: var(--chester-prose-radius);
  background: #050505;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-embed iframe, .wp-block-video video) {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
}

.chester-article-content:not(.chester-article-content--legacy) :where(pre, code),
.editor-styles-wrapper :where(pre, code) {
  font-family: var(--ff-mono);
  font-size: 0.92em;
}

.chester-article-content:not(.chester-article-content--legacy) :where(code),
.editor-styles-wrapper :where(code) {
  padding: 0.12em 0.38em;
  border: 1px solid var(--chester-prose-border);
  border-radius: 6px;
  background: var(--chester-prose-surface);
  color: #fff;
}

.chester-article-content:not(.chester-article-content--legacy) :where(pre),
.editor-styles-wrapper :where(pre) {
  margin: 24px 0;
  padding: 18px 20px;
  overflow-x: auto;
  border: 1px solid var(--chester-prose-border);
  border-radius: 14px;
  background: var(--chester-prose-surface);
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.55;
}

.chester-article-content:not(.chester-article-content--legacy) :where(pre code) {
  padding: 0;
  border: 0;
  background: transparent;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-buttons) {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 28px 0;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-button__link) {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid #fff;
  border-radius: 999px;
  background: #fff;
  color: #000;
  font-size: 14px;
  font-weight: 800;
  text-decoration: none;
  transition: background-color 180ms ease, transform 180ms ease;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-button__link:hover),
.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-button__link:focus-visible) {
  background: rgba(255, 255, 255, 0.92);
  opacity: 1;
  text-decoration: none;
}

.chester-article-content:not(.chester-article-content--legacy) :where(.wp-block-button.is-style-outline .wp-block-button__link) {
  background: transparent;
  color: #fff;
}

@media (max-width: 760px) {
  .chester-article-content:not(.chester-article-content--legacy) {
    font-size: 15.5px;
    line-height: 1.68;
  }

  .chester-article-content:not(.chester-article-content--legacy) :where(p) {
    margin-bottom: 16px;
  }

  .chester-article-content:not(.chester-article-content--legacy) > :where(p:first-of-type) {
    font-size: 16.5px;
    line-height: 1.66;
  }

  .chester-article-content:not(.chester-article-content--legacy) :where(h2) {
    margin-top: 46px;
    margin-bottom: 16px;
    font-size: clamp(25px, 7.2vw, 34px);
    line-height: 1.1;
    letter-spacing: -0.04em;
  }

  .chester-article-content:not(.chester-article-content--legacy) :where(h3) {
    margin-top: 28px;
    font-size: clamp(20px, 5.6vw, 25px);
    line-height: 1.16;
  }

  .chester-article-content:not(.chester-article-content--legacy) :where(ul, ol) {
    gap: 9px;
    margin: 16px 0 22px;
  }

  .chester-article-content:not(.chester-article-content--legacy) :where(ul > li) {
    padding-left: 20px;
  }
}

@media (max-width: 430px) {
  .chester-article-content:not(.chester-article-content--legacy) :where(h2, h3, h4) {
    hyphens: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chester-article-content:not(.chester-article-content--legacy) :where(a, .wp-block-button__link) {
    transition: none;
  }
}
