/* Cursor follower, three states built from a few small pieces:
   - rest: an arrow pointing up and left, its tip exactly on the pointer. It is
     made of the wings (the two short lines of the head) and the body (the
     diagonal), both inverting what is under them;
   - over opted-in links and buttons (.cursor-arrow, .link-arrow): the arrow
     turns to point the way the element says (right by default; see the
     cursor-arrow--… classes), as a solid dark line inside a frosted diamond
     (the veil);
   - over images inside links or buttons (the cards): the same, with a
     slightly larger diamond.
   Other links and buttons keep the resting arrow.
   Mouse and trackpad only, and not for visitors who prefer reduced motion,
   who keep the browser's own cursor. The native cursor is hidden while the
   follower runs, except inside .use-native-cursor containers (the language
   switch) and form fields, where the follower steps aside. */

.site-cursor {
  display: none;
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  .site-cursor {
    --theme-cursor-arrow: 1.25rem;
    --theme-cursor-veil: 2rem;
    --theme-cursor-turn: 135deg;
    --theme-cursor-shift-x: 0.7071;
    --theme-cursor-shift-y: 0;

    position: fixed;
    inset: 0 auto auto 0;
    z-index: 9999;
    display: block;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--theme-ease-signature);
  }

  /* In fast (the browser's own cursor is hidden, so a slow fade-in would leave the page
     without a pointer when it comes back into the window); out stays slow. */
  .site-cursor.is-visible {
    opacity: 1;
    transition-duration: 0.1s;
  }

  .site-cursor.is-native {
    opacity: 0;
  }

  .has-cursor,
  .has-cursor body,
  .has-cursor :is(.intro, .site-header, main, .site-footer),
  .has-cursor :is(.intro, .site-header, main, .site-footer) * {
    cursor: none !important;
  }

  /* Everything else on the page (admin bar, chat widgets, popups) keeps the
     browser's own cursors. */
  .has-cursor body > :not(.intro, .site-header, main, .site-footer, .site-cursor),
  .has-cursor body > :not(.intro, .site-header, main, .site-footer, .site-cursor) * {
    cursor: auto !important;
  }

  .has-cursor
    body
    > :not(.intro, .site-header, main, .site-footer, .site-cursor)
    :is(
      a[href],
      button:not(:disabled),
      summary,
      [role='button'],
      label,
      select,
      input[type='submit']
    ) {
    cursor: pointer !important;
  }

  /* The arrow: its top-left corner is the pointer. Over links it hides; over
     images it centres on the pointer and turns to point right. */

  .site-cursor__arrow {
    position: absolute;
    inset: 0 auto auto 0;
    width: var(--theme-cursor-arrow);
    height: var(--theme-cursor-arrow);
    transform-origin: top left;
    transition:
      translate 0.5s var(--theme-ease-signature),
      rotate 0.6s var(--theme-ease-signature),
      scale 0.4s var(--theme-ease-signature),
      opacity 0.3s var(--theme-ease-signature);
  }

  .site-cursor__body,
  .site-cursor__wings::before,
  .site-cursor__wings::after {
    position: absolute;
    inset: 0 auto auto 0;

    /* Inverts what is behind it. The contrast step pushes the in-between greys apart:
       a plain invert turns a mid grey into the same grey, so the arrow vanished over
       mid-tone footage. The blur keeps the colour steady over textured pictures. */
    backdrop-filter: blur(6px) grayscale(1) invert(1) contrast(10);
    transition:
      clip-path 0.6s var(--theme-ease-signature),
      background-color 0.4s var(--theme-ease-signature);
  }

  /* The diagonal (2px) and the tip corner. The wings are thinner (1.5px)
     because a diagonal line looks lighter than a straight one of the same
     width, so this evens out their weight. 1.5px is a whole number of device
     pixels at 1x and 2x of the density that matters (3 rows at 2x), and
     main.js snaps the position to the pixel grid: the straight edges are
     clipped to whole pixels, so otherwise they would swing between two
     thicknesses as the pointer moves. The wings meet the body along straight
     edges, so there is no seam. */

  .site-cursor__body {
    width: 100%;
    height: 100%;
    clip-path: polygon(
      0 0,
      20% 0,
      20% 7.5%,
      14.57% 7.5%,
      98.54% 91.46%,
      91.46% 98.54%,
      7.5% 14.57%,
      7.5% 20%,
      0 20%
    );
  }

  .site-cursor__wings {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
    height: 100%;
  }

  .site-cursor__wings::before,
  .site-cursor__wings::after {
    content: '';
    width: 100%;
    height: 100%;
  }

  .site-cursor__wings::before {
    clip-path: polygon(20% 0, 46% 0, 46% 7.5%, 20% 7.5%);
  }

  .site-cursor__wings::after {
    clip-path: polygon(0 20%, 7.5% 20%, 7.5% 46%, 0 46%);
  }

  /* Over links and images the arrow centres on the pointer and turns to point
     right. */

  .site-cursor.is-active .site-cursor__arrow {
    /* The turn is about the top-left corner (the origin never changes, so it
       also animates back smoothly). The arrow's centre moves when it turns, so
       it is shifted back by the matching share of its size to land centred on
       the pointer. Both come from the direction (below). */
    translate: calc(var(--theme-cursor-arrow) * var(--theme-cursor-shift-x))
      calc(var(--theme-cursor-arrow) * var(--theme-cursor-shift-y));
    rotate: var(--theme-cursor-turn);
  }

  /* Which way the arrow points, set by main.js from the element's
     cursor-arrow--… class. The resting arrow points up and left; the turn is
     how far it has to rotate, the shift keeps it centred. Right is the
     default (above). */

  .site-cursor[data-direction='down'] {
    --theme-cursor-turn: 225deg;
    --theme-cursor-shift-x: 0;
    --theme-cursor-shift-y: 0.7071;
  }

  .site-cursor[data-direction='up'] {
    --theme-cursor-turn: 45deg;
    --theme-cursor-shift-x: 0;
    --theme-cursor-shift-y: -0.7071;
  }

  .site-cursor[data-direction='left'] {
    --theme-cursor-turn: -45deg;
    --theme-cursor-shift-x: -0.7071;
    --theme-cursor-shift-y: 0;
  }

  /* Up and right: a quarter turn, the shaft stays diagonal. */

  .site-cursor[data-direction='external'],
  .site-cursor[data-direction='mail'],
  .site-cursor[data-direction='linkedin'],
  .site-cursor[data-direction='phone'] {
    --theme-cursor-turn: 90deg;
    --theme-cursor-shift-x: 0.5;
    --theme-cursor-shift-y: -0.5;
  }

  /* Up and left: the resting direction, no turn; the shift centres it on the
     pointer. */

  .site-cursor[data-direction='top-left'] {
    --theme-cursor-turn: 0deg;
    --theme-cursor-shift-x: -0.5;
    --theme-cursor-shift-y: -0.5;
  }

  /* Turned right it is a solid dark line on the frosted veil (inverting a
     frosted area would only give a washed-out grey). The switch is not
     animated: half way between inverting and solid is a mid grey on a light
     page, which made the arrow look thinner while it turned. */

  .site-cursor.is-active .site-cursor__body,
  .site-cursor.is-active .site-cursor__wings::before,
  .site-cursor.is-active .site-cursor__wings::after {
    background-color: #000;
    backdrop-filter: none;
  }

  /* Turned to point right, down, up or left, the straight and diagonal strokes
     swap places, so their thickness swaps too (the head 2px, the shaft 1.5px)
     and the arrow keeps the same visual weight. Same points as at rest, so it
     morphs while it turns. The up-and-right arrow keeps the resting shape. */

  .site-cursor.is-active:not(
      [data-direction='external'],
      [data-direction='mail'],
      [data-direction='phone'],
      [data-direction='linkedin'],
      [data-direction='top-left']
    )
    .site-cursor__body {
    clip-path: polygon(
      0 0,
      20% 0,
      20% 10%,
      15.3% 10%,
      97.65% 92.35%,
      92.35% 97.65%,
      10% 15.3%,
      10% 20%,
      0 20%
    );
  }

  .site-cursor.is-active:not(
      [data-direction='external'],
      [data-direction='mail'],
      [data-direction='phone'],
      [data-direction='linkedin'],
      [data-direction='top-left']
    )
    .site-cursor__wings::before {
    clip-path: polygon(20% 0, 46% 0, 46% 10%, 20% 10%);
  }

  .site-cursor.is-active:not(
      [data-direction='external'],
      [data-direction='mail'],
      [data-direction='phone'],
      [data-direction='linkedin'],
      [data-direction='top-left']
    )
    .site-cursor__wings::after {
    clip-path: polygon(0 20%, 10% 20%, 10% 46%, 0 46%);
  }

  /* mailto: and tel: links: an icon replaces the arrow, centred on the pointer,
     solid dark (white on dark areas) on the frosted diamond like the other arrow states. */

  .site-cursor__icon {
    position: absolute;
    inset: 0 auto auto 0;
    width: 1.375rem;
    height: 1.375rem;
    margin: -0.6875rem 0 0 -0.6875rem;
    background: #000;
    mask: var(--theme-cursor-icon) center / contain no-repeat;
    opacity: 0;
    scale: 0.5;
    transition:
      opacity 0.2s var(--theme-ease-signature),
      scale 0.2s var(--theme-ease-signature),
      background-color 0.4s var(--theme-ease-signature);
  }

  .site-cursor[data-direction='mail'] {
    --theme-cursor-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-linejoin='round' stroke-width='2'%3E%3Cpath stroke-linecap='round' d='M2 6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2z'/%3E%3Cpath d='m2 8l7.501 6.001a4 4 0 0 0 4.998 0L22 8'/%3E%3C/svg%3E");
  }

  .site-cursor[data-direction='linkedin'] {
    --theme-cursor-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M9.429 8.969h3.714v1.85c.535-1.064 1.907-2.02 3.968-2.02c3.951 0 4.889 2.118 4.889 6.004V22h-4v-6.312c0-2.213-.535-3.461-1.897-3.461c-1.889 0-2.674 1.345-2.674 3.46V22h-4zM2.57 21.83h4V8.799h-4zM7.143 4.55a2.53 2.53 0 0 1-.753 1.802a2.57 2.57 0 0 1-1.82.748a2.6 2.6 0 0 1-1.818-.747A2.55 2.55 0 0 1 2 4.55c0-.677.27-1.325.753-1.803A2.58 2.58 0 0 1 4.571 2c.682 0 1.336.269 1.819.747s.753 1.126.753 1.803'/%3E%3C/svg%3E");
  }

  .site-cursor[data-direction='phone'] {
    --theme-cursor-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-linecap='round' stroke-linejoin='round' stroke-width='2'%3E%3Cpath d='M10.554 6.24L7.171 2.335c-.39-.45-1.105-.448-1.558.006L2.831 5.128c-.828.829-1.065 2.06-.586 3.047a29.2 29.2 0 0 0 13.561 13.58c.986.479 2.216.242 3.044-.587l2.808-2.813c.455-.455.456-1.174.002-1.564l-3.92-3.365c-.41-.352-1.047-.306-1.458.106l-1.364 1.366a.46.46 0 0 1-.553.088a14.56 14.56 0 0 1-5.36-5.367a.46.46 0 0 1 .088-.554l1.36-1.361c.412-.414.457-1.054.101-1.465'/%3E%3C/svg%3E");
  }

  .site-cursor.is-active[data-direction='mail'] .site-cursor__icon,
  .site-cursor.is-active[data-direction='linkedin'] .site-cursor__icon,
  .site-cursor.is-active[data-direction='phone'] .site-cursor__icon {
    opacity: 1;
    scale: 1;
    transition:
      opacity 0.3s var(--theme-ease-signature),
      scale 0.45s var(--theme-ease-signature),
      background-color 0.4s var(--theme-ease-signature);
  }

  /* Like the external link: the arrow turns up and right, then becomes the icon
     (the arrow fades out while the icon grows in on the same spot). */

  .site-cursor.is-active[data-direction='mail'] .site-cursor__arrow,
  .site-cursor.is-active[data-direction='linkedin'] .site-cursor__arrow,
  .site-cursor.is-active[data-direction='phone'] .site-cursor__arrow {
    opacity: 0;
  }

  .site-cursor[data-tone='dark'] .site-cursor__icon {
    background: #fff;
  }

  /* Over the dark areas (footer, hero, dark sections; main.js sets the tone)
     the arrow is white and the shape a darker frost, so it reads there too. */

  .site-cursor.is-active[data-tone='dark'] .site-cursor__body,
  .site-cursor.is-active[data-tone='dark'] .site-cursor__wings::before,
  .site-cursor.is-active[data-tone='dark'] .site-cursor__wings::after {
    background-color: #fff;
  }

  /* The veil: a frosted diamond centred on the pointer, the same look over
     links and images; a little smaller over links. */

  .site-cursor__veil {
    position: absolute;
    inset: 0 auto auto 0;
    width: var(--theme-cursor-veil);
    height: var(--theme-cursor-veil);
    margin: calc(var(--theme-cursor-veil) / -2) 0 0 calc(var(--theme-cursor-veil) / -2);
    background: rgb(225 225 225 / 50%);
    opacity: 0;
    rotate: 45deg;
    scale: 0.4;
    transition:
      width 0.5s var(--theme-ease-signature),
      height 0.5s var(--theme-ease-signature),
      margin 0.5s var(--theme-ease-signature),
      opacity 0.4s var(--theme-ease-signature),
      rotate 0.5s var(--theme-ease-signature),
      scale 0.5s var(--theme-ease-signature),
      background-color 0.4s var(--theme-ease-signature);
  }

  @supports (backdrop-filter: blur(1px)) {
    .site-cursor__veil {
      backdrop-filter: blur(5px);
    }
  }

  .site-cursor[data-tone='dark'] .site-cursor__veil {
    background: rgb(0 0 0 / 35%);
  }

  /* External links: the shape stays an upright square, only the arrow turns
     (up and right). */

  .site-cursor[data-direction='external'] .site-cursor__veil {
    rotate: 0deg;
  }

  .site-cursor.is-active .site-cursor__veil {
    opacity: 1;
    scale: 1;
  }

  /* Over the edge zones that scroll a row (team, logos, life) only the arrow shows,
     without the shape, which stands for a click. */

  .site-cursor.is-edge .site-cursor__veil {
    opacity: 0;
    scale: 0.4;
  }

  .site-cursor.is-active {
    --theme-cursor-veil: 2.25rem;
  }

  .site-cursor.is-media {
    --theme-cursor-veil: 2.75rem;
  }
}

/* Opt-out: add use-native-cursor to a container to give everything inside the
   browser's own cursors: arrow, hand over links and buttons, caret in fields. */

.use-native-cursor,
.use-native-cursor * {
  cursor: auto !important;
}

.use-native-cursor
  :is(
    a[href],
    button:not(:disabled),
    summary,
    [role='button'],
    label,
    select,
    input[type='submit'],
    input[type='button'],
    input[type='checkbox'],
    input[type='radio']
  ) {
  cursor: pointer !important;
}

.has-cursor
  :is(input:not([type='submit'], [type='button'], [type='checkbox'], [type='radio']), textarea) {
  cursor: text !important;
}
