/* WOWSGNL motion.
   The motion is switched by html.motion-on, which the head script sets unless the visitor
   has asked for reduced motion. With html.motion-off the page keeps its words and layout
   and runs only the motion it had before. */

/* The trust scene gets a camera wrapper. It is inert until the scene is held. */
.trust-camera {
  display: contents;
}

/* ------------------------------------------------------------------
   Line reveal (revealLines in motion.js)
   ------------------------------------------------------------------ */
html.motion-on [data-reveal] {
  visibility: hidden;
  /* If the script never arrives, the text still shows. */
  animation: motion-reveal-failsafe 0s linear 4s forwards;
}
@keyframes motion-reveal-failsafe {
  to {
    visibility: visible;
  }
}

html.motion-on [data-reveal] > * {
  margin-bottom: -0.18em;
}

html.motion-on [data-reveal] .word-mask,
html.motion-on [data-reveal] .char-mask {
  vertical-align: top;
}

html.motion-on [data-reveal] .line-mask,
html.motion-on [data-reveal] .word-mask,
html.motion-on [data-reveal] .char-mask {
  overflow: clip;
  overflow-clip-margin: 0.06em;
}

html.motion-on [data-reveal] .line-mask > *,
html.motion-on [data-reveal] .word-mask > *,
html.motion-on [data-reveal] .char-mask > * {
  padding-bottom: 0.18em;
  will-change: transform;
}

/* ------------------------------------------------------------------
   Hero load: the nav settles first, the sentence rises after the shutter
   ------------------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  html.motion-on .opening .mast {
    animation: motion-mast-in 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) 0.12s backwards;
  }
  /* mast-motion.js walks the negative from here to its resting crop. */
  html.motion-on:not(.mast-settled) .opening .wordmark > span {
    background-position: 61% 30%;
  }
}
@keyframes motion-mast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
}

/* ------------------------------------------------------------------
   Section transitions (motion.js)
   The three sibling blocks are the hero, main and the footer.
   ------------------------------------------------------------------ */
html.motion-on body > .opening,
html.motion-on body > main {
  position: relative;
  z-index: 1;
}
html.motion-on body > main {
  background: var(--ink);
}
html.motion-on [data-transition]:not([data-transition='pin']) {
  will-change: transform;
}

/* The lifted edge of main leaves a soft shadow on the footer it uncovers. */
html.motion-on:not(.footer-tall) body > main::after {
  content: '';
  position: absolute;
  inset: 100% 0 auto;
  height: 64px;
  background: linear-gradient(rgba(5, 9, 22, 0.34), rgba(5, 9, 22, 0));
  pointer-events: none;
}

/* A footer taller than the screen cannot sit behind the page, so it scrolls normally. */
html.motion-on.footer-tall .inquire[data-transition='reveal'] {
  position: static !important;
  transform: none !important;
}
/* The underline draws as the headline is uncovered, in place of its entry timeline. */
html.motion-on:not(.footer-tall) .inquire[data-transition='reveal'] .invitation span::after {
  animation: none;
  transform: rotate(-1.5deg) scaleX(var(--invitation-stroke, 1));
}

/* ------------------------------------------------------------------
   Trust scene: the sentence holds at centre while the photographs drift
   ------------------------------------------------------------------ */
html.motion-on [data-scene='1'] {
  --trust-height: max(100svh, 66.5vw); /* the scene's own height, from collage.css */
  --trust-hold: 45svh;
}
@media (min-width: 768px) and (max-width: 991px) {
  html.motion-on [data-scene='1'] {
    --trust-height: max(110svh, 1180px);
  }
}
html.motion-on [data-scene='1'][data-trust-hold] {
  display: block;
  height: calc(var(--trust-height) + var(--trust-hold));
  padding-inline: 0;
}
html.motion-on [data-trust-hold] .trust-camera {
  position: sticky;
  top: calc((100svh - var(--trust-height)) / 2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--trust-height);
  padding-inline: var(--gutter);
}
html.motion-on [data-trust-hold] .collage-photo {
  will-change: transform;
}

/* "Trust" takes its colour last, with the gradient sweep the experience titles already use
   (experience.css). Until the sweep it is drawn in the heading's own paper colour, so
   the sentence always reads whole; the sweep then carries it to periwinkle. State lives on the
   heading because SplitText rebuilds its children. */
html.motion-on #scene-1-title[data-trust] span {
  --reveal-resting-color: var(--periwinkle);
  --reveal-blur: 0px;
  color: transparent;
  background-image: linear-gradient(
    90deg,
    var(--reveal-resting-color) 0%,
    var(--reveal-resting-color) 33.33%,
    #6274ff 40%,
    #a99aff 45%,
    #ff8b8a 50%,
    #ff674d 55%,
    #ffcab0 60%,
    var(--paper, #ede9e1) 66.67%,
    var(--paper, #ede9e1) 100%
  );
  background-position: 100% 0;
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
html.motion-on #scene-1-title[data-trust='sweep'] span {
  animation: sweep-reveal 1.1s cubic-bezier(0.455, 0.03, 0.515, 0.955) forwards;
}
html.motion-on #scene-1-title[data-trust='done'] span {
  animation: none;
  filter: none;
  background-position: 0 0;
}
@media (forced-colors: active) {
  html.motion-on #scene-1-title[data-trust] span {
    background: none;
    color: CanvasText;
    -webkit-text-fill-color: CanvasText;
    animation: none;
  }
  /* In forced colours every line of text is drawn on a solid plate. At this heading's tight
     leading the plate of one line covered the tails of the letters in the line above. */
  .inquire .invitation {
    line-height: 1.2;
  }
}

/* ------------------------------------------------------------------
   Coin: it can be picked up
   ------------------------------------------------------------------ */
html.motion-on .justice-coin[data-rendered] .justice-coin__object {
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
}
html.motion-on .justice-coin[data-rendered][data-coin-hover] .justice-coin__object {
  cursor: grab;
}
html.motion-on .justice-coin[data-rendered][data-grabbing] .justice-coin__object {
  cursor: grabbing;
}

/* ------------------------------------------------------------------
   The lines under the trust sentence, and the line above the footer headline.
   ------------------------------------------------------------------ */
.trust-copy {
  position: relative;
  top: -2.2em;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  pointer-events: none;
}
/* Three lines beneath the trust sentence. Each rises out of its own mask. */
.trust-lines {
  display: grid;
  justify-items: center;
  gap: 0.3em;
  width: 100%;
  max-width: 100%;
  margin: 1.1em auto 0;
  color: #ede9e1;
  font: 600 clamp(16px, 1.6em, 27px)/1.3 var(--sans);
  letter-spacing: -0.018em;
  text-align: center;
}
.trust-line {
  margin: 0;
  overflow: clip;
  overflow-clip-margin: 0.08em;
}
.trust-line > span {
  display: block;
  opacity: 0.9;
  text-wrap: balance;
}
html.motion-on .trust-line > span {
  transform: translateY(118%);
  transition: transform 0.95s cubic-bezier(0.16, 1, 0.3, 1);
}
html.motion-on .trust-line.is-on > span {
  transform: none;
}
/* If the motion script failed to load, nothing will raise the lines: show them. */
html.motion-missing .trust-line > span {
  transform: none;
  transition: none;
}
/* The lines keep to the column between the photographs on either side, where the
   signal runs down. Narrower windows wrap them rather than let them reach a photograph. */
@media (min-width: 992px) {
  .trust-lines {
    max-width: 50vw;
  }
}
@media (min-width: 768px) and (max-width: 991px) {
  .trust-lines {
    max-width: 46vw;
    font-size: 16px;
  }
}

.inquire-why {
  max-width: 40ch;
  margin: 0 0 clamp(16px, 1.8vw, 28px);
  color: #bcc4ff;
  font: 600 clamp(19px, 1.9vw, 30px)/1.25 var(--sans);
  letter-spacing: -0.025em;
  text-wrap: balance;
}

/* ------------------------------------------------------------------
   Two posts added to the collage.
   ------------------------------------------------------------------ */
.collage-photo.is-extra {
  display: none;
}
html.wowsgnl .collage-photo.is-extra {
  display: block;
}
.collage-photo.is-extra img {
  object-position: center top;
}
/* The r/TheoVon post sits above the trust sentence, midway between the two upper
   photographs. On a wide, short window the scene is taller than the screen while it
   holds, so the post starts lower there, and narrows to stay clear of the sentence:
   its title stays in view. */
html.wowsgnl [data-scene='1'] .collage-photo.is-06 {
  --post-top: clamp(4.6em, calc((var(--trust-height, 100svh) - 100svh) / 2 + 1.4em), 16.8em);
  --post-width: clamp(12em, calc((23.6em - var(--post-top)) * 1.775), 22em);
  top: var(--post-top);
  left: calc(58em - var(--post-width) / 2);
  width: var(--post-width);
}
@media (min-width: 768px) and (max-width: 991px) {
  html.wowsgnl [data-scene='1'] .collage-photo.is-06 {
    top: clamp(7em, calc((var(--trust-height, 100svh) - 100svh) / 2 + 1.4em), 14em);
    left: 35.5vw;
    width: 24vw;
  }
}
/* The r/YAPms post sits above the stream, between the lead photograph and the rally. */
@media (min-width: 768px) and (min-height: 551px), (min-width: 768px) and (hover: hover) {
  html.wowsgnl .pullback-camera .collage-photo.is-06 {
    inset: 6% auto auto 45%;
    width: min(20cqw, 31cqh);
  }
}
@media (max-width: 767px), (hover: none) and (pointer: coarse) and (max-height: 550px) {
  .trust-copy {
    grid-area: headline;
    top: 0;
  }
  .collage-scene .trust-copy .trust-title {
    margin-bottom: 0;
  }
  .trust-lines {
    gap: 8px;
    max-width: 100%;
    margin: 14px auto clamp(12px, 4vw, 25px);
    font-size: 16px;
  }
  /* On a phone the two posts are tiles like the photographs, small enough to stay sharp.
     In the first collage the rally stands beside the two Reddit posts, one above the other,
     and takes their height. In the second the r/TheoVon post shares the last row with the
     portrait beside it, and takes that portrait's height. */
  html.wowsgnl .collage-scene[data-scene='2'] {
    grid-template-columns: minmax(0, 1.19fr) minmax(0, 1fr);
    grid-template-areas: 'lead lead' 'interview interview' 'portrait detail' 'portrait extra' 'last last';
  }
  html.wowsgnl .collage-scene[data-scene='1'] {
    grid-template-areas: 'lead lead' 'headline headline' 'interview portrait' 'detail portrait' 'extra last';
  }
  html.wowsgnl .collage-scene .collage-photo.is-06 {
    grid-area: extra;
    inset: auto;
    width: 100%;
  }
  html.wowsgnl [data-scene='2'] .collage-photo.is-03,
  html.wowsgnl [data-scene='1'] .collage-photo.is-06 {
    aspect-ratio: auto;
    align-self: stretch;
  }
  /* Those two tiles have no height of their own: the frame fills whatever the row gives. */
  html.wowsgnl [data-scene='2'] .collage-photo.is-03 .photo-frame,
  html.wowsgnl [data-scene='1'] .collage-photo.is-06 .photo-frame {
    position: absolute;
    inset: 0;
  }
  html.wowsgnl [data-scene='2'] .collage-photo.is-05 {
    width: 92%;
    justify-self: start;
  }
  html.wowsgnl [data-scene='1'] .collage-photo.is-05 {
    width: 100%;
  }
}

/* ------------------------------------------------------------------
   The signal: the hairline, the point of light that travels it, and the
   photographs that wake as it arrives
   ------------------------------------------------------------------ */
html.wowsgnl [data-scene='1'] {
  --trust-hold: 72svh;
}
.signal-web {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  /* A drawing covers its whole section. A browser must not take it as the thing to hold in
     place while the page changes, or to find its place by after a reload. */
  overflow-anchor: none;
}
/* An empty slot has no box at all until a line is drawn in it. Left sized to its section,
   the one in Services sat over the whole page until the phone line started, and its jump
   into place was measured as a large layout shift on every phone visit. */
.signal-web[data-signal-slot]:not([data-drawn]) {
  display: none;
}
.signal-web__line {
  fill: none;
  stroke: #bcc4ff;
  stroke-opacity: 0.5;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.signal-web__head {
  fill: #fff;
  filter: drop-shadow(0 0 6px rgba(188, 196, 255, 0.95));
  opacity: 0;
  transition: opacity 0.25s ease;
}
html.motion-on [data-signal] .collage-photo {
  filter: brightness(0.7) saturate(0.85);
  transition: filter 0.9s ease;
}
html.motion-on [data-signal] .collage-photo.is-lit {
  filter: none;
}
/* On a phone every photograph but the first waits for the signal, and waits from the first
   frame. (Until the script started they were shown at full strength, then dimmed half a
   second into the visit.) If the motion script never arrives, nothing is dimmed. */
@media (max-width: 767px), (hover: none) and (pointer: coarse) and (max-height: 550px) {
  html.motion-on:not(.motion-missing) .collage-container .collage-photo:not(.is-lit) {
    filter: brightness(0.7) saturate(0.85);
  }
  html.motion-on:not(.motion-missing) .collage-container [data-scene='2'] .collage-photo.is-01:not(.is-lit) {
    filter: none;
  }
}

/* ------------------------------------------------------------------
   The signal, carried through the rest of the page. Each piece sits behind what its
   section holds, so only the runs between things show.
   ------------------------------------------------------------------ */
html.motion-on .record {
  isolation: isolate;
}
.signal-web--under {
  z-index: -1;
}
/* On paper it takes the colours the Services list uses. */
.signal-web--paper .signal-web__line {
  stroke: #293bb6;
}
.signal-web--paper .signal-web__head {
  fill: #fa765d;
  filter: drop-shadow(0 0 5px rgba(250, 118, 93, 0.5));
}
.signal-web__stop {
  fill: #121211;
  stroke: #bcc4ff;
  stroke-opacity: 0.55;
  stroke-width: 1.25;
  transition: fill 0.5s ease;
}
.signal-web__stop.is-reached {
  fill: #bcc4ff;
}
.signal-web--paper .signal-web__stop {
  fill: #ede9e1;
  stroke: #293bb6;
}
.signal-web--paper .signal-web__stop.is-reached {
  fill: #293bb6;
}
/* The line under the address is the signal's, so the link does not draw a second one. */
html.signal-through .inquire .email:hover,
html.signal-rail .inquire .email:hover {
  text-decoration: none;
}
/* On a phone the line runs down the page margin, through every section (see phoneLine).
   The light gets a ring in place of its glow, which is drawn the same in every browser. */
html.signal-rail .service-index {
  position: relative;
  isolation: isolate;
}
html.signal-rail .signal-web__head {
  filter: none;
  stroke: rgba(188, 196, 255, 0.3);
  stroke-width: 6px;
  paint-order: stroke;
}
html.signal-rail .signal-web--paper .signal-web__head {
  stroke: rgba(250, 118, 93, 0.24);
}

/* ------------------------------------------------------------------
   Services: sized to the window, and on a laptop or larger a scene of its own.
   The list is still the checkbox accordion from services.css. Nothing about how it opens is changed here:
   motion.js ticks its boxes as the page scrolls.
   ------------------------------------------------------------------ */
@media (min-width: 992px) {
  /* The same layout, sized to the window like the rest of the page. One unit sets every
     size: a hundredth of the window's width, held back on a wide, short window so the
     section always fits the screen it has to hold in. */
  html.wowsgnl .service-index {
    --svc: min(1vw, 2.05svh);
  }
  html.wowsgnl .service-index__layout {
    width: 100%;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    column-gap: clamp(56px, 8vw, 220px);
    row-gap: clamp(16px, calc(var(--svc) * 2), 44px);
  }
  html.wowsgnl .service-index__heading h2 {
    font-size: clamp(42px, calc(var(--svc) * 6.2), 168px);
  }
  html.wowsgnl .service-photo {
    width: min(100%, 62svh * 4 / 3);
  }
  html.wowsgnl .service-index .accordion {
    --accordion-question-padding: clamp(20px, calc(var(--svc) * 1.6), 42px);
    --accordion-open-question-end: clamp(8px, calc(var(--svc) * 0.6), 16px);
    --accordion-answer-end: clamp(16px, calc(var(--svc) * 1.3), 34px);
    --service-icon: clamp(28px, calc(var(--svc) * 2), 52px);
  }
  html.wowsgnl .service-index .accordion .question {
    gap: clamp(24px, calc(var(--svc) * 2), 48px);
    font-size: clamp(20px, calc(var(--svc) * 2.15), 56px);
  }
  html.wowsgnl .service-index .accordion .answer-inner p {
    font-size: clamp(16px, calc(var(--svc) * 1.2), 30px);
  }
  html.wowsgnl .service-index .accordion .icon {
    flex-basis: var(--service-icon);
    width: var(--service-icon);
    height: var(--service-icon);
  }
  html.wowsgnl .service-index .accordion .icon-mark::before,
  html.wowsgnl .service-index .accordion .icon-mark::after {
    width: 43%;
    height: max(2px, calc(var(--service-icon) * 0.07));
  }
}

/* The scene: the section fills the screen and holds while the signal comes down the
   list. motion.js sets data-service-scene only where there is room for it. */
html.motion-on .service-index[data-service-scene] {
  --service-hold: 100svh;
  height: calc(100svh + var(--service-hold));
  padding-block: 0;
  scroll-margin-top: 0;
}
html.motion-on .service-index[data-service-scene] .service-index__layout {
  position: sticky;
  top: 0;
  height: 100svh;
  grid-template-rows: auto auto;
  align-content: center;
}
/* The service the signal is on reads at full strength. The others wait. */
html.motion-on .service-index[data-service-scene] .accordion .toggle:not(:checked) + .question {
  color: rgba(16, 17, 15, 0.44);
}
@media (hover: hover) {
  html.motion-on .service-index[data-service-scene] .accordion .item:hover .toggle:not(:checked) + .question {
    color: var(--accordion-text);
  }
}
html.motion-on .service-index[data-service-scene] .service-photo img {
  will-change: transform;
}

/* The signal, in the colours the list already uses: the blue of an open title, and the
   coral of its mark for the point of light. */
.service-signal {
  --service-node: clamp(8px, calc(var(--svc, 1vw) * 0.62), 15px);
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.service-signal i {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}
.service-signal__line,
.service-signal__track {
  width: 1.25px;
  height: 100%;
  margin-left: -0.625px;
  background: #293bb6;
  transform-origin: 50% 0;
  transform: scaleY(0);
}
.service-signal__line {
  opacity: 0.5;
}
/* A fainter rail joins the four stops before the signal has run it. */
.service-signal__track {
  opacity: 0.13;
}
.service-signal__node,
.service-signal__head {
  width: var(--service-node);
  height: var(--service-node);
  margin: calc(var(--service-node) / -2) 0 0 calc(var(--service-node) / -2);
  border-radius: 50%;
}
.service-signal__node {
  background: var(--paper, #ede9e1);
  box-shadow: inset 0 0 0 1.25px rgba(41, 59, 182, 0.5);
  transition:
    background-color 0.5s ease,
    box-shadow 0.5s ease;
}
.service-signal__node.is-reached {
  background: #293bb6;
  box-shadow: inset 0 0 0 1.25px #293bb6;
}
.service-signal__head {
  background: #fa765d;
  box-shadow: 0 0 0 calc(var(--service-node) * 0.55) rgba(250, 118, 93, 0.2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

/* ------------------------------------------------------------------
   Paper
   Printed, or saved as a PDF, the page is laid out plainly: every section in order, nothing
   held in place and nothing waiting to be revealed, in one ink on white. (Left to itself the
   page printed its light text on white paper and left out whatever had not yet been scrolled to.)
   ------------------------------------------------------------------ */
@media print {
  @page {
    margin: 14mm;
  }
  html,
  body {
    background: #fff !important;
  }
  body,
  body * {
    color: #121211 !important;
    -webkit-text-fill-color: currentColor !important;
    background: none !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  body *,
  body *::before,
  body *::after {
    animation: none !important;
    transition: none !important;
  }
  /* Nothing waits to be shown. */
  body :is(header, main, footer) :not(.print-sheet) {
    transform: none !important;
    opacity: 1 !important;
    clip-path: none !important;
    filter: none !important;
    visibility: visible !important;
  }
  /* The drawn and the decorative layers stay on the screen. */
  .signal-web,
  .backdrop-track,
  .blur-track,
  [data-transition-layer],
  .skip,
  .mast nav,
  .justice-coin__render,
  .justice-coin__flip,
  .justice-coin__shadow,
  dialog,
  body > main::after,
  a[data-photo-cue]::after {
    display: none !important;
  }
  /* Nothing is held in place. */
  .pin-spacer {
    position: static !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .opening,
  .inquire,
  .service-index__layout {
    position: static !important;
    inset: auto !important;
    width: auto !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
  }
  [data-scene],
  .service-index {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    padding-block: 0 8mm !important;
  }
  /* The two scenes of photographs become plain sheets, three to a row, each in its own shape. */
  .pullback-camera,
  .trust-camera {
    position: static !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 5mm !important;
    align-items: start !important;
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    container-type: normal !important;
    overflow: visible !important;
  }
  .trust-copy {
    grid-column: 1 / -1 !important;
    position: static !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 0 4mm !important;
  }
  [data-scene] .collage-photo {
    position: static !important;
    inset: auto !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    aspect-ratio: var(--media-aspect, 4 / 5) !important;
    justify-self: stretch !important;
    align-self: start !important;
  }
  [data-scene] .collage-photo img {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    height: 100% !important;
  }
  /* Headings that were split into lines for the screen run as ordinary text again. */
  :is(.line, .line-mask) {
    display: inline !important;
  }
  /* The coin as a still photograph. */
  .justice-coin__still {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
  }
  /* Every service is open on paper. */
  .service-index .accordion .answer {
    grid-template-rows: 1fr !important;
  }
  .service-index .accordion .icon {
    display: none !important;
  }
  figure,
  img,
  .item,
  .experience__point,
  .record-metric,
  .objects,
  h2,
  h2 + p {
    break-inside: avoid;
  }
  h2 {
    break-after: avoid;
  }
}
