/* Grid, color and spacing tokens now come from tokens.css (loaded first) */

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

/* Mobile Safari auto-inflates small text on rotation to landscape to keep
   it readable - exactly what made .text-tag/.text-caption look bigger in
   landscape than portrait despite an identical, fixed font-size. Every
   size on the site is already deliberately chosen, so opt out globally. */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* How far a sticky side-column (.header-intro, and the sticky variants of
   Omni) sits from the top - reserving
   room for the nav while it's showing, so the two never overlap. --nav-height
   is published live by nav.php; html.nav-hidden (also set there, from the
   same scroll-direction flag that slides the nav itself out) drops this
   back to just the grid margin once there's no nav to dodge. Each sticky
   rule transitions its own `top` to match the nav's slide, so the two move
   in lockstep without this needing to know anything about that animation. */
:root {
  --sticky-padding-top: calc(var(--grid-margin) + var(--nav-height, 0px));
}

html.nav-hidden:not(.next-project-on) {
  --sticky-padding-top: var(--grid-margin);
}

/* Browsers give <p> a default 1em top/bottom margin - kirbytext output (the
   intro, text block, atom-text) is all plain <p> tags, so left alone this
   silently offsets their visible top edge from anything we've explicitly
   zeroed (like the header h1). Reset here; nothing re-adds it automatically -
   any space between paragraphs is a deliberate margin scoped to that one
   place in the design, not a rule the type style applies on its own. */
p {
  margin: 0;
}

/* --- Type styles -----------------------------------------------------------
   One class per Figma text style (tokens.css holds the raw values; these
   compose them into the named styles Figma actually has - heading, body,
   caption, tag). Apply the class to whatever element needs that
   style and it inherits the whole bundle - font-family, size, line-height,
   letter-spacing - in one place, rather than each consumer restating them.

   Applying the class to a container works too: font properties inherit, so
   a style class on a kirbytext wrapper (.intro, .block-text, .atom-text)
   reaches the <p> tags kirbytext generates inside it without needing a
   class on each one individually.

   No spacing lives here on purpose - a style only ever sets type properties.
   Space between elements (paragraphs included) is added explicitly, scoped
   to wherever it's actually wanted, using a spacing token - never an
   automatic rule the style applies just because it's in use. The
   --type-ps-* tokens in tokens.css exist for exactly that, on demand. */
.text-heading {
  font-family: var(--font-family-base);
  font-size: var(--type-fs-heading);
  font-weight: var(--type-weight-heading);
  line-height: var(--type-lh-heading);
  letter-spacing: var(--type-ls-heading);
}

.text-body {
  font-family: var(--font-family-base);
  font-size: var(--type-fs-body);
  font-weight: var(--type-weight-body);
  line-height: var(--type-lh-body);
  letter-spacing: var(--type-ls-body);
}

.text-caption {
  font-family: var(--font-family-base);
  font-size: var(--type-fs-caption);
  font-weight: var(--type-weight-caption);
  line-height: var(--type-lh-caption);
  letter-spacing: var(--type-ls-caption);
  text-wrap: pretty;
}

/* Tags, labels and eyebrows - mono, with tokens of their own (body-sm)
   and all caps. */
.text-tag {
  font-family: var(--font-family-mono);
  font-size: var(--type-fs-body-sm);
  line-height: var(--type-lh-body-sm);
  letter-spacing: var(--type-ls-body-sm);
  text-transform: uppercase;
}

body {
  margin: 0;
  font-family: var(--font-family-base);
  color: var(--text-primary);
  background: var(--ui-bg);
  line-height: 1.5;
  transition: background-color var(--theme-transition-duration) ease,
              color var(--theme-transition-duration) ease;
}

img, video, .lottie {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Blur-up placeholders (site/plugins/lqip, the media snippet). The
   blurred tiny version arrives as an inline background-image; it sits
   centred and covering, the same way the media itself is cropped
   (object-fit: cover, centred) wherever it's cropped at all.

   When an image arrives after its placeholder has been in view for a
   moment, it comes into focus: it starts blurred - close to how the
   placeholder looked - and sharpens over a moment. lqip.js decides that
   (data-lqip-reveal); an image that was ready before anyone saw its
   placeholder, the usual case on a decent connection, just appears.
   The placeholder is dropped once the image has loaded - or a video's first
   frame is ready - so a transparent PNG or GIF never shows the blur through
   its see-through parts, and nothing is left to show at a box's smoothed
   edge. */
[data-lqip] {
  background-position: 50% 50%;
  background-size: cover;
  background-repeat: no-repeat;
}

[data-lqip-loaded] {
  background-image: none !important;
}

@media (prefers-reduced-motion: no-preference) {
  img[data-lqip-reveal] {
    animation: lqip-focus 700ms ease-out;
  }
}

@keyframes lqip-focus {
  from { filter: blur(16px); }
  to   { filter: blur(0); }
}

/* Autoplay refused (autoplay-fallback.js): the hidden video's poster frame
   as a clean still, laid over the video's own box by the script, with the
   site's play button centred on it. The whole still is the button, so a
   click anywhere on it plays.

   The poster drops the shared img radius: it stands exactly where the
   video was, and a video never carries its own (whatever holds it does
   the rounding). The play button is a fixed size everywhere, in frosted
   glass with a white triangle - a dark tint in light sections, a light one
   in dark sections (--ui-glass, tokens.css), so it stands out from the page
   around it; the blur and its pale rim help over the video itself. */
.video-fallback {
  position: absolute;
  display: block;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.video-fallback__poster {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 0;
}

.video-fallback__button {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: var(--ui-glass);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.22), 0 4px 16px rgb(0 0 0 / 0.16);
}

/* The play triangle, nudged right of centre: a triangle's visual weight sits
   left of its box, so a mathematically centred one looks off. */
.video-fallback__button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 20px;
  margin: -10px 0 0 -7px;
  background: #fff;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}

@media (hover: hover) {
  .video-fallback:hover .video-fallback__button {
    background: var(--ui-glass-hover);
  }
}

.video-fallback:focus-visible {
  outline: none;
}

.video-fallback:focus-visible .video-fallback__button {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .video-fallback__button {
    transition: transform 0.2s ease, background-color 0.2s ease;
  }

  @media (hover: hover) {
    .video-fallback:hover .video-fallback__button {
      transform: scale(1.06);
    }
  }
}

/* Backup for the above: Safari's own controls - the scrim and play button it
   puts on a video it refused to autoplay - hidden directly, for the instant
   before autoplay-fallback.js swaps the video out. These selectors are
   Safari's own and unofficial, and have changed between versions, so this
   is never relied on alone. Every video here is decorative and controls-
   free, so hiding them takes nothing away anywhere. */
video::-webkit-media-controls,
video::-webkit-media-controls-start-playback-button,
video::-webkit-media-controls-overlay-play-button {
  display: none !important;
  -webkit-appearance: none;
}

/* Radius lives on img directly, but never on a bare video element - Safari
   renders an actively-decoding <video> as solid black when it (not an
   ancestor) carries its own border-radius, a known WebKit compositing bug.
   Every video on the site sits inside a wrapper that clips via its own
   overflow:hidden + border-radius instead (.header-hero, .atom-media__file,
   .atom-slides__frame, .atom-crop__media) - the video itself stays
   unrounded and just gets cropped to match. */
img {
  border-radius: var(--radius);
}

.container {
  /* Fluid - fills the viewport minus margin at every size. The only fixed
     number is this outer cap, so content doesn't stretch indefinitely on
     very wide screens; --grid-margin itself is fluid (see tokens.css). */
  max-width: calc(var(--container-max) + (var(--grid-margin) * 2));
  margin-inline: auto;
  padding-inline: var(--grid-margin);
}

.grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  gap: var(--grid-gutter);
}

/* Site nav - the global name/Work/About row that sits on every page. Fixed
   and transparent, so it doesn't push the page down; the page's own top
   padding (on .header, and
   --gap-header-top on the home page) is what reserves room for it, not this
   component's own height. */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  padding-top: var(--grid-margin);
}

.nav-name {
  grid-column: 1 / span 6;
  justify-self: start;
  color: var(--text-primary);
  text-decoration: none;
}

/* A nav label and its hover title from the Site, stacked in one cell so the box
   is one line tall and as wide as the longer of the two. The title waits a line
   below, out of sight, and both move up on hover. */
.nav-swap {
  display: grid;
  overflow: hidden;
  white-space: nowrap;
}

.nav-swap__line {
  grid-area: 1 / 1;
}

.nav-swap__line + .nav-swap__line {
  translate: 0 100%;
}

/* Against the next link, not the left of a box sized for the longer title. */
.nav-links .nav-swap {
  justify-items: end;
}

@media (prefers-reduced-motion: no-preference) {
  .nav-swap__line {
    transition: translate var(--nav-swap-duration) var(--nav-swap-ease);
  }
}

@media (hover: hover) {
  a:not([aria-expanded="true"]):hover > .nav-swap > .nav-swap__line {
    translate: 0 -100%;
  }

  a:not([aria-expanded="true"]):hover > .nav-swap > .nav-swap__line + .nav-swap__line {
    translate: 0 0;
  }
}

a:not([aria-expanded="true"]):focus-visible > .nav-swap > .nav-swap__line {
  translate: 0 -100%;
}

a:not([aria-expanded="true"]):focus-visible > .nav-swap > .nav-swap__line + .nav-swap__line {
  translate: 0 0;
}

/* The Work menu is open: Work and About fade out where they are, and Close fades
   in where About was, with no mask or movement. Work's lines stay put meanwhile,
   including the title if it was showing when clicked (work-menu.js), so nothing
   flips past. Close is hidden, not only clear, while closed, so it can't take
   focus. */
a[aria-expanded="true"] > .nav-swap > .nav-swap__line {
  transition: none;
}

a.nav-swap--held > .nav-swap > .nav-swap__line {
  translate: 0 -100%;
}

a.nav-swap--held > .nav-swap > .nav-swap__line + .nav-swap__line {
  translate: 0 0;
}

a[aria-expanded="true"] > .nav-swap,
.work-menu-open [data-work-menu-about] {
  opacity: 0;
}

.nav-swap__line + .nav-swap__close {
  translate: none;
  visibility: hidden;
  opacity: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-primary);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.work-menu-open .nav-swap__line + .nav-swap__close {
  visibility: visible;
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  a[data-work-menu-toggle] > .nav-swap {
    transition: opacity var(--work-menu-fade) ease;
  }

  /* Colour too, as the nav turns dark over the menu and back. */
  .nav-name,
  a[data-work-menu-toggle] {
    transition: color var(--work-menu-fade) ease;
  }

  .nav-swap--about > [data-work-menu-about] {
    transition:
      opacity var(--work-menu-fade) ease,
      color var(--work-menu-fade) ease;
  }

  .nav-swap__line + .nav-swap__close {
    transition:
      opacity var(--work-menu-fade) ease,
      color var(--work-menu-fade) ease,
      visibility var(--work-menu-fade);
  }

  /* Visible at once on the way in, so focus can land on it straight away. */
  .work-menu-open .nav-swap__line + .nav-swap__close {
    transition:
      opacity var(--work-menu-fade) ease,
      color var(--work-menu-fade) ease;
  }
}

.nav-links {
  grid-column: 9 / span 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--grid-gutter);
  white-space: nowrap;
}

/* The row is often narrower than its links on phones, and a label's mask has no
   minimum width of its own, so without this they'd shrink out of sight. */
.nav-links > * {
  flex: none;
}

/* One colour for every link, whichever page is current - the current page
   is no longer picked out. nav.php still marks it with .is-active, so it
   can be styled again without touching the markup. */
.nav-links a {
  color: var(--text-primary);
  text-decoration: none;
}

/* Project header — matches Figma's responsive "Project Header" component */
.header {
  /* The nav's height - its own --grid-margin top padding plus one line of
     .text-tag - then --grid-margin of clear space before the hero. The nav
     is fixed and transparent, so this is all that keeps the two apart; it
     follows the nav's tokens rather than measuring it, so it's right from
     the first paint. One line of nav text only - a nav that wrapped would
     eat into the gap. */
  padding-top: calc(var(--grid-margin) * 2 + var(--type-fs-body-sm) * var(--type-lh-body-sm));
  padding-bottom: var(--gap-header-bottom-project);
  /* No row gap: each space down the header is its part's own margin-bottom,
     so it's exactly one token - not a token plus the grid's gutter. */
  row-gap: 0;
}

.header-hero {
  grid-column: 1 / -1;
  grid-row: 1;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: var(--grid-margin);
}

/* These two shapes are repeated in case-study.php ($heroBoxes), where Fit
   and Fill overlays measure against them - change them together. */
.header-hero__mobile {
  aspect-ratio: 240 / 320;
}

.header-hero__desktop {
  display: none;
  aspect-ratio: 240 / 135;
}

.header-hero img,
.header-hero video,
.header-hero .lottie {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* A hero with overlays (case-study.php): the overlay frame stands in for the
   file and covers the hero's box exactly as the file would with object-fit:
   cover - its own shape (--frame-ratio), at least as wide and as tall as the
   box, centred. The box is a size container so the frame can measure it,
   and it does the clipping and rounding, so the frame needs neither. */
.header-hero__desktop,
.header-hero__mobile {
  position: relative;
  container-type: size;
}

.atom-overlay__frame[data-cover] {
  position: absolute;
  top: 50%;
  left: 50%;
  width: max(100cqw, 100cqh * var(--frame-ratio));
  aspect-ratio: var(--frame-ratio);
  translate: -50% -50%;
  border-radius: 0;
}

/* Under the hero - at the top of the left column, above header-stack, from
   the shared breakpoint further down. */
.header-title {
  grid-column: 1 / span 12;
  grid-row: 2;
  margin-bottom: var(--gap-header-bottom-project);
}

.header-title h1 {
  margin: 0;
  text-wrap: balance;
}

.header-title .subtitle {
  margin: 0;
  color: var(--text-secondary);
  text-wrap: balance;
}

.header-intro {
  grid-column: 1 / span 12;
  grid-row: 3;
  display: flex;
  flex-direction: column;
  gap: var(--gap-intro-kpi);
  /* Stacked under the title on mobile, with header-stack right after it.
     Cancelled at desktop, where header-stack sits beside this column
     instead of below it. */
  margin-bottom: var(--gap-header-stack);
}

.header-intro .intro p,
.block-text p,
.atom-text p {
  text-wrap: pretty;
}

.header-intro .intro {
  color: var(--text-primary);
}

/* A blank line in body text makes a new paragraph (in About's lists, a new
   group of items - about.php), and only that gets a gap: the space above a paragraph that follows another, nothing at the
   text's top or bottom. In the type's own paragraph-spacing token, so the
   gap stays in proportion to the text's size. :not([class])
   matches only the paragraphs the text itself produces - a block's eyebrow
   is a <p> too, and the text under it mustn't move. */
:is(.block-text, .atom-text, .header-intro .intro, .about__intro, .about__list) p:not([class]) + p:not([class]) {
  margin-top: var(--type-ps-body);
}

/* Links typed into body text with the Panel's link button - the text's own
   colour, underlined (tokens.css). */
:is(.block-text, .atom-text, .header-intro .intro, .about__intro, .about__list) a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: var(--link-underline-thickness);
  text-underline-offset: var(--link-underline-offset);
  transition: color var(--link-hover-duration) ease;
}

/* Hover only where there's a pointer to hover with - on a touch screen it
   would stick after a tap. */
@media (hover: hover) {
  :is(.block-text, .atom-text, .header-intro .intro, .about__intro, .about__list) a:hover {
    color: var(--link-hover-color);
  }
}

/* Holds atoms rather than bare files, so there's nothing here about media
   sizing or clipping - each atom brings its own, and a wrapper adding a
   second radius would round the outside of one that has a caption below it,
   leaving the media's own bottom corners square. This is only the column
   they stack in. */
.header-stack {
  grid-column: 1 / span 12;
  grid-row: 4;
  display: flex;
  flex-direction: column;
  gap: var(--grid-gutter);
}

.kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--grid-gutter);
}

.kpis__column {
  display: flex;
  flex-direction: column;
  gap: var(--gap-kpi);
  margin: 0;
  min-width: 0;
  text-wrap: pretty;
}

.kpis dt {
  color: var(--text-secondary);
}

.kpis dd {
  margin: 0;
  margin-top: var(--eyebrow-gap-kpi);
  color: var(--text-primary);
}

/* Visit website (case-study.php) - the project's URL, as a pill under the
   KPIs, on the theme's raised UI colour. */
.project-link {
  align-self: flex-start;
  padding: 0.75em 1.25em;
  white-space: nowrap;
  border-radius: 999px;
  background: var(--ui-bg-layer-2);
  color: var(--text-primary);
  text-decoration: none;
  transition: background-color 0.2s ease;
}

@media (hover: hover) {
  .project-link:hover {
    background: color-mix(in srgb, var(--ui-bg-layer-2), var(--ui-bg-inverse) 10%);
  }
}

/* Homepage - dark bio intro + a staggered project grid. The grid is a
   repeating 6-card cycle (landscape / two portraits / landscape / two
   portraits) driven entirely by nth-child, so adding or removing a case
   study just reflows the cycle rather than needing per-card markup. */
.home-intro {
  padding-top: var(--gap-header-top);
  padding-bottom: var(--gap-header-bottom-home);
}

.home-intro p {
  grid-column: 2 / span 10;
  text-align: center;
  text-wrap: balance;
}

/* Read by screen readers, never seen - the home title's letters are hidden
   from them instead (home.php). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* About (about.php): the image, then the text - stacked on phones, side by
   side from 768px. The top is the home intro's, and the text column is a
   case study's intro column at six columns: intro, then the lists in the
   KPIs' type and grid, then a pill like Visit website, all
   --gap-intro-kpi apart. */
.about {
  padding-top: var(--gap-header-top);
  padding-bottom: var(--gap-project-lg);
  row-gap: var(--gap-intro-kpi);
}

/* At the image's own proportions - the width and height the media snippet
   sets reserve its shape before it loads. */
.about__image {
  grid-column: 1 / -1;
  align-self: start;
  overflow: hidden;
  border-radius: var(--radius);
}

.about__image img {
  display: block;
  width: 100%;
  height: auto;
}

.about__text {
  --reveal-distance: var(--reveal-distance-about);
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: var(--gap-intro-kpi);
  min-width: 0;
}

.about__intro {
  color: var(--text-primary);
}

.about__intro p {
  text-wrap: pretty;
}

/* A line each, as it wrapped (reveal.js), so each can rise by itself. Kept
   to one line, as the box is exactly as wide as the text it was given. */
.about__line {
  display: block;
  white-space: nowrap;
}

/* Two to a row, however many there are; a row's lists the same distance
   below the row above as the lists are below the intro. */
.about__lists {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--grid-gutter);
  row-gap: var(--gap-intro-kpi);
}

.about__list {
  margin: 0;
  min-width: 0;
  text-wrap: pretty;
}

.about__list dt {
  color: var(--text-secondary);
}

.about__list dd {
  margin: 0;
  margin-top: var(--eyebrow-gap-about);
  color: var(--text-primary);
  line-height: var(--about-list-line-height);
}

/* A line each, as the <br>s between them were - their own elements so each
   can rise by itself (reveal.js). */
.about__item {
  display: block;
}

.home-projects {
  row-gap: var(--gap-home-project-gap);
  padding-bottom: var(--gap-project-lg);
}

.home-card {
  position: relative;
  grid-column: 4 / span 9;
  /* Without this, a grid item stretches to fill its row's height by
     default - since row height here is often set by a neighbouring
     offset card or the row-gap, not this card's own content, that left
     the <a>'s hoverable/clickable box reaching well past the visible
     card into blank space. */
  align-self: start;
  display: block;
  color: inherit;
  text-decoration: none;
  /* Transform, not width/height - it doesn't affect layout, so neighbours
     never reflow or need any special handling for it. Declared here,
     unconditionally, so it also covers the shrink back to normal, not
     just growing on hover. */
  transition: transform 0.3s ease;
}

.home-card:nth-child(even) {
  grid-column: 1 / span 9;
}

/* The very first card only - full width here rather than the partial-width
   stagger every other mobile card gets, since there's no second card yet to
   stagger against. */
.home-card:first-child {
  grid-column: 1 / span 12;
}

.home-card__image {
  position: relative;
  aspect-ratio: var(--aspect-num, 0.8);
  overflow: hidden;
  border-radius: var(--radius);
}

/* What fills the card's box (home.php): the file, or its overlay frame
   covering the box as a hero's does - a size container, so the frame can
   measure it. Two of them when the box changes shape at 768px, shown one
   either side like the Media atom's versions (.atom-media__variant). */
.home-card__slot {
  position: absolute;
  inset: 0;
  container-type: size;
}

.home-card__image img,
.home-card__image video,
.home-card__image .lottie {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-card__label {
  margin-top: var(--grid-gutter);
}

.home-card__label p {
  text-wrap: balance;
}

.home-card__label p:first-child {
  color: var(--text-primary);
}

/* Not a title on its own - a card whose project has no subtitle. */
.home-card__label p:last-child:not(:first-child) {
  color: var(--text-secondary);
}

/* The link to the next case study, under the last block (next-project.php):
   stacked on phones, side by side on the page's grid from 768px, further
   down - the text in the first 4 columns, the image across the last 6. Its
   image is a listing card's, portrait then 5:3 - the ratios next-project.php
   hands the card's overlays. */
.next-project {
  --aspect-num: 0.8;
  margin-top: var(--gap-next-project);
  padding-bottom: var(--grid-margin);
}

/* It ends the page, so its text and image rising into place (reveal.js) hang
   below the last scroll position for a moment and make the page taller. As
   they rise it shrinks back, and the browser pulls a reader who has reached
   the bottom along with it - the whole module jumped. Clipped top and bottom
   they add no height. The padding, taken back off the margin, keeps the
   image's hover scale clear of the clip at the top. */
@media (prefers-reduced-motion: no-preference) {
  .next-project {
    --next-project-headroom: 1vw;
    overflow-y: clip;
    margin-top: calc(var(--gap-next-project) - var(--next-project-headroom));
    padding-top: var(--next-project-headroom);
  }
}

/* Once the module swaps the theme (theme-scroll.js), the header and blocks
   above fade back, on the theme change's own timing. */
.next-project-fades :is(.header, main) {
  transition: opacity var(--theme-transition-duration) ease;
}

.next-project-on:not(.reveal-loading) :is(.header, main) {
  opacity: var(--next-project-dim);
}

.next-project__link {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: subgrid;
  row-gap: var(--grid-gutter);
  color: inherit;
  text-decoration: none;
}

.next-project__text,
.next-project__image {
  grid-column: 1 / -1;
}

.next-project__text {
  display: grid;
  align-content: start;
  gap: var(--grid-gutter);
}

.next-project__eyebrow {
  color: var(--text-secondary);
}

.next-project__title h2,
.next-project__title p {
  margin: 0;
  color: var(--text-primary);
  text-wrap: balance;
}

.next-project__title p {
  color: var(--text-secondary);
}

/* Stacked, the image has no line spacing of its own, so the same gap reads
   smaller under the subtitle than it does above the title. This makes up the
   difference: the space above a line's capitals, which scales with the type. */
@media (max-width: 767.98px) {
  .next-project__title > :last-child {
    margin-bottom: 0.3em;
  }
}

.next-project__image {
  transition: transform 0.3s ease;
}

/* Text block - body text spanning --text-cols-phone of the
   page's grid columns, then --text-cols from the shared breakpoint
   further down, against the left or right edge, or centred. */
.block-text {
  grid-column: 1 / span var(--text-cols-phone, var(--text-block-columns-phone));
}

.block-text[data-align="right"] {
  grid-column: span var(--text-cols-phone, var(--text-block-columns-phone)) / -1;
}

/* Gap above and below (text.php) - the Gap block's sizes, named as the
   TOTAL separation from the block either side. A margin adds to the one
   row gap between them, so the gutter comes off once (a Gap block, a row of
   its own, takes off two). None leaves the plain row gap. */
.block-text[data-gap-top="sm"] {
  margin-top: calc(var(--gap-project-sm) - var(--grid-gutter));
}

.block-text[data-gap-top="md"] {
  margin-top: calc(var(--gap-project-md) - var(--grid-gutter));
}

.block-text[data-gap-top="lg"] {
  margin-top: calc(var(--gap-project-lg) - var(--grid-gutter));
}

.block-text[data-gap-bottom="sm"] {
  margin-bottom: calc(var(--gap-project-sm) - var(--grid-gutter));
}

.block-text[data-gap-bottom="md"] {
  margin-bottom: calc(var(--gap-project-md) - var(--grid-gutter));
}

.block-text[data-gap-bottom="lg"] {
  margin-bottom: calc(var(--gap-project-lg) - var(--grid-gutter));
}

/* Centred exactly, not on grid lines: it spans the row at the width of
   --text-span columns (as .scroll-video does) and sits in the middle, so an
   odd count's edges fall mid-column. */
.block-text[data-align="centre"] {
  --text-span: var(--text-cols-phone, var(--text-block-columns-phone));
  grid-column: 1 / -1;
  width: calc(
    (100% - (var(--grid-columns) - 1) * var(--grid-gutter)) /
      var(--grid-columns) * var(--text-span) +
    var(--grid-gutter) * (var(--text-span) - 1)
  );
  margin-inline: auto;
  text-align: center;
}

.block-text__eyebrow {
  color: var(--text-secondary);
  margin-bottom: var(--grid-gutter);
}

/* Shared by every project block (Masonry, Omni, Gap) */
.project-block {
  grid-column: 1 / -1;
}

/* A block's caption is a grid item of its own, sitting under the card rather
   than inside it - the padding and colour belong to the media, the caption
   belongs to the page, same as every atom's.

   Nothing to add for the spacing: being another row, the grid's own row gap
   already sits between them, and --grid-gutter is what every caption on the
   site is spaced by. */
.block-caption {
  grid-column: 1 / -1;
}

/* Everything that paints a theme colour of its own fades over the page's
   theme timing, so a theme change - the page's, or one Omni block's -
   crossfades as one piece instead of body fading while the blocks, cards
   and secondary text on top of it snap.

   body's own fade doesn't reach these: an element that names a token itself
   (a block's --block-bg, a caption's --text-secondary) re-resolves it the
   moment the theme flips, and only a transition on that element softens it.
   Text that just inherits its colour already rides on body's fade.

   Listed rather than caught with a *: several atom parts carry transitions
   of their own (Slides layers, Media Swap's second image, a home card's
   hover scale), and a blanket `transition` would replace them. None of the
   elements below has one. The nav is left out on purpose: its links change
   colour on hover, and a 1s hover would feel broken. */
.project-block,
.atom-media__file,
.atom-media-grid__group,
.atom-slides__card,
.atom-carousel__card,
.atom-stack__card,
.atom-media-swap__card,
.atom-crop__card,
.atom-marquee__box,
.header-title .subtitle,
.header-intro .intro,
.kpis dt,
.kpis dd,
.about__intro,
.about__list dt,
.about__list dd,
.block-text__eyebrow,
.atom-text__eyebrow,
.atom-overlay__copy p,
.next-project__eyebrow,
.next-project__title h2,
.next-project__title p,
.omni__major[data-column-bg],
.omni__minor[data-column-bg],
.atom-media__caption,
.atom-media-grid__caption,
.atom-slides__caption,
.atom-carousel__caption,
.atom-slides__captions,
.atom-carousel__captions,
.atom-stack__caption,
.atom-media-swap__caption,
.atom-crop__caption,
.atom-marquee__caption,
.block-caption {
  transition: background-color var(--theme-transition-duration) ease,
              color var(--theme-transition-duration) ease;
}

.project-block[data-padding="md"] {
  padding: var(--padding-project-block-md);
  background: var(--block-bg, var(--ui-bg-layer-1));
  border-radius: var(--radius);
}

.project-block[data-padding="lg"] {
  padding: var(--padding-project-block-lg);
  background: var(--block-bg, var(--ui-bg-layer-1));
  border-radius: var(--radius);
}

.project-block[data-padding="xl"] {
  padding: var(--padding-project-block-xl);
  background: var(--block-bg, var(--ui-bg-layer-1));
  border-radius: var(--radius);
}

.project-block[data-padding="none"] {
  padding: 0;
  background: transparent;
}

.project-block[data-bg="none"] {
  --block-bg: transparent;
}

/* Omni is the one block that can be coloured without padding: the colour
   fills exactly the block's own box, no inset. */
.block-omni[data-padding="none"]:not([data-bg="none"]) {
  background: var(--block-bg, var(--ui-bg-layer-1));
  border-radius: var(--radius);
}

/* Safe defaults for pages that have no project colours set. Without these,
   --block-bg would resolve to an unset var(), which makes the whole
   background declaration invalid at computed-value time - and crucially, CSS
   then falls back to the INITIAL value (transparent), not to the fallback
   inside var(--block-bg, ...). A page missing its colours would lose its
   cards entirely rather than quietly staying grey. */
:root {
  --project-bg-light: var(--ui-bg-layer-1);
  --project-bg-dark: var(--ui-bg-layer-1);
}

/* The project's one accent colour, resolved to whichever of the page's two
   fields matches the theme actually active on this subtree - the same
   data-theme attribute the text/button/ui tokens above already follow, so
   a Theme Switch block carries this along with everything else rather than
   needing its own rule. */
:root,
[data-theme="light"] {
  --project-bg: var(--project-bg-light);
}

[data-theme="dark"] {
  --project-bg: var(--project-bg-dark);
}

/* data-theme on a block re-points the theme tokens for its subtree, but that
   alone changes nothing visible: body's `color: var(--text-primary)` was
   already resolved to a literal black and INHERITED down, and inherited
   colours don't re-evaluate when a descendant redefines the variable. The
   block has to read the token itself for its subtree to inherit the new
   value. Anything that names a token directly - .atom-media__caption's
   --text-secondary, for instance - already follows without help. */
.project-block[data-theme] {
  color: var(--text-primary);
}

/* Background choice. These only ever SET --block-bg - the padding rules
   above are what actually paint it, so a block at padding:none stays
   transparent no matter what colour is picked, with no special case needed.

   --project-bg is published above from the page's own light/dark fields,
   already resolved for whichever theme applies here - a block just asks
   for "the project colour" rather than choosing between two of its own.
   "custom" is the exception: that colour lives on the block, and arrives
   as an inline --block-bg. */
.project-block[data-bg="project"],
.atom-media__file[data-bg="project"],
.atom-media-grid__group[data-bg="project"],
.atom-slides__card[data-bg="project"],
.atom-carousel__card[data-bg="project"],
.atom-stack__card[data-bg="project"],
.atom-media-swap__card[data-bg="project"],
.atom-crop__card[data-bg="project"],
.atom-marquee__box[data-bg="project"] {
  --block-bg: var(--project-bg);
}

.project-block[data-bg="default"],
.atom-media__file[data-bg="default"],
.atom-media-grid__group[data-bg="default"],
.atom-slides__card[data-bg="default"],
.atom-carousel__card[data-bg="default"],
.atom-stack__card[data-bg="default"],
.atom-media-swap__card[data-bg="default"],
.atom-crop__card[data-bg="default"],
.atom-marquee__box[data-bg="default"] {
  --block-bg: var(--ui-bg-layer-1);
}

/* Omni block - two columns (major and minor in the code, Column 1 and
   Column 2 in the panel) side by side once there's room, each at its own
   width in grid tracks and placed by the block's Column position (the
   desktop rule at the end of this file; omni.php works out where). Below the shared breakpoint further
   down, both stay on the same 12-column grid but stack one per row in
   source order instead - major at full width (span 12), minor narrower
   (span 8, left- or right-aligned depending on the same toggle) rather
   than matching it. Sticky doesn't apply there (see that breakpoint for
   why) - only the alignment half of swap does. Auto-flow (no explicit
   grid-row here) is enough to stack them correctly: a span-12 item fills
   its row entirely, so the next item can't fit beside it and drops to a
   new row on its own. grid-row:1 in the desktop rule below is required on
   both there - without it, swapping to a column range that's "earlier"
   than DOM order (minor moving before major) makes CSS Grid's sparse
   auto-placement bump the swapped element to row 2 instead of sharing
   row 1, since sparse packing won't backfill an earlier column range once
   the placement cursor has moved past it. */
.omni__columns {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  gap: var(--grid-gutter);
}

.block-omni {
  --item-gap: var(--padding-project-block-grid-gutter);
}

.omni__major,
.omni__minor {
  display: flex;
  flex-direction: column;
  gap: var(--item-gap);
  min-width: 0;
}

/* Crop top/bottom - the Crop block's pair, on this block's card. The padding
   overrides work the same way: horizontal padding and the background still
   come from the shared .project-block[data-padding] rule, and these just zero
   one edge each. The card keeps its own corners, for the same reason Crop's
   does - with two columns of differing height, squaring the card reads as
   lost rounding rather than as a crop.

   Only the major column is cropped. Zeroing an edge takes the padding off
   the card, which wraps both columns, so the minor column puts that same
   padding back on itself and ends up exactly where it was - it keeps the
   size the author chose while the major column runs flush past it. One rule
   per size because the value has to match whichever --padding-project-block-*
   the card is using; only the cropped edge is restored, so the minor column
   stays aligned with the major one horizontally.

   The squaring itself lives in the desktop breakpoint at the end of this
   file - see there for why. */
.block-omni[data-crop~="top"] {
  padding-top: 0;
}

.block-omni[data-crop~="bottom"] {
  padding-bottom: 0;
}

.block-omni[data-crop~="top"][data-padding="md"] .omni__minor {
  --omni-crop-top: var(--padding-project-block-md);
}

.block-omni[data-crop~="top"][data-padding="lg"] .omni__minor {
  --omni-crop-top: var(--padding-project-block-lg);
}

.block-omni[data-crop~="top"][data-padding="xl"] .omni__minor {
  --omni-crop-top: var(--padding-project-block-xl);
}

.block-omni[data-crop~="bottom"][data-padding="md"] .omni__minor {
  --omni-crop-bottom: var(--padding-project-block-md);
}

.block-omni[data-crop~="bottom"][data-padding="lg"] .omni__minor {
  --omni-crop-bottom: var(--padding-project-block-lg);
}

.block-omni[data-crop~="bottom"][data-padding="xl"] .omni__minor {
  --omni-crop-bottom: var(--padding-project-block-xl);
}

/* On top of whatever padding the column has of its own (below). */
.block-omni[data-crop~="top"] .omni__minor {
  padding-top: calc(var(--omni-crop-top, 0px) + var(--omni-column-padding, 0px));
}

.block-omni[data-crop~="bottom"] .omni__minor {
  padding-bottom: calc(var(--omni-crop-bottom, 0px) + var(--omni-column-padding, 0px));
}

/* With a background of its own that space has to stay outside it, or the
   colour would reach the card's edge on a column that's still inset from it. */
.block-omni[data-crop~="top"] .omni__minor[data-column-bg] {
  padding-top: var(--omni-column-padding, 0px);
  margin-top: var(--omni-crop-top, 0px);
}

.block-omni[data-crop~="bottom"] .omni__minor[data-column-bg] {
  padding-bottom: var(--omni-column-padding, 0px);
  margin-bottom: var(--omni-crop-bottom, 0px);
}

/* Squaring the atom that actually runs flush to a cropped edge, while the
   columns are stacked. Which atom that is depends on the stacking order the
   snippet chose: the minor column leads when it opens with a text atom, and
   whichever column leads owns the card's top edge - the other one owns the
   bottom. :first-child/:last-child on the column reads that order straight
   off the DOM, so nothing new has to be emitted to describe it.

   The minor column never qualifies at either edge: it puts back the padding
   the crop took off the card, so it is always inset from the edge and always
   keeps its rounding.

   These hold at every width. The desktop breakpoint then widens them - see
   the end of this file - because once the columns sit side by side the major
   column reaches the top edge whichever order it is in. */
/* A marker the edge atom passes down to its own descendants. The rules below
   square the atom's outermost radius, which is all a single-media atom needs
   - but a Media Grid has a row of files of its own against that edge, each
   carrying its own rounding. Those can't be reached by an ancestor selector
   alone: which files form the edge row depends on the column count, and that
   is worked out at runtime from the container's width. So the atom publishes
   "you are at a cropped edge" as an inherited custom property, and the Media
   Grid rules match on it together with the resolved count. Set in the same
   two places, under the same conditions, as the squaring itself. */
.block-omni[data-crop~="top"] .omni__major:first-child:where(:not([data-column-padding])) > :first-child {
  --crop-edge-top: 1;
}

.block-omni[data-crop~="bottom"] .omni__major:last-child:where(:not([data-column-padding])) > :last-child {
  --crop-edge-bottom: 1;
}

.block-omni[data-crop~="top"] .omni__major:first-child:where(:not([data-column-padding])) > :first-child
  :is(.atom-media__file,
        .atom-media-grid__group,
        .atom-slides__card,
        .atom-slides__frame,
        .atom-carousel__card,
        .atom-carousel__item,
        .atom-media-swap__card,
        .atom-media-swap__frame,
        .atom-overlay__frame,
        .atom-crop__card,
        .atom-crop__media),
.block-omni[data-crop~="top"] .omni__major:first-child:where(:not([data-column-padding])) > :first-child
  :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) img {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.block-omni[data-crop~="bottom"] .omni__major:last-child:where(:not([data-column-padding])) > :last-child
  :is(.atom-media__file,
        .atom-media-grid__group,
        .atom-slides__card,
        .atom-slides__frame,
        .atom-carousel__card,
        .atom-carousel__item,
        .atom-media-swap__card,
        .atom-media-swap__frame,
        .atom-overlay__frame,
        .atom-crop__card,
        .atom-crop__media),
.block-omni[data-crop~="bottom"] .omni__major:last-child:where(:not([data-column-padding])) > :last-child
  :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) img {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Crop left/right - the same idea sideways, on whichever column holds that
   side. The card's own padding can't be zeroed here the way top and bottom are:
   the columns sit on a 12-track grid, so taking padding off one side would
   widen the grid and shift both columns. Instead the column that touches the
   side pulls itself out into the padding with a negative margin, which widens
   it and nothing else; the other column, and the grid, stay exactly where they
   were.

   Which columns touch which side is decided in the snippet (data-edge-*),
   because it depends on swap, the minor column and the phone's full width
   option, and differs between stacked and side by side. */
.block-omni[data-padding="md"] {
  --omni-pad: var(--padding-project-block-md);
}

.block-omni[data-padding="lg"] {
  --omni-pad: var(--padding-project-block-lg);
}

.block-omni[data-padding="xl"] {
  --omni-pad: var(--padding-project-block-xl);
}

@media (max-width: 767.98px) {
  .block-omni[data-crop~="left"] > .omni__columns > [data-edge-narrow~="left"] {
    margin-left: calc(-1 * var(--omni-pad));
    --omni-flush-left: 1;
  }

  .block-omni[data-crop~="right"] > .omni__columns > [data-edge-narrow~="right"] {
    margin-right: calc(-1 * var(--omni-pad));
    --omni-flush-right: 1;
  }

}

@media (min-width: 768px) {
  .block-omni[data-crop~="left"] > .omni__columns > [data-edge-wide~="left"] {
    margin-left: calc(-1 * var(--omni-pad));
    --omni-flush-left: 1;
  }

  .block-omni[data-crop~="right"] > .omni__columns > [data-edge-wide~="right"] {
    margin-right: calc(-1 * var(--omni-pad));
    --omni-flush-right: 1;
  }

}

/* The flush column's atoms square the corners that now touch the card's side.
   Every atom in the column reaches the side, not just the first or last as at
   the top and bottom. Which column is flush changes at the breakpoint, so the
   same two pairs of rules as the margins above, by data-edge-narrow and
   -wide. Plain selectors, not a style query on --omni-flush-left/right:
   Safari before 18 and Firefox have no style queries, and the corners stayed
   rounded there. (The properties are still set, for the Media Grid's edge
   files, whose squaring depends on its column count.) The :where()s keep
   these at the specificity the style query rules had. */
@media (max-width: 767.98px) {
  :where(.block-omni[data-crop~="left"]) > .omni__columns > :where([data-edge-narrow~="left"])
    :is(.atom-media__file,
    .atom-media-grid__group,
    .atom-slides__card,
    .atom-slides__frame,
    .atom-carousel__card,
    .atom-carousel__item,
    .atom-media-swap__card,
    .atom-media-swap__frame,
    .atom-overlay__frame,
    .atom-crop__card,
    .atom-crop__media),
  :where(.block-omni[data-crop~="left"]) > .omni__columns > :where([data-edge-narrow~="left"])
    :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) img {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  :where(.block-omni[data-crop~="right"]) > .omni__columns > :where([data-edge-narrow~="right"])
    :is(.atom-media__file,
    .atom-media-grid__group,
    .atom-slides__card,
    .atom-slides__frame,
    .atom-carousel__card,
    .atom-carousel__item,
    .atom-media-swap__card,
    .atom-media-swap__frame,
    .atom-overlay__frame,
    .atom-crop__card,
    .atom-crop__media),
  :where(.block-omni[data-crop~="right"]) > .omni__columns > :where([data-edge-narrow~="right"])
    :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) img {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@media (min-width: 768px) {
  :where(.block-omni[data-crop~="left"]) > .omni__columns > :where([data-edge-wide~="left"])
    :is(.atom-media__file,
    .atom-media-grid__group,
    .atom-slides__card,
    .atom-slides__frame,
    .atom-carousel__card,
    .atom-carousel__item,
    .atom-media-swap__card,
    .atom-media-swap__frame,
    .atom-overlay__frame,
    .atom-crop__card,
    .atom-crop__media),
  :where(.block-omni[data-crop~="left"]) > .omni__columns > :where([data-edge-wide~="left"])
    :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) img {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  :where(.block-omni[data-crop~="right"]) > .omni__columns > :where([data-edge-wide~="right"])
    :is(.atom-media__file,
    .atom-media-grid__group,
    .atom-slides__card,
    .atom-slides__frame,
    .atom-carousel__card,
    .atom-carousel__item,
    .atom-media-swap__card,
    .atom-media-swap__frame,
    .atom-overlay__frame,
    .atom-crop__card,
    .atom-crop__media),
  :where(.block-omni[data-crop~="right"]) > .omni__columns > :where([data-edge-wide~="right"])
    :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) img {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

/* A column's own padding and background (omni.php). The background hugs the
   column's content: a grid item stretches to its row by default, so it stops
   at the start instead. On a flush side the column runs to the card's edge and
   squares that corner, like the atoms above; its padding stays inside it. */
.omni__major[data-column-padding="gutter"],
.omni__minor[data-column-padding="gutter"] {
  --omni-column-padding: var(--padding-project-block-grid-gutter);
}

.omni__major[data-column-padding="sm"],
.omni__minor[data-column-padding="sm"] {
  --omni-column-padding: var(--padding-project-block-sm);
}

.omni__major[data-column-padding="md"],
.omni__minor[data-column-padding="md"] {
  --omni-column-padding: var(--padding-project-block-md);
}

.omni__major[data-column-padding="lg"],
.omni__minor[data-column-padding="lg"] {
  --omni-column-padding: var(--padding-project-block-lg);
}

.omni__major[data-column-padding="xl"],
.omni__minor[data-column-padding="xl"] {
  --omni-column-padding: var(--padding-project-block-xl);
}

.omni__major[data-column-padding],
.omni__minor[data-column-padding] {
  padding: var(--omni-column-padding);
}

/* Inset by that padding, its blocks don't reach a cropped or flush edge, so
   they keep their rounding. !important because the rules that set these are
   spread across this file, at higher specificity. */
.omni__major[data-column-padding] > *,
.omni__minor[data-column-padding] > * {
  --crop-edge-top: 0 !important;
  --crop-edge-bottom: 0 !important;
  --omni-flush-left: 0 !important;
  --omni-flush-right: 0 !important;
}

.omni__major[data-column-bg="project"],
.omni__minor[data-column-bg="project"] {
  --omni-column-bg: var(--project-bg);
}

.omni__major[data-column-bg="default"],
.omni__minor[data-column-bg="default"] {
  --omni-column-bg: var(--ui-bg-layer-1);
}

.omni__major[data-column-bg],
.omni__minor[data-column-bg] {
  align-self: start;
  background-color: var(--omni-column-bg);
  border-radius: var(--radius);
}

.block-omni[data-crop~="top"] .omni__major[data-column-bg]:first-child {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.block-omni[data-crop~="bottom"] .omni__major[data-column-bg]:last-child {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

@media (max-width: 767.98px) {
  .block-omni[data-crop~="left"] > .omni__columns > [data-column-bg][data-edge-narrow~="left"] {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .block-omni[data-crop~="right"] > .omni__columns > [data-column-bg][data-edge-narrow~="right"] {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@media (min-width: 768px) {
  .block-omni[data-crop~="top"] .omni__major[data-column-bg] {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .block-omni[data-crop~="bottom"] .omni__major[data-column-bg] {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .block-omni[data-crop~="left"] > .omni__columns > [data-column-bg][data-edge-wide~="left"] {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .block-omni[data-crop~="right"] > .omni__columns > [data-column-bg][data-edge-wide~="right"] {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

/* The major column split into columns (omni.php's data-columns): its
   blocks flow left to right, then down, in a grid - a block per cell, each
   row as tall as its tallest block, the shorter ones at the top of it.

   The count is worked out the way the Media Grid atom's is (see there), from
   the column's own width: how many columns of --media-grid-column-min fit,
   clamped to the author's minimum and maximum. The column can't be a size
   container itself - an element's cqi measures its container, never itself -
   so its width is worked out from the row of columns it sits in, which is
   one: the share of the 12-track grid the major column spans (all of it, or
   8 tracks beside a minor column from 768px), gutters included. Viewport
   mode pins the count either side of 768px instead.

   A registered integer, like --media-grid-columns: repeat() needs a literal
   count, and the cropped-edge rules below match on it with style queries. */
/* One of the page's grid columns, measured on the Omni block's columns
   (the container below) and handed down as a length - for a Text atom's
   width in grid columns. Registered so it resolves where it's set, not in
   whichever container the atom happens to sit in. */
@property --grid-col {
  syntax: "<length>";
  inherits: true;
  initial-value: 0px;
}

.omni__major,
.omni__minor {
  --grid-col: calc((100cqw - (var(--grid-columns) - 1) * var(--grid-gutter)) / var(--grid-columns));
}

@property --omni-major-columns {
  syntax: "<integer>";
  inherits: true;
  initial-value: 1;
}

.omni__columns {
  container-type: inline-size;
}

.omni__major {
  --omni-major-span: var(--omni-mobile-span, var(--grid-columns));
}

.omni__major[data-columns] {
  --column-gap: var(--padding-project-block-grid-gutter);
  display: grid;
  grid-template-columns: repeat(var(--omni-major-columns), minmax(0, 1fr));
  align-items: start;
  column-gap: var(--column-gap);
  row-gap: var(--item-gap);
}

.omni__major[data-columns="range"] {
  --omni-major-columns: clamp(
    var(--omni-min),
    round(down, ((100cqi + var(--grid-gutter)) * var(--omni-major-span) / var(--grid-columns) - var(--grid-gutter) - 2 * var(--omni-column-padding, 0px)) / var(--media-grid-column-min)),
    var(--omni-max)
  );
}

.omni__major[data-columns="viewport"] {
  --omni-major-columns: var(--omni-mobile);
}

@media (min-width: 768px) {
  /* Side by side, the column is as wide as its own setting (omni.php). */
  .omni__major {
    --omni-major-span: var(--omni-span, var(--grid-columns));
  }

  .omni__major[data-columns="viewport"] {
    --omni-major-columns: var(--omni-desktop);
  }
}

/* The horizontal gap, its own setting; the vertical one stays the column's
   item gap. */
.omni__major[data-column-gap="sm"] {
  --column-gap: var(--padding-project-block-sm);
}

.omni__major[data-column-gap="md"] {
  --column-gap: var(--padding-project-block-md);
}

.omni__major[data-column-gap="lg"] {
  --column-gap: var(--padding-project-block-lg);
}

.omni__major[data-column-gap="xl"] {
  --column-gap: var(--padding-project-block-xl);
}

/* Zero gaps in the major column: its blocks joined into one image exported
   in chunks, as the Media Grid's Zero does. Each block reaches 2px under the
   next one down (Vertical) and across (Horizontal, with more than one
   column) - the next in reading order drawn on top - so sub-pixel rounding
   can never open a hairline; the exports carry those 2px. The blocks' media
   lose their own rounding and the column rounds and clips the set as one,
   trimming the 2px the last row and column reach past it. */
.block-omni .omni__major[data-item-gap="zero"] {
  --item-gap: 0px;
}

.omni__major[data-column-gap="zero"] {
  --column-gap: 0px;
}

.omni__major:is([data-item-gap="zero"], [data-column-gap="zero"]) {
  overflow: hidden;
  border-radius: var(--radius);
}

.omni__major[data-item-gap="zero"] > * {
  margin-bottom: -2px;
}

.omni__major[data-columns][data-column-gap="zero"] > * {
  margin-right: -2px;
}

/* One column at this width has no neighbour across. */
@container style(--omni-major-columns: 1) {
  .omni__major[data-columns][data-column-gap="zero"] > * {
    margin-right: 0;
  }
}

.omni__major:is([data-item-gap="zero"], [data-column-gap="zero"])
    :is(.atom-media__file,
      .atom-media-grid__group,
      .atom-slides__card,
      .atom-slides__frame,
      .atom-carousel__card,
      .atom-carousel__item,
      .atom-media-swap__card,
      .atom-media-swap__frame,
      .atom-overlay__frame,
      .atom-crop__card,
      .atom-crop__media,
      .atom-marquee__box,
      .atom-stack__card),
.omni__major:is([data-item-gap="zero"], [data-column-gap="zero"]) :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) :is(img, video, .lottie) {
  border-radius: 0;
}

/* Unless the last block in the column has a caption: that hangs below its
   media, inside the column, so the column's rounded bottom lands under the
   caption, where there's nothing to see it on, and the media's own corners
   stay square. So the last block keeps its own bottom corners - its outer
   box, and the frame inside that clips where the box doesn't - and stops
   reaching 2px down, with nothing below to tuck under. Not where the block
   is cropped at the bottom, where they're square anyway, nor in a grid of
   columns, whose last block isn't the whole bottom edge. */
.block-omni:not([data-crop~="bottom"]) .omni__major[data-item-gap="zero"]:not([data-columns]) > :last-child:has(> .text-caption) {
  margin-bottom: 0;
}

.block-omni:not([data-crop~="bottom"]) .omni__major[data-item-gap="zero"]:not([data-columns]) > :last-child:has(> .text-caption)
  > :is(.atom-media__file,
        .atom-media-grid__group,
        .atom-slides__card,
        .atom-carousel__card,
        .atom-media-swap__card,
        .atom-crop__card,
        .atom-marquee__box,
        .atom-stack__card),
.block-omni:not([data-crop~="bottom"]) .omni__major[data-item-gap="zero"]:not([data-columns]) > :last-child:has(> .text-caption)
  > .atom-slides__card > .atom-slides__frame,
.block-omni:not([data-crop~="bottom"]) .omni__major[data-item-gap="zero"]:not([data-columns]) > :last-child:has(> .text-caption)
  > .atom-media-swap__card > :is(.atom-media-swap__frame, .atom-overlay__frame),
.block-omni:not([data-crop~="bottom"]) .omni__major[data-item-gap="zero"]:not([data-columns]) > :last-child:has(> .text-caption)
  > .atom-crop__card .atom-crop__media {
  border-bottom-left-radius: var(--radius);
  border-bottom-right-radius: var(--radius);
}

/* At a cropped edge of the card the set's corners square there, as the
   blocks' own would: stacked, only the leading column reaches the top and
   only the trailing one the bottom; side by side, the major column reaches
   both. Sides follow the same edges as the column's flush margins. */
.block-omni[data-crop~="top"] .omni__major:is([data-item-gap="zero"], [data-column-gap="zero"]):first-child {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.block-omni[data-crop~="bottom"] .omni__major:is([data-item-gap="zero"], [data-column-gap="zero"]):last-child {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

@media (max-width: 767.98px) {
  .block-omni[data-crop~="left"] > .omni__columns > .omni__major:is([data-item-gap="zero"], [data-column-gap="zero"])[data-edge-narrow~="left"] {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .block-omni[data-crop~="right"] > .omni__columns > .omni__major:is([data-item-gap="zero"], [data-column-gap="zero"])[data-edge-narrow~="right"] {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@media (min-width: 768px) {
  .block-omni[data-crop~="top"] .omni__major:is([data-item-gap="zero"], [data-column-gap="zero"]) {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .block-omni[data-crop~="bottom"] .omni__major:is([data-item-gap="zero"], [data-column-gap="zero"]) {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .block-omni[data-crop~="left"] > .omni__columns > .omni__major:is([data-item-gap="zero"], [data-column-gap="zero"])[data-edge-wide~="left"] {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }

  .block-omni[data-crop~="right"] > .omni__columns > .omni__major:is([data-item-gap="zero"], [data-column-gap="zero"])[data-edge-wide~="right"] {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

/* A right-aligned narrower text atom: align-self moved it right in the
   column's flex stack, but in a grid it's the vertical axis - so the cell
   lines it up across instead, and it stays at the top. */
.omni__major[data-columns] > .atom-text[data-align="right"] {
  align-self: start;
  justify-self: end;
}

/* And Bottom, in a grid: the foot of its cell. */
.omni__major[data-columns] > .atom-text[data-valign="bottom"] {
  align-self: end;
  margin-top: 0;
}

/* Cropped edges with more than one column. At a cropped top it's the whole
   first row that runs flush, not just the first block - and at the bottom
   the whole last row, however full it is (its first cell is the one that
   starts a row and is within the last count of blocks, and every block
   after it). Same conditions as the single-column rules above: stacked, the
   major column has to be the one at that edge; side by side, it always is.
   At a cropped side, only the blocks in the first or last column of the
   grid touch it, so the rest switch the flush marker back off. One block of
   rules per count; a single column needs none, as the rules above already
   cover it.

   These only mark the blocks (--crop-edge-*); the squaring follows from the
   marker, below, the way the Media Grid's edge rows already do. */
@container style(--omni-major-columns: 2) {
  .block-omni[data-crop~="top"] .omni__major[data-columns]:first-child > :nth-child(-n+2) {
    --crop-edge-top: 1;
  }

  .block-omni[data-crop~="bottom"] .omni__major[data-columns]:last-child > :nth-child(2n+1):nth-last-child(-n+2),
  .block-omni[data-crop~="bottom"] .omni__major[data-columns]:last-child > :nth-child(2n+1):nth-last-child(-n+2) ~ * {
    --crop-edge-bottom: 1;
  }

  .omni__major[data-columns] > :not(:nth-child(2n+1)) {
    --omni-flush-left: 0;
  }

  .omni__major[data-columns] > :not(:nth-child(2n)) {
    --omni-flush-right: 0;
  }

  @media (min-width: 768px) {
    .block-omni[data-crop~="top"] .omni__major[data-columns] > :nth-child(-n+2) {
      --crop-edge-top: 1;
    }

    .block-omni[data-crop~="bottom"] .omni__major[data-columns] > :nth-child(2n+1):nth-last-child(-n+2),
    .block-omni[data-crop~="bottom"] .omni__major[data-columns] > :nth-child(2n+1):nth-last-child(-n+2) ~ * {
      --crop-edge-bottom: 1;
    }
  }
}

@container style(--omni-major-columns: 3) {
  .block-omni[data-crop~="top"] .omni__major[data-columns]:first-child > :nth-child(-n+3) {
    --crop-edge-top: 1;
  }

  .block-omni[data-crop~="bottom"] .omni__major[data-columns]:last-child > :nth-child(3n+1):nth-last-child(-n+3),
  .block-omni[data-crop~="bottom"] .omni__major[data-columns]:last-child > :nth-child(3n+1):nth-last-child(-n+3) ~ * {
    --crop-edge-bottom: 1;
  }

  .omni__major[data-columns] > :not(:nth-child(3n+1)) {
    --omni-flush-left: 0;
  }

  .omni__major[data-columns] > :not(:nth-child(3n)) {
    --omni-flush-right: 0;
  }

  @media (min-width: 768px) {
    .block-omni[data-crop~="top"] .omni__major[data-columns] > :nth-child(-n+3) {
      --crop-edge-top: 1;
    }

    .block-omni[data-crop~="bottom"] .omni__major[data-columns] > :nth-child(3n+1):nth-last-child(-n+3),
    .block-omni[data-crop~="bottom"] .omni__major[data-columns] > :nth-child(3n+1):nth-last-child(-n+3) ~ * {
      --crop-edge-bottom: 1;
    }
  }
}

@container style(--omni-major-columns: 4) {
  .block-omni[data-crop~="top"] .omni__major[data-columns]:first-child > :nth-child(-n+4) {
    --crop-edge-top: 1;
  }

  .block-omni[data-crop~="bottom"] .omni__major[data-columns]:last-child > :nth-child(4n+1):nth-last-child(-n+4),
  .block-omni[data-crop~="bottom"] .omni__major[data-columns]:last-child > :nth-child(4n+1):nth-last-child(-n+4) ~ * {
    --crop-edge-bottom: 1;
  }

  .omni__major[data-columns] > :not(:nth-child(4n+1)) {
    --omni-flush-left: 0;
  }

  .omni__major[data-columns] > :not(:nth-child(4n)) {
    --omni-flush-right: 0;
  }

  @media (min-width: 768px) {
    .block-omni[data-crop~="top"] .omni__major[data-columns] > :nth-child(-n+4) {
      --crop-edge-top: 1;
    }

    .block-omni[data-crop~="bottom"] .omni__major[data-columns] > :nth-child(4n+1):nth-last-child(-n+4),
    .block-omni[data-crop~="bottom"] .omni__major[data-columns] > :nth-child(4n+1):nth-last-child(-n+4) ~ * {
      --crop-edge-bottom: 1;
    }
  }
}

@container style(--omni-major-columns: 5) {
  .block-omni[data-crop~="top"] .omni__major[data-columns]:first-child > :nth-child(-n+5) {
    --crop-edge-top: 1;
  }

  .block-omni[data-crop~="bottom"] .omni__major[data-columns]:last-child > :nth-child(5n+1):nth-last-child(-n+5),
  .block-omni[data-crop~="bottom"] .omni__major[data-columns]:last-child > :nth-child(5n+1):nth-last-child(-n+5) ~ * {
    --crop-edge-bottom: 1;
  }

  .omni__major[data-columns] > :not(:nth-child(5n+1)) {
    --omni-flush-left: 0;
  }

  .omni__major[data-columns] > :not(:nth-child(5n)) {
    --omni-flush-right: 0;
  }

  @media (min-width: 768px) {
    .block-omni[data-crop~="top"] .omni__major[data-columns] > :nth-child(-n+5) {
      --crop-edge-top: 1;
    }

    .block-omni[data-crop~="bottom"] .omni__major[data-columns] > :nth-child(5n+1):nth-last-child(-n+5),
    .block-omni[data-crop~="bottom"] .omni__major[data-columns] > :nth-child(5n+1):nth-last-child(-n+5) ~ * {
      --crop-edge-bottom: 1;
    }
  }
}

@container style(--omni-major-columns: 6) {
  .block-omni[data-crop~="top"] .omni__major[data-columns]:first-child > :nth-child(-n+6) {
    --crop-edge-top: 1;
  }

  .block-omni[data-crop~="bottom"] .omni__major[data-columns]:last-child > :nth-child(6n+1):nth-last-child(-n+6),
  .block-omni[data-crop~="bottom"] .omni__major[data-columns]:last-child > :nth-child(6n+1):nth-last-child(-n+6) ~ * {
    --crop-edge-bottom: 1;
  }

  .omni__major[data-columns] > :not(:nth-child(6n+1)) {
    --omni-flush-left: 0;
  }

  .omni__major[data-columns] > :not(:nth-child(6n)) {
    --omni-flush-right: 0;
  }

  @media (min-width: 768px) {
    .block-omni[data-crop~="top"] .omni__major[data-columns] > :nth-child(-n+6) {
      --crop-edge-top: 1;
    }

    .block-omni[data-crop~="bottom"] .omni__major[data-columns] > :nth-child(6n+1):nth-last-child(-n+6),
    .block-omni[data-crop~="bottom"] .omni__major[data-columns] > :nth-child(6n+1):nth-last-child(-n+6) ~ * {
      --crop-edge-bottom: 1;
    }
  }
}

@container style(--crop-edge-top: 1) {
  .omni__major[data-columns]
    :is(.atom-media__file,
      .atom-media-grid__group,
      .atom-slides__card,
      .atom-slides__frame,
      .atom-carousel__card,
      .atom-carousel__item,
      .atom-media-swap__card,
      .atom-media-swap__frame,
      .atom-overlay__frame,
      .atom-crop__card,
      .atom-crop__media),
  .omni__major[data-columns] :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) img {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@container style(--crop-edge-bottom: 1) {
  .omni__major[data-columns]
    :is(.atom-media__file,
      .atom-media-grid__group,
      .atom-slides__card,
      .atom-slides__frame,
      .atom-carousel__card,
      .atom-carousel__item,
      .atom-media-swap__card,
      .atom-media-swap__frame,
      .atom-overlay__frame,
      .atom-crop__card,
      .atom-crop__media),
  .omni__major[data-columns] :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

.atom-text__eyebrow {
  color: var(--text-secondary);
  margin-bottom: var(--grid-gutter);
}

/* Text atom - optional bottom-only padding (same tokens as the blocks'
   all-side padding), plus an optional width in grid columns that shrinks
   it to part of the column and aligns it to either edge. Width/alignment work
   because the atom is itself a flex item of its column's flex column -
   an explicit width overrides the default stretch-to-fill sizing, and
   with no align-self override a sized flex item naturally sits at the
   cross-axis start (left) already, so only the right-aligned case needs
   an explicit align-self.

   70% below the shared breakpoint, not 50% - a column is already narrow
   there, and half of a narrow column reads as cramped. See the desktop
   media query for the 50% it settles back to once columns have room. */
.atom-text[data-padding="sm"] {
  padding-bottom: var(--padding-project-block-sm);
}

.atom-text[data-padding="md"] {
  padding-bottom: var(--padding-project-block-md);
}

.atom-text[data-padding="lg"] {
  padding-bottom: var(--padding-project-block-lg);
}

.atom-text[data-padding="xl"] {
  padding-bottom: var(--padding-project-block-xl);
}

/* Width in the page's grid columns (--text-cols, from the Panel): that
   many columns and the gutters between them, never more than its column -
   or its cell. Phones have their own count, where the columns are the full
   12 wide. */
.atom-text[data-cols] {
  --cols: var(--text-cols-phone, 12);
  width: min(100%, calc(var(--cols) * var(--grid-col) + (var(--cols) - 1) * var(--grid-gutter)));
}

.atom-text[data-cols][data-align="right"] {
  align-self: flex-end;
}

/* Vertical alignment Bottom: the spare height of the column goes above
   it, so it - and anything after it - sits at the column's foot, level
   with the bottom of the column beside it. Stacked on phones, a column is
   only as tall as its content, so nothing moves. */
.atom-text[data-valign="bottom"] {
  margin-top: auto;
}

/* Media atom - optional caption below the file, spaced tighter than the
   gap between atoms since it reads as part of the media, not a sibling.
   The radius/clip live on .atom-media__file specifically, not on this
   outer flex column - with a caption present, the file's own bottom edge
   is an internal seam, not the box's edge, so rounding the OUTER box
   would only round the top of the file and the bottom of the caption,
   leaving the file's bottom corners square. Rounding a wrapper around
   just the file keeps it correct with or without a caption. */
.atom-media {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gutter);
}

.atom-media__file {
  overflow: hidden;
  border-radius: var(--radius);
}

/* Fill the column, whatever the file's own pixel size. The global img/video
   rule is max-width:100%, which only ever caps an image - it never stretches
   one - so a file narrower than its column would otherwise draw at its
   intrinsic width and sit short of the edge. That reads as a bug when the
   same atom is moved from a narrow column to a wide one: nothing about the
   atom changed, only whether the file happened to be bigger than the space.
   Same rule the header hero and stack already apply to their own media. */
/* Painted only when a colour is actually chosen - "none" matches no rule and
   stays transparent, which is what almost every photo wants. The point is
   transparent files: a PNG or SVG logo needs something behind it. */
.atom-media__file[data-bg]:not([data-bg="none"]) {
  background: var(--block-bg, var(--ui-bg-layer-1));
}

/* Insets the file within its background - the point of pairing it with a
   colour, so a transparent logo isn't flush to the edges of its box. */
.atom-media__file[data-padding="sm"] {
  padding: var(--padding-project-block-sm);
}

.atom-media__file[data-padding="md"] {
  padding: var(--padding-project-block-md);
}

.atom-media__file[data-padding="lg"] {
  padding: var(--padding-project-block-lg);
}

.atom-media__file[data-padding="xl"] {
  padding: var(--padding-project-block-xl);
}

.atom-media__file img,
.atom-media__file video,
.atom-media__file .lottie {
  width: 100%;
}

/* Optional mask (site/plugins/media-layers, blueprints/fields/mask.yml). Each
   block publishes the mask as --media-mask on one element (data-mask), and
   these rules apply it to what that block clips. Stretched to the clipped
   box, so a mask has to be drawn for that shape; opaque areas show the
   media, transparent ones hide it.

   - Media: the file itself, not its padding or background. The img/video is
     masked directly - the file's wrapper also holds the padding.
   - Media Grid, Masonry, Marquee, Scroll Video: each item, by masking
     the wrapper every item already has (which also clips the still
     autoplay-fallback.js lays over a refused video).
   - Crop, Media Swap, Slides: the frame, so everything inside it - both
     swap states, every slide - shares one shape. So does a Media atom with
     overlays: its frame takes the mask, not the file.

   Rounding goes wherever the mask applies: the mask is the shape now. That
   includes the wrappers that clip a video's corners (a bare <video> can't
   carry a radius in Safari), and the Media atom's own wrapper when it has no
   padding, since then it clips the file too. */
:is(
  .atom-media[data-mask] .atom-media__file :is(img, video, .lottie):not(.atom-overlay__frame *),
  .atom-media[data-mask] .atom-overlay__frame,
  .atom-media-grid__items[data-mask] .atom-media-grid__file,
  .atom-marquee__rows[data-mask] .atom-marquee__item,
  .masonry__items[data-mask] .masonry__media,
  .scroll-video__media[data-mask],
  .atom-crop[data-mask] .atom-crop__media,
  .atom-media-swap[data-mask] .atom-media-swap__frame:not(.atom-overlay__frame *),
  .atom-media-swap[data-mask] .atom-overlay__frame,
  .atom-slides[data-mask] .atom-slides__frame,
  .atom-carousel[data-mask] .atom-carousel__item
) {
  -webkit-mask-image: var(--media-mask);
  mask-image: var(--media-mask);
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  border-radius: 0;
}

:is(
  .atom-media[data-mask] .atom-media__file[data-padding="none"],
  .atom-media-grid__items[data-mask] .atom-media-grid__file,
  .atom-marquee__rows[data-mask] .atom-marquee__item,
  .masonry__items[data-mask] .masonry__media,
  .scroll-video__media[data-mask],
  .atom-crop[data-mask] .atom-crop__media,
  .atom-media-swap[data-mask] .atom-media-swap__frame,
  .atom-slides[data-mask] .atom-slides__frame,
  .atom-carousel[data-mask] .atom-carousel__item
) img {
  border-radius: 0;
}

.atom-media[data-mask] .atom-media__file[data-padding="none"] {
  border-radius: 0;
}

/* Optional overlay image (site/plugins/media-layers,
   blueprints/fields/overlay-image.yml) - published as --media-overlay, the
   same way and on the same element as the mask, and drawn as an ::after over
   the same box the mask clips. Unlike the mask it's never stretched: it keeps
   its own proportions, fitted inside the box and centred, and the mask on
   that box clips it along with everything else. The Media and Media Swap
   atoms have none: their Overlays lists do the job, placed rather than
   centred.

   Clicks pass through. z-index 4 keeps it above everything a host stacks
   inside itself - Slides restacks its layers at z-index 0-2 on every
   transition, and anything lower let the incoming slide fade in over the
   overlay - and above the scrim (3, below). It sits above the still
   autoplay-fallback.js lays over a refused video, and below that still's
   play button (z-index 5, below) - except in
   Slides, where the still lives inside a layer, and a layer is its own
   stacking context, so the button can't rise above the frame's overlay.
   It still works there: the overlay lets the click through. */
:is(
  .atom-media-grid__items[data-overlay] .atom-media-grid__file,
  .masonry__items[data-overlay] .masonry__media,
  .scroll-video__media[data-overlay],
  .atom-crop[data-overlay] .atom-crop__media,
  .atom-slides[data-overlay] .atom-slides__frame
) {
  position: relative;
}

:is(
  .atom-media-grid__items[data-overlay] .atom-media-grid__file,
  .masonry__items[data-overlay] .masonry__media,
  .scroll-video__media[data-overlay],
  .atom-crop[data-overlay] .atom-crop__media,
  .atom-slides[data-overlay] .atom-slides__frame,
  .atom-carousel[data-overlay] .atom-carousel__item
)::after {
  content: "";
  position: absolute;
  inset: var(--overlay-inset, 0);
  z-index: 4;
  background: var(--media-overlay) center / contain no-repeat;
  pointer-events: none;
}

/* A Lottie animation as the overlay (mediaOverlayLottie()): an element in
   the same box, at the same z-index, instead of the ::after - which gets no
   picture then and stays empty. Fitted inside and centred like an image
   (lottie.js reads object-fit: contain as "fit inside"). The extra parts of
   the selector out-rank each host's own .lottie rules, which size a file,
   not a layer over it. */
.lottie.media-overlay[data-lottie] {
  position: absolute;
  inset: var(--overlay-inset, 0);
  z-index: 4;
  width: auto;
  height: auto;
  max-width: none;
  aspect-ratio: auto;
  margin: 0;
  border-radius: 0;
  object-fit: contain;
  pointer-events: none;
}

/* Optional scrim (site/plugins/media-layers, blueprints/fields/scrim.yml) -
   a colour or gradient, already at its opacity, published as --media-scrim on the
   same element as the mask and overlay image and drawn as a ::before over
   the same box: above the media, under the overlay image, clipped by the
   mask the same way. On its own it just tints the media. Its blend mode
   (--media-scrim-blend) mixes it with the media only: each host is isolated,
   so nothing behind the media takes part. */
:is(
  .atom-media-grid__items[data-scrim] .atom-media-grid__file,
  .atom-marquee__rows[data-scrim] .atom-marquee__item,
  .masonry__items[data-scrim] .masonry__media,
  .scroll-video__media[data-scrim],
  .atom-crop[data-scrim] .atom-crop__media,
  .atom-media-swap[data-scrim] .atom-media-swap__frame,
  .atom-slides[data-scrim] .atom-slides__frame
) {
  position: relative;
  /* So a blended scrim mixes with this media only, not with the card's
     colour or the page behind it. */
  isolation: isolate;
}

:is(
  .atom-media-grid__items[data-scrim] .atom-media-grid__file,
  .atom-marquee__rows[data-scrim] .atom-marquee__item,
  .masonry__items[data-scrim] .masonry__media,
  .scroll-video__media[data-scrim],
  .atom-crop[data-scrim] .atom-crop__media,
  .atom-media-swap[data-scrim] .atom-media-swap__frame,
  .atom-slides[data-scrim] .atom-slides__frame,
  .atom-carousel[data-scrim] .atom-carousel__item
)::before {
  content: "";
  position: absolute;
  inset: var(--overlay-inset, 0);
  z-index: 3;
  background: var(--media-scrim);
  mix-blend-mode: var(--media-scrim-blend, normal);
  pointer-events: none;
}

/* The whole-card scrim (mediaScrimElement()): one layer over the entire
   card, padding and colour included, rounded with it - for the blocks with
   several items when the scrim is set to cover the whole atom. Above the
   items, under their overlay images; the card is isolated so a blend mixes
   with the card alone. */
.media-scrim {
  position: absolute;
  inset: 0;
  z-index: 3;
  border-radius: inherit;
  pointer-events: none;
}

:is(.atom-media-grid__group, .block-masonry):has(> .media-scrim) {
  position: relative;
  isolation: isolate;
}

.video-fallback__button {
  z-index: 5;
}

/* A Lottie animation (site/plugins/lottie, assets/js/lottie.js) - a box the
   player draws an SVG into. Everywhere a video is sized, a .lottie is sized
   the same way (it's listed beside video in each of those rules), and with
   no height set it takes the animation's own shape, as a video takes its
   width and height attributes. The player reads object-fit back off the box
   to know whether to cover it or fit inside it. */
.lottie {
  width: 100%;
  aspect-ratio: var(--lottie-ratio, 1);
  overflow: hidden;
}

.lottie svg {
  display: block;
}

/* A still shown over a video while it pauses or holds (video-hold.js),
   laid over the video's exact box and matched to its cropping there.
   Hidden until needed; its fade, if any, is set inline. No z-index: it sits
   just after its video, so it covers the video and nothing else - scrims
   and overlay images stay above it on their own layers. */
.video-still {
  position: absolute;
  display: block;
  max-width: none;
  margin: 0;
  border-radius: 0;
  opacity: 0;
  pointer-events: none;
}

.video-still.is-shown {
  opacity: 1;
}

/* Mobile version (atom-media.php). Two images come as a <picture>, which
   only needs to be a block so its image fills the width like a bare one.
   A pair involving a video comes as two variants instead: the mobile one
   shows here, the desktop one from 768px up (in the breakpoint block at the
   end of this file). */
.atom-media__file picture {
  display: block;
}

.atom-media__variant[data-variant="desktop"] {
  display: none;
}

/* A Media atom in a slot (media-atom-slot.php): a Slides layer or a Marquee
   item, which sets the shape and does the outer clipping and rounding. The
   atom fills it, padding and colour included. Inside the padding,
   .atom-media__slot clips the media to the radius, and each
   .atom-media__fill (one, or a desktop and a mobile version shown either
   side of 768px like the Media atom's own) is a size container the media
   covers, cropped and centred: a file by object-fit (the Slides and
   Marquee rules further down), an overlay frame as a hero's does
   (.atom-overlay__frame[data-cover]). With no padding the slot's own
   rounding is the edge, so the inner one goes. */
.atom-media--slot {
  position: absolute;
  inset: 0;
  display: block;
}

.atom-media--slot .atom-media__file {
  height: 100%;
  box-sizing: border-box;
  border-radius: 0;
}

.atom-media__slot {
  position: relative;
  height: 100%;
  overflow: hidden;
  border-radius: var(--radius);
}

.atom-media__file[data-padding="none"] > .atom-media__slot,
.atom-media--slot[data-mask] .atom-media__slot {
  border-radius: 0;
}

.atom-media__fill {
  position: absolute;
  inset: 0;
  container-type: size;
}

/* An atom's overlays each get a compositing layer of their own here. Slides
   and Marquee move and fade their slots, and as a swipe or a fade starts,
   Safari hands a playing video its own layer - which it then painted over
   any overlay above it that had none (a footer image over a video, say),
   breaking the stack. With every layer composited, their order holds. */
.atom-media--slot .atom-overlay__item {
  will-change: transform;
}

/* Media Grid atom - the Media atom with several files instead of one.
   Same flex column as .atom-media, so the gap that separates the file from
   the caption there separates the group from the caption here too.

   The padding/background live on .atom-media-grid__group, once, around
   every file together - not on each file - so several files read as one
   card of images rather than several small cards in a row (each with its
   own inset and colour). Individual files still get their own rounding,
   so a stack with no padding or background set still reads as separate
   rounded photos rather than square-cornered ones. */
.atom-media-grid {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gutter);
}

.atom-media-grid__group {
  container-type: inline-size;
  overflow: hidden;
  border-radius: var(--radius);
}

/* The column count, as an integer the grid can repeat(). It has to be a
   registered property: repeat()'s count argument must be a literal integer,
   and only a registered <integer> property computes the clamp() below down
   to one before it's substituted. An engine without @property drops the
   grid-template-columns that uses it (an unregistered var() substitutes the
   clamp() expression itself, which repeat() rejects), leaving the items in
   one implicit column - the vertical stack this atom used to be, which is a
   fair place to land. */
@property --media-grid-columns {
  syntax: "<integer>";
  /* Inherited, although only the grid itself reads it for repeat(). The crop
     rules query it with a style query, and a style query resolves against the
     nearest ancestor container - for a file that's the grid, but for the img
     inside a file it's the file. Non-inherited, the img's container reports
     the initial 1 instead of the real count, and only the very last image in
     the grid squares. Inheriting carries the resolved count to every depth
     that has to match on it. */
  inherits: true;
  initial-value: 1;
}

/* A grid, not the multi-column layout Masonry uses: multi-column fills each
   column top to bottom before moving right, and these files should read in
   the order they were added - left to right, then down.

   The count itself is worked out exactly as Masonry's is, and for the same
   reason: container query units, so an atom in a narrow layout column gets a
   count chosen for its own width rather than the page's.
   round(down, 100cqi / --media-grid-column-min) is "how many columns of at
   least that width fit", and clamp() bounds it by the author's two values.

   Doing the bounding in clamp() rather than by folding the two limits into a
   minmax() track size (the usual auto-fill technique) is what makes them
   exact. That technique puts the count one floor() away from the author's
   maximum, so sub-pixel error in the gutter can leave a block one column
   short of the maximum it asked for at the very widths that should pin it
   there - measured here as 7 columns where 8 were set. clamp() can't be off
   by one: the bounds are the author's numbers.

   align-items: start leaves every file its natural height: a row is as tall
   as its tallest file, and the shorter ones sit at the top of it rather than
   stretching to match. */
.atom-media-grid {
  --item-gap: var(--padding-project-block-grid-gutter);
}

.atom-media-grid__items {
  --media-grid-columns: clamp(
    var(--media-grid-min),
    round(down, 100cqi / var(--media-grid-column-min)),
    var(--media-grid-max)
  );

  display: grid;
  grid-template-columns: repeat(var(--media-grid-columns), 1fr);
  align-items: start;
  gap: var(--item-gap);
}

/* Viewport mode: the same clamp, pinned shut on one count - min and max both
   point at the mobile count here, and at the desktop one past the breakpoint
   (in the 768px block at the end of the file). A pinned clamp is still just
   the count, so --media-grid-columns and the crop-edge style queries that
   read it carry on unchanged. */
.atom-media-grid[data-columns="viewport"] {
  --media-grid-min: var(--media-grid-mobile);
  --media-grid-max: var(--media-grid-mobile);
}

.atom-media-grid__group[data-bg]:not([data-bg="none"]) {
  background: var(--block-bg, var(--ui-bg-layer-1));
}

.atom-media-grid__group[data-padding="sm"] {
  padding: var(--padding-project-block-sm);
}

.atom-media-grid__group[data-padding="md"] {
  padding: var(--padding-project-block-md);
}

.atom-media-grid__group[data-padding="lg"] {
  padding: var(--padding-project-block-lg);
}

.atom-media-grid__group[data-padding="xl"] {
  padding: var(--padding-project-block-xl);
}

.atom-media-grid__file {
  overflow: hidden;
  border-radius: var(--radius);
}

.atom-media-grid__file img,
.atom-media-grid__file video,
.atom-media-grid__file .lottie {
  width: 100%;
}

/* Zero gap: one large image exported in chunks, joined back into one. Each
   file reaches 2px under the next one across and down (negative right and
   bottom margins - the next in reading order is drawn on top), so sub-pixel
   rounding can never open a hairline between them; the exports carry those
   2px of overlap. In one column there's only the overlap down. The files lose their own rounding and the grid rounds and
   clips the whole set instead - which also trims the 2px the last row and
   column reach past it. */
.atom-media-grid[data-item-gap="zero"] {
  --item-gap: 0px;
}

.atom-media-grid[data-item-gap="zero"] .atom-media-grid__items {
  overflow: hidden;
  border-radius: var(--radius);
}

.atom-media-grid[data-item-gap="zero"] .atom-media-grid__file {
  margin: 0 -2px -2px 0;
  border-radius: 0;
}

.atom-media-grid[data-item-gap="zero"] .atom-media-grid__file :is(img, video, .lottie) {
  border-radius: 0;
}

/* One column has no neighbour across, so only the overlap down is needed -
   keeping the right edge of every file. --media-grid-columns is on the
   grid, these files' style container. */
@container style(--media-grid-columns: 1) {
  .atom-media-grid[data-item-gap="zero"] .atom-media-grid__file {
    margin-right: 0;
  }
}

/* At a cropped Omni edge the set's own corners square, like the files'
   would (see below). */
@container style(--crop-edge-top: 1) {
  .atom-media-grid[data-item-gap="zero"] .atom-media-grid__group[data-padding="none"] .atom-media-grid__items {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@container style(--crop-edge-bottom: 1) {
  .atom-media-grid[data-item-gap="zero"] .atom-media-grid__group[data-padding="none"] .atom-media-grid__items {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--omni-flush-left: 1) {
  .atom-media-grid[data-item-gap="zero"] .atom-media-grid__group[data-padding="none"] .atom-media-grid__items {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

@container style(--omni-flush-right: 1) {
  .atom-media-grid[data-item-gap="zero"] .atom-media-grid__group[data-padding="none"] .atom-media-grid__items {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

/* The files along a cropped edge of a Omni block - see the --crop-edge-*
   marker there for how they know. Squaring the group box isn't enough: with no
   padding of its own, the group's files sit flush against the card's edge, so
   it's their corners that read as rounded - and the img inside each carries its
   own radius on top of that (the global img rule near the top of this file),
   which shows as a notch cut out of the image's own pixels whatever the wrapper
   clips to.

   Which files form that row depends on the column count, resolved at runtime by
   the container query above - no literal a selector could use. But it is
   already published as --media-grid-columns on the grid, which is these files'
   own style container, so a style query reads it back and picks the matching
   :nth-child. One pair of rules per count the blueprint allows; the grid can
   never resolve outside 1-8, because clamp() bounds it.

   [data-padding="none"] because a padded group insets its files from the card
   edge - nothing touches it, so nothing should square. The group's own box is
   handled by the Omni rules either way.

   Style queries are Baseline as of May 2026. Where they aren't supported the
   whole block is skipped and the files keep their rounding, which is how this
   looked before - a smaller wrong than guessing a count and squaring a row
   that isn't at the edge. */

@container style(--crop-edge-top: 1) and style(--media-grid-columns: 1) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 1),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 1) img {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@container style(--crop-edge-top: 1) and style(--media-grid-columns: 2) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 2),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 2) img {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@container style(--crop-edge-top: 1) and style(--media-grid-columns: 3) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 3),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 3) img {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@container style(--crop-edge-top: 1) and style(--media-grid-columns: 4) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 4),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 4) img {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@container style(--crop-edge-top: 1) and style(--media-grid-columns: 5) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 5),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 5) img {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@container style(--crop-edge-top: 1) and style(--media-grid-columns: 6) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 6),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 6) img {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@container style(--crop-edge-top: 1) and style(--media-grid-columns: 7) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 7),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 7) img {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@container style(--crop-edge-top: 1) and style(--media-grid-columns: 8) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 8),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(-n + 8) img {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }
}

@container style(--crop-edge-bottom: 1) and style(--media-grid-columns: 1) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 1),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 1) img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--crop-edge-bottom: 1) and style(--media-grid-columns: 2) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 2),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 2) img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--crop-edge-bottom: 1) and style(--media-grid-columns: 3) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 3),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 3) img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--crop-edge-bottom: 1) and style(--media-grid-columns: 4) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 4),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 4) img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--crop-edge-bottom: 1) and style(--media-grid-columns: 5) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 5),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 5) img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--crop-edge-bottom: 1) and style(--media-grid-columns: 6) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 6),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 6) img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--crop-edge-bottom: 1) and style(--media-grid-columns: 7) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 7),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 7) img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--crop-edge-bottom: 1) and style(--media-grid-columns: 8) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 8),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-last-child(-n + 8) img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }
}

/* A Media Grid in a flush column: the files in its first (left) or last
   (right) track of each row reach the card's side. Same reasoning as the
   top/bottom rules above - the count is resolved at runtime and published as
   --media-grid-columns, so one pair per count the blueprint allows. */

@container style(--omni-flush-left: 1) and style(--media-grid-columns: 1) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(1n + 1),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(1n + 1) img {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

@container style(--omni-flush-right: 1) and style(--media-grid-columns: 1) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(1n),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(1n) img {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--omni-flush-left: 1) and style(--media-grid-columns: 2) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(2n + 1),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(2n + 1) img {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

@container style(--omni-flush-right: 1) and style(--media-grid-columns: 2) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(2n),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(2n) img {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--omni-flush-left: 1) and style(--media-grid-columns: 3) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(3n + 1),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(3n + 1) img {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

@container style(--omni-flush-right: 1) and style(--media-grid-columns: 3) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(3n),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(3n) img {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--omni-flush-left: 1) and style(--media-grid-columns: 4) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(4n + 1),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(4n + 1) img {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

@container style(--omni-flush-right: 1) and style(--media-grid-columns: 4) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(4n),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(4n) img {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--omni-flush-left: 1) and style(--media-grid-columns: 5) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(5n + 1),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(5n + 1) img {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

@container style(--omni-flush-right: 1) and style(--media-grid-columns: 5) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(5n),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(5n) img {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--omni-flush-left: 1) and style(--media-grid-columns: 6) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(6n + 1),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(6n + 1) img {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

@container style(--omni-flush-right: 1) and style(--media-grid-columns: 6) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(6n),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(6n) img {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--omni-flush-left: 1) and style(--media-grid-columns: 7) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(7n + 1),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(7n + 1) img {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

@container style(--omni-flush-right: 1) and style(--media-grid-columns: 7) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(7n),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(7n) img {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

@container style(--omni-flush-left: 1) and style(--media-grid-columns: 8) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(8n + 1),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(8n + 1) img {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
  }
}

@container style(--omni-flush-right: 1) and style(--media-grid-columns: 8) {
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(8n),
  .atom-media-grid__group[data-padding="none"] .atom-media-grid__file:nth-child(8n) img {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
  }
}

/* Slides atom - the Media atom holding a stack of files rather than one,
   moving from each to the next on a loop.

   The files sit in a frame of a fixed ratio instead of keeping their own
   shapes. They're rarely all the same shape, and a box that resized between
   them would shunt everything below it up and down on every fade - so the
   frame holds the ratio and each file covers it. The ratio comes in from the
   snippet, already turned on its side if the author asked for vertical. */
.atom-slides {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gutter);
}

/* Rounded twice over, deliberately: the frame clips the media to the radius,
   and the card carries its own so that padding shows as a rounded margin of
   colour around it rather than a square one. With padding at none the two
   coincide and only one is visible. No overflow:hidden needed here - unlike
   the Media atom, nothing reaches this box's edge to be clipped; the frame
   does its own clipping. */
.atom-slides__card {
  border-radius: var(--radius);
}

.atom-slides__card[data-bg]:not([data-bg="none"]) {
  background: var(--block-bg, var(--ui-bg-layer-1));
}

.atom-slides__card[data-padding="sm"] {
  padding: var(--padding-project-block-sm);
}

.atom-slides__card[data-padding="md"] {
  padding: var(--padding-project-block-md);
}

.atom-slides__card[data-padding="lg"] {
  padding: var(--padding-project-block-lg);
}

.atom-slides__card[data-padding="xl"] {
  padding: var(--padding-project-block-xl);
}

.atom-slides__frame {
  position: relative;
  aspect-ratio: var(--slides-ratio, 4 / 3);
  overflow: hidden;
  border-radius: var(--radius);
}

/* Stacked rather than sequenced: every layer fills the frame and only
   opacity tells them apart. The incoming one fades in ON TOP of the outgoing
   one, which stays fully opaque underneath until the dissolve finishes -
   fading one out as the other fades in would dip through a moment where both
   are half transparent and the card shows between them. slides.js keeps
   the z-order right; with no scripting the first layer just stays put. */
.atom-slides__layer {
  position: absolute;
  inset: 0;
  opacity: 0;

  /* Identity values, declared even though "none" never moves anything: a
     layer that gains a translate or scale only while animating would gain a
     stacking context with it, and slides.js is ordering these by z-index.
     Declaring the identity up front keeps the context there all along. */
  translate: 0;
  scale: 1;

  /* Movement eases OUT while the fade stays ease-in-out - it should settle
     into place rather than creep away and creep back. */
  transition:
    opacity var(--slides-duration) ease-in-out,
    translate var(--slides-duration) ease-out,
    scale var(--slides-duration) ease-out;
}

.atom-slides__layer[data-current="true"] {
  opacity: 1;
}

/* The slides' own captions - each Media atom's, one at a time, the
   current slide's (atom-slides.php, slides.js). Stacked in one cell, so the
   space is the longest one's and nothing shifts as they change; only the
   current one shows, fading in as the one before fades out.

   With padding they come after the frame, hanging from its bottom-left
   corner. The padding below becomes their space: at least as tall as the
   padding was, taller when a caption needs it. */
.atom-slides__card:has(> .atom-slides__captions) {
  padding-bottom: 0;
}

.atom-slides__captions {
  display: grid;
  align-content: start;
  box-sizing: border-box;
  padding-block: calc(var(--grid-gutter) / 2);
}

.atom-slides__card[data-padding="sm"] > .atom-slides__captions {
  min-height: var(--padding-project-block-sm);
}

.atom-slides__card[data-padding="md"] > .atom-slides__captions {
  min-height: var(--padding-project-block-md);
}

.atom-slides__card[data-padding="lg"] > .atom-slides__captions {
  min-height: var(--padding-project-block-lg);
}

.atom-slides__card[data-padding="xl"] > .atom-slides__captions {
  min-height: var(--padding-project-block-xl);
}

.atom-slides__captions > p {
  grid-area: 1 / 1;
  margin: 0;
  opacity: 0;
}

.atom-slides__captions > p[data-current] {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .atom-slides__captions > p {
    transition: opacity 0.3s ease;
  }
}

/* With no padding: over the slide, bottom left, in by the gutter - a
   longer caption grows upwards. White, since it's over the media. */
.atom-slides__frame > .atom-slides__captions {
  position: absolute;
  z-index: 5;
  left: var(--grid-gutter);
  right: var(--grid-gutter);
  bottom: var(--grid-gutter);
  padding: 0;
  align-content: end;
  color: #fff;
  pointer-events: none;
}

/* "None" is the same machinery with the transition taken out, rather than a
   separate code path: zeroing the duration makes the opacity swap instant,
   and slides.js reads this same property for its own timing, so the cycle
   becomes the hold alone with nothing added for a dissolve that isn't
   happening. The movement rules below don't apply to it either way - they
   select on swipe and scale. */
.atom-slides__frame[data-effect="none"] {
  --slides-duration: 0s;
}

/* Swipe and Scale. The resting state below belongs to the HIDDEN layers:
   they sit offset, and taking their turn is what settles them to nothing,
   so the movement rides in on the same transition as the fade.

   Only the incoming layer ever moves, which is forced by the dissolve
   itself - the outgoing one stays fully opaque underneath for the whole
   dissolve, so if it moved too, the strip of frame it left behind would
   show bare card until the incoming layer faded up over it. Moving only the
   incoming layer means the gap at its trailing edge is always filled by the
   outgoing layer sitting right behind it.

   Direction names where the movement GOES: "up" enters from below and
   settles upward, so the layer starts shifted down.

   The :not() is load-bearing, not decoration. These selectors are more
   specific than the [data-current] rule, so without it the offset would
   apply to the layer taking its turn as well and nothing would ever move.

   Gated on no-preference rather than undone in a reduce block, so there's
   no !important and nothing to keep in sync - with reduce set these rules
   simply never apply and the plain dissolve is what's left. The cycling
   itself carries on either way. */
@media (prefers-reduced-motion: no-preference) {
  .atom-slides__frame[data-effect="swipe"][data-direction="up"] .atom-slides__layer:not([data-current="true"]) {
    translate: 0 calc(var(--slides-shift) * 100%);
  }

  .atom-slides__frame[data-effect="swipe"][data-direction="down"] .atom-slides__layer:not([data-current="true"]) {
    translate: 0 calc(var(--slides-shift) * -100%);
  }

  .atom-slides__frame[data-effect="swipe"][data-direction="left"] .atom-slides__layer:not([data-current="true"]) {
    translate: calc(var(--slides-shift) * 100%);
  }

  .atom-slides__frame[data-effect="swipe"][data-direction="right"] .atom-slides__layer:not([data-current="true"]) {
    translate: calc(var(--slides-shift) * -100%);
  }

  /* Why the layer is bigger than the frame it sits in.

     A layer shifted off centre leaves that much of the frame uncovered
     behind it, and what shows through is the outgoing layer at full opacity
     - a hard seam rather than a blend, since the dissolve hasn't reached
     that strip. So the layer is given exactly that much extra material on
     the edge it travels away from, and is still covering the frame at both
     ends of its journey and everywhere in between.

     It's extra SIZE, not a scale: the box is this shape for the whole life
     of the atom and nothing about it animates, so a swipe is a pure slide.
     Growing the layer during the transition would cover the frame just as
     well, but a swipe would then be a swipe and a zoom at once.

     It applies to every layer, not only the hidden ones - the geometry has
     to be constant. Applied only while a layer was hidden, the box would
     change shape the instant that layer took its turn, which is the seam
     back again by another route.

     The cost is that the media is cropped to a box a shift bigger than the
     frame, so slightly tighter than the ratio alone would give. It's fixed,
     so it never reads as movement.

     Why shift/(1-shift) rather than just shift: the two percentages resolve
     against different boxes. An inset is a percentage of the CONTAINING
     BLOCK - the frame - while a percentage translate is of the element's
     OWN size, and that element is now bigger than the frame. Asking for the
     plain shift on both leaves the layer landing a fraction short, which at
     5% is a ~0.6px seam - small, but it's the same seam. Dividing by
     (1 - shift) makes the overhang exactly one travel-length of the layer
     itself, whatever the shift is set to. */
  .atom-slides__frame[data-effect="swipe"][data-direction="up"] .atom-slides__layer {
    top: calc(var(--slides-shift) / (1 - var(--slides-shift)) * -100%);
  }

  .atom-slides__frame[data-effect="swipe"][data-direction="down"] .atom-slides__layer {
    bottom: calc(var(--slides-shift) / (1 - var(--slides-shift)) * -100%);
  }

  .atom-slides__frame[data-effect="swipe"][data-direction="left"] .atom-slides__layer {
    left: calc(var(--slides-shift) / (1 - var(--slides-shift)) * -100%);
  }

  .atom-slides__frame[data-effect="swipe"][data-direction="right"] .atom-slides__layer {
    right: calc(var(--slides-shift) / (1 - var(--slides-shift)) * -100%);
  }

  /* Starts larger and settles, rather than growing into place: a layer
     coming up from under 1 has its edges inset from the frame, which reads
     as a shrinking picture rather than a camera easing to a stop. */
  .atom-slides__frame[data-effect="scale"] .atom-slides__layer:not([data-current="true"]) {
    scale: var(--slides-zoom);
  }
}

/* Cover, so a file of any shape fills the frame and is cropped instead of
   letterboxed. The radius is zeroed because the frame clips already - an
   <img> carries its own from the shared rule up top. */
.atom-slides__layer img,
.atom-slides__layer video,
.atom-slides__layer .lottie {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* Carousel atom - one item at a time, centred, swiped side to side
   (carousel.js). Sized like a one-row Marquee: the card has a set shape
   (--carousel-box, phones' --carousel-box-mobile) and each item keeps its
   own (--r, a Media atom's mobile version's --r-mobile on phones), centred
   in it. Item size is a share of the card's height (Size by Height) or
   width (Width) - never taller than the card - and the gap between items a
   share of its height. carousel.js lays the items out along it, edge to
   edge with the gap between, the current one in the middle.

   Under the items, the foot: the items' captions and room for the arrows.
   It starts at the tallest item's bottom edge and overlaps the space below
   the items; only what doesn't fit there makes the card taller than its
   shape. */
.atom-carousel {
  --carousel-box-now: var(--carousel-box-mobile);
  --carousel-narrowest-now: var(--carousel-narrowest-mobile, var(--carousel-narrowest));
  display: flex;
  flex-direction: column;
  gap: var(--grid-gutter);
}

@media (min-width: 768px) {
  .atom-carousel {
    --carousel-box-now: var(--carousel-box);
    --carousel-narrowest-now: var(--carousel-narrowest);
  }
}

/* Clips the items to its rounded edge. pan-y leaves vertical scrolling to
   the page and side-to-side movement to carousel.js. A container, so
   everything inside is sized from its width: --carousel-h is its shape's
   height, and the rows are the items and the foot. These are worked out
   where they're used, inside it, so cqw is the card's. */
.atom-carousel__card {
  --carousel-h: calc(100cqw / (var(--carousel-box-now)));
  --carousel-tallest: calc(var(--carousel-size) * var(--carousel-h));
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  container-type: inline-size;
  overflow: hidden;
  border-radius: var(--radius);
  touch-action: pan-y;
}

/* Sized by width, the narrowest shape is the tallest item. */
.atom-carousel__card[data-size-by="width"] {
  --carousel-tallest: min(var(--carousel-size) * 100cqw / var(--carousel-narrowest-now), var(--carousel-h));
}

.atom-carousel__card[data-bg]:not([data-bg="none"]) {
  background: var(--block-bg, var(--ui-bg-layer-1));
}

.atom-carousel__card[data-ready] {
  cursor: grab;
}

.atom-carousel__card[data-dragging] {
  cursor: grabbing;
}

/* The card's shape. Isolated, so the items' z-index and their overlays'
   stay among themselves, under the arrows. */
.atom-carousel__frame {
  position: relative;
  height: var(--carousel-h);
  isolation: isolate;
}

/* An item and its caption share its size: --carousel-item-h tall and
   --carousel-item-w wide. */
.atom-carousel__item,
.atom-carousel__captions > p {
  --r-now: var(--r-mobile, var(--r));
  --carousel-item-h: calc(var(--carousel-size) * var(--carousel-h));
  --carousel-item-w: calc(var(--carousel-item-h) * var(--r-now));
}

@media (min-width: 768px) {
  .atom-carousel__item,
  .atom-carousel__captions > p {
    --r-now: var(--r);
  }
}

.atom-carousel__card[data-size-by="width"] :is(.atom-carousel__item, .atom-carousel__captions > p) {
  --carousel-item-w: min(var(--carousel-size) * 100cqw, var(--carousel-h) * var(--r-now));
  --carousel-item-h: calc(var(--carousel-item-w) / var(--r-now));
}

/* Centred, then moved along by --x (px, carousel.js). Until it has placed
   them, only the current one shows. */
.atom-carousel__item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--carousel-item-w);
  height: var(--carousel-item-h);
  overflow: hidden;
  border-radius: var(--carousel-item-radius, var(--radius));
  translate: calc(-50% + var(--x, 0px)) -50%;
  -webkit-user-select: none;
  user-select: none;
}

.atom-carousel__card:not([data-ready]) .atom-carousel__item:not([data-current]) {
  visibility: hidden;
}

/* Cover: the item is the file's own shape, so nothing is cropped unless a
   Media atom's padding or mobile version says otherwise. The item clips
   and rounds. */
.atom-carousel__item img,
.atom-carousel__item video,
.atom-carousel__item .lottie:not(.media-overlay) {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  -webkit-user-drag: none;
}

/* A scrim lies over each item (media-layers). The item is isolated so a
   blended one mixes with that item's media only. */
.atom-carousel[data-scrim] .atom-carousel__item {
  isolation: isolate;
}

/* Under the items, from the tallest one's bottom edge: pulled up over the
   space below them, so only what doesn't fit there adds to the card's
   height. Room for the captions and, with more than one item, the arrows -
   both a gutter in from the edge. Not in the way of a drag. */
.atom-carousel__foot {
  box-sizing: border-box;
  margin-top: calc((var(--carousel-tallest) - var(--carousel-h)) / 2);
  padding-block: var(--grid-gutter);
  pointer-events: none;
}

.atom-carousel__foot[data-arrows] {
  min-height: calc(40px + 2 * var(--grid-gutter));
}

/* Bottom right, a gutter in - always under the items, on the background.
   The play button's frosted glass (.video-fallback__button), without its
   pale rim or shadow: a dark tint in light sections, a light one in dark
   sections (--ui-glass). White arrows in both. */
.atom-carousel__arrows {
  position: absolute;
  right: var(--grid-gutter);
  bottom: var(--grid-gutter);
  z-index: 5;
  display: flex;
  gap: 8px;
}

.atom-carousel__arrows[hidden] {
  display: none;
}

.atom-carousel__arrow {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--ui-glass);
  -webkit-backdrop-filter: blur(14px) saturate(160%);
  backdrop-filter: blur(14px) saturate(160%);
  cursor: pointer;
  touch-action: manipulation;
}

.atom-carousel__arrow svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .atom-carousel__arrow:hover {
    background: var(--ui-glass-hover);
  }
}

.atom-carousel__arrow:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: no-preference) {
  .atom-carousel__arrow {
    transition: scale 0.15s ease, background-color 0.2s ease;
  }

  .atom-carousel__arrow:active {
    scale: 0.94;
  }
}

/* The items' own captions - each Media atom's, one at a time, the centre
   item's (atom-carousel.php, carousel.js). Stacked in one cell, so the
   space is the longest one's and nothing shifts as they change; only the
   current one shows, fading in as the one before fades out - the same in
   Swipe and Fade. Each starts at its item's left edge, and stops 8px short
   of the arrows. */
.atom-carousel__captions {
  display: grid;
}

.atom-carousel__captions > p {
  grid-area: 1 / 1;
  margin: 0 0 0 max(0px, (100cqw - var(--carousel-item-w)) / 2);
  opacity: 0;
}

.atom-carousel__foot[data-arrows] .atom-carousel__captions > p {
  margin-right: calc(var(--grid-gutter) + 96px);
}

.atom-carousel__captions > p[data-current] {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .atom-carousel__captions > p {
    transition: opacity 0.3s ease;
  }
}

/* Announces "2 of 5" after someone moves it (carousel.js) - read out, never
   shown. */
.atom-carousel__status {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Stack atom - a mini website or other design built from horizontal slices
   (atom-stack.php): Media, Slides and Media Swap atoms, top to bottom, edge
   to edge, each 1px over the one above so no hairline shows at a seam. One
   background behind them all - the design's page colour or gradient - and
   the card clips everything to its rounded edge, a slice on its way in
   included. The slices' own padding and backgrounds stay as set; their
   corners square off, as in an Omni column with no gap, so the slices meet
   as one design. Their captions never show here. */
.atom-stack {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gutter);
}

.atom-stack__card {
  position: relative;
  container-type: inline-size;
  overflow: hidden;
  border-radius: var(--radius);
}

.atom-stack__card[data-bg]:not([data-bg="none"], [data-bg="gradient"]) {
  background: var(--block-bg, var(--ui-bg-layer-1));
}

.atom-stack__card[data-bg="gradient"] {
  background: var(--stack-bg);
}

.atom-stack__card[data-padding="sm"] {
  padding: var(--padding-project-block-sm);
}

.atom-stack__card[data-padding="md"] {
  padding: var(--padding-project-block-md);
}

.atom-stack__card[data-padding="lg"] {
  padding: var(--padding-project-block-lg);
}

.atom-stack__card[data-padding="xl"] {
  padding: var(--padding-project-block-xl);
}

.atom-stack__slices {
  display: flex;
  flex-direction: column;
}

.atom-stack__slice + .atom-stack__slice {
  margin-top: -1px;
}

.atom-stack__slice
    :is(.atom-media__file,
      .atom-slides__card,
      .atom-slides__frame,
      .atom-media-swap__card,
      .atom-media-swap__frame,
      .atom-overlay__frame),
.atom-stack__slice :is(.atom-media__file, .atom-slides__frame) :is(img, video, .lottie) {
  border-radius: 0;
}

.atom-stack__slice
    :is(.atom-media__caption,
      .atom-slides__caption,
      .atom-slides__captions,
      .atom-media-swap__caption) {
  display: none;
}

/* The slices' loading transitions (stack.js): the real site's timing and
   easing (--reveal-*), the movement scaled to the Stack - a rise of 3% of
   its width, a scale from 97%. While waiting a slice is only invisible,
   not moved, as on the site. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes stack-rise {
    from {
      opacity: 0;
      translate: 0 20cqw;
    }
  }

  @keyframes stack-fade {
    from {
      opacity: 0;
    }
  }

  @keyframes stack-scale {
    from {
      opacity: 0;
      scale: 0.7;
    }
  }

  .atom-stack__slice[data-slice] {
    opacity: 0;
  }

  .atom-stack__slice[data-slice="in"] {
    opacity: 1;
    animation: stack-rise var(--reveal-duration) var(--reveal-ease) backwards;
    animation-delay: calc(var(--slice-wait, 0ms) + min(var(--slice-index, 0), 3) * var(--reveal-stagger));
  }

  .atom-stack[data-transition="fade"] .atom-stack__slice[data-slice="in"] {
    animation-name: stack-fade;
  }

  .atom-stack[data-transition="scale"] .atom-stack__slice[data-slice="in"] {
    animation-name: stack-scale;
  }
}

@media print {
  .atom-stack__slice[data-slice] {
    opacity: 1;
    animation: none;
  }
}

/* Media Swap atom - two images in one box, one showing at a time. Built
   like Slides: a card for the padding and colour, a frame inside it that
   holds the shape and clips, and the images stacked in the frame.

   The second image sits ON TOP of the first and only its opacity changes.
   The first stays fully opaque underneath, so the crossfade never dips
   through a moment where both are half transparent, whichever way it runs.
   Same timing as the Slides dissolve on hover; a theme swap takes the page's
   own theme timing instead (see the theme rules below).

   The frame's shape comes from the first image (--media-swap-ratio, from the
   snippet) and the second covers it, so a mismatched pair crops instead of
   resizing the box mid-swap. */
.atom-media-swap {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gutter);
}

.atom-media-swap__card {
  border-radius: var(--radius);
}

.atom-media-swap__card[data-bg]:not([data-bg="none"]) {
  background: var(--block-bg, var(--ui-bg-layer-1));
}

.atom-media-swap__card[data-padding="sm"] {
  padding: var(--padding-project-block-sm);
}

.atom-media-swap__card[data-padding="md"] {
  padding: var(--padding-project-block-md);
}

.atom-media-swap__card[data-padding="lg"] {
  padding: var(--padding-project-block-lg);
}

.atom-media-swap__card[data-padding="xl"] {
  padding: var(--padding-project-block-xl);
}

.atom-media-swap__frame {
  position: relative;
  aspect-ratio: var(--media-swap-ratio, auto);
  overflow: hidden;
  border-radius: var(--radius);
}

.atom-media-swap__frame img,
.atom-media-swap__frame video,
.atom-media-swap__frame .lottie {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* A refused first video gets autoplay-fallback.js's still, added after both
   files in the frame - it would sit over the second one too, play button
   and all, once that's swapped in. Its own stacking context at 0 keeps the
   whole still, button included, under the second (z-index 1, below), which
   covers it as it fades in. */
.atom-media-swap__frame .video-fallback {
  z-index: 0;
}

/* Never quite 0, and on its own compositing layer from the start. Safari
   skips painting anything at opacity 0 outright, so the first time a swap
   began it had to paint and upload the whole full-size image to the GPU
   mid-fade - that ate the start of the transition and the image arrived
   near full strength, a jump. Every swap after was fine, because by then
   the layer existed. At 0.001 it's still painted, so the layer is ready
   before any swap; that's under half a step of 8-bit colour, so nothing
   shows through. */
.atom-media-swap__second {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0.001;
  will-change: opacity;
  transition: opacity var(--slides-duration) ease-in-out;
}

/* Hover: only where there's a real hover. On a touch screen :hover sticks
   after a tap, which would fight media-swap.js's own tap toggle below. */
@media (hover: hover) {
  .atom-media-swap__frame[data-trigger="hover"]:hover .atom-media-swap__second {
    opacity: 1;
  }
}

/* Set by media-swap.js: a tap on a hover atom, or a position atom's line
   having scrolled past. Both keep the Slides timing from the base rule. */
.atom-media-swap__frame:is([data-trigger="hover"], [data-trigger="position"])[data-swapped="true"] .atom-media-swap__second {
  opacity: 1;
}

/* Theme: which image shows follows whichever data-theme is NEAREST - the
   page's, a Theme Switch block's, or one pinned on the block this atom sits
   in. A selector like [data-theme="dark"] .atom-media-swap can't express
   "nearest": with <html> light and a block pinned dark, both ancestors
   match. A custom property can - it inherits, so the closest [data-theme]
   always wins, the same way --project-bg resolves above. */
:root,
[data-theme="light"] {
  --media-swap-dark: 0;
}

[data-theme="dark"] {
  --media-swap-dark: 1;
}

/* Timed and eased like the page's own theme change (body, above) rather
   than the Slides dissolve, so the image lands in step with the background
   and text changing around it. */
.atom-media-swap__frame[data-trigger="theme"] .atom-media-swap__second {
  opacity: max(var(--media-swap-dark), 0.001);
  transition: opacity var(--theme-transition-duration) ease;
}

/* The first image steps out once the second has fully covered it, and back
   in the instant a swap back begins. While both are in the frame, the top
   image's anti-aliased edges - partly transparent along the rounded corners
   - let the one underneath show through as a faint outline, very visible
   with a dark image over a light one. Hiding the first once it's covered
   leaves one image in the frame, so there's nothing to show through.

   Done with a zero-length transition and a delay, never a fade, so the
   crossfade itself is untouched: the first stays fully opaque under the
   second for the whole fade-in (no see-through moment in the middle), then
   drops out. The delay only applies on the way to swapped - the base rule
   has none, so on the way back the first is already there, under a second
   that's still opaque, before that one starts to fade. */
.atom-media-swap__first {
  transition: opacity 0s linear 0s;
}

@media (hover: hover) {
  .atom-media-swap__frame[data-trigger="hover"]:hover .atom-media-swap__first {
    opacity: 0;
    transition-delay: var(--slides-duration);
  }
}

.atom-media-swap__frame:is([data-trigger="hover"], [data-trigger="position"])[data-swapped="true"] .atom-media-swap__first {
  opacity: 0;
  transition-delay: var(--slides-duration);
}

/* Theme: the same, driven by --media-swap-dark (0 or 1) rather than a
   selector, so it follows whichever data-theme is nearest, as the second
   image does. The delay is the theme timing times that same 0 or 1: the
   full fade on the way to dark, none on the way back. */
.atom-media-swap__frame[data-trigger="theme"] .atom-media-swap__first {
  opacity: calc(1 - var(--media-swap-dark));
  transition-delay: calc(var(--theme-transition-duration) * var(--media-swap-dark));
}

/* Hairline edges - Slides, Media Swap and Stack. Anything layered under
   the edge of one of these boxes showed through it as a faint outline,
   mostly in Safari: a box's edge rarely lands on a whole pixel, so the edge
   pixels are only partly covered by what's on top, and whatever is beneath
   bleeds into them - very visible as a white card's background around a
   dark image, or a light slide under a dark one.

   So nothing that's meant to be hidden reaches the edge. The media is 1px
   bigger than its frame all round, which clips it, so every edge pixel is
   fully covered by whatever is on top. And with no padding - where the
   card's background sits right under the media's edge - the background
   stops 1px short of the edge (padding plus a content-box background, the
   corner radius following), and whatever fills the card takes that 1px
   back with a negative margin, so the box is the same size as before.

   The cost is 1px of each image at every edge, out of sight. A transparent
   slice in a Stack shows the background 1px in from the card's edge rather
   than right up to it. */
.atom-slides__layer {
  inset: -1px;
}

.atom-media-swap__frame > .atom-media-swap__first {
  max-width: none;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
  margin: -1px;
}

.atom-media-swap__frame > .atom-media-swap__second {
  max-width: none;
  inset: -1px;
  width: calc(100% + 2px);
  height: calc(100% + 2px);
}

:is(.atom-slides__card, .atom-media-swap__card, .atom-stack__card)[data-padding="none"][data-bg]:not([data-bg="none"]) {
  padding: 1px;
  background-clip: content-box;
}

/* A Stack whose slices are still to land - waiting below the screen, or
   rising in (stack.js) - keeps its background right up to the edge, or the
   1px held back shows as a gap around the slices as they move. Pulled back
   in once every slice is in place, when they cover that edge again. */
.atom-stack__card[data-padding="none"][data-bg]:not([data-bg="none"]):has(.atom-stack__slice[data-slice]) {
  background-clip: border-box;
}

.atom-slides__card[data-padding="none"][data-bg]:not([data-bg="none"]) > .atom-slides__frame,
.atom-media-swap__card[data-padding="none"][data-bg]:not([data-bg="none"]) > :is(.atom-media-swap__frame, .atom-overlay__frame) {
  margin: -1px;
}

/* The Stack's slices also run 1px past the card, which clips them like a
   frame - so 2px, the padding's 1px and then the bleed's. (Safari draws an
   SVG slice short of its box by varying amounts, more than any overlap
   worth losing from every image hides, so Stack slices are exported as
   JPG or PNG rather than SVG.) */
.atom-stack__card[data-padding="none"] > .atom-stack__slices {
  margin: -1px;
}

.atom-stack__card[data-padding="none"][data-bg]:not([data-bg="none"]) > .atom-stack__slices {
  margin: -2px;
}

/* Overlays (the Media atom's Overlays list - the overlay-frame snippet):
   the frame holds the composition and clips it. It takes its shape from the
   base image, which sits in normal flow; each layer is absolutely placed by
   percentages of that image (worked out from the author's pixel values in
   mediaOverlayFrame()), so the whole thing scales as one and every video
   stays locked to its spot. The class names are the retired Overlay atom's,
   kept since the content and scripts already know them. */
/* A container, so an overlay's corner radius can be given in cqw - a
   length that scales with the frame, like the rest of the composition.
   Isolated, so a scrim layer's blend mode mixes with the layers below it in
   the frame and nothing behind the frame. */
.atom-overlay__frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  container-type: inline-size;
  isolation: isolate;
}

/* The frame clips to the radius already, so the base image drops its own.
   --frame-lift lowers it when an overlay runs past its top and the frame
   grows upward (mediaOverlayFrame()) - in cqw of the frame, so it resolves
   here, inside the container. */
.atom-overlay__frame > img,
.atom-overlay__frame > video,
.atom-overlay__frame > .lottie {
  display: block;
  width: 100%;
  margin-top: var(--frame-lift, 0);
  border-radius: 0;
}

/* A Media Swap atom's base is its own frame, holding both files. Isolated,
   so what it stacks inside itself stays under the overlays. Clicks and hover
   pass through the overlays to it, so they can't get in the way of a swap -
   other than a refused video's play button. */
.atom-overlay__frame > .atom-media-swap__frame {
  margin-top: var(--frame-lift, 0);
  border-radius: 0;
  isolation: isolate;
}

.atom-media-swap .atom-overlay__item {
  pointer-events: none;
}

.atom-media-swap .atom-overlay__item .video-fallback {
  pointer-events: auto;
}

/* Each overlay's wrapper does the clipping and rounding (radius, if any,
   arrives inline); the video only fills it. Cover rather than stretch, so a
   rectangle a hair off the video's own shape crops rather than distorts. */
/* The mask is the long-standing fix for WebKit not clipping a composited
   child - a playing video - to its parent's rounded corners. Masking the
   wrapper makes WebKit clip everything inside it by its own rounded shape.
   It changes nothing visible: the gradient is opaque white throughout. */
.atom-overlay__item {
  position: absolute;
  /* Above the still autoplay-fallback.js adds for a refused base video,
     which lands after the items in the frame and would otherwise cover
     them. */
  z-index: 1;
  overflow: hidden;
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.atom-overlay__item img,
.atom-overlay__item video,
.atom-overlay__item .lottie {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* A text layer: its box is the base, so overflow: hidden above clips long text
   at the base's edge. The rest arrives inline (mediaOverlayFrame()). */
.atom-overlay__text {
  display: flex;
  box-sizing: border-box;
}

.atom-overlay__copy {
  display: grid;
  gap: var(--grid-gutter);
  min-width: 0;
}

/* Each text names the token itself so that its own Light mode or Dark mode
   data-theme, or a Theme Switch for Follow, reaches it - see
   .project-block[data-theme]. A Custom colour arrives inline over this. */
.atom-overlay__copy p {
  margin: 0;
  color: var(--text-primary);
  white-space: pre-line;
  overflow-wrap: break-word;
}

/* Like every other eyebrow on the site (captions elsewhere are tertiary). */
.atom-overlay__copy .atom-overlay__eyebrow,
.atom-overlay__copy .atom-overlay__caption {
  color: var(--text-secondary);
}

.atom-media__caption,
.atom-media-grid__caption,
.atom-slides__caption,
.atom-carousel__caption,
.atom-slides__captions,
.atom-carousel__captions,
.atom-stack__caption,
.atom-media-swap__caption,
.atom-crop__caption,
.atom-marquee__caption,
.block-caption {
  color: var(--text-tertiary);
}

/* Marquee atom - files in rows that bleed off both ends, alternate rows
   half an item along (atom-marquee.php, marquee.js). The box takes
   the set ratio and always carries a colour: the space around the items and
   the row ends show it. marquee.js picks the row count, sizes the rows
   and fills them; the rest is here.

   The rows touch. Each item sits centred in its row at --marquee-size of the
   row's thickness (the Item size slider), so the space between items across
   rows is the rest of the thickness. The space along a row (--marquee-gap) is
   its own slider, which marquee.js turns into px. */
.atom-marquee {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gutter);
}

.atom-marquee__box {
  position: relative;
  /* A blended scrim mixes with the marquee's own items and colour only. */
  isolation: isolate;
  aspect-ratio: var(--marquee-ratio-mobile, 1 / 1);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--block-bg, var(--ui-bg-layer-1));
}

/* The rows share the box evenly across, the two outer ones running
   --marquee-bleed (from marquee.js) past its edges so that two thirds of
   their items show - and each one runs the box's full length. */
.atom-marquee__rows {
  position: absolute;
  inset: calc(var(--marquee-bleed, 0px) * -1) 0;
  display: flex;
  flex-direction: column;
}

.atom-marquee__box[data-orientation="vertical"] .atom-marquee__rows {
  inset: 0 calc(var(--marquee-bleed, 0px) * -1);
  flex-direction: row;
}

.atom-marquee__row {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
}

/* A row's items, centred across it, starting --marquee-start before the box's
   edge (marquee.js - alternate rows half an item apart). */
.atom-marquee__track {
  display: flex;
  align-items: center;
  gap: var(--marquee-gap, 0px);
  width: max-content;
  height: 100%;
  translate: var(--marquee-start, 0) 0;
}

.atom-marquee__box[data-orientation="vertical"] .atom-marquee__track {
  flex-direction: column;
  width: 100%;
  height: max-content;
  translate: 0 var(--marquee-start, 0);
}

/* Sized from the row alone: --marquee-size of its thickness across, and as long
   as its own shape (--item-ratio, from the snippet) makes it. Rows running
   down size theirs from the marquee's height instead (below). The clip and
   radius are on this wrapper, never on a bare <video> - Safari paints a
   decoding video black when it carries its own radius. Corners set to
   Custom publish --marquee-item-radius on the rows (atom-marquee.php). */
.atom-marquee__item {
  flex: none;
  height: calc(var(--marquee-size, 0.7) * 100%);
  aspect-ratio: var(--item-ratio, 1);
  overflow: hidden;
  border-radius: var(--marquee-item-radius, var(--radius));
}

/* Size by (data-size-by, marquee.js): measured along the rows, an item is
   --marquee-size of the marquee's length (--marquee-length, from marquee.js)
   - as thick as its shape makes that, but never thicker than its row.
   Measured across, it's --marquee-size of the row's thickness. */
.atom-marquee__box[data-size-by="width"] .atom-marquee__item {
  height: min(100%, var(--marquee-length, 0px) / var(--item-ratio, 1));
}

.atom-marquee__box[data-orientation="vertical"] .atom-marquee__item {
  width: min(100%, var(--marquee-length, 0px) * var(--item-ratio, 1));
  height: auto;
}

.atom-marquee__box[data-orientation="vertical"][data-size-by="width"] .atom-marquee__item {
  width: calc(var(--marquee-size, 0.7) * 100%);
}

/* A Media atom in place of a file (media-atom-slot.php) fills the item.
   Its padding scales with the item (tokens.css) - the page-sized padding
   would leave a small item's media a sliver. */
.atom-marquee__item--atom {
  position: relative;
}

.atom-marquee__item--atom > .atom-media--slot {
  container-type: size;
}

.atom-marquee__item--atom .atom-media__file[data-padding="sm"] {
  padding: var(--padding-marquee-atom-sm);
}

.atom-marquee__item--atom .atom-media__file[data-padding="md"] {
  padding: var(--padding-marquee-atom-md);
}

.atom-marquee__item--atom .atom-media__file[data-padding="lg"] {
  padding: var(--padding-marquee-atom-lg);
}

.atom-marquee__item--atom .atom-media__file[data-padding="xl"] {
  padding: var(--padding-marquee-atom-xl);
}

.atom-marquee__item img,
.atom-marquee__item video,
.atom-marquee__item .lottie {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
}

/* Item overlay (atom-marquee.php): one image over every item, drawn the way
   the other atoms' overlay image is (data-overlay, further up) - at the same
   z-index, over the scrim, clipped by the item's mask and rounding. Fit keeps
   the whole overlay inside the item, centred; Fill covers it. */
.atom-marquee__rows[data-item-overlay] .atom-marquee__item {
  position: relative;
}

.atom-marquee__rows[data-item-overlay] .atom-marquee__item::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  background: var(--item-overlay) center / contain no-repeat;
  pointer-events: none;
}

.atom-marquee__rows[data-item-overlay="fill"] .atom-marquee__item::after {
  background-size: cover;
}

/* The scrim, over the whole marquee like the overlay image and under it. */
.atom-marquee__scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

/* The Overlays list, over the whole marquee rather than each item
   (marqueeOverlayItems()), above the rows and the scrim. Each layer is placed
   against the box it actually lands in, so the box is a size container:
   cqw and cqh follow the marquee's shape on either side of 768px, and
   Custom's --overlay-unit scales with it. The box, not this layer: a
   container is its own stacking context, and a scrim layer's blend mode
   has to reach the rows - the box is already isolated, so it stops there.
   Clicks pass through, other than to a refused video's play button. */
.atom-marquee__box:has(> .atom-marquee__layers) {
  container-type: size;
}

.atom-marquee__layers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.atom-marquee__layers .video-fallback {
  pointer-events: auto;
}

/* Animated: each row holds its set twice and slides by exactly one set
   (--marquee-set), which lands the copy where the original began, so the loop
   has no seam. Opposite rows run it backwards. Paused while the marquee is off
   screen. */
.atom-marquee__box[data-motion="animated"] .atom-marquee__track {
  /* The duration is only a fallback: marquee.js sets each row's own on the
     track, from the Speed setting. */
  animation: marquee-x 30s linear infinite;
  will-change: translate;
}

.atom-marquee__box[data-motion="animated"][data-orientation="vertical"] .atom-marquee__track {
  animation-name: marquee-y;
}

.atom-marquee__row[data-reverse="true"] .atom-marquee__track {
  animation-direction: reverse;
}

.atom-marquee__box[data-paused="true"] .atom-marquee__track {
  animation-play-state: paused;
}

/* Swipe: marquee.js moves each row itself, setting its translate at rest
   and animating it between rests. */
.atom-marquee__box[data-motion="swipe"] .atom-marquee__track {
  will-change: translate;
}

@keyframes marquee-x {
  from {
    translate: var(--marquee-start, 0) 0;
  }

  to {
    translate: calc(var(--marquee-start, 0px) - var(--marquee-set, 0px)) 0;
  }
}

@keyframes marquee-y {
  from {
    translate: 0 var(--marquee-start, 0);
  }

  to {
    translate: 0 calc(var(--marquee-start, 0px) - var(--marquee-set, 0px));
  }
}

@media (min-width: 768px) {
  .atom-marquee__box {
    aspect-ratio: var(--marquee-ratio, 16 / 9);
  }
}

/* Crop atom - the Crop block reduced to what fits in a column: a padded
   card holding one file, with the same top/bottom crop toggles. No second
   column, so no swap or sticky either, and no Text option - the only text
   is the caption, which sits below the card like the Media atom's, on the
   page's own background rather than on the colour.

   Cropping squares the clipping wrapper and the <img> - both, since an
   <img> carries its own radius from the shared img rule and would otherwise
   cut a rounded notch inside a square wrapper. The card is left alone; see
   below for why it differs from the block there. */
.atom-crop {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gutter);
}

.atom-crop__card {
  background: var(--block-bg, var(--ui-bg-layer-1));
  border-radius: var(--radius);
}

.atom-crop__card[data-padding="sm"] {
  padding: var(--padding-project-block-sm);
}

.atom-crop__card[data-padding="md"] {
  padding: var(--padding-project-block-md);
}

.atom-crop__card[data-padding="lg"] {
  padding: var(--padding-project-block-lg);
}

.atom-crop__card[data-padding="xl"] {
  padding: var(--padding-project-block-xl);
}

/* Only the padding goes - the card keeps its corners, and the block does the
   same. Flattening the card makes the box a different shape rather than
   making the image look cropped out of it. The image still runs flush; it's
   the image's corners that square, below. */
.atom-crop__card[data-crop-top="true"] {
  padding-top: 0;
}

.atom-crop__card[data-crop-bottom="true"] {
  padding-bottom: 0;
}

.atom-crop__media {
  overflow: hidden;
  border-radius: var(--radius);
}

.atom-crop__media img,
.atom-crop__media video,
.atom-crop__media .lottie {
  width: 100%;
}

.atom-crop__card[data-crop-top="true"] .atom-crop__media,
.atom-crop__card[data-crop-top="true"] .atom-crop__media img {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.atom-crop__card[data-crop-bottom="true"] .atom-crop__media,
.atom-crop__card[data-crop-bottom="true"] .atom-crop__media img {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Height cap - optional on the Media, Media Swap, Slides and Crop atoms
   (blueprints/fields/height-cap.yml, mediaHeightCap() in the media-layers
   plugin). The media keeps its shape, so a cap on its height is a cap on
   the atom's width: the cap times the media's width / height, plus the
   card's padding either side. The caption is inside the atom, so it
   narrows with the media. Short media is under its max-width already and
   nothing changes. The margins place a narrowed atom in its column.
   Heights are svh, so the cap holds still while Safari's toolbar comes and
   goes. These are the phone values - the mobile cap and the mobile
   version's shape when there are any - and the desktop ones take over in
   the 768px block at the end of this file. */
.atom[data-height-cap] {
  width: 100%;
  max-width: calc(
    var(--cap-height-mobile, var(--cap-height)) * var(--cap-ratio-mobile, var(--cap-ratio))
    + var(--cap-inset, 0px) * 2
  );
}

.atom[data-height-cap="centre"] {
  margin-inline: auto;
}

.atom[data-height-cap="right"] {
  margin-inline-start: auto;
}

/* Stacked, below 768px: each column on its own row, as many tracks wide
   as its mobile width and placed by its mobile alignment (omni.php). Which
   one comes first is DOM order, which the template sets (see $minorFirst
   there). Centred with an odd number of spare tracks, half a track further
   along, as side by side. The 768px block places them side by side. */
.block-omni .omni__columns > :is(.omni__major, .omni__minor) {
  grid-column: var(--omni-mobile-start, 1) / span var(--omni-mobile-span, 12);
}

@media (max-width: 767.98px) {
  .block-omni .omni__columns > [data-mobile-half="true"] {
    translate: calc((var(--grid-col) + var(--grid-gutter)) / 2) 0;
  }
}

/* Phone-only options for the stacked columns. Kept inside their own query
   rather than undone in the 768px block: these selectors outrank the plain
   desktop column rules there, so they'd otherwise carry on past the
   breakpoint.

   The gap is the grid's row gap - the only row gap there is, since the two
   columns stack as two rows - on the project gap tokens, as the Gap block
   uses. It's the whole space between the columns, so unlike the Gap block
   nothing comes off it. Gutter matches no rule and keeps the base
   --grid-gutter. */
@media (max-width: 767.98px) {
  .block-omni[data-mobile-gap="sm"] .omni__columns {
    row-gap: var(--gap-project-sm);
  }

  .block-omni[data-mobile-gap="md"] .omni__columns {
    row-gap: var(--gap-project-md);
  }

  .block-omni[data-mobile-gap="lg"] .omni__columns {
    row-gap: var(--gap-project-lg);
  }
}

/* Theme Switch block - a threshold marker, never drawn. display:none rather
   than height:0 or visibility:hidden on purpose: content blocks are rows of a
   grid with a row gap, so an element with any box at all - even a zero-height
   one - still adds a gap and pushes the blocks either side apart. Inserting a
   theme switch has to change nothing about the layout, and only display:none
   guarantees that, because it generates no box to be spaced.

   The cost is that the marker has no position to measure, which is why
   theme-scroll.js takes its line from the neighbouring block instead. */
.block-theme-switch {
  display: none;
}

/* Gap block - nothing but vertical space between the two blocks either side.
   The size tokens name the TOTAL separation they produce, which is why the
   grid's own row gaps are subtracted here rather than added to: content
   blocks are grid rows, so dropping one more row in contributes a gutter
   above AND below this element. Without the subtraction a "medium" gap would
   come out as 150 + two gutters, and would drift further from the token as
   the gutter grows with the viewport. */
.block-gap[data-size="sm"] {
  height: calc(var(--gap-project-sm) - var(--grid-gutter) * 2);
}

.block-gap[data-size="md"] {
  height: calc(var(--gap-project-md) - var(--grid-gutter) * 2);
}

.block-gap[data-size="lg"] {
  height: calc(var(--gap-project-lg) - var(--grid-gutter) * 2);
}

/* Gap atom - the Gap block, one level in. Same contract: the size names the
   TOTAL separation between the atoms either side, so the column's own gaps
   have to come off, one above this element and one below.

   What gets subtracted isn't the gutter, though. An atom column's gap is
   whichever the block chose - Omni publishes --item-gap, and a block
   set to the larger one spaces its atoms by that. Crop's and Stretch's
   columns have no such control and sit on the gutter, so that's the
   fallback. Reading the same variable the column's own `gap` reads is what
   keeps the total honest when the author changes it.

   The sizes are the block's, unchanged: a gap should measure the same
   whether it separates two blocks or two atoms. */
.atom-gap[data-size="sm"] {
  height: calc(var(--gap-project-sm) - var(--item-gap, var(--grid-gutter)) * 2);
}

.atom-gap[data-size="md"] {
  height: calc(var(--gap-project-md) - var(--item-gap, var(--grid-gutter)) * 2);
}

.atom-gap[data-size="lg"] {
  height: calc(var(--gap-project-lg) - var(--item-gap, var(--grid-gutter)) * 2);
}

/* Scroll Video block - a video scrubbed by the scrollbar (scroll-video.js).
   The card pins while the track scrolls past it, and that travel is what the
   playhead is mapped onto.

   The track is the grid item, not the card: a block normally spans the grid
   itself, but this one needs an outer box tall enough to scroll through, and
   the card has to be free to stick inside it. The extra height is an empty
   ::after rather than a height on the track, so the box comes out as exactly
   the card plus the author's distance whatever the card's own height turns
   out to be - nothing has to be measured, and the video keeps its natural
   shape instead of being forced to fill a viewport.

   It has to be a child, not padding on the track. A sticky element can only
   travel within its containing block, and that is the parent's CONTENT box -
   padding sits outside it, so a padded track gives the card a travel range of
   zero and it never sticks at all.

   1vh, not 1svh or 1lvh: the distance is a scroll length, and it should mean
   the same thing whether or not a mobile browser's toolbars happen to be
   showing at the time.

   What sticks is the pin, a viewport-tall box that centres the card inside
   itself, rather than the card directly. Sticking the card would need a top
   offset of "half the viewport minus half the card", and a sticky element's
   percentage offsets resolve against its container's height, not its own -
   so the card's height would have to be measured in JavaScript and written
   back as a variable. A full-height flex box centres it with no measuring
   and no layout dependency at all.

   Width is set on the track, in the grid's own terms: one track is the
   twelfth of the row left after the eleven gutters, and n columns is n of
   those plus the n-1 gutters between them - so a narrower video lines up
   with the page grid exactly rather than approximately. Auto margins place
   it, which avoids naming grid lines: a right-aligned span would otherwise
   need a start line of 13 minus the width, and grid line numbers can't be
   calc()ed.

   The author sets a count per breakpoint, and only the count crosses the
   breakpoint: --scroll-video-columns is the mobile one here and is swapped
   for the desktop one at the media query, so the formula and the position
   rules are each written once. Position is deliberately NOT split - the same
   side applies at both sizes. */
.scroll-video {
  grid-column: 1 / -1;
  --scroll-video-columns: var(--scroll-video-columns-mobile);
  width: calc(
    (100% - (var(--grid-columns) - 1) * var(--grid-gutter)) /
      var(--grid-columns) * var(--scroll-video-columns) +
    var(--grid-gutter) * (var(--scroll-video-columns) - 1)
  );
}

.scroll-video[data-position="centre"] {
  margin-inline: auto;
}

.scroll-video[data-position="right"] {
  margin-inline-start: auto;
}

.scroll-video::after {
  content: "";
  display: block;
  height: calc(var(--scroll-video-distance) * 1vh);
}

.scroll-video__pin {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* The caption rides along inside the pin, so the gap that would have come
     from the blocks grid has to come from here instead - same value. */
  gap: var(--grid-gutter);
}

/* The clip and radius live on this wrapper rather than the video, for the
   same reason as .atom-media__file: a bare <video> carrying its own
   border-radius renders black in Safari. */
.scroll-video__media {
  overflow: hidden;
  border-radius: var(--radius);
}

.scroll-video__media video {
  width: 100%;
}

/* Crop top/bottom, the same pair every other block has: the padding goes and
   the video's corners square at that edge, since it is now what runs flush
   to it. The card keeps its own corners. */
.block-scroll-video[data-crop-top="true"] {
  padding-top: 0;
}

.block-scroll-video[data-crop-bottom="true"] {
  padding-bottom: 0;
}

.block-scroll-video[data-crop-top="true"] .scroll-video__media {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.block-scroll-video[data-crop-bottom="true"] .scroll-video__media {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

/* Masonry block - atoms flowing into however many columns the block's own
   width can afford, between the author's minimum and maximum.

   Multi-column rather than grid: it's the only CSS layout that packs items
   of uneven height without measuring them in JavaScript, and it keeps DOM
   order, so reading and tab order match what's on screen. Items flow down
   each column in turn rather than across rows - that's inherent to
   multi-column, and fine for a wall of imagery where the texture is the
   point rather than the sequence.

   The count is derived from the container's own width, not the viewport, so
   a masonry sitting inside a narrow column or a heavily padded card gets a
   sensible number of columns rather than one chosen for the page. That's
   what container-type buys, and why there's no breakpoint ladder here.

   round(down, 100cqi / --masonry-column-min) is "how many columns of at
   least that width fit", and clamp() bounds it by the author's two values -
   so both are honoured exactly at every width. The plain column-count above
   it is the fallback for engines without round(); it holds the minimum,
   which degrades safely rather than cramming in columns. */
.block-masonry {
  container-type: inline-size;
}

.block-masonry {
  --item-gap: var(--padding-project-block-grid-gutter);
}

/* The sizes, one rule each rather than one per block: the value is the same
   wherever it is chosen, and only the default differs per consumer (declared
   on each root above, which is what stops a block's choice leaking into an
   atom nested inside it). Anything not listed here falls back to that
   default, the grid gutter. */
.block-masonry[data-item-gap="sm"],
.block-omni :is(.omni__major, .omni__minor)[data-item-gap="sm"],
.atom-media-grid[data-item-gap="sm"] {
  --item-gap: var(--padding-project-block-sm);
}

.block-masonry[data-item-gap="md"],
.block-omni :is(.omni__major, .omni__minor)[data-item-gap="md"],
.atom-media-grid[data-item-gap="md"] {
  --item-gap: var(--padding-project-block-md);
}

.block-masonry[data-item-gap="lg"],
.block-omni :is(.omni__major, .omni__minor)[data-item-gap="lg"],
.atom-media-grid[data-item-gap="lg"] {
  --item-gap: var(--padding-project-block-lg);
}

.block-masonry[data-item-gap="xl"],
.block-omni :is(.omni__major, .omni__minor)[data-item-gap="xl"],
.atom-media-grid[data-item-gap="xl"] {
  --item-gap: var(--padding-project-block-xl);
}

/* Gap between items, switchable per block. --item-gap is declared on each
   consumer's own root rather than inherited from further up, so an atom that
   sets its own gap keeps it even when it sits inside a block that has chosen
   the larger one. Only gaps BETWEEN items read it: a block's outer padding,
   the gap between a column's two tracks (which has to stay on --grid-gutter
   or the block's 12 tracks stop lining up with the page's) and the gap above
   a caption are all left alone. */
.masonry__items {
  column-gap: var(--item-gap);
  column-count: var(--masonry-min);
  column-count: clamp(
    var(--masonry-min),
    round(down, 100cqi / var(--masonry-column-min)),
    var(--masonry-max)
  );
}

/* Viewport mode - pinned on one count, as for the Media Grid above. */
.block-masonry[data-columns="viewport"] {
  --masonry-min: var(--masonry-mobile);
  --masonry-max: var(--masonry-mobile);
}

/* break-inside keeps an item from being split down the middle by a column
   boundary. The gap between items can't come from row-gap: in multi-column,
   gap only governs the space BETWEEN columns.

   It's padding INSIDE this box rather than a margin below it, and that
   distinction matters. A margin sits outside the box, so it isn't covered by
   break-inside: avoid - when a column break lands part-way through one, the
   remainder is carried to the top of the next column and that column starts
   lower than its neighbours by a stray fraction of a gutter. The spec only
   requires margins to be truncated at FORCED breaks; at the automatic breaks
   multi-column makes, truncating is optional, so Chromium drops them and
   WebKit doesn't. Padding is part of the box break-inside keeps whole, so
   there's nothing left over to carry. */
.masonry__item {
  break-inside: avoid;
  padding-block-end: var(--item-gap);
}

/* The clip and radius live on this inner wrapper rather than on the media,
   for the same reason as .atom-media__file: a bare <video> carrying its
   own border-radius renders black in Safari. It has to be a separate element
   from .masonry__item too - clipping the padded box would round the corners
   a gutter below the media instead of around it. */
.masonry__media {
  overflow: hidden;
  border-radius: var(--radius);
}

/* Fill the column whatever the file's own pixel size - the global rule is
   max-width:100%, which caps but never stretches, so a file narrower than
   its column would sit short of the edge. */
.masonry__media img,
.masonry__media video,
.masonry__media .lottie {
  width: 100%;
}

/* Every item carries bottom padding, including whichever ends each column,
   so the block would otherwise finish with a stray gutter below it. */
.masonry__items {
  margin-block-end: calc(var(--item-gap) * -1);
}

/* The one structural breakpoint in the whole layout: everywhere else is
   fluid, but a grid-column span can't be - it's always a whole number of
   tracks, so anywhere content sits in side-by-side columns (the header,
   Text's left/right alignment, and Omni's second column) has to switch
   to stacked single-column below a real threshold instead.
   768px is a standard, round mobile/desktop line - adjust here (and only here)
   if it ever needs to move. Swap and sticky are both meaningless once
   stacked (there's no "side" to swap to, nothing to stay level with), so
   those live here too rather than applying unconditionally.

   This has to stay the LAST thing in the file: it overrides the mobile-
   first base rules declared throughout (display:flex -> grid, plus swap/
   sticky), and a media query only wins a tie in specificity by coming
   later in source order - it gets no automatic priority just for being
   conditional. Moved below its own base rule, it would silently lose. */

/* Lets each sticky column's own `top` glide along with --sticky-padding-top
   as it grows/shrinks (see that token's definition, above) instead of
   jumping - which is what keeps it visually in step with the nav's own
   slide, even though neither side knows the other's animation exists. */
@media (prefers-reduced-motion: no-preference) {
  .header-intro,
  .omni__minor[data-sticky="true"],
  .about__image {
    transition: top 0.5s ease;
  }
}

@media (min-width: 768px) {
  .atom[data-height-cap] {
    max-width: calc(var(--cap-height) * var(--cap-ratio) + var(--cap-inset, 0px) * 2);
  }

  .atom-media-grid[data-columns="viewport"] {
    --media-grid-min: var(--media-grid-desktop);
    --media-grid-max: var(--media-grid-desktop);
  }

  .block-masonry[data-columns="viewport"] {
    --masonry-min: var(--masonry-desktop);
    --masonry-max: var(--masonry-desktop);
  }

  .nav-links {
    grid-column: 10 / span 3;
  }

  .header-hero__desktop {
    display: block;
  }

  .atom-media__variant[data-variant="desktop"] {
    display: block;
  }

  .atom-media__variant[data-variant="mobile"] {
    display: none;
  }

  .header-hero__mobile {
    display: none;
  }

  /* Hero, then the left column's title and stack, then a last, flexible
     row with nothing in it. The intro beside the title and stack spans
     down to the end, so an intro taller than both lands its extra height
     in that last row, below the stack - not between the title and the
     stack. */
  .header {
    grid-template-rows: auto auto auto 1fr;
  }

  .header-title {
    grid-column: 1 / span 6;
    /* Directly above the stack here; on mobile the intro's in between and
       this space moves to .header-intro. */
    margin-bottom: var(--gap-header-stack);
  }

  .header-intro {
    grid-column: 8 / span 5;
    grid-row: 2 / -1;
    /* Beside the title and header-stack here, not above the stack, so the
       base rule's margin-bottom before header-stack doesn't apply. */
    margin-bottom: 0;
    /* Only sticky once it's actually a side column next to header-stack -
       below this breakpoint it's just another full-width stacked block,
       and staying sticky there has nothing to stay level with. */
    align-self: start;
    position: sticky;
    top: var(--sticky-padding-top);
  }

  .header-stack {
    grid-column: 1 / span 6;
    grid-row: 3;
  }

  /* Side by side: each column's first grid line and width in tracks, from
     the block's widths and position (omni.php), so this is the one rule for
     every layout. grid-row: 1 on both - without it, a column placed on
     earlier tracks than the one before it in the DOM is bumped to row 2 by
     sparse auto-placement, which won't backfill a range it has moved past. */
  .block-omni .omni__columns > :is(.omni__major, .omni__minor) {
    grid-column: var(--omni-start) / span var(--omni-span);
    grid-row: 1;
  }

  /* Vertical alignment, Bottom (omni.php): the shorter column ends level
     with the taller one, a column with its own background included. */
  .block-omni[data-valign="bottom"] .omni__columns > :is(.omni__major, .omni__minor) {
    align-self: end;
  }

  /* Centred with an odd number of spare tracks: the pair sits half a track
     further along than the grid line it's placed on - centred exactly, its
     edges mid-column. */
  .block-omni[data-half="true"] .omni__columns > :is(.omni__major, .omni__minor) {
    translate: calc((var(--grid-col) + var(--grid-gutter)) / 2) 0;
  }

  /* The cropped edge squares the atom that runs flush to it, so the corner
     doesn't stay rounded where the media now reaches the card's edge. The
     minor column is never cropped, so this is the major column only - the
     same "main media only" rule the Crop block follows.

     Side by side, the major column reaches both edges whichever order the
     two are in, so no :first-child/:last-child test is needed here - unlike
     the stacked case earlier in this file, where only the leading column is
     at the top edge and only the trailing one is at the bottom. */
  /* Only the count changes at this breakpoint - the width it feeds and the
     position that places it are declared once, further up. */
  .scroll-video {
    --scroll-video-columns: var(--scroll-video-columns-desktop);
  }

  .block-omni[data-crop~="top"] .omni__major:where(:not([data-column-padding])) > :first-child {
    --crop-edge-top: 1;
  }

  .block-omni[data-crop~="bottom"] .omni__major:where(:not([data-column-padding])) > :last-child {
    --crop-edge-bottom: 1;
  }

  .block-omni[data-crop~="top"] .omni__major:where(:not([data-column-padding])) > :first-child
    :is(.atom-media__file,
        .atom-media-grid__group,
        .atom-slides__card,
        .atom-slides__frame,
        .atom-carousel__card,
        .atom-carousel__item,
        .atom-media-swap__card,
        .atom-media-swap__frame,
        .atom-overlay__frame,
        .atom-crop__card,
        .atom-crop__media),
  .block-omni[data-crop~="top"] .omni__major:where(:not([data-column-padding])) > :first-child
    :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) img {
    border-top-left-radius: 0;
    border-top-right-radius: 0;
  }

  .block-omni[data-crop~="bottom"] .omni__major:where(:not([data-column-padding])) > :last-child
    :is(.atom-media__file,
        .atom-media-grid__group,
        .atom-slides__card,
        .atom-slides__frame,
        .atom-carousel__card,
        .atom-carousel__item,
        .atom-media-swap__card,
        .atom-media-swap__frame,
        .atom-overlay__frame,
        .atom-crop__card,
        .atom-crop__media),
  .block-omni[data-crop~="bottom"] .omni__major:where(:not([data-column-padding])) > :last-child
    :is(.atom-media__file, .atom-crop__media, .atom-slides__frame) img {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .omni__minor[data-sticky="true"] {
    position: sticky;
    top: var(--sticky-padding-top);
    align-self: start;
  }

  /* A Text atom's desktop width in grid columns (see .atom-text[data-cols]
     above, which starts from its phone count). */
  .atom-text[data-cols] {
    --cols: var(--text-cols, 12);
  }

  .block-text[data-align="left"] {
    grid-column: 1 / span var(--text-cols, var(--text-block-columns));
  }

  .block-text[data-align="right"] {
    grid-column: span var(--text-cols, var(--text-block-columns)) / -1;
  }

  .block-text[data-align="centre"] {
    --text-span: var(--text-cols, var(--text-block-columns));
  }

  .home-intro p {
    grid-column: 3 / span 8;
  }

  /* Stays in view beside the text while it scrolls, under the nav like a
     case study's intro column. Side by side only - stacked on phones there
     is nothing beside it. */
  .about__image {
    grid-column: 1 / span 4;
    position: sticky;
    top: var(--sticky-padding-top);
  }

  .about__text {
    grid-column: 6 / span 7;
  }

  /* The staggered cycle: landscape alone, two portraits (right one pushed
     down), landscape alone, two portraits (left one pushed down instead) -
     then it repeats. nth-child keys it to a card's position in the
     project list rather than anything computed in the template. */
  .home-projects {
    /* For the 6n+5 / 6n pair below, whose earlier card sits on the right:
       the grid places cards in page order and never goes back along a row,
       so without this 6n would drop to a row of its own instead of filling
       the left slot beside 6n+5. Dense also lets any later card back into
       any hole earlier up - safe only while no hole the cycle leaves fits a
       card: today the widest is 3 columns (beside a landscape card, or the
       middle of a pair) and the narrowest card spans 4. Narrow the portraits
       to 3 columns or less, or the landscapes, and cards will start jumping
       up into those holes. */
    grid-auto-flow: row dense;
  }

  .home-card:nth-child(6n+1) {
    grid-column: 4 / span 8;
    --aspect-num: 1.6667;
  }

  /* Same slot as 6n+1 above, centered instead of off-set - an exception for
     the very first card only, not every landscape card the cycle produces.
     Same specificity as the rule above, so this has to come after it to
     win the tie. */
  .home-card:first-child {
    grid-column: 3 / span 8;
  }

  .home-card:nth-child(6n+2) {
    grid-column: 2 / span 4;
  }

  .home-card:nth-child(6n+3) {
    grid-column: 8 / span 4;
    margin-top: var(--gap-home-project-offset);
  }

  .home-card:nth-child(6n+4) {
    grid-column: 2 / span 8;
    --aspect-num: 1.6667;
  }

  /* The second pair has its left card pushed down, which makes the right
     one the higher - read first. So the pair's earlier project takes the
     right-hand slot and the later one the pushed-down left, keeping the
     order top to bottom. The slots themselves are the same as ever. This
     also covers a list cut short after a 6n+5 (project count % 6 == 5): the
     lone card sits on the right, un-offset, rather than offset beside a
     bare gap. */
  .home-card:nth-child(6n+5) {
    grid-column: 8 / span 4;
  }

  .home-card:nth-child(6n) {
    grid-column: 2 / span 4;
    margin-top: var(--gap-home-project-offset);
  }

  /* Classic subtle hover: the whole card scales up slightly in place. Only
     where there's a real pointer: a touch tap would otherwise trigger it, and
     a wide touch screen is past this breakpoint too. */
  @media (hover: hover) {
    .home-card:hover {
      transform: scale(1.04);
      z-index: 1;
    }
  }

  .next-project {
    --aspect-num: 1.6667;
  }

  .next-project__text {
    grid-column: 1 / span 4;
  }

  .next-project__image {
    grid-column: 7 / span 6;
  }

  /* The same hover as a listing card, on the image alone. */
  @media (hover: hover) {
    .next-project__image:hover {
      transform: scale(1.04);
    }
  }
}

/* The Work menu - a layer over the page and under the nav, scrolling by itself. */
.work-menu {
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--ui-bg);
  opacity: 0;
}

.work-menu.is-open {
  opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .work-menu {
    transition: opacity var(--work-menu-fade) ease;
  }
}

html.work-menu-open {
  overflow: hidden;
}

.work-menu__grid {
  display: grid;
  /* auto-fill fits as many cards as --work-menu-card-min allows. The max()
     stops it at --work-menu-columns-max: no card narrower than that many
     columns would make one. The min() keeps --work-menu-columns-min: no card
     wider than that many would. (The 0.1px absorbs rounding, so an exact fit
     still counts.) */
  --work-menu-at-max: calc((100% - (var(--work-menu-columns-max) - 1) * var(--grid-gutter)) / var(--work-menu-columns-max) - 0.1px);
  --work-menu-at-min: calc((100% - (var(--work-menu-columns-min) - 1) * var(--grid-gutter)) / var(--work-menu-columns-min) - 0.1px);
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(max(var(--work-menu-card-min), var(--work-menu-at-max)), var(--work-menu-at-min)), 1fr)
  );
  column-gap: var(--grid-gutter);
  row-gap: var(--gap-work-menu-row);
  padding-top: calc(var(--nav-height) + var(--gap-work-menu-row));
  padding-bottom: var(--grid-margin);
}

/* The work menu's subtitles show from 768px - on phones, titles only. */
@media (max-width: 767.98px) {
  .work-menu__subtitle {
    display: none;
  }
}

.work-menu__card {
  position: relative;
  display: block;
  color: inherit;
  text-decoration: none;
}

/* Each card's hover area reaches halfway across the gaps around it, so
   the pointer is always over one card or the next - crossing a gap never
   leaves the grid with nothing hovered for a moment. It sits over
   the card's own contents too, which is fine: they're all part of the
   link. */
.work-menu__card::after {
  content: "";
  position: absolute;
  inset: calc(var(--gap-work-menu-row) / -2) calc(var(--grid-gutter) / -2);
}

.work-menu__image {
  transition: transform 0.3s ease;
}

/* The same hover as a listing card, on the image - from anywhere on the
   card, now that its hover area covers it. */
@media (hover: hover) {
  .work-menu__card:hover .work-menu__image {
    transform: scale(1.04);
  }
}

/* A card shows only its video or image; its overlays (the logo or title and
   the darkening behind it) fade in while it's pointed at or keyboard-focused.
   Without hover - phones, tablets - the overlays never show. work-menu.js
   starts the overlay's animation over each time it appears. */
.work-menu .atom-overlay__item {
  opacity: 0;
}

@media (hover: hover) {
  .work-menu .atom-overlay__item {
    transition: opacity var(--work-menu-hover-duration) ease;
  }

  .work-menu__card:is(:hover, :focus-visible) .atom-overlay__item {
    opacity: 1;
  }
}

/* The About page's text a column narrower than on tablets - then one
   narrower again from 1440px. Its image stays 4 columns throughout. */
@media (min-width: 1200px) {
  .about__text {
    grid-column: 7 / span 6;
  }
}

@media (min-width: 1440px) {
  /* A case study's title (with its subtitle) and header stack, a column
     narrower than the 6 they take from 768px - at this width 6 reads as
     too wide. The intro beside them narrows too, from 5 columns to 4. */
  .header-title,
  .header-stack {
    grid-column: 1 / span 5;
  }

  .header-intro {
    grid-column: 9 / span 4;
  }

  /* The About page's text a column narrower than below this width, at
     the same breakpoint as the case study header. */
  .about__text {
    grid-column: 8 / span 5;
  }
}

/* Scroll reveal - data-reveal only ever comes from reveal.js and work-menu.js, which remove it
   again once the rise ends. While waiting, things are only invisible, not
   moved: lowered, the last item in a box can land outside it, where Safari
   counts it as clipped and never reports it as in view. The stagger counts
   along each row and stops growing after the fourth item, so a long row doesn't
   leave its end trailing. */
@media (prefers-reduced-motion: no-preference) {
  @keyframes reveal {
    from {
      opacity: 0;
      translate: 0 var(--reveal-distance);
    }
  }

  /* Until reveal.js runs (reveal-head.php). The nav isn't part of it. */
  .reveal-loading :is(.header, main, .next-project) {
    opacity: 0;
  }

  [data-reveal] {
    opacity: 0;
  }

  [data-reveal="in"] {
    opacity: 1;
    animation: reveal var(--reveal-span, var(--reveal-duration)) var(--reveal-ease) backwards;
    animation-delay: var(--reveal-delay, calc(var(--reveal-wait, 0ms) + min(var(--reveal-index, 0), 3) * var(--reveal-stagger)));
  }

  /* The home title's letters only fade - moving them would make each its
     own box, and the text would lose its kerning between them. */
  @keyframes reveal-fade {
    from {
      opacity: 0;
    }
  }

  .home-intro__letter[data-reveal="in"] {
    animation-name: reveal-fade;
  }

  /* A home card's label, under an image already in place: it fades in, one
     stagger step after it would otherwise start. */
  .home-card__label[data-reveal="in"] {
    animation-name: reveal-fade;
    animation-delay: calc(var(--reveal-wait, 0ms) + (min(var(--reveal-index, 0), 3) + 1) * var(--reveal-stagger));
  }

  /* While something in an Omni block with a background is still rising, the
     block clips to its own edges, so a fast scroll never catches the lowered
     content hanging out past its bottom - it slides up from behind the edge
     instead. Column 2's own background does the same. Only during the rise,
     so nothing is cut once it lands (focus rings at the edge, for one), and
     clip isn't a scroll container, so a sticky column 2 still sticks. Blocks
     with no background have no visible edge to keep inside. */
  .block-omni:not([data-bg="none"]):has([data-reveal="in"]),
  .omni__columns > [data-column-bg]:has([data-reveal="in"]) {
    overflow: clip;
  }

  /* A fixed step per card, with no cap, so the order is the same at any width. */
  .work-menu__card[data-reveal="in"] {
    animation-delay: calc(var(--reveal-index, 0) * var(--work-menu-stagger));
  }
}

@media print {
  [data-reveal] {
    opacity: 1;
    animation: none;
  }
}

/* Page fade - the browser crossfades from the old page to the new one, which
   starts out blank (reveal-head.php). A browser without this navigates
   instantly, as does anything else that makes it skip the transition. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: var(--page-fade-duration);
  }
}

/* Column counts on browsers that can't divide one size by another (Safari
   before 26, Chrome before 140). The Omni block's column range and the
   Media Grid work their count out as width / minimum column width, which
   those browsers reject - and a registered property whose value fails falls
   back to its initial value, 1, so everything stacked in one column. Here
   they take the author's numbers instead: the minimum on phones, the
   maximum from 768px. Viewport mode pins both to one count, so it's
   unaffected. (Masonry's column-count has its own fallback - a plain
   declaration before the clamp - since it isn't a custom property.) */
@supports not (line-height: calc(1px / 1px)) {
  .omni__major[data-columns="range"] {
    --omni-major-columns: var(--omni-min);
  }

  .atom-media-grid__items {
    --media-grid-columns: var(--media-grid-min);
  }

  @media (min-width: 768px) {
    .omni__major[data-columns="range"] {
      --omni-major-columns: var(--omni-max);
    }

    .atom-media-grid__items {
      --media-grid-columns: var(--media-grid-max);
    }
  }
}

/* Holding page (snippets/holding.php) - the name, role and contact, centred
   on black, for anyone on the live site without a private link; and "Page
   not found" in the same look. */
.holding {
  /* Flex rather than grid: anything a browser or extension slips into
     <body> (Herd adds an empty div locally) would become a second grid row
     and push the lines into the top half. */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: var(--grid-gutter);
  background: var(--ui-bg);
  color: var(--text-secondary);
  text-align: center;
}

/* The space between lines is the line-height minus the capitals (the text
   is all caps); the gap adds half as much again. */
.holding__lines {
  --holding-gap: calc((1lh - 1cap) / 2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--holding-gap);
}

.holding__lines p {
  margin: 0;
}

/* The link (Contact, or Home on "Page not found") stands apart from the
   name and role: twice the step between them, so one extra line plus gap. */
.holding__lines p:last-child:not(:nth-child(2)) {
  margin-top: calc(1lh + var(--holding-gap));
}

.holding__name {
  color: var(--text-primary);
}

.holding__lines a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: var(--link-underline-thickness);
  text-underline-offset: var(--link-underline-offset);
}

@media (hover: hover) {
  .holding__lines a:hover {
    color: var(--text-primary);
  }
}
