/* Pass two: motion and craft. It loads after site.css and only adds or
   overrides. Everything that moves animates transform, opacity, clip-path or
   a stroke, never layout. reduced.css switches it all off. */

/* ---- page transitions -------------------------------------------------- */
/* Between pages of the site the header stays put and the rest cross-fades. */
@view-transition {
  navigation: auto;
}

.site-header {
  view-transition-name: site-header;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.32s;
  animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---- the header: nothing shows through once you scroll ------------------- */
.site-header {
  background: transparent;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition:
    background-color 0.25s,
    border-color 0.25s;
}

.site-header[data-scrolled] {
  background: rgb(15, 16, 18);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  backdrop-filter: blur(20px) saturate(1.3);
  border-bottom-color: var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03);
}

/* ---- editorial type -------------------------------------------------------- */
body {
  color: #c3c5ca;
  letter-spacing: 0.004em;
}

.display {
  font-size: clamp(2.8rem, 1rem + 5.4vw, 6.4rem);
  line-height: 0.92;
  letter-spacing: -0.055em;
}

.h1 {
  line-height: 1;
  letter-spacing: -0.05em;
}

.h2 {
  line-height: 1.03;
  letter-spacing: -0.045em;
}

.lead {
  max-width: 34em;
  font-weight: 400;
}

/* The big numbers are outlines: drawn, not filled, so they stay quiet. */
.feature-num {
  color: transparent;
  -webkit-text-stroke: 1.5px var(--line-strong);
  font-size: clamp(4rem, 2.4rem + 6vw, 8rem);
}

/* ---- film grain and a slow wallpaper ------------------------------------------ */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .55 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.wallpaper {
  inset: -120px 0;
  overflow: hidden;
  background: none;
  opacity: 1;
  transform: none;
}

/* One tile of the pattern is 700px, so sliding by exactly one tile loops
   without a seam. Three minutes a loop: you feel it more than see it. */
.wallpaper::before {
  content: "";
  position: absolute;
  inset: -700px;
  background: url("../img/doodles.svg") repeat;
  background-size: 700px 700px;
  animation: drift 200s linear infinite;
}

@keyframes drift {
  to {
    transform: translate3d(700px, 700px, 0);
  }
}

/* ---- the hero: lines rise out of a mask, the underline draws --------------------- */
.line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.16em;
  margin-bottom: -0.16em;
}

.line > span {
  display: block;
}

.js .hero .line > span {
  animation: line-in 1.05s var(--ease) both;
  animation-delay: calc(var(--i, 0) * 130ms + 120ms);
}

@keyframes line-in {
  from {
    transform: translateY(108%);
  }
}

.mark {
  position: relative;
  background: none;
}

.mark::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.1em;
  height: 0.075em;
  background: rgba(203, 185, 143, 0.6);
  transform-origin: left center;
}

.js .hero .mark::after {
  animation: draw 0.9s var(--ease) 1.05s both;
}

@keyframes draw {
  from {
    transform: scaleX(0);
  }
}

/* ---- Loki: blinks, and knocks a mug off the edge ---------------------------------- */
.loki .eye {
  transform-box: fill-box;
  transform-origin: center;
  animation: blink 6.5s infinite;
}

.loki:nth-of-type(2n) .eye {
  animation-delay: -3.1s;
}

@keyframes blink {
  0%,
  93%,
  100% {
    scale: 1;
  }
  96% {
    scale: 1 0.08;
  }
}

.loki-btn {
  position: relative;
  display: block;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.loki-btn:focus-visible {
  outline-offset: 6px;
}

.mug {
  position: absolute;
  left: -48px;
  top: 32px;
  width: 38px;
  pointer-events: none;
}

.loki-hero-say {
  position: absolute;
  right: calc(100% + 10px);
  top: -8px;
  z-index: 4;
  white-space: nowrap;
}

/* ---- pointer effects ---------------------------------------------------------------- */
.btn {
  translate: var(--tx, 0) var(--ty, 0);
  transition:
    translate 0.3s var(--ease),
    transform 0.2s var(--ease),
    background 0.2s,
    border-color 0.2s;
}

[data-tilt] {
  transform: perspective(1400px) rotateX(var(--rx, 0deg))
    rotateY(var(--ry, 0deg));
  transition: transform 0.4s var(--ease);
}

[data-tilt]:hover {
  will-change: transform;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(
    260px circle at var(--mx, 50%) var(--my, 0%),
    rgba(255, 255, 255, 0.075),
    transparent 70%
  );
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover::before {
  opacity: 1;
}

/* ---- scroll-driven, where the browser can do it by itself ------------------------------ */
@supports (animation-timeline: view()) {
  .feature-num {
    animation: num-drift linear both;
    animation-timeline: view();
    animation-range: entry 0% exit 100%;
  }

  .frame:not(.frame-phone) > img {
    animation: settle linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 90%;
  }

  .hero-grid > :first-child {
    animation: copy-out linear both;
    animation-timeline: scroll(root);
    animation-range: 0 70vh;
  }

  .wallpaper {
    animation: wallpaper-lift linear both;
    animation-timeline: scroll(root);
  }

  @keyframes num-drift {
    from {
      transform: translateY(48px);
    }
    to {
      transform: translateY(-48px);
    }
  }

  @keyframes settle {
    from {
      transform: scale(1.07);
    }
    to {
      transform: none;
    }
  }

  @keyframes copy-out {
    to {
      transform: translateY(-36px);
      opacity: 0.35;
    }
  }

  @keyframes wallpaper-lift {
    to {
      transform: translateY(-120px);
    }
  }
}

/* ---- a story slot that stays out of the way until it is built ---------------------------- */
.story[hidden] {
  display: none;
}

/* `clip`, not `hidden`: it cuts what sticks out without making a scroll
   container, so the pinned stage inside still sticks. */
#story {
  overflow-x: clip;
}

/* With the story on the page, the rows it already tells (team, desk,
   workspace, tiling) give way, and the numbers that counted them go too. */
html[data-story="on"] .feature[data-covered],
html[data-story="on"] .feature-num {
  display: none;
}

/* ---- pawd restarts, the chat keeps going -------------------------------------------------- */
.restart {
  display: grid;
  gap: var(--s-4);
  max-width: 44rem;
  margin: var(--s-7) auto 0;
  padding: var(--s-5);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--panel);
}

.restart-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
}

.restart-head h3 {
  font-size: var(--t-lg);
}

.restart-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-1) var(--s-3);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--bright);
  font-size: var(--t-xs);
  font-weight: 700;
}

/* Up is a filled dot, down is a hollow dashed ring that turns: shape, not hue. */
.restart-pill::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--bright);
}

.restart-pill[data-state="down"]::before {
  background: none;
  border: 2px dashed var(--bright);
  animation: spin 1.2s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.restart-chat {
  display: grid;
  gap: var(--s-2);
}

.restart-chat .bubble {
  min-height: 3.2em;
  max-width: 100%;
}

.restart-chat .bubble.me {
  max-width: 85%;
}

.restart-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-4);
}

.restart-actions .btn {
  min-height: 40px;
  padding: 0 var(--s-4);
}

/* ---- Loki lives a little: the hero and the footer ---------------------------------------- */
/* His blink in the hero is a timer's job now, not an endless loop. */
[data-mug] .loki .eye {
  animation: none;
}

/* Ears are separate shapes, so one can twitch. */
.loki .ear {
  transform-box: view-box;
}

.loki .ear-l {
  transform-origin: 6px 9px;
}

.loki .ear-r {
  transform-origin: 18px 9px;
}

.loki-btn .paw {
  position: absolute;
  left: -2px;
  top: 44px;
  width: 22px;
  height: auto;
  opacity: 0;
  pointer-events: none;
}

/* The footer line, with a cat and a ball of paper on it. */
.site-footer {
  position: relative;
}

.fl {
  --fl-cat: 64px;
  position: absolute;
  top: calc(var(--fl-cat) * -1);
  right: var(--gutter);
  left: var(--gutter);
  height: var(--fl-cat);
  pointer-events: none;
}

.fl-cat,
.fl-ball,
.fl-zzz {
  position: absolute;
  bottom: 0;
  left: 0;
}

.fl-cat {
  width: var(--fl-cat);
  height: var(--fl-cat);
  transform-origin: 50% 100%;
}

.fl-body {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%;
}

.fl-head {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.fl-head .ear {
  transform-box: view-box;
}

.fl-head .ear-l {
  transform-origin: 6px 9px;
}

.fl-head .ear-r {
  transform-origin: 18px 9px;
}

.fl-paw {
  position: absolute;
  bottom: -2px;
  width: 22%;
}

.fl-paw svg {
  display: block;
  width: 100%;
  height: auto;
}

.fl-paw-l {
  left: 20%;
}

.fl-paw-r {
  right: 20%;
}

.fl-ball {
  width: 22px;
  height: 22px;
}

.fl-ball svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* Eyes: open, or shut when he naps (or blinks). */
.fl-shut {
  display: none;
}

.fl[data-state="nap"] .fl-open,
.fl[data-blink] .fl-open {
  display: none;
}

.fl[data-state="nap"] .fl-shut,
.fl[data-blink] .fl-shut {
  display: inline;
}

/* The z's float over him while he sleeps, and are not mirrored with him. */
.fl-zzz {
  bottom: calc(var(--fl-cat) * 0.8);
  display: none;
  font: 700 0.9rem/1 var(--font);
  color: var(--dim);
}

.fl[data-state="nap"] .fl-zzz {
  display: block;
}

.fl-zzz i {
  position: absolute;
  font-style: normal;
  opacity: 0;
  animation: fl-z 3s ease-in-out infinite;
}

.fl-zzz i:nth-child(2) {
  left: 10px;
  animation-delay: 0.6s;
}

.fl-zzz i:nth-child(3) {
  left: 20px;
  animation-delay: 1.2s;
}

@keyframes fl-z {
  0%,
  100% {
    opacity: 0;
    transform: translateY(4px);
  }
  50% {
    opacity: 1;
    transform: translateY(-10px);
  }
}

@media (max-width: 560px) {
  .fl {
    --fl-cat: 52px;
  }

  .mug {
    left: -40px;
    width: 32px;
  }
}
