/* Praxcision hero on a web page. The still is always there underneath; a video is shown
   only once it is actually playing (.is-on), so a slow or refused video never leaves a
   blank hero. */
/* The section is the picture's shape, but never taller than the screen (zoomed in, at the
   end, is the exception): where the window is shorter than the picture (a laptop, a phone
   held sideways under its address bar), the hero ends at the foot of the screen, so the
   section after it starts just below the fold, and what is cropped is the picture's empty
   floor: the picture keeps its top edge (object-position below), and the film keeps
   everything it shows above the bottom fifth of the frame (layout.js). */
.prax-hero {
  /* the picture's width; the video frame's width (px); one video px in CSS px; the
     format's type scale; the frame's side margin and the strip at its foot (video px);
     the frame's height over its width */
  --fw: 100cqw;
  --W: 1600;
  --u: calc(var(--fw) / var(--W));
  --s: 1;
  --mx: 160;
  --floor: 160;
  --ar: 9 / 16;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 100vh;
  max-height: 100svh;
  overflow: hidden;
  background: var(--prax-hero-bg, #0f1218);
}
/* The section takes the shape of the format that fits the screen. These media queries
   must match the ones on the still's and the videos' <source>s (index.html). */
/* Any upright screen: a phone, a tablet, a monitor turned on its side (1080 x 1920). On a
   screen wider than 9:16 the section stops at the screen's height, so the copy at the
   foot of the picture is never below the fold, and the picture sits centred in it, the
   page colour either side. */
@media (orientation: portrait) {
  .prax-hero {
    --fw: min(100cqw, 100svh * 9 / 16);
    --W: 1080;
    --s: 1.9;
    --mx: 80;
    --floor: 140;
    --ar: 16 / 9;
    aspect-ratio: 9 / 16;
  }
  /* (scoped to .prax-hero so it outranks the cover rule below) */
  .prax-hero .prax-hero__still img,
  .prax-hero .prax-hero__video {
    object-fit: contain;
  }
}
@media (orientation: landscape) and (max-height: 500px) {
  /* a phone held sideways */
  .prax-hero {
    --W: 1920;
    --s: 1.45;
    --mx: 120;
    --ar: 888 / 1920;
    aspect-ratio: 1920 / 888;
  }
}
.prax-hero__still,
.prax-hero__still img,
.prax-hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: 50% 0;
}
.prax-hero__video {
  opacity: 0;
  transition: opacity 350ms ease-out;
}
.prax-hero__video[data-part="loop"] {
  z-index: 2; /* above the showcase, so the hand-off swaps under it */
}
.prax-hero__video.is-on {
  opacity: 1;
}
/* The hero's foot fades into its background colour, so a section in that colour can
   follow it without a seam (the picture's own floor runs from near black under the copy
   to slate under the object). Only background sits in this strip in every format: the
   object has already faded out, and the upright copy ends above it. --prax-hero-foot: 0
   turns it off (the zoomed layout below keeps its own 6%). */
.prax-hero::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--prax-hero-foot, 6%);
  z-index: 3;
  pointer-events: none;
  background: linear-gradient(to bottom, transparent, var(--prax-hero-bg, #0f1218));
}

/* Turning the phone (hero-player.js: refit). The film dips to the hero's background colour
   while the file for the new format loads, then fades back in at the same moment of the
   film. The still is hidden during the dip, so the ending is not shown early; it fades in
   only if the new file is slow (.is-switching-slow), so the hero is never an empty box for
   long. Afterwards the still comes back only once the video has faded fully in over it
   (the 400 ms delay below), so the end frame never shows through mid-fade. */
.prax-hero__still {
  transition: opacity 0s linear 400ms;
}
.prax-hero.is-switching .prax-hero__video,
.prax-hero.is-switching .prax-hero__still {
  opacity: 0;
  transition: opacity 180ms ease-in;
}
.prax-hero.is-switching.is-switching-slow .prax-hero__still {
  opacity: 1;
  transition: opacity 500ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .prax-hero__video {
    display: none;
  }
}

/* ---- The copy: the headline and the supporting line, as real text over the film.
   The film keeps their place clear (it lays the copy out but does not draw it), and the
   page sets the same words in the same place, at the same sizes, scaled with the picture:
   every length below is the video's own pixels times --u, one video pixel in CSS pixels,
   measured against .prax-top (header.css), as the header is. So the words stay sharp at any
   size, are read by search engines and screen readers, and change without a render.
   hero-copy.js fits the upright headline to its width and times the phrases to the
   showcase; without it the copy simply stands complete. Type: Inter (declared in site.css), platinum
   #ffffff and steel mist #b6c0cc, as the Prax-Copperslate hero tokens. */
.prax-copy {
  /* desktop: on the 160 px margin, centred in the picture's top 820 px (measured from the
     picture's top, which the hero always shows, so a cropped floor never moves it) */
  position: absolute;
  z-index: 4;
  left: calc((100cqw - var(--fw)) / 2 + var(--mx) * var(--u));
  top: 0;
  height: calc(820 * var(--u));
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  transition: opacity 350ms ease-out;
}
/* one line where hero-copy.js runs (data-ready): --fit shrinks it where the copy has a
   fixed width; without the script, and zoomed in (below), it wraps rather than overflow */
.prax-copy__headline {
  margin: 0;
  font-size: calc(61 * var(--s) * var(--fit, 1) * var(--u));
  line-height: 1;
  letter-spacing: -0.04em;
  font-weight: 500;
  color: #ffffff;
}
.prax-copy[data-ready] .prax-copy__headline {
  white-space: nowrap;
}
/* the four supporting phrases: a 2 x 2 grid centred under the headline, two equal columns,
   divided by a vertical and a horizontal line through its middle and no outer edge; each
   phrase links to its practice below. The gap above it is where hero-copy.js stages each
   phrase before it moves into its cell. */
.prax-copy__support {
  align-self: center;
  /* an optical nudge: the headline's I sets its ink a little in from its box and the
     closing full stop a little short of it, so the boxes' centres sit 0.075 em left of
     the inks' centres; this centres what the eye sees */
  position: relative;
  left: 0.075em;
  display: grid;
  grid-template-columns: repeat(2, minmax(max-content, 1fr));
  width: max-content;
  margin: calc(76 * var(--s) * var(--u)) 0 0;
  padding: 0;
  list-style: none;
  font-size: calc(24 * var(--s) * var(--u));
  line-height: 1.3;
  letter-spacing: -0.02em;
  font-weight: 400;
  font-style: italic;
  color: #b6c0cc;
  white-space: nowrap;
}
.prax-copy__support li {
  display: flex;
  justify-content: flex-start;
}
/* the left column against the dividing line, mirroring the right */
.prax-copy__support li:nth-child(odd) {
  justify-content: flex-end;
  text-align: right;
}
/* the dividing lines, fading out at their ends; hero-copy.js draws them out from the middle
   at the end of the showcase. Steel mist #b6c0cc. */
.prax-copy__support::before,
.prax-copy__support::after {
  content: "";
  position: absolute;
  pointer-events: none;
}
.prax-copy__support::before {
  left: 50%;
  top: 0.15em;
  bottom: 0.15em;
  width: 1px;
  background: linear-gradient(to bottom, rgba(182, 192, 204, 0), rgba(182, 192, 204, 0.45) 30%, rgba(182, 192, 204, 0.45) 70%, rgba(182, 192, 204, 0));
}
.prax-copy__support::after {
  top: 50%;
  left: 0.5em;
  right: 0.5em;
  height: 1px;
  background: linear-gradient(to right, rgba(182, 192, 204, 0), rgba(182, 192, 204, 0.45) 25%, rgba(182, 192, 204, 0.45) 75%, rgba(182, 192, 204, 0));
}
.prax-copy__support a {
  display: block;
  padding: 0.4em 1.1em;
  border-radius: 0.3em;
  color: inherit;
  text-decoration: none;
}
.prax-copy__support a:hover {
  color: #f0bd98; /* ember */
}
.prax-copy__support a:focus-visible {
  outline: 2px solid #f0bd98; /* ember */
  outline-offset: -2px;
}
@media (pointer: coarse) {
  .prax-copy__support a {
    display: flex;
    align-items: center;
    min-height: 44px; /* a full touch target */
    box-sizing: border-box;
  }
}
.prax-copy .phrase {
  display: inline-block;
}
/* the phrase's text, inside its link: it is what hero-copy.js moves and colours, never the
   link itself */
.prax-copy__support .phrase {
  display: inline-block;
}
/* the light at a headline phrase's leading edge as hero-copy.js writes it in; unseen
   otherwise. Ember #f0bd98. */
.prax-copy__headline .phrase {
  position: relative;
}
.prax-copy__headline .phrase::after {
  content: "";
  position: absolute;
  top: 0.06em;
  bottom: 0;
  left: 0;
  width: max(2px, 0.035em);
  margin-left: max(-1px, -0.0175em);
  border-radius: 1px;
  background: linear-gradient(to bottom, rgba(240, 189, 152, 0), #f0bd98 30%, #f0bd98 70%, rgba(240, 189, 152, 0));
  box-shadow: 0 0 0.25em rgba(240, 189, 152, 0.7);
  opacity: 0;
  pointer-events: none;
}
/* a phone held sideways (1920 x 888): the desktop layout, every size x 1.45 */
@media (orientation: landscape) and (max-height: 500px) {
  .prax-copy {
    height: calc(840 * var(--u));
  }
}
/* upright (1080 x 1920): the copy at the foot of the picture, 140 px up, from the 80 px
   margin and no wider than the 920 px between the margins; every size x 1.9, the headline
   shrunk to fit (0.766 with this copy, hero-copy.js measures it) */
@media (orientation: portrait) {
  .prax-copy {
    --fit: 0.766;
    max-width: calc(var(--fw) - 2 * var(--mx) * var(--u));
    top: auto;
    height: auto;
    bottom: calc(var(--floor) * var(--u));
    justify-content: flex-start;
  }
  .prax-copy__support {
    margin-top: calc(56 * var(--s) * var(--u));
  }
  /* narrower cells, and the grid no wider than the copy: with a reader's wide text spacing
     (WCAG 1.4.12) a phrase wraps rather than run off a 360 px phone */
  .prax-copy__support {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: auto;
    max-width: 100%;
    white-space: normal;
  }
  .prax-copy__support a {
    padding-inline: 0.6em;
  }
}
/* the film fades in over the still: the complete copy fades out with it, then follows
   the film's clock (hero-copy.js) */
.prax-copy.is-handing-over {
  opacity: 0;
}
/* turning the phone: the copy dips with the film, and stays up if the new file is slow */
.prax-hero.is-switching .prax-copy {
  opacity: 0;
  transition: opacity 180ms ease-in;
}
.prax-hero.is-switching.is-switching-slow .prax-copy {
  opacity: 1;
  transition: opacity 500ms ease-out;
}

/* ---- Pause and play, shown by hero-player.js while the film plays: on the frame's side
   margin, centred in a strip the frame's floor height above the hero's foot. A 44 px target
   on a touch screen. With a mouse it shows while the pointer moves over the picture
   (.is-pointing) or rests on the button, with keyboard focus and while the film is held.
   Platinum #ffffff on basalt deep #090b0f, the ember #f0bd98 focus ring on the disc. */
.prax-hero__pause {
  --disc: max(24px, 40 * var(--s) * var(--u));
  --hit: var(--disc);
  position: absolute;
  z-index: 5;
  right: calc((100cqw - var(--fw)) / 2 + var(--mx) * var(--u) - (var(--hit) - var(--disc)) / 2);
  bottom: max(0px, (var(--floor) * var(--u) - var(--hit)) / 2);
  display: grid;
  place-items: center;
  width: var(--hit);
  height: var(--hit);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: #ffffff;
  cursor: pointer;
}
.prax-hero__pause::before {
  content: "";
  position: absolute;
  inset: calc((var(--hit) - var(--disc)) / 2);
  border-radius: 50%;
  background: rgba(9, 11, 15, 0.6);
}
.prax-hero__pause svg {
  position: relative;
  width: calc(var(--disc) * 0.55);
  height: calc(var(--disc) * 0.55);
}
.prax-hero__pause[hidden],
.prax-hero__pause .play,
.prax-hero.is-held .prax-hero__pause .pause {
  display: none;
}
.prax-hero.is-held .prax-hero__pause .play {
  display: block;
}
.prax-hero__pause:focus-visible {
  outline: none;
}
.prax-hero__pause:focus-visible::before {
  outline: 2px solid #f0bd98;
  outline-offset: 2px;
}
@media (pointer: coarse) {
  .prax-hero__pause { --hit: max(44px, var(--disc)); }
}
@media (hover: hover) and (pointer: fine) {
  .prax-hero__pause {
    opacity: 0;
    transition: opacity 200ms ease-out;
  }
  .prax-hero.is-pointing .prax-hero__pause,
  .prax-hero__pause:hover,
  .prax-hero__pause:focus-visible,
  .prax-hero.is-held .prax-hero__pause {
    opacity: 1;
  }
}

/* ---- Zoomed in until a wide window is 41em across or less (1280 px at 200%; not 40em,
   which a 640 px viewport can miss by a fraction): the copy keeps its size in rem, which
   the picture has no room for, so it sits below the picture on the hero's background, and
   the hero is as tall as both. The headline shrinks only where its longer word would not
   fit (a 1280 px window at 400%), and both lines may wrap. */
@media (orientation: landscape) and (max-width: 41em) {
  .prax-hero {
    --ph: calc(100cqw * var(--ar));
    aspect-ratio: auto;
    max-height: none;
  }
  .prax-hero__still,
  .prax-hero__still img,
  .prax-hero__video {
    bottom: auto;
    height: var(--ph);
  }
  .prax-hero::after {
    top: calc(var(--ph) * 0.94);
    bottom: auto;
    height: calc(var(--ph) * 0.06);
  }
  .prax-copy {
    position: relative;
    left: auto;
    width: fit-content;
    max-width: 100%;
    height: auto;
    box-sizing: border-box;
    margin-top: var(--ph);
    padding: 1rem calc(var(--mx) * var(--u)) 2rem;
  }
  .prax-copy[data-ready] .prax-copy__headline,
  .prax-copy__headline {
    font-size: min(3.125rem, (100cqw - 2 * var(--mx) * var(--u)) / 6.2);
    white-space: normal;
    overflow-wrap: anywhere; /* a reader's wide letter spacing breaks the word, not cuts it */
  }
  .prax-copy__support {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: auto;
    max-width: 100%;
    margin-top: 2.75rem;
    font-size: 1.25rem;
    white-space: normal;
  }
  .prax-hero__pause {
    top: calc(var(--ph) - (var(--floor) * var(--u) + var(--hit)) / 2);
    bottom: auto;
  }
}
