/*
 * The page frame. Loaded on the site and in the editor. Layout tokens live here; colours live in
 * theme.json. No rails: one centred container, --page-max wide including its gutters, shared by the
 * header, the footer and the content.
 *
 * Block widths map onto the frame like this:
 *   default and Wide = the container's content box (lines up with the logo) | Full = the whole window
 */
:root {
  --page-max: 80rem;
  --header-h: 4rem;
  --gutter: 1rem;
  /* Kept at 0 for older rules: there is no margin outside the frame any more. */
  --frame-margin: 0px;
  --site-inset: calc(var(--frame-margin) + var(--gutter));
  /* Inside a full-bleed hero (a size container): from the window edge to where the frame's content
     starts, so hero text lines up with the logo and the rest of the page. */
  --hero-inset: calc(
    max(var(--frame-margin), (100cqw - var(--page-max)) / 2) + var(--gutter)
  );
  --pad-sm: 1rem;
  --pad-md: 2rem;
  --pad-lg: 3rem;
  --reading: 48rem;
  --hairline: var(--wp--preset--color--hairline);
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --card-gap: 1rem;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  /* Titles scale with the window between a phone and the container width, no steps. */
  --fs-hero: clamp(2.25rem, 1.5rem + 3.2vw, 3.5rem);
  --fs-h1: clamp(2rem, 1.4rem + 2.5vw, 3.5rem);
  --fs-h2: clamp(1.625rem, 1.35rem + 1.2vw, 2.25rem);
  --fs-h3: clamp(1.25rem, 1.15rem + 0.45vw, 1.5rem);
  --fs-h4: clamp(1.125rem, 1.08rem + 0.2vw, 1.25rem);
}

@media (min-width: 48rem) {
  :root {
    --gutter: 2rem;
    --pad-sm: 1.25rem;
    --pad-md: 2.5rem;
    --pad-lg: 4rem;
  }

}

@media (min-width: 64rem) {
  :root {
    --gutter: 3rem;
    --pad-md: 3rem;
    --pad-lg: 5rem;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: calc(var(--header-h) + 1rem);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* The footer sits at the bottom of short pages. */
.wp-site-blocks {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.wp-site-blocks > * {
  margin-block: 0;
}

.site-main {
  flex: 1;
}

.site-main > * {
  margin-block: 0;
}

/* Wide and default both end at the container's content box (theme.json sets both sizes to
   --page-max minus the gutters), so cards and grids line up with the headings and the logo. */

/* Sections stack with no gap, like the app's Sections. */
.wp-block-post-content > .alignfull,
.wp-block-post-content > .alignwide {
  margin-block: 0;
}

/* Plain text typed straight into a page still gets breathing room. */
.wp-block-post-content:not(.article-body) > :first-child:not(.alignfull, .alignwide) {
  margin-block-start: var(--pad-lg);
}

.wp-block-post-content:not(.article-body) > :last-child:not(.alignfull, .alignwide) {
  margin-block-end: var(--pad-lg);
}

/* A wrapper left empty, such as a post without a featured image, takes no space. */
.wp-block-group:not(:has(*)) {
  display: none;
}

/* Heroes always bleed to the window edges, whether set to Wide or Full. Their text keeps to the
   frame through --hero-inset. */
.has-global-padding > :is(.is-style-hero-globe, .is-style-hero-split):is(.alignwide, .alignfull) {
  width: auto;
  max-width: none !important;
  margin-inline: calc(-1 * var(--wp--style--root--padding-left))
    calc(-1 * var(--wp--style--root--padding-right)) !important;
}

.is-style-hero-globe,
.wp-block-columns.is-style-hero-split {
  position: relative;
  z-index: 2;
  container-type: inline-size;
}

/* Hero: image (a Full width Cover block) bleeds to the window; its content keeps to the frame. The
   Cover is a size container so --hero-inset measures it: the gutter on small screens, the
   container's content edge on wide ones. Text aligned left starts in line with the logo. */
.wp-block-cover.alignfull {
  container-type: inline-size;
  padding-inline: 0;
}

.wp-block-cover.alignfull > .wp-block-cover__inner-container {
  padding-inline: var(--hero-inset);
}

/* Section dividers */
.is-style-section-bleed,
.is-style-section-contained,
.is-style-section-none {
  padding-block: var(--pad-md);
}

.is-style-section-bleed {
  border-bottom: 1px solid var(--hairline);
}

.is-style-section-contained {
  position: relative;
}

.is-style-section-contained::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  border-bottom: 1px solid var(--hairline);
}

/* Contained: the divider runs across the container's content box only. */
.is-style-section-contained.alignfull::after {
  inset-inline: max(var(--gutter), (100% - var(--page-max)) / 2 + var(--gutter));
}

/* A hero at the start or end of a section takes the section's padding there, so no strip shows above
   or below it, even when the client puts more blocks in the same section. */
.is-style-section-bleed:has(> :is(.is-style-hero-globe, .is-style-hero-split, .is-style-hero-narrow, .wp-block-cover):nth-child(1 of :not([aria-hidden]))) {
  padding-block-start: 0;
}

.is-style-section-bleed:has(> :is(.is-style-hero-globe, .is-style-hero-split, .is-style-hero-narrow, .wp-block-cover):nth-last-child(1 of :not([aria-hidden]))) {
  padding-block-end: 0;
}

/* A section that only wraps a Wide or Full block (such as a hero) has no padding of its own. */
.is-style-section-bleed:has(> :is(.alignwide, .alignfull):nth-child(1 of :not([aria-hidden])):nth-last-child(1 of :not([aria-hidden]))) {
  padding-block: 0;
}
