/*
 * PBK M1.02 — shared content baseline.
 *
 * This exact file is loaded on the front end and in the block editor. Selectors
 * deliberately use :where() so native blocks and PBK components can override
 * the baseline without cascade hacks or specificity escalation.
 */

:where(.pbk-content, .editor-styles-wrapper) {
  --pbk-content-canvas: var(--wp--preset--color--canvas, Canvas);
  --pbk-content-surface: var(--wp--preset--color--surface, Canvas);
  --pbk-content-surface-strong: var(--wp--preset--color--surface-strong, Canvas);
  --pbk-content-text: var(--wp--preset--color--text, CanvasText);
  --pbk-content-text-strong: var(--wp--preset--color--text-strong, CanvasText);
  --pbk-content-text-muted: var(--wp--preset--color--text-muted, CanvasText);
  --pbk-content-border: var(--wp--preset--color--border, currentColor);
  --pbk-content-action: var(--wp--preset--color--action, LinkText);
  --pbk-content-action-hover: var(--wp--custom--pbk--color--action-hover, var(--pbk-content-action));
  --pbk-content-term-chip-background: var(--wp--custom--pbk--color--term-chip-background, var(--wp--preset--color--action-soft, Canvas));
  --pbk-content-term-chip-background-hover: var(--wp--custom--pbk--color--term-chip-background-hover, var(--pbk-content-term-chip-background));
  --pbk-content-focus: var(--wp--custom--pbk--color--focus, Highlight);
  --pbk-content-dark: var(--wp--preset--color--dark, CanvasText);
  --pbk-content-on-dark: var(--wp--preset--color--on-dark, Canvas);
  --pbk-content-danger: var(--wp--custom--pbk--color--danger, Mark);
  --pbk-content-radius-inline: var(--wp--custom--pbk--radius--inline, 0.25rem);
  --pbk-content-radius-control: var(--wp--custom--pbk--radius--control, 0.375rem);
  --pbk-content-radius-frame: var(--wp--custom--pbk--radius--frame, 0.5rem);
  color: var(--pbk-content-text);
  font-family: var(--wp--preset--font-family--sans, sans-serif);
  font-size: var(--wp--preset--font-size--base, 1rem);
  line-height: 1.75;
  overflow-wrap: break-word;
}

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

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

:where(.pbk-content, .editor-styles-wrapper) :where(h1, h2, h3, h4, h5, h6) {
  color: var(--pbk-content-text-strong);
  font-family: inherit;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-wrap: balance;
  scroll-margin-block-start: var(--wp--preset--spacing--3-xl, 4rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(h1) {
  margin-block: 0 var(--wp--preset--spacing--xl, 2rem);
  font-size: var(--wp--preset--font-size--heading-x-large, 2.25rem);
  line-height: 1.15;
}

:where(.pbk-content, .editor-styles-wrapper) :where(h2) {
  margin-block: var(--wp--preset--spacing--2-xl, 3rem) var(--wp--preset--spacing--lg, 1.5rem);
  font-size: var(--wp--preset--font-size--heading-x-large, 2.25rem);
  line-height: 1.2;
}

:where(.pbk-content, .editor-styles-wrapper) :where(h3) {
  margin-block: 2.5rem var(--wp--preset--spacing--md, 1rem);
  font-size: var(--wp--preset--font-size--heading-large, 1.875rem);
  line-height: 1.25;
}

:where(.pbk-content, .editor-styles-wrapper) :where(h4) {
  margin-block: var(--wp--preset--spacing--xl, 2rem) var(--wp--preset--spacing--sm, 0.75rem);
  font-size: var(--wp--preset--font-size--heading-medium, 1.5rem);
  line-height: 1.3;
}

:where(.pbk-content, .editor-styles-wrapper) :where(h5) {
  margin-block: var(--wp--preset--spacing--lg, 1.5rem) var(--wp--preset--spacing--sm, 0.75rem);
  font-size: var(--wp--preset--font-size--heading-small, 1.25rem);
  line-height: 1.4;
}

:where(.pbk-content, .editor-styles-wrapper) :where(h6) {
  margin-block: var(--wp--preset--spacing--lg, 1.5rem) var(--wp--preset--spacing--xs, 0.5rem);
  font-size: var(--wp--preset--font-size--lead, 1.125rem);
  line-height: 1.4;
}

@media (min-width: 48rem) {
  :where(.pbk-content, .editor-styles-wrapper) :where(h1) {
    font-size: var(--wp--preset--font-size--display, 3rem);
  }
}

:where(.pbk-content, .editor-styles-wrapper) :where(p) {
  margin-block: 0 var(--wp--preset--spacing--lg, 1.5rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(a:not(.wp-element-button):not(.wp-block-button__link)) {
  text-decoration: none;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

:is(.pbk-content, .editor-styles-wrapper) :where(
  p,
  blockquote,
  td,
  th,
  dd,
  figcaption,
  caption,
  .wp-block-list,
  .wp-block-list-item,
  .pbk-prose-links
) :where(a:not(.wp-element-button):not(.wp-block-button__link):not(.kt-btn)) {
  color: var(--wp--style--color--link, var(--pbk-content-action));
  font-weight: 500;
  text-decoration-line: underline;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.2em;
}

:is(.pbk-content, .editor-styles-wrapper) :where(
  p,
  blockquote,
  td,
  th,
  dd,
  figcaption,
  caption,
  .wp-block-list,
  .wp-block-list-item,
  .pbk-prose-links
) :where(a:not(.wp-element-button):not(.wp-block-button__link):not(.kt-btn)):hover {
  color: var(--wp--style--color--link, var(--pbk-content-action-hover));
}

:where(.pbk-content, .editor-styles-wrapper) :where(strong, b) {
  color: var(--pbk-content-text-strong);
  font-weight: 600;
}

:where(.pbk-content, .editor-styles-wrapper) :where(small) {
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  line-height: 1.5;
}

:where(.pbk-content, .editor-styles-wrapper) :where(mark) {
  border-radius: 0.125rem;
  background: var(--wp--custom--pbk--color--warning, Mark);
  color: var(--wp--custom--pbk--color--on-warning, MarkText);
  padding-inline: 0.15em;
}

:where(.pbk-content, .editor-styles-wrapper) :where(ins) {
  text-decoration-style: double;
  text-underline-offset: 0.16em;
}

:where(.pbk-content, .editor-styles-wrapper) :where(abbr[title]) {
  cursor: help;
  text-decoration-style: dotted;
  text-underline-offset: 0.16em;
}

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

:where(.pbk-content, .editor-styles-wrapper) :where(ul) {
  list-style-type: disc;
}

:where(.pbk-content, .editor-styles-wrapper) :where(ol) {
  list-style-type: decimal;
}

:where(.pbk-content, .editor-styles-wrapper) :where(li + li) {
  margin-block-start: var(--wp--preset--spacing--xs, 0.5rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(li > ul, li > ol) {
  margin-block: var(--wp--preset--spacing--xs, 0.5rem) 0;
}

:where(.pbk-content, .editor-styles-wrapper) :where(li)::marker {
  color: var(--pbk-content-action);
  font-weight: 600;
}

:where(.pbk-content, .editor-styles-wrapper) :where(dl) {
  margin-block: 0 var(--wp--preset--spacing--lg, 1.5rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(dt) {
  color: var(--pbk-content-text-strong);
  font-weight: 600;
}

:where(.pbk-content, .editor-styles-wrapper) :where(dd) {
  margin-block: var(--wp--preset--spacing--2-xs, 0.25rem) var(--wp--preset--spacing--md, 1rem);
  margin-inline-start: 0;
}

:where(.pbk-content, .editor-styles-wrapper) :where(blockquote) {
  margin-block: var(--wp--preset--spacing--xl, 2rem);
  margin-inline: 0;
  border-inline-start: 0.25rem solid var(--pbk-content-action);
  padding-inline-start: var(--wp--preset--spacing--lg, 1.5rem);
  color: var(--pbk-content-text-strong);
  font-size: var(--wp--preset--font-size--lead, 1.125rem);
  font-style: italic;
  line-height: 1.65;
}

:where(.pbk-content, .editor-styles-wrapper) :where(blockquote p:last-of-type) {
  margin-block-end: var(--wp--preset--spacing--sm, 0.75rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(blockquote cite) {
  display: block;
  color: var(--pbk-content-text-muted);
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  font-style: normal;
  font-weight: 500;
}

:where(.pbk-content, .editor-styles-wrapper) :where(hr) {
  margin-block: var(--wp--preset--spacing--2-xl, 3rem);
  border: 0;
  border-block-start: 1px solid var(--pbk-content-border);
}

:where(.pbk-content, .editor-styles-wrapper) :where(code, kbd, samp, pre) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

:where(.pbk-content, .editor-styles-wrapper) :where(code, kbd, samp) {
  border-radius: var(--pbk-content-radius-inline);
  background: var(--pbk-content-surface-strong);
  color: var(--pbk-content-text-strong);
  padding: 0.125em 0.375em;
  font-size: 0.875em;
}

:where(.pbk-content, .editor-styles-wrapper) :where(kbd) {
  border: 1px solid var(--pbk-content-border);
  box-shadow: 0 1px 0 var(--pbk-content-border);
  white-space: nowrap;
}

:where(.pbk-content, .editor-styles-wrapper) :where(pre) {
  max-inline-size: 100%;
  overflow-x: auto;
  margin-block: var(--wp--preset--spacing--xl, 2rem);
  border-radius: var(--pbk-content-radius-frame);
  background: var(--pbk-content-dark);
  color: var(--pbk-content-on-dark);
  padding: var(--wp--preset--spacing--lg, 1.5rem);
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  line-height: 1.65;
  tab-size: 2;
  white-space: pre;
}

:where(.pbk-content, .editor-styles-wrapper) :where(pre code) {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
}

:where(.pbk-content, .editor-styles-wrapper) :where(figure, .wp-block-image) {
  margin-block: var(--wp--preset--spacing--xl, 2rem);
  margin-inline: 0;
}

:where(.pbk-content, .editor-styles-wrapper) :where(figure, .wp-block-image) img {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
  border-radius: var(--pbk-content-radius-frame);
}

:where(.pbk-content, .editor-styles-wrapper) :where(audio, video, iframe) {
  max-inline-size: 100%;
}

:where(.pbk-content, .editor-styles-wrapper) :where(figcaption, .wp-element-caption, caption) {
  margin-block-start: 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;
  text-align: start;
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-table) {
  max-inline-size: 100%;
  overflow-x: auto;
  margin-block: var(--wp--preset--spacing--xl, 2rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(table) {
  width: 100%;
  margin-block: var(--wp--preset--spacing--xl, 2rem);
  border-collapse: collapse;
  border-spacing: 0;
  font-size: var(--wp--preset--font-size--small, 0.875rem);
  line-height: 1.5;
}

:where(.pbk-content, .editor-styles-wrapper) :where(.wp-block-table table) {
  margin-block: 0;
}

:where(.pbk-content, .editor-styles-wrapper) :where(th, td) {
  border: 1px solid var(--pbk-content-border);
  padding: var(--wp--preset--spacing--sm, 0.75rem);
  text-align: start;
  vertical-align: top;
}

:where(.pbk-content, .editor-styles-wrapper) :where(th) {
  color: inherit;
  font-weight: 600;
}

:where(.pbk-content, .editor-styles-wrapper) :where(caption) {
  caption-side: bottom;
}

:where(.pbk-content, .editor-styles-wrapper) :where(fieldset) {
  margin-block: 0 var(--wp--preset--spacing--lg, 1.5rem);
  border: 1px solid var(--pbk-content-border);
  border-radius: var(--pbk-content-radius-frame);
  padding: var(--wp--preset--spacing--lg, 1.5rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(legend, label) {
  color: var(--pbk-content-text-strong);
  font-weight: 600;
}

:where(.pbk-content, .editor-styles-wrapper) :where(legend) {
  padding-inline: var(--wp--preset--spacing--xs, 0.5rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(label) {
  display: inline-block;
  margin-block-end: var(--wp--preset--spacing--xs, 0.5rem);
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  input:not([type="button"]):not([type="checkbox"]):not([type="color"]):not([type="file"]):not([type="hidden"]):not([type="image"]):not([type="radio"]):not([type="range"]):not([type="reset"]):not([type="submit"]),
  select,
  textarea
) {
  width: 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: 0.625rem 0.75rem;
  font: inherit;
  line-height: 1.5;
}

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

:where(.pbk-content, .editor-styles-wrapper) :where(input, textarea)::placeholder {
  color: var(--pbk-content-text-muted);
  opacity: 0.75;
}

:where(.pbk-content, .editor-styles-wrapper) :where(input[type="checkbox"], input[type="radio"], input[type="range"]) {
  accent-color: var(--pbk-content-action);
}

:where(.pbk-content, .editor-styles-wrapper) :where(input, select, textarea)[aria-invalid="true"] {
  border-color: var(--pbk-content-danger);
}

:where(.pbk-content, .editor-styles-wrapper) :where(input, select, textarea, button):disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

:where(.pbk-content, .editor-styles-wrapper) :where(details) {
  box-sizing: border-box;
}

:where(.pbk-content, .editor-styles-wrapper) :where(summary) {
  cursor: pointer;
  color: var(--pbk-content-text-strong);
  font-weight: 600;
}

:where(.pbk-content, .editor-styles-wrapper) :where(
  a,
  button,
  summary,
  input,
  select,
  textarea,
  [tabindex]:not([tabindex="-1"])
):focus-visible {
  outline: 3px solid var(--pbk-content-focus);
  outline-offset: 3px;
}

:where(.pbk-content, .editor-styles-wrapper) :where([id]) {
  scroll-margin-block-start: var(--wp--preset--spacing--3-xl, 4rem);
}

@media (prefers-reduced-motion: reduce) {
  :where(.pbk-content, .editor-styles-wrapper) :where(a) {
    transition-duration: 0.01ms;
  }
}
