/* ==========================================================================
   Odduel motion layer
   Start states are scoped to html.od-motion (set by motion.js) and to
   visitors who have not asked for reduced motion. Without either, content
   simply sits in place.
   ========================================================================== */

:root {
  --od-ease-out: cubic-bezier(.16, 1, .3, 1);
  --od-ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --od-dur-fast: 400ms;
  --od-dur: 700ms;
  --od-dur-slow: 900ms;
  --od-stagger: 80ms;
  --od-rise: 28px;
}

/* Numbers keep their width while counting. */
[data-od-count] { font-variant-numeric: tabular-nums; }

/* Accordion chevron: follows the native [open] state, with or without script. */
.od-accordion__icon { transition: transform var(--od-dur-fast) var(--od-ease-out); }
details[open]:not(.is-closing) > summary .od-accordion__icon { transform: rotate(180deg); }

/* Card hover: clipped frame for the image zoom. */
.od-hover__media { overflow: hidden; }
.od-hover__media img { display: block; }

@media (prefers-reduced-motion: reduce) {
  .od-accordion__icon { transition: none; }
}

@media (prefers-reduced-motion: no-preference) {

  /* ---- Reveal and stagger ------------------------------------------------ */
  .od-motion [data-od-reveal],
  .od-motion [data-od-stagger] > * {
    opacity: 0;
    transform: translate3d(0, var(--od-rise), 0);
    transition:
      opacity var(--od-dur) var(--od-ease-out) var(--od-delay, 0ms),
      transform var(--od-dur-slow) var(--od-ease-out) var(--od-delay, 0ms);
  }
  .od-motion [data-od-reveal="fade"] { transform: none; }
  .od-motion [data-od-reveal="left"] { transform: translate3d(calc(var(--od-rise) * -1), 0, 0); }
  .od-motion [data-od-reveal="right"] { transform: translate3d(var(--od-rise), 0, 0); }
  .od-motion [data-od-reveal].is-in,
  .od-motion [data-od-stagger] > .is-in {
    opacity: 1;
    transform: none;
  }
  /* Tied to the scroll: the script paints the element, so it rests in place and only
     its colours keep a transition (for hover), whatever a page style asks for. */
  .od-motion .od-sc,
  .od-motion [data-od-stagger] > .od-sc {
    opacity: 1;
    transform: none;
    transition: color .25s, background-color .25s, border-color .25s !important;
  }

  /* ---- Page-load sequence ------------------------------------------------ */
  .od-motion [data-od-load] {
    opacity: 0;
    transform: translate3d(0, -16px, 0);
    transition:
      opacity var(--od-dur) var(--od-ease-out) var(--od-delay, 0ms),
      transform var(--od-dur-slow) var(--od-ease-out) var(--od-delay, 0ms);
  }
  .od-motion [data-od-load="up"] { transform: translate3d(0, var(--od-rise), 0); }
  .od-motion [data-od-load="fade"] { transform: none; }
  .od-motion.od-loaded [data-od-load] {
    opacity: 1;
    transform: none;
  }

  /* ---- First screen ------------------------------------------------------ */
  /* data-od-first marks the largest element of the first screen. It is painted with the
     first frame: its entrance is the rise alone, started here, so it waits for neither the
     script nor the fonts. An element that only fades is simply there; a picture opens
     without its wipe. Further down the page the mark changes nothing. */
  .od-motion [data-od-first][data-od-first] {
    opacity: 1;
    transform: none;
    animation: od-first var(--od-dur-slow) var(--od-ease-out);
  }
  .od-motion [data-od-first][data-od-reveal="fade"],
  .od-motion [data-od-first][data-od-load="fade"],
  .od-motion [data-od-first][data-od-image-reveal] { animation: none; }
  .od-motion [data-od-first][data-od-image-reveal] > * { clip-path: none; }
  @keyframes od-first {
    from { transform: translate3d(0, var(--od-rise), 0); }
  }

  /* ---- Split headline ---------------------------------------------------- */
  .od-w {
    display: inline-block;
    overflow: hidden;
    vertical-align: top;
    /* Room for descenders and tight tracking inside the mask, without moving the text. */
    padding: 0 .06em .16em;
    margin: 0 -.06em -.16em;
  }
  .od-w__i {
    display: inline-block;
    transform: translate3d(0, calc(100% + .2em), 0);
    transition: transform var(--od-dur-slow) var(--od-ease-out)
      calc(var(--od-delay, 0ms) + var(--od-i, 0) * var(--od-split-step, 90ms));
  }
  [data-od-split="words"] { --od-split-step: 35ms; }
  [data-od-split].is-in .od-w__i { transform: none; }
  /* Further down the page the pieces rise with the scroll; a word never breaks inside. */
  .od-motion .od-rise .od-s,
  .od-motion .od-rise .od-c { display: inline-block; }

  /* ---- Image reveal ------------------------------------------------------ */
  /* The frame is observed; its child (img, picture or video) is wiped and settles. */
  .od-motion [data-od-image-reveal] { overflow: hidden; }
  .od-motion [data-od-image-reveal] > * {
    clip-path: inset(100% 0 0 0);
    scale: 1.06;
    transition:
      clip-path 600ms var(--od-ease-out) var(--od-delay, 0ms),
      scale 800ms var(--od-ease-out) var(--od-delay, 0ms);
  }
  .od-motion [data-od-image-reveal="down"] > * { clip-path: inset(0 0 100% 0); }
  .od-motion [data-od-image-reveal="right"] > * { clip-path: inset(0 100% 0 0); }
  .od-motion [data-od-image-reveal="left"] > * { clip-path: inset(0 0 0 100%); }
  .od-motion [data-od-image-reveal].is-in > * {
    clip-path: inset(0);
    scale: 1;
  }
  .od-motion [data-od-image-reveal].od-sc > * {
    clip-path: none;
    scale: 1;
    transition: transform var(--od-dur-slow) var(--od-ease-out) !important;
  }

  /* ---- Parallax (class is only added on fine pointers) ------------------- */
  /* The extra scale gives the drift room, so the frame never shows a gap. */
  .od-motion .od-parallax,
  .od-motion [data-od-image-reveal].is-in > .od-parallax {
    scale: 1.16;
  }
  .od-motion [data-od-image-reveal]:not(.is-in) > .od-parallax { scale: 1.3; }

  /* ---- Marquee ----------------------------------------------------------- */
  .od-motion [data-od-marquee] {
    display: flex;
    overflow: hidden;
    gap: var(--od-marquee-gap, 4rem);
  }
  .od-motion [data-od-marquee] > * {
    display: flex;
    flex: none;
    flex-wrap: nowrap;
    align-items: center;
    gap: var(--od-marquee-gap, 4rem);
    min-width: max-content;
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .od-motion [data-od-marquee] > * > * { flex: none; }
  .od-motion .od-marquee-on > * {
    animation: od-marquee var(--od-marquee-d, 40s) linear infinite;
  }
  .od-motion [data-od-marquee="reverse"] > * { animation-direction: reverse; }
  .od-motion [data-od-marquee]:hover > *,
  .od-motion [data-od-marquee]:focus-within > *,
  .od-motion [data-od-marquee].is-paused > * { animation-play-state: paused; }
  .od-motion .od-marquee--fade {
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
  }

  @keyframes od-marquee {
    to { transform: translate3d(calc(-100% - var(--od-marquee-gap, 4rem)), 0, 0); }
  }

  /* ---- Text fill on scroll ----------------------------------------------- */
  /* Letters are dimmed and filled by the script; a thin line marks the reading edge. */
  .od-motion .od-scrub { position: relative; }
  .od-motion .od-scrub .od-s,
  .od-motion [data-od-scrub-with] .od-s { display: inline-block; }
  .od-caret {
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 1.06em;
    background: var(--od-brand);
    opacity: 0;
    pointer-events: none;
  }

  /* Pointer light: a full-strength copy of the text, visible inside a soft circle around the pointer. */
  .od-motion .od-spot-host { position: relative; }
  .od-spot {
    position: absolute;
    inset: 0;
    padding: inherit;
    color: var(--od-fg);
    pointer-events: none;
    -webkit-user-select: none;
    user-select: none;
    opacity: var(--od-spot-o, 0);
    -webkit-mask-image: radial-gradient(circle 180px at var(--od-mx, -999px) var(--od-my, -999px), #000 0, rgba(0, 0, 0, .6) 45%, transparent 100%);
    mask-image: radial-gradient(circle 180px at var(--od-mx, -999px) var(--od-my, -999px), #000 0, rgba(0, 0, 0, .6) 45%, transparent 100%);
  }
  .od-spot .od-s,
  .od-spot .od-c {
    opacity: 1 !important;
    transform: none !important;
  }

  /* ---- Held sections ----------------------------------------------------- */
  /* The wrapper adds the scrolling room; the section stays on screen inside it. */
  .od-pin { position: relative; }
  .od-pin__hold { position: sticky; }
  .od-measure .od-pin__hold {
    position: relative !important;
    top: 0 !important;
  }
  /* Sizes are read with everything at rest, and what rises into the footer never lengthens the page. */
  .od-measure .od-sc,
  .od-measure .od-work > * { transform: none !important; }
  .od-motion .od-footer { overflow: clip; }

  /* ---- Rules, label lines, page hero ------------------------------------- */
  /* A rule that draws across, its length following --od-draw: section heads scale the
     line they already have; any other rule is repainted from its border. */
  .od-motion .od-section-head--rule.od-draw::before {
    transform: scaleX(var(--od-draw, 1));
    transition: none;
  }
  .od-motion .od-draw:not(.od-section-head--rule) {
    border-top-color: transparent;
    background-image: linear-gradient(var(--od-rule-c), var(--od-rule-c));
    background-repeat: no-repeat;
    background-position: left top;
    background-origin: border-box;
    background-size: calc(var(--od-draw, 1) * 100%) 1px;
  }
  /* The short line beside a label makes its own strokes (base styles); its reach follows --od-grow. */
  .od-motion .od-grow:not(.od-label)::before { scale: var(--od-grow, 1) 1; }
  /* The hero's content sinks behind the section that follows. */
  .od-motion .od-recede { overflow: clip; }
  .od-measure .od-recede__box {
    translate: none !important;
    scale: none !important;
  }

  /* ---- Page progress ----------------------------------------------------- */
  .od-progress {
    position: fixed;
    inset: 0 0 auto;
    z-index: 130;
    height: 3px;
    background: var(--od-brand);
    transform-origin: left center;
    transform: scaleX(0);
    /* Its own layer: the line moves on every frame of scrolling and must not repaint the page. */
    will-change: transform;
    pointer-events: none;
  }
  .od-menu-open .od-progress { visibility: hidden; }
  /* Articles keep the line as a reading mark, thinner. */
  .od-page-article .od-progress { height: 2px; }

  /* ---- Accordion --------------------------------------------------------- */
  .od-motion details[data-od-accordion] { box-sizing: border-box; }

  /* ---- Card hover -------------------------------------------------------- */
  .od-hover__media img { transition: transform var(--od-dur-slow) var(--od-ease-out); }
  .od-hover__arrow { transition: transform var(--od-dur-fast) var(--od-ease-out); }

  .od-hover:focus-visible .od-hover__media img,
  .od-hover:focus-within .od-hover__media img { transform: scale(1.05); }
  .od-hover:focus-visible .od-hover__arrow,
  .od-hover:focus-within .od-hover__arrow { transform: translate3d(6px, 0, 0); }
  .od-hover:focus-visible .od-hover__arrow--diag,
  .od-hover:focus-within .od-hover__arrow--diag { transform: translate3d(4px, -4px, 0); }

  @media (hover: hover) {
    .od-hover:hover .od-hover__media img { transform: scale(1.05); }
    .od-hover:hover .od-hover__arrow { transform: translate3d(6px, 0, 0); }
    .od-hover:hover .od-hover__arrow--diag { transform: translate3d(4px, -4px, 0); }
  }
}

/* ---- Print ----------------------------------------------------------------
   Paper has no scroll position: every start state is dropped and whatever the
   script painted for the current position is overruled, so all content prints. */
@media print {
  .od-motion [data-od-reveal],
  .od-motion [data-od-stagger] > *,
  .od-motion [data-od-load],
  .od-motion .od-work > *,
  .od-motion .od-sc,
  .od-motion .od-s,
  .od-motion .od-c,
  .od-motion .od-w__i,
  .od-motion .od-recede__box,
  .od-motion [data-od-image-reveal],
  .od-motion [data-od-image-reveal] > *,
  .od-motion .od-parallax,
  .od-motion .od-clients__list > *,
  .od-motion [data-od-stage-media],
  .od-motion [data-od-stage-item] > * {
    opacity: 1 !important;
    transform: none !important;
    translate: none !important;
    scale: none !important;
    clip-path: none !important;
    transition: none !important;
    animation: none !important;
  }
  .od-motion section,
  .od-motion .od-pin { clip-path: none !important; }
  .od-pin { height: auto !important; }
  .od-pin__hold { position: static !important; }
  .od-caret,
  .od-spot { display: none !important; }
  .od-motion .od-section-head--rule::before { transform: none !important; }
  .od-motion .od-draw:not(.od-section-head--rule) { background-size: 100% 1px !important; }
  .od-motion .od-grow::before { scale: none !important; }
  /* Client logos wrap inside the sheet instead of running past its edge */
  .od-motion .od-clients { padding-inline: var(--od-logo-edge) !important; }
  .od-motion .od-clients__list { flex-wrap: wrap !important; gap: 24px 48px !important; width: auto !important; padding-inline: 0 !important; transform: none !important; }
  .od-motion .od-clients__item[aria-hidden="true"] { display: none !important; }
  .od-motion [data-od-marquee] > [aria-hidden="true"] { display: none !important; }
  .od-motion .od-marquee-on > * { animation: none !important; flex-wrap: wrap !important; min-width: 0 !important; }
}

/* Text blocks on scroll (assets/js/text-scenes.js): out of the distance on the way in, back into it on the way out. */
html.od-motion .od-tx { opacity: 0; scale: 0.955; filter: blur(9px); transition: opacity 0.42s ease, scale 0.5s ease, filter 0.42s ease; }
html.od-motion .od-tx.is-tx { opacity: 1; scale: 1; filter: blur(0); transition: opacity 0.75s ease var(--tx-d, 0ms), scale 0.95s cubic-bezier(.16, 1, .3, 1) var(--tx-d, 0ms), filter 0.75s ease var(--tx-d, 0ms); }
@media print { html.od-motion .od-tx { opacity: 1; scale: 1; filter: none; } }

/* Project pages on desktop (assets/js/text-scenes.js): each block is a fixed scene, the scroll only changes scene. */
html.od-stage .od-tx { transition: none; }
html.od-stage .od-scene { position: relative; }
html.od-stage .od-scene__in { position: fixed; inset: 0; z-index: 1; display: flex; flex-direction: column; justify-content: center; overflow: hidden; padding-inline: 30px; background: transparent; }
html.od-stage .od-scene__in--media { padding-top: calc(var(--od-header-h) + 24px); padding-bottom: 24px; align-items: stretch; }
html.od-stage .od-scene__in:has(> .od-cs-hero) { padding-inline: 0; justify-content: flex-start; }
html.od-stage .od-scene__in > * { flex: none; width: 100%; margin-block: 0 !important; transform-origin: 50% 50%; will-change: opacity, scale, filter; }
html.od-stage .od-scene__in > .od-mosaic { margin-left: -30px; width: 100vw; height: auto !important; }
html.od-stage .od-scene__in > .od-mosaic .od-mosaic__pin { position: static; height: auto; }
html.od-stage .od-cs-block { padding-inline: 0; }
@media print { html.od-stage .od-scene { height: auto !important; } html.od-stage .od-scene__in { position: static; display: block !important; visibility: visible !important; } html.od-stage .od-scene__in > * { opacity: 1 !important; scale: 1 !important; filter: none !important; translate: none !important; } }
html.od-stage .od-cs-hero { display: flex; flex-direction: column; height: 100vh; box-sizing: border-box; }
html.od-stage .od-cs-hero__media { flex: 1 1 0; min-height: 0; }
html.od-stage .od-cs-facts { flex: none; }
html.od-stage .od-scene__in--full { padding-inline: 0; }
html.od-stage .od-stage-back { position: fixed; inset: 0; z-index: 1; background: var(--od-white); }
@media print { html.od-stage .od-stage-back { display: none !important; } }
/* What follows the fixed scenes is reached with its top at the top of the window: its first line stands clear of the bar. */
html.od-stage .od-cta .od-cw { padding-top: calc(var(--od-header-h) + var(--od-end, 48px)); }
