/**
 * @file
 * Content page node layout (spec-00 §6, spec-01 §13a, #888). Token-driven
 * scaffold for the page and landing_page node types. Scoped to
 * .tp-content-page to avoid touching other node contexts. Depends on
 * tpemis_ui/tokens for --tp-* custom properties.
 */

/* --------------------------------------------------------------------------
 * Outer article
 * Vertical rhythm and max-width constraint shared by both subtypes.
 * -------------------------------------------------------------------------- */
.tp-content-page {
  margin-block: var(--tp-spacing-8);
}

.tp-content-page__body {
  max-width: var(--tp-content-width-prose, 860px);
  margin-inline: auto;
  padding-inline: var(--tp-spacing-4);
}

/* --------------------------------------------------------------------------
 * Landing page: wider content column at large viewports
 * -------------------------------------------------------------------------- */
.tp-content-page--landing .tp-content-page__body {
  max-width: var(--tp-content-width-wide, 1140px);
}

@media (min-width: 1024px) {
  .tp-content-page--landing .tp-content-page__body {
    display: grid;
    grid-template-columns: 1fr 320px;
    column-gap: var(--tp-spacing-8);
    align-items: start;
  }

  /* Main prose column spans full width when no sidebar is present. */
  .tp-content-page--landing .tp-content-page__main {
    grid-column: 1;
  }
}

/* --------------------------------------------------------------------------
 * Prose content area
 * Typography rhythm for body copy rendered from Drupal's text fields.
 * -------------------------------------------------------------------------- */
.tp-prose {
  font-family: var(--tp-font-family-sans);
  font-size: var(--tp-font-size-base);
  line-height: var(--tp-line-height-relaxed);
  color: var(--tp-color-text-primary);
}

.tp-prose > * + * {
  margin-block-start: var(--tp-spacing-4);
}

.tp-prose h2,
.tp-prose h3,
.tp-prose h4 {
  font-family: var(--tp-font-family-sans);
  font-weight: var(--tp-font-weight-semibold);
  line-height: var(--tp-line-height-tight);
  color: var(--tp-color-text-primary);
  margin-block-start: var(--tp-spacing-6);
  margin-block-end: var(--tp-spacing-2);
}

.tp-prose h2 {
  font-size: var(--tp-font-size-xl);
}

.tp-prose h3 {
  font-size: var(--tp-font-size-lg);
}

.tp-prose h4 {
  font-size: var(--tp-font-size-base);
}

.tp-prose ul,
.tp-prose ol {
  padding-inline-start: var(--tp-spacing-6);
}

.tp-prose li + li {
  margin-block-start: var(--tp-spacing-2);
}

.tp-prose a {
  color: var(--tp-color-brand-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.tp-prose a:hover {
  color: var(--tp-color-brand-primary-dark, var(--tp-color-brand-primary));
  text-decoration-thickness: 2px;
}

/* Inline code and pre blocks. */
.tp-prose code {
  font-family: var(--tp-font-family-mono);
  /* stylelint-disable-next-line scale-unlimited/declaration-strict-value -- em keeps inline code proportional to its surrounding text; a rem token would break that relationship (#887). */
  font-size: 0.875em;
  background: var(--tp-color-surface-subtle);
  padding: 0.125em 0.375em;
  border-radius: var(--tp-border-radius-sm);
}

.tp-prose pre {
  background: var(--tp-color-surface-subtle);
  border: 1px solid var(--tp-color-border-default);
  border-radius: var(--tp-border-radius-md);
  padding: var(--tp-spacing-4);
  overflow-x: auto;
}

.tp-prose pre code {
  background: none;
  padding: 0;
}

/* Tables — responsive scroll container. */
.tp-prose table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--tp-font-size-sm);
}

.tp-prose th,
.tp-prose td {
  padding: var(--tp-spacing-3) var(--tp-spacing-4);
  text-align: start;
  border-bottom: 1px solid var(--tp-color-border-default);
}

.tp-prose th {
  font-weight: var(--tp-font-weight-semibold);
  background: var(--tp-color-surface-subtle);
}
