/* Visual contract layer, version 2.0.0
 *
 * Loaded last on every public view. It carries only the rules the page
 * still needs after the structural fixes: one column with one left and one
 * right edge, a standfirst that is never clamped, footer headings larger
 * than the lists they introduce, and a masthead that no ancestor can clip.
 * Palette, type scale and the ranking row live in style.css.
 */

/* ---------- One column, one left edge, one right edge ----------
 * D3 shipped because .entry-content carried the measure while the blocks
 * inside it also carried the gutter, so every child sat 32px narrower than
 * the column and the header. The measure now lives on the blocks rather
 * than the wrapper, and the header uses the same arithmetic.
 */
.entry-content,
.entry-content > *,
.pk-page,
.pk-page > * {
  margin-inline: auto !important;
  box-sizing: border-box;
}

.entry-content > *,
.pk-page > * {
  width: 100% !important;
  max-width: calc(var(--pk-measure) - (var(--pk-gutter) * 2)) !important;
  margin-inline: auto !important;
}

/* The stored fragments carry their own gutter margin; the width above owns
 * the edge now, so the extra margin is dropped rather than doubled. */
.entry-content > .pk-breadcrumb,
.entry-content > .pk-hero,
.entry-content > .pk-board-slot,
.entry-content > .pk-board,
.entry-content > section,
.entry-content > p,
.entry-content > nav,
.entry-content > aside,
.entry-content > figure,
.entry-content > h2,
.entry-content > h3,
.entry-content > .pk-tablewrap,
.entry-content > .pk-board {
  margin-inline: auto !important;
}

.pk-header-inner {
  max-width: var(--pk-measure) !important;
  margin-inline: auto !important;
  padding-inline: var(--pk-gutter) !important;
  box-sizing: border-box;
}

/* The navigation is part of the masthead panel, so it shares the column. */
.pk-nav {
  max-width: var(--pk-measure) !important;
  margin-inline: auto !important;
  padding-inline: var(--pk-gutter) !important;
  box-sizing: border-box;
}

/* ---------- No ancestor may clip a dropdown ----------
 * Gate 24 asks the page, not the element: a panel can compute visible and
 * still be cut away by an overflow or a clip-path further up.
 */
html,
body,
#page,
#content,
.site,
.hfeed,
#content .ast-container,
.ast-container,
.ast-separate-container,
.ast-plain-container,
.site-content,
#primary,
.site-main,
#main,
.content-area,
article,
.entry-content,
.pk-header,
.pk-header-inner,
.pk-nav,
.pk-nav > ul {
  overflow: visible !important;
  clip-path: none !important;
}

html { overflow-x: hidden !important; }

/* Tables scroll inside their own wrapper; the page never does. */
.pk-tablewrap,
.pk-table-scroll {
  overflow-x: auto !important;
  max-width: 100%;
}

/* ---------- Horizontal overflow, width by width ----------
 * Measured 32px at 1024, 24px at 768 and 16px at 390: exactly the gutter,
 * added once by the wrapper and kept by the child. One edge is enough.
 */
@media (max-width: 1120px) {
  .entry-content > *,
  .pk-page > * {
    max-width: calc(100% - (var(--pk-gutter) * 2)) !important;
  }
}
@media (max-width: 768px) {
  :root { --pk-gutter: 24px; }
  .pk-header-inner,
  .pk-nav { padding-inline: var(--pk-gutter) !important; }
}
@media (max-width: 599px) {
  :root { --pk-gutter: 16px; }
  .pk-header-inner,
  .pk-nav { padding-inline: var(--pk-gutter) !important; }
}

/* ---------- D8: nothing is clipped, nothing is truncated ----------
 * A standfirst cut to four lines met the reader mid-sentence. The clamp is
 * removed and the type is set at standfirst size, apart from the body.
 */
.pk-standfirst,
.pk-hero .pk-standfirst {
  display: block !important;
  -webkit-line-clamp: unset !important;
  -webkit-box-orient: initial !important;
  line-clamp: unset !important;
  overflow: visible !important;
  max-height: none !important;
  height: auto !important;
  font-size: 1.16rem !important;
  line-height: 1.5 !important;
  max-width: 68ch;
  color: var(--pk-ink-2);
}

/* ---------- Gate 42: a heading is never smaller than its text ----------
 * The footer headings measured 12.16px above 17px list text, so they read
 * as captions on the column. They now clear the list size.
 */
.pk-footer-head {
  font-size: 1.08rem !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  line-height: 1.3 !important;
  margin: 0 0 14px !important;
  color: var(--pk-accent-soft) !important;
}

.pk-footer-help li,
.pk-footer-pages li,
.pk-footer-brand p {
  font-size: 1rem !important;
  line-height: 1.55 !important;
}

.pk-footer-tagline { color: #dedad0; }
.pk-footer-regulator { color: #dedad0; }

/* Footer inner column matches the article column exactly. */
.pk-footer-inner {
  max-width: calc(var(--pk-measure) - (var(--pk-gutter) * 2)) !important;
  margin-inline: auto !important;
  padding-inline: 0 !important;
}
.pk-footer-legal {
  max-width: calc(var(--pk-measure) - (var(--pk-gutter) * 2)) !important;
  margin-inline: auto !important;
  padding-inline: 0 !important;
}
@media (max-width: 1199px) {
  .pk-footer-inner,
  .pk-footer-legal {
    max-width: calc(100% - (var(--pk-gutter) * 2)) !important;
  }
}

/* ---------- Chips keep their own edge, 3:1 against the ground ---------- */
.pk-row-terms span,
.pk-chip {
  border: 1px solid var(--pk-line);
  border-radius: 999px;
  padding: 2px 10px;
}

/* ---------- Focus ring on both grounds ---------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
.pk-cta:focus-visible {
  outline: 2px solid var(--pk-accent-soft) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(244, 243, 240, 0.9) !important;
}

/* ---------- Motion: colour stays, movement goes ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
