/**
 * Single article — allowlist vs iawp-hub-proto/artigo.html.
 *
 * Natives first (spacing/typography/color/layout/aspectRatio in patterns).
 * CSS só: wash, sticky top offset, cat pill, prose children, featured filter,
 * sidebar form Jetpack, related list chrome, share boxes.
 *
 * Zero !important salvo .sidebar-form (Jetpack grunion / wp-container-*),
 * mesmo padrão de cta.css.
 */

/* ── Header wash (fashion) — Group sem layer wash+bg ── */
.single-header {
  position: relative;
  overflow: hidden;
}

.single-header::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--wp--custom--fashion-wash);
  opacity: 0.7;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 85%);
  z-index: 0;
}

.single-header > .single-header__inner,
.single-header > .wp-block-group.alignwide {
  position: relative;
  z-index: 1;
}

/* Cat pill — post-terms: front = <a>; canvas template = texto sem link.
   Estilizar <a> OU o próprio bloco quando não há <a> (fidelidade editor). */
.single-cat.wp-block-post-terms {
  margin: 0;
  display: inline-flex;
  align-items: center;
}

.single-cat.wp-block-post-terms a,
.single-cat.wp-block-post-terms:not(:has(a)) {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.85rem;
  border: 1px solid var(--wp--custom--primary-alpha-40);
  border-radius: 2px;
  font-family: var(--wp--preset--font-family--display);
  font-size: var(--wp--preset--font-size--2-xs);
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--wp--preset--color--primary);
  text-decoration: none;
  background: transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.single-cat.wp-block-post-terms a:hover {
  color: var(--wp--preset--color--contrast);
  border-color: var(--wp--preset--color--contrast);
}

/* Read time — tipografia nativa; CSS só bullet (margin = attr no pattern) */
.single-read-time.wp-block-post-time-to-read::before {
  content: "• ";
  color: var(--wp--preset--color--primary);
}

/* Title max-width — heading sem maxWidth no block.json.
   elements.h1 do theme.json força uppercase (hub); proto artigo = sentence case. */
.single-title.wp-block-post-title {
  max-width: 22ch;
  text-transform: none;
}

/* Meta bar borders — Group border = caixa inteira, não só topo/base */
.single-meta-bar.wp-block-group {
  width: 100%;
  border-top: 1px solid var(--wp--preset--color--outline);
  border-bottom: 1px solid var(--wp--preset--color--outline);
}

/* Data: sentence case (não herdar uppercase do label) */
.single-author-date.wp-block-post-date {
  margin: 0;
  text-transform: none;
  font-weight: 400;
  letter-spacing: normal;
}

.single-author-date.wp-block-post-date a {
  color: inherit;
  text-decoration: none;
}

/*
 * Share — Social Sharing Block (outermost) obrigatório.
 * Markup TT5 mínimo (save válido). Cores brand do plugin vencidas por
 * especificidade (0,3,0) > (0,2,0) — sem !important.
 * Proto = texto in/X/@: esconder SVG + ::after (labels nativos do plugin
 * com showLabels quebram o save() JS no Site Editor).
 */
.single-share-list.wp-block-outermost-social-sharing {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.wp-block-outermost-social-sharing.single-share-list:not(.is-style-logos-only) .outermost-social-sharing-link,
.wp-block-outermost-social-sharing.single-share-list:not(.is-style-logos-only) .outermost-social-sharing-link-linkedin,
.wp-block-outermost-social-sharing.single-share-list:not(.is-style-logos-only) .outermost-social-sharing-link-x,
.wp-block-outermost-social-sharing.single-share-list:not(.is-style-logos-only) .outermost-social-sharing-link-mail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 1px solid var(--wp--preset--color--outline);
  border-radius: 0;
  background-color: transparent;
  color: var(--wp--preset--color--muted);
  transition: color 0.25s ease, border-color 0.25s ease;
}

.wp-block-outermost-social-sharing.single-share-list:not(.is-style-logos-only) .outermost-social-sharing-link:hover,
.wp-block-outermost-social-sharing.single-share-list:not(.is-style-logos-only) .outermost-social-sharing-link-linkedin:hover,
.wp-block-outermost-social-sharing.single-share-list:not(.is-style-logos-only) .outermost-social-sharing-link-x:hover,
.wp-block-outermost-social-sharing.single-share-list:not(.is-style-logos-only) .outermost-social-sharing-link-mail:hover {
  transform: none;
  border-color: var(--wp--preset--color--primary);
  color: var(--wp--preset--color--primary);
  background-color: transparent;
}

.single-share-list .wp-block-outermost-social-sharing-link-anchor {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  line-height: 1;
  color: inherit;
}

.single-share-list .outermost-social-sharing-link svg {
  display: none;
}

.single-share-list .outermost-social-sharing-link-linkedin .wp-block-outermost-social-sharing-link-anchor::after {
  content: "in";
}

.single-share-list .outermost-social-sharing-link-x .wp-block-outermost-social-sharing-link-anchor::after {
  content: "X";
}

.single-share-list .outermost-social-sharing-link-mail .wp-block-outermost-social-sharing-link-anchor::after {
  content: "@";
}

.single-share-list .wp-block-outermost-social-sharing-link-anchor::after {
  font-family: var(--wp--preset--font-family--display);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: inherit;
}

/* Featured — aspectRatio nativo; filter/hover = proto */
.single-featured.wp-block-post-featured-image {
  margin: 0;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--wp--preset--color--outline);
  background: var(--wp--preset--color--surface-mid);
}

.single-featured.wp-block-post-featured-image img {
  filter: grayscale(0.15);
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1), filter 0.7s;
}

.single-featured.wp-block-post-featured-image:hover img {
  transform: scale(1.03);
  filter: grayscale(0);
}

/* ── Layout: stretch sidebar track for sticky ── */
.single-layout.wp-block-columns.alignwide {
  align-items: stretch;
}

.single-content-col.wp-block-column {
  align-self: flex-start;
  min-width: 0;
}

.single-sidebar-col.wp-block-column {
  min-width: 0;
  align-self: stretch;
}

/*
 * Sticky top offset — WP sticky gera .wp-container-* { top: calc(0px + admin-bar) }.
 * Seletor (0,2,0) vence o container (0,1,0) sem !important.
 */
.single-sidebar-col .single-sidebar-sticky {
  top: calc(
    var(--wp-admin--admin-bar--position-offset, 0px) +
    var(--wp--custom--header-height, 96px) +
    1.5rem
  );
  z-index: 2;
}

/* ── Prose (tipografia/cor residual; ritmo = theme.json blockGap + margins) ── */
.single-prose.entry-content.wp-block-post-content,
.single-prose.wp-block-post-content {
  max-width: none;
  font-size: var(--wp--preset--font-size--lg);
  line-height: 1.7;
  color: var(--wp--preset--color--muted);
}

.single-prose.wp-block-post-content > p {
  font-size: var(--wp--preset--font-size--lg);
  line-height: 1.7;
  color: var(--wp--preset--color--muted);
}

.single-prose.wp-block-post-content > p strong {
  color: var(--wp--preset--color--contrast);
  font-weight: 600;
}

.single-prose.wp-block-post-content a {
  color: var(--wp--preset--color--primary);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.single-prose.wp-block-post-content a:hover {
  color: var(--wp--preset--color--contrast);
}

/* Size/cor de H2/H3 no single — margins vêm de styles.blocks.core/heading */
.single-prose.wp-block-post-content > h2 {
  font-family: var(--wp--preset--font-family--display);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
  color: var(--wp--preset--color--contrast);
}

.single-prose.wp-block-post-content > h3 {
  font-family: var(--wp--preset--font-family--display);
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
  color: var(--wp--preset--color--contrast);
}

.single-prose.wp-block-post-content > ul,
.single-prose.wp-block-post-content > ol {
  padding-left: 1.25rem;
  color: var(--wp--preset--color--muted);
}

.single-prose.wp-block-post-content > ul li,
.single-prose.wp-block-post-content > ol li,
.single-prose.wp-block-post-content li {
  font-size: var(--wp--preset--font-size--lg);
  line-height: 1.7;
  color: var(--wp--preset--color--muted);
}

.single-prose.wp-block-post-content code {
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  border: 1px solid var(--wp--preset--color--outline);
  background: var(--wp--preset--color--surface-low);
  color: var(--wp--preset--color--contrast);
}

.single-prose.wp-block-post-content > blockquote,
.single-prose.wp-block-post-content > .wp-block-quote {
  padding: 0 0 0 1.25rem;
  border-left: 2px solid var(--wp--preset--color--primary);
  background: transparent;
  border-radius: 0;
}

.single-prose.wp-block-post-content > blockquote p,
.single-prose.wp-block-post-content > .wp-block-quote p {
  margin: 0;
  color: var(--wp--preset--color--contrast);
  font-size: 1.25rem;
  line-height: 1.5;
  font-style: normal;
  font-weight: 400;
}

.single-prose.wp-block-post-content table,
.single-prose.wp-block-post-content .wp-block-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

.single-prose.wp-block-post-content th,
.single-prose.wp-block-post-content td {
  padding: 0.75rem 1rem;
  border: 1px solid var(--wp--preset--color--outline);
  text-align: left;
  vertical-align: top;
  color: var(--wp--preset--color--muted);
}

.single-prose.wp-block-post-content th {
  font-family: var(--wp--preset--font-family--display);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wp--preset--color--primary);
  background: var(--wp--preset--color--surface-low);
}

/* In-content “ler mais” (proto .single-more) */
.single-prose.wp-block-post-content a.single-more {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.5rem;
  font-family: var(--wp--preset--font-family--display);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wp--preset--color--primary);
  text-decoration: none;
}

.single-prose.wp-block-post-content a.single-more:hover {
  color: var(--wp--preset--color--contrast);
}

/* Article CTA — max-widths (attrs cobrem tipografia/pad/border) */
.article-cta-title.wp-block-heading {
  max-width: 16ch;
  text-transform: none;
}

.article-cta-copy {
  max-width: 42ch;
}

/* Sidebar CTA — faixa brand (proto ::before).
   elements.h4 = uppercase/xs/tracking — attrs do pattern cobrem size/weight;
   CSS só anula o transform/tracking do elements. */
.sidebar-cta.wp-block-group {
  position: relative;
}

.sidebar-cta-title.wp-block-heading {
  text-transform: none;
  letter-spacing: -0.04em;
}

.sidebar-cta.wp-block-group::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--wp--custom--gradient-brand);
  opacity: 0.7;
  pointer-events: none;
}

/* Related list — query post-template (não latest-posts) */
.sidebar-related-list.wp-block-post-template {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-related-list.wp-block-post-template > .wp-block-post,
.sidebar-related-list.wp-block-post-template > li {
  list-style: none;
  padding-bottom: 1.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid var(--wp--preset--color--outline);
}

.sidebar-related-list.wp-block-post-template > .wp-block-post:last-child,
.sidebar-related-list.wp-block-post-template > li:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: 0;
}

.sidebar-related-list .wp-block-post-title,
.sidebar-related-list .wp-block-post-title a {
  display: block;
  text-decoration: none;
  transition: color 0.25s ease;
}

.sidebar-related-list .wp-block-post-title a:hover {
  color: var(--wp--preset--color--primary);
}

/* ── Sidebar Jetpack form (!important só contra plugin) ── */
.sidebar-cta .jetpack-contact-form-container,
.sidebar-cta .wp-block-jetpack-contact-form {
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
}

.sidebar-form.wp-block-jetpack-contact-form {
  --wp--style--block-gap: 0px;
  --jetpack--contact-form--border-radius: 0px;
  --jetpack--contact-form--border-color: var(--wp--preset--color--outline);
  --jetpack--contact-form--input-padding: 1rem 1.25rem;
  --jetpack--contact-form--font-size: 0.9375rem;
  display: flex !important;
  flex-direction: column !important;
  gap: 0 !important;
  width: 100% !important;
  margin: 0.25rem 0 0;
}

[class*="wp-container-jetpack-contact-form"].sidebar-form {
  gap: 0 !important;
  flex-direction: column !important;
}

/* Editor: inner blocks empilham field+button com gap do canvas */
.sidebar-form.wp-block-jetpack-contact-form > .block-editor-inner-blocks > .block-editor-block-list__layout,
.sidebar-form .block-editor-block-list__layout:where(:has(> .wp-block-jetpack-field-email)),
.sidebar-form .block-editor-block-list__layout:where(:has(> [data-type="jetpack/field-email"])) {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 0 !important;
  row-gap: 0 !important;
  width: 100%;
}

.sidebar-form .block-editor-block-list__layout > .wp-block,
.sidebar-form .block-editor-block-list__layout > [data-block] {
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

.sidebar-form label,
.sidebar-form .jetpack-field-label,
.sidebar-form .grunion-label-required {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.sidebar-form .grunion-field-wrap,
.sidebar-form .jetpack-field,
.sidebar-form .wp-block-jetpack-field-email {
  width: 100% !important;
  margin: 0 !important;
  flex: none !important;
}

.sidebar-form input[type="email"],
.sidebar-form input[type="text"],
.sidebar-form .grunion-field {
  width: 100% !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 1rem 1.25rem !important;
  border: 1px solid var(--wp--preset--color--outline) !important;
  border-bottom-width: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--wp--preset--color--contrast) !important;
  font-family: var(--wp--preset--font-family--body) !important;
  font-size: 0.9375rem !important;
  font-weight: 400 !important;
  text-align: center !important;
  outline: none !important;
  box-shadow: none !important;
}

.sidebar-form input[type="email"]::placeholder,
.sidebar-form .grunion-field::placeholder {
  color: var(--wp--custom--muted-alpha-35) !important;
}

.sidebar-form input[type="email"]:focus,
.sidebar-form .grunion-field:focus {
  border-color: var(--wp--preset--color--primary) !important;
}

.sidebar-form .wp-block-button {
  width: 100% !important;
  margin: 0 !important;
  flex: none !important;
}

.sidebar-form .wp-block-button__link,
.sidebar-form button[type="submit"] {
  width: 100% !important;
  display: block !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  padding: 1rem 1.25rem !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: var(--wp--preset--color--primary) !important;
  color: var(--wp--preset--color--contrast) !important;
  font-family: var(--wp--preset--font-family--display) !important;
  font-size: 0.6875rem !important;
  font-weight: 800 !important;
  letter-spacing: 0.15em !important;
  text-transform: uppercase !important;
  text-align: center !important;
  text-decoration: none !important;
  cursor: pointer !important;
  min-height: unset !important;
}

.sidebar-form .wp-block-button__link:hover,
.sidebar-form button[type="submit"]:hover {
  background: var(--wp--custom--primary-dark) !important;
  opacity: 1 !important;
}

/* Responsive — stack columns; drop sticky */
@media (max-width: 959px) {
  .single-title.wp-block-post-title {
    max-width: none;
  }

  .single-meta-bar.wp-block-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .single-layout.wp-block-columns {
    flex-direction: column;
  }

  .single-content-col.wp-block-column,
  .single-sidebar-col.wp-block-column {
    flex-basis: 100%;
    width: 100%;
  }

  .single-sidebar-col .single-sidebar-sticky {
    position: relative;
    top: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .single-featured.wp-block-post-featured-image img,
  .single-cat.wp-block-post-terms a,
  .single-share-list a,
  .sidebar-related-list .wp-block-post-title a {
    transition: none;
  }

  .single-featured.wp-block-post-featured-image:hover img {
    transform: none;
  }
}
