/*
 * PBK M1.03E — native dynamic, query, post, term and comment blocks.
 *
 * Front end and editor load this exact file. Dynamic wrappers keep WordPress
 * semantics; styling is attached to their rendered structures and stable core
 * classes, with editor-only affordances for wrapper blocks that disappear on
 * the front end.
 */

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-avatar,
  .wp-block-comments,
  .wp-block-comment-template,
  .wp-block-post-template,
  .wp-block-query,
  .wp-block-terms-query,
  .wp-block-term-template,
  .wp-block-site-logo,
  .wp-block-site-title,
  .wp-block-site-tagline,
  .wp-block-template-part,
  .wp-block-pattern,
  .wp-block-block
) {
  box-sizing: border-box;
  min-inline-size: 0;
  max-inline-size: 100%;
}

/* Site identity and account utilities. */
:where(.pbk-content, .editor-styles-wrapper) .wp-block-site-logo {
  margin-block: var(--wp--preset--spacing--lg, 1.5rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-site-logo :where(a, img) {
  display: block;
  max-inline-size: 100%;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-site-logo img {
  inline-size: auto;
  block-size: auto;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-site-title {
  margin-block: var(--wp--preset--spacing--md, 1rem) var(--wp--preset--spacing--xs, 0.5rem);
  color: var(--pbk-content-text-strong);
  font-size: var(--wp--preset--font-size--heading-large, 1.875rem);
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-site-title a {
  color: inherit;
  text-decoration-thickness: 0.08em;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-site-tagline {
  margin-block: 0 var(--wp--preset--spacing--lg, 1.5rem);
  color: var(--pbk-content-text-muted);
  font-size: var(--wp--preset--font-size--lead, 1.125rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-loginout {
  margin-block: var(--wp--preset--spacing--md, 1rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-loginout a {
  display: inline-flex;
  min-block-size: 2.75rem;
  align-items: center;
  border: 1px solid var(--pbk-content-action);
  border-radius: 0.375rem;
  padding: var(--wp--preset--spacing--xs, 0.5rem) var(--wp--preset--spacing--md, 1rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-avatar {
  margin-block: var(--wp--preset--spacing--md, 1rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-avatar img {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
  border: 2px solid var(--pbk-content-border);
  border-radius: 9999px;
}

/* Query and post collections. */
:where(.pbk-content, .editor-styles-wrapper) .wp-block-query {
  margin-block: var(--wp--preset--spacing--2-xl, 3rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-query-title,
  .wp-block-comments-title
) {
  margin-block: 0 var(--wp--preset--spacing--lg, 1.5rem);
  color: var(--pbk-content-text-strong);
  overflow-wrap: anywhere;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-query-total {
  margin-block: calc(var(--wp--preset--spacing--md, 1rem) * -1) var(--wp--preset--spacing--lg, 1.5rem);
  color: var(--pbk-content-text-muted);
  font-size: var(--wp--preset--font-size--small, 0.875rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-template {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--wp--preset--spacing--lg, 1.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-template > li,
:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-template > .wp-block-post {
  min-inline-size: 0;
  margin: 0;
  border: 1px solid var(--pbk-content-border);
  border-radius: 0.5rem;
  background: var(--pbk-content-canvas);
  padding: var(--wp--preset--spacing--lg, 1.5rem);
  overflow: hidden;
  overflow-wrap: anywhere;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-template > li > :first-child,
:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-template > .wp-block-post > :first-child {
  margin-block-start: 0;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-template > li > :last-child,
:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-template > .wp-block-post > :last-child {
  margin-block-end: 0;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-featured-image {
  margin: calc(var(--wp--preset--spacing--lg, 1.5rem) * -1) calc(var(--wp--preset--spacing--lg, 1.5rem) * -1) var(--wp--preset--spacing--lg, 1.5rem);
  overflow: hidden;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-featured-image :where(a, img) {
  display: block;
  inline-size: 100%;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-featured-image img {
  block-size: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-post-title) {
  margin-block: 0 var(--wp--preset--spacing--sm, 0.75rem);
  color: var(--pbk-content-text-strong);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.375;
  overflow-wrap: anywhere;
}

@media (min-width: 48rem) {
  :where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-post-title) {
    font-size: 1.25rem;
  }
}

/*
 * The post title field is part of the editor canvas, but it is not an
 * editorial Post Title block. Match the title rendered by the classic PHP
 * templates without changing Post Title blocks used inside Query Loops.
 */
.editor-styles-wrapper .wp-block-post-title.editor-post-title__input {
  margin-block: 0 var(--wp--preset--spacing--2-xl, 3rem);
  color: var(--pbk-content-text-strong);
  font-family: inherit;
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

@media (min-width: 40rem) {
  .editor-styles-wrapper .wp-block-post-title.editor-post-title__input {
    font-size: 3rem;
  }
}

@media (min-width: 64rem) {
  .editor-styles-wrapper .wp-block-post-title.editor-post-title__input {
    font-size: 3.75rem;
  }
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-post-title) a {
  color: inherit;
  text-decoration: none;
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-post-title) a:hover {
  color: var(--pbk-content-action-hover);
  text-decoration: none;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-post-time-to-read,
  .wp-block-post-comments-count,
  .wp-block-post-comments-link
) {
  margin-block: var(--wp--preset--spacing--xs, 0.5rem);
  color: var(--pbk-content-text-muted);
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-post-date) {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-block: var(--wp--preset--spacing--xs, 0.5rem);
  color: var(--pbk-content-text-muted);
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  line-height: 1.5;
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-post-date)::before {
  inline-size: 1rem;
  block-size: 1rem;
  flex: 0 0 1rem;
  background-color: currentColor;
  content: "";
  mask: url("../icons/lucide-calendar.svg") center / contain no-repeat;
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-post-date) a {
  color: inherit;
  text-decoration: none;
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-post-terms) {
  margin-block: var(--wp--preset--spacing--xs, 0.5rem);
  color: var(--pbk-content-action);
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1rem;
  overflow-wrap: anywhere;
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-post-terms) a {
  display: inline-flex;
  align-items: center;
  margin-block: 0.125rem;
  border-radius: var(--wp--custom--pbk--radius--badge, 0.375rem);
  background: var(--pbk-content-term-chip-background);
  color: inherit;
  padding: 0.25rem 0.625rem;
  text-decoration: none;
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-post-terms) a:hover {
  background: var(--pbk-content-term-chip-background-hover);
  color: var(--pbk-content-action-hover);
  text-decoration: none;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-post-title,
  .wp-block-post-date,
  .wp-block-post-terms
) a:focus-visible {
  outline: 3px solid var(--pbk-content-focus);
  outline-offset: 2px;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-excerpt {
  margin-block: var(--wp--preset--spacing--md, 1rem);
  color: var(--pbk-content-text);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-excerpt__excerpt {
  margin-block-end: var(--wp--preset--spacing--sm, 0.75rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-post-excerpt__more-link,
  .wp-block-read-more
) {
  display: inline-flex;
  min-block-size: 2.75rem;
  align-items: center;
  border-block-end: 2px solid currentColor;
  color: var(--pbk-content-action);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-post-excerpt__more-link,
  .wp-block-read-more
):hover {
  color: var(--pbk-content-action-hover);
  text-decoration: none;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-content {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

/* Author data: both legacy aggregate and atomic author blocks. */
:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-author {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--wp--preset--spacing--sm, 0.75rem);
  align-items: center;
  margin-block: var(--wp--preset--spacing--md, 1rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-author__avatar img {
  display: block;
  inline-size: 3rem;
  block-size: 3rem;
  border-radius: 9999px;
  object-fit: cover;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-author__content {
  min-inline-size: 0;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-post-author__name,
  .wp-block-post-author-name
) {
  margin: 0;
  color: var(--pbk-content-text-strong);
  font-weight: 600;
  overflow-wrap: anywhere;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-post-author__bio,
  .wp-block-post-author-biography
) {
  margin-block: var(--wp--preset--spacing--2-xs, 0.25rem) 0;
  color: var(--pbk-content-text-muted);
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* Query empty state and both pagination families. */
:where(.pbk-content, .editor-styles-wrapper) .wp-block-query-no-results {
  margin-block: var(--wp--preset--spacing--lg, 1.5rem);
  border: 1px dashed var(--pbk-content-border);
  border-radius: 0.5rem;
  background: var(--pbk-content-surface);
  padding: var(--wp--preset--spacing--lg, 1.5rem);
  color: var(--pbk-content-text-muted);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-query-no-results > :last-child {
  margin-block-end: 0;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-query-pagination,
  .wp-block-comments-pagination
) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--wp--preset--spacing--xs, 0.5rem);
  margin-block: var(--wp--preset--spacing--xl, 2rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-query-pagination-previous,
  .wp-block-query-pagination-next,
  .wp-block-query-pagination-numbers,
  .wp-block-comments-pagination-previous,
  .wp-block-comments-pagination-next,
  .wp-block-comments-pagination-numbers
) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--wp--preset--spacing--2-xs, 0.25rem);
  margin: 0;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-query-pagination,
  .wp-block-comments-pagination
) :where(a, .page-numbers) {
  box-sizing: border-box;
  display: inline-flex;
  min-inline-size: 2.75rem;
  min-block-size: 2.75rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--pbk-content-border);
  border-radius: 0.375rem;
  background: var(--pbk-content-canvas);
  color: var(--pbk-content-action);
  padding: var(--wp--preset--spacing--xs, 0.5rem);
  text-decoration: none;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-query-pagination,
  .wp-block-comments-pagination
) .page-numbers.current {
  border-color: var(--pbk-content-action);
  background: var(--pbk-content-action);
  color: var(--wp--preset--color--on-action, var(--pbk-content-on-dark));
  font-weight: 600;
  text-decoration: none;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-query-pagination,
  .wp-block-comments-pagination
) :where(a, .page-numbers):focus-visible {
  outline: 3px solid var(--pbk-content-focus);
  outline-offset: 2px;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-navigation-link {
  margin-block: var(--wp--preset--spacing--sm, 0.75rem);
  overflow-wrap: anywhere;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-navigation-link a {
  display: inline-flex;
  min-block-size: 2.75rem;
  align-items: center;
  border-block-end: 2px solid currentColor;
  font-weight: 600;
}

/* Comments, including the modern template and the legacy post-comments block. */
:where(.pbk-content, .editor-styles-wrapper) .wp-block-comments {
  margin-block: var(--wp--preset--spacing--2-xl, 3rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-comment-template {
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-comment-template > li {
  min-inline-size: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-comment-template .wp-block-comment-template {
  margin-block-start: var(--wp--preset--spacing--lg, 1.5rem);
  padding-inline-start: var(--wp--preset--spacing--lg, 1.5rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-comment-template .wp-block-avatar {
  margin: 0;
  align-self: flex-start;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-comment-content {
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-comments {
  max-inline-size: 100%;
  overflow-x: auto;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-comments :where(table, ol, ul) {
  max-inline-size: 100%;
}

/* Native comment form: visible labels, full keyboard focus and 44px controls. */
:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-comments-form {
  margin-block: var(--wp--preset--spacing--xl, 2rem);
  border: 1px solid var(--pbk-content-border);
  border-radius: 0.5rem;
  background: var(--pbk-content-surface);
  padding: var(--wp--preset--spacing--lg, 1.5rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-comments-form label {
  display: block;
  margin-block-end: var(--wp--preset--spacing--2-xs, 0.25rem);
  color: var(--pbk-content-text-strong);
  font-weight: 600;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-comments-form :where(
  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]),
  textarea
) {
  box-sizing: border-box;
  inline-size: 100%;
  min-block-size: 2.75rem;
  border: 1px solid var(--pbk-content-border);
  border-radius: 0.375rem;
  background: var(--pbk-content-canvas);
  color: var(--pbk-content-text);
  padding: var(--wp--preset--spacing--xs, 0.5rem) var(--wp--preset--spacing--sm, 0.75rem);
  font: inherit;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-comments-form textarea {
  min-block-size: 8rem;
  resize: vertical;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-comments-form :where(
  input[type="submit"],
  .submit
) {
  box-sizing: border-box;
  min-block-size: 2.75rem;
  border: 2px solid var(--pbk-content-action);
  border-radius: 0.375rem;
  background: var(--pbk-content-action);
  color: var(--wp--preset--color--on-action, var(--pbk-content-on-dark));
  padding: var(--wp--preset--spacing--xs, 0.5rem) var(--wp--preset--spacing--md, 1rem);
  font: inherit;
  font-weight: 600;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-post-comments-form :where(input, textarea):focus-visible {
  outline: 3px solid var(--pbk-content-focus);
  outline-offset: 2px;
}

/* Terms query is a quiet list of links, not a second card system. */
:where(.pbk-content, .editor-styles-wrapper) .wp-block-terms-query {
  margin-block: var(--wp--preset--spacing--lg, 1.5rem);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-term-template {
  display: flex;
  flex-direction: column;
  gap: var(--wp--preset--spacing--sm, 0.75rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-term-template > li,
:where(.pbk-content, .editor-styles-wrapper) .wp-block-term-template > .wp-block-term {
  min-inline-size: 0;
  margin: 0;
  border: 0;
  padding: 0;
  overflow-wrap: anywhere;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-term-name {
  display: inline;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-term-name a {
  color: var(--wp--style--color--link, var(--pbk-content-action));
  font-weight: 500;
  text-decoration: none;
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-term-name a:hover {
  color: var(--wp--style--color--link, var(--pbk-content-action-hover));
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-term-count {
  display: inline;
  margin-inline-start: var(--wp--preset--spacing--2-xs, 0.25rem);
  color: var(--pbk-content-text-muted);
}

:where(.pbk-content, .editor-styles-wrapper) .wp-block-term-description {
  margin-block-start: var(--wp--preset--spacing--sm, 0.75rem);
  color: var(--pbk-content-text-muted);
}

/* Wrapper blocks do not invent front-end chrome. Editor outlines only expose
 * their editable boundary; rendered pattern/block/template content inherits
 * the normal core-block styles above. */
.editor-styles-wrapper :where(
  .wp-block-template-part,
  .wp-block-pattern,
  .wp-block-block
) {
  min-block-size: 2.75rem;
  outline: 1px dashed var(--pbk-content-border);
  outline-offset: 0.25rem;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  .wp-block-template-part,
  .wp-block-pattern,
  .wp-block-block
) :where(img, iframe, table, pre) {
  max-inline-size: 100%;
}

@media (max-width: 48rem) {
  :where(.pbk-content, .editor-styles-wrapper) .wp-block-post-template {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (forced-colors: active) {
  :where(.pbk-content, .editor-styles-wrapper) :where(
    .wp-block-post-template > li,
    .wp-block-query-pagination a,
    .wp-block-comments-pagination a,
    .wp-block-post-comments-form
  ) {
    border: 1px solid CanvasText;
  }
}
