/* ==========================================================================
   Studio MARY: two-column header over an edge-to-edge banner grid
   Colours, sizes and the grid gap come from design/tokens.json
   (injected by cms/lib/render.php as <style id="design-tokens">).
   ========================================================================== */
@font-face {
  font-family: 'MARY';
  src: url('../fonts/Executive-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'MARY';
  src: url('../fonts/Executive-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

:root {
  --z-info: 80;
  --z-hero: 90; /* above the info panel, so "close" stays reachable */
  --z-controls: 100;
  --ease-out: cubic-bezier(0.2, 1, 0.3, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  background: var(--color-bg);
  /* Keeps "info" from jumping sideways when the info panel locks scrolling. */
  scrollbar-gutter: stable;
}

body {
  font-family: 'MARY', 'Helvetica Neue', Arial, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

body.info-open {
  overflow: hidden;
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Header: intro sentence (left) and info button (right).
   Sticky with a solid background; slides away while scrolling down and
   comes back on scroll up (never while the info panel is open).
   -------------------------------------------------------------------------- */
.hero {
  position: sticky;
  top: 0;
  z-index: var(--z-hero);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--layout-hero-column-gap);
  padding: var(--layout-hero-padding-top) var(--layout-hero-padding-x) var(--layout-hero-padding-bottom);
  background: var(--color-bg);
  font-size: var(--type-hero-size);
  line-height: var(--type-hero-line-height);
  transition: transform 0.6s var(--ease-out);
}

.hero.is-hidden {
  transform: translateY(-110%);
}

body.info-open .hero {
  transform: none;
}

.intro-text {
  flex: 0 1 auto;
  min-width: 0;
  max-width: var(--layout-hero-max-width);
}

.intro-text a,
.filter,
.info-toggle {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.filter,
.info-toggle {
  font: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
}

.info-toggle {
  flex: none;
  font-size: var(--type-button-size);
  text-align: right;
}

/* Room for the longer label, so the intro text doesn't re-wrap when "info" turns into "close". */
.info-toggle::after {
  content: attr(data-closed-label) "\A" attr(data-open-label);
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  white-space: pre;
}

/* Lines sit close together: keep the focus ring off the neighbouring lines. */
.hero :focus-visible {
  outline-offset: 1px;
  border-radius: 2px;
}

.underline-text {
  text-decoration: underline;
  text-underline-offset: 0.12em;
}

/* Filters read as plain words: the underline marks hover, focus and the selected state. */
.filter .underline-text {
  text-decoration-line: none;
}

.filter:focus-visible .underline-text,
.filter[aria-pressed="true"] .underline-text {
  text-decoration-line: underline;
}

.filter[aria-pressed="true"] {
  color: var(--hover-color, var(--color-text));
  text-shadow: 0 0 8px var(--hover-color, transparent);
}

@media (hover: hover) {
  .filter:hover,
  .intro-text a:hover,
  .info-toggle:hover {
    color: var(--hover-color, var(--color-hover-fallback));
    text-shadow: 0 0 5px var(--hover-color, var(--color-hover-fallback));
  }

  .filter:hover .underline-text {
    text-decoration-line: underline;
  }
}

/* Pages published before this header have the button after the grid: pin it top-right.
   Safe to delete once live and staging have been republished from the Layout Desk. */
body > .info-toggle {
  position: fixed;
  top: 1rem;
  right: 1.375rem;
  z-index: var(--z-controls);
  line-height: 1.35;
}

/* --------------------------------------------------------------------------
   Banner grid: every row is one height and fills the width.
   Each item grows in proportion to its aspect ratio (--ar = width / height),
   so equal heights fall out of flexbox with no script.
   The one-column stacking rule is generated from grid/stack-below.
   -------------------------------------------------------------------------- */
.banner-grid {
  display: flex;
  flex-direction: column;
  gap: var(--grid-gap);
  max-width: var(--grid-max-width);
  margin: 0 auto;
  padding: 0 var(--grid-side-margin) var(--grid-side-margin);
}

.banner-row {
  display: flex;
  gap: var(--grid-gap);
  align-items: flex-start;
}

.banner-item {
  position: relative;
  flex: var(--ar) 1 0%;
  min-width: 0;
  aspect-ratio: var(--ar);
  overflow: hidden;
  background: var(--color-media-placeholder);
}

.banner-link {
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
}

/* Items touch each other and the screen edge, so the focus ring is drawn inside the image. */
.banner-link:focus-visible {
  outline: 2px solid transparent; /* still shown in forced-colours mode */
  outline-offset: -2px;
}

.banner-link:focus-visible::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 2px var(--color-label-text), inset 0 0 0 4px #000;
  pointer-events: none;
}

.banner-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* No overlays on the images. A video without a link pauses/plays when clicked or tapped (banner.js). */
.banner-item > video.banner-media,
.banner-frame > video.banner-media {
  cursor: pointer;
}

/* Phone frame (a video option in the Layout Desk): the video sits centred in its box with
   phone-like rounded corners. Size and corner radius come from the renderer (inline style). */
.banner-item--framed {
  background: transparent;
}

.banner-frame {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  overflow: hidden;
  isolation: isolate; /* keeps Safari clipping playing video to the rounded corners */
  background: var(--color-media-placeholder);
}

.banner-frame > .banner-media {
  border-radius: inherit;
}

/* Pause/play for keyboard users (WCAG 2.2.2): invisible until it gets keyboard focus. */
.video-toggle {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
  border-radius: var(--layout-label-radius);
  font-family: inherit;
  font-size: var(--type-label-size);
  line-height: 1.3;
  color: var(--color-label-text);
  background: var(--color-label-background);
  cursor: pointer;
}

.video-toggle:focus-visible {
  width: auto;
  height: auto;
  overflow: visible;
  clip-path: none;
  padding: 5px 12px 3px;
  outline: 2px solid var(--color-label-text);
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #000;
}

.grid-empty {
  padding: 4rem var(--layout-hero-padding-x);
  text-align: center;
  font-size: var(--type-hero-size);
}

/* --------------------------------------------------------------------------
   Info panel: overlay below the header ("close" stays on top of it).
   --hero-height is measured by banner.js.
   -------------------------------------------------------------------------- */
.info-panel {
  position: fixed;
  inset: 0;
  z-index: var(--z-info);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: start;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--hero-height, 6rem) var(--layout-hero-padding-x) 4rem;
  background: var(--color-info-overlay);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  animation: info-in 0.35s var(--ease-out);
}

@keyframes info-in {
  from { opacity: 0; }
}

.footer {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
  gap: var(--layout-info-column-gap);
  width: 100%;
  max-width: var(--layout-info-max-width);
  padding-top: 2rem;
  border-top: 0.5px solid currentColor;
  font-size: var(--type-info-size);
  line-height: var(--type-info-line-height);
  font-weight: 300;
}

.footer a {
  color: inherit;
}

ul.dash-list {
  list-style: none;
}

ul.dash-list li {
  position: relative;
  padding-left: 8px;
}

ul.dash-list li::before {
  content: "\2011";
  position: absolute;
  left: 0;
}

@media (max-width: 767px) {
  .hero,
  .info-panel {
    padding-left: var(--layout-hero-padding-x-phone);
    padding-right: var(--layout-hero-padding-x-phone);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
