/* 333: a sky drawn in code. It starts as the page colour, so there is no edge,
   and deepens into the landing page's noon (light) or dusk (dark). The brand
   kit's cloud mark floats between a far and a near cloud bank. */
@font-face {
  font-family: '333 Nunito';
  src: url('/fonts/signoffs/333-nunito.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

/* Taller than the default band: the dissolve from page to sky needs the top
   ~40% to itself, and the mark needs open sky above the clouds. */
[data-signoff='333'] {
  --b-height: clamp(380px, 34vw, 480px);
  --b-height-m: 340px;
  --s333-h: clamp(200px, 19vw, 280px);
  --s333-lift: 17%;

  view-timeline: --s333 block;
}
/* Many stops instead of two, so the colour eases out of the page instead of
   starting at a line. */
[data-signoff='333'] .s333-sky {
  -webkit-mask-image: none;
  mask-image: none;
  background: linear-gradient(
    in oklab,
    #fff 0%,
    #fcfdff 10%,
    #f1f7fd 22%,
    #deecf9 35%,
    #c2dbf3 48%,
    #accdef 62%,
    #9fc5ec 78%,
    #98c1ea 100%
  );
}
.dark [data-signoff='333'] .s333-sky {
  background: linear-gradient(
    in oklab,
    #18181b 0%,
    #19191f 10%,
    #1e1c2c 21%,
    #2a2549 33%,
    #3f357c 45%,
    #6150b4 56%,
    #915fc2 66%,
    #c56cae 75%,
    #ea8590 84%,
    #f6aa7c 92%,
    #fdc98a 100%
  );
}

[data-signoff='333'] .s333-stars {
  display: none;
}
.dark [data-signoff='333'] .s333-stars {
  display: block;
  position: absolute;
  inset: 0;
}
[data-signoff='333'] .s333-stars i {
  position: absolute;
  width: calc(var(--s) * 2px);
  height: calc(var(--s) * 2px);
  border-radius: 50%;
  background: #fff;
  opacity: calc(var(--s) * 0.55);
  animation: s333-twinkle 4.8s ease-in-out var(--d) infinite alternate;
}
@keyframes s333-twinkle {
  to {
    opacity: calc(var(--s) * 0.18);
  }
}

/* The setting sun, low behind the clouds. Dusk only. */
[data-signoff='333'] .s333-sun {
  display: none;
}
.dark [data-signoff='333'] .s333-sun {
  display: block;
  position: absolute;
  left: 50%;
  /* Sized off the band's height so its glow always fades out inside the
     band; an edge at the top would show as a line on the dark page. */
  bottom: -12%;
  height: 92%;
  width: min(1100px, 130%);
  translate: -50% 0;
  background: radial-gradient(
    closest-side,
    #fff1c9 0%,
    #ffd795d0 14%,
    #ffb38a70 38%,
    #f08a9a22 66%,
    transparent 100%
  );
}

[data-signoff='333'] .s333-rise {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}
[data-signoff='333'] .s333-rise-far {
  height: 58%;
}
[data-signoff='333'] .s333-rise-near {
  z-index: 2;
  height: 30%;
}
[data-signoff='333'] .s333-bank {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}
/* Each bank paints a base colour, then the filter adds light on top of every
   lump and shade under it. The far bank sits lower in contrast, like haze. */
[data-signoff='333'] .s333-bank-far {
  --s333-lit: #fff;
  --s333-shade: #b8cfe9;
}
[data-signoff='333'] .s333-far {
  fill: #e4eef9;
}
[data-signoff='333'] .s333-far-back {
  fill: #d6e6f6;
}
[data-signoff='333'] .s333-wisps {
  fill: #fff;
  opacity: 0.55;
}
[data-signoff='333'] .s333-bank-near {
  --s333-lit: #fff;
  --s333-shade: #b4c8e3;
}
[data-signoff='333'] .s333-bank-near {
  --s333-near-top: #f3f8fd;
  --s333-near-low: #dbe7f5;
}
.dark [data-signoff='333'] .s333-bank-far {
  --s333-lit: #f6c1c9;
  --s333-shade: #5d4a9c;
}
.dark [data-signoff='333'] .s333-far {
  fill: #a479b8;
}
.dark [data-signoff='333'] .s333-far-back {
  fill: #8a6cb6;
}
.dark [data-signoff='333'] .s333-wisps {
  fill: #f2a0a8;
  opacity: 0.4;
}
.dark [data-signoff='333'] .s333-bank-near {
  --s333-lit: #ffe0c6;
  --s333-shade: #6a4f9e;
}
.dark [data-signoff='333'] .s333-bank-near {
  --s333-near-top: #d39ab9;
  --s333-near-low: #7d62a9;
}

/* A clip layer, not a scroll box: the cropped name hangs past the band's
   bottom edge, and without this, focusing it would scroll the band. */
[data-signoff='333'] .s333-layer {
  position: absolute;
  z-index: 1;
  inset: 0;
  overflow: clip;
  pointer-events: none;
}

/* The button is only as big as the cloud, so the links row stays clickable. */
[data-signoff='333'] .s333-mark {
  position: absolute;
  z-index: 1;
  left: 50%;
  bottom: var(--s333-lift);
  width: calc(var(--s333-h) * 1.12);
  height: var(--s333-h);
  translate: -50% 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
[data-signoff='333'] .s333-mark:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 6px;
  border-radius: 24px;
}

[data-signoff='333'] .s333-cloud {
  position: absolute;
  inset: 0;
  transition:
    scale 0.4s cubic-bezier(0.23, 1, 0.32, 1),
    opacity 0.4s ease;
  animation: s333-float 7s ease-in-out infinite alternate;
  /* On the parent, so it shades all three pieces after their clip. */
  filter: saturate(0.6) brightness(1.04) drop-shadow(0 12px 20px #4f7cab38);
}
.dark [data-signoff='333'] .s333-cloud {
  filter: drop-shadow(0 12px 24px #24185a66);
}
@keyframes s333-float {
  to {
    transform: translateY(-6px);
  }
}
[data-signoff='333'] .s333-mark:hover .s333-cloud {
  scale: 1.015;
}
[data-signoff='333'] .s333-mark:active .s333-cloud {
  scale: 0.985;
  transition-duration: 0.12s;
}

/* At rest the mark is one image. For the knock it is swapped for three copies,
   each cut to one 3, and swapped back once they land, so the cut lines never
   show on the resting mark. */
[data-signoff='333'] .s333-whole,
[data-signoff='333'] .s333-piece {
  position: absolute;
  inset: 0;
  background: url('/images/projects/footers/333/mark-cloud.webp') center / 100%
    100% no-repeat;
}
.dark [data-signoff='333'] .s333-whole,
.dark [data-signoff='333'] .s333-piece {
  background-image: url('/images/projects/footers/333/mark-dawn.webp');
  filter: brightness(1.1) saturate(0.95);
}
[data-signoff='333'] .s333-piece {
  visibility: hidden;
}
[data-signoff='333'] .s333-piece[data-p='a'] {
  clip-path: polygon(0 0, 81% 0, 0 76.5%);
}
[data-signoff='333'] .s333-piece[data-p='b'] {
  clip-path: polygon(81% 0, 100% 0, 100% 33.7%, 29.8% 100%, 0 100%, 0 76.5%);
}
[data-signoff='333'] .s333-piece[data-p='c'] {
  clip-path: polygon(100% 33.7%, 100% 100%, 29.8% 100%);
}

/* The knock: the cloud thins out, then the first 3 condenses, the second
   slides out of it down the stair, then the third out of the second. All
   three are down by 1.46s; the whole image takes over at 1.5s. */
[data-signoff='333'] .s333-cloud[data-run] .s333-whole {
  animation: s333-disperse 1.5s linear both;
}
[data-signoff='333'] .s333-cloud[data-run] .s333-piece[data-p='a'] {
  animation:
    s333-in-a 0.62s cubic-bezier(0.2, 0.8, 0.2, 1) 0.2s both,
    s333-hold 1.5s step-end;
}
[data-signoff='333'] .s333-cloud[data-run] .s333-piece[data-p='b'] {
  animation:
    s333-in-b 0.62s cubic-bezier(0.2, 0.8, 0.2, 1) 0.52s both,
    s333-hold 1.5s step-end;
}
[data-signoff='333'] .s333-cloud[data-run] .s333-piece[data-p='c'] {
  animation:
    s333-in-c 0.62s cubic-bezier(0.2, 0.8, 0.2, 1) 0.84s both,
    s333-hold 1.5s step-end;
}
@keyframes s333-disperse {
  0% {
    opacity: 1;
    scale: 1;
    filter: blur(0);
    animation-timing-function: cubic-bezier(0.4, 0, 1, 1);
  }
  13% {
    opacity: 0;
    scale: 1.04;
    filter: blur(8px);
  }
  99.9% {
    opacity: 0;
    scale: 1;
    filter: blur(0);
  }
}
@keyframes s333-hold {
  from {
    visibility: visible;
  }
}
@keyframes s333-in-a {
  from {
    opacity: 0;
    translate: 0 -24%;
    filter: blur(6px);
  }
  45% {
    opacity: 1;
  }
}
@keyframes s333-in-b {
  from {
    opacity: 0;
    translate: -25% -28%;
    filter: blur(6px);
  }
  35% {
    opacity: 1;
  }
}
@keyframes s333-in-c {
  from {
    opacity: 0;
    translate: -22% -31%;
    filter: blur(6px);
  }
  35% {
    opacity: 1;
  }
}

/* The 3:33 drop, as the July build sent it. Its middle lines up with the
   middle of the mark, a fixed gap to its right. */
[data-signoff='333'] .s333-drop-slot {
  position: absolute;
  z-index: 3;
  left: calc(50% + var(--s333-h) * 0.56 + 24px);
  bottom: calc(var(--s333-lift) + var(--s333-h) * 0.5);
  translate: 0 50%;
  pointer-events: none;
}
[data-signoff='333'] .s333-drop {
  padding: 14px 18px 15px;
  border-radius: 22px;
  border: 1px solid #ffffffd0;
  background: linear-gradient(155deg, #ffffffe0, #ffffffa8 50%, #ffffffc8);
  box-shadow:
    inset 0 1px 2px #fff,
    0 14px 30px #2747602a;
  backdrop-filter: blur(16px) saturate(1.25);
  -webkit-backdrop-filter: blur(16px) saturate(1.25);
  color: #15191e;
  font:
    700 13px/1.3 '333 Nunito',
    var(--s-sans),
    sans-serif;
  white-space: nowrap;
}
.dark [data-signoff='333'] .s333-drop {
  border-color: #ffffff40;
  background: #1b1f25c8;
  box-shadow:
    inset 0 1px 1px #ffffff30,
    0 14px 30px #120d2a50;
  color: #f8f9fb;
}
[data-signoff='333'] .s333-drop p {
  margin: 0;
}
[data-signoff='333'] .s333-drop-title {
  color: #b8860b;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}
.dark [data-signoff='333'] .s333-drop-title {
  color: #f5c542;
}
[data-signoff='333'] .s333-drop-line {
  margin-top: 4px !important;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
[data-signoff='333'] .s333-drop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px !important;
}
[data-signoff='333'] .s333-drop-badge {
  padding: 2px 9px 3px;
  border-radius: 99px;
  background: #f5c542;
  color: #2a2208;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
[data-signoff='333'] .s333-drop-place {
  font-weight: 800;
}
[data-signoff='333'] .s333-drop-min {
  font-weight: 600;
  opacity: 0.6;
  font-variant-numeric: tabular-nums;
}

/* Scroll-linked: over the last stretch of the page the clouds rise into
   place and the sun comes up, finishing exactly at the page's end. Browsers
   without scroll timelines show the finished scene. */
@supports (animation-timeline: view()) {
  [data-signoff='333'] .s333-rise-far,
  [data-signoff='333'] .s333-rise-near,
  [data-signoff='333'] .s333-mark,
  .dark [data-signoff='333'] .s333-sun {
    animation: linear both;
    animation-timeline: --s333;
    animation-range: entry 0% entry 100%;
    animation-timing-function: cubic-bezier(0.3, 0.6, 0.4, 1);
  }
  [data-signoff='333'] .s333-rise-far {
    animation-name: s333-rise-far;
  }
  [data-signoff='333'] .s333-rise-near {
    animation-name: s333-rise-near;
  }
  [data-signoff='333'] .s333-mark {
    animation-name: s333-rise-mark;
  }
  .dark [data-signoff='333'] .s333-sun {
    animation-name: s333-sunrise;
  }
}
@keyframes s333-rise-far {
  from {
    translate: 0 30%;
  }
}
@keyframes s333-rise-near {
  from {
    translate: 0 70%;
  }
}
@keyframes s333-rise-mark {
  from {
    translate: -50% 22%;
    opacity: 0.4;
  }
}
@keyframes s333-sunrise {
  from {
    translate: -50% 30%;
    opacity: 0;
  }
}

@media (max-width: 640px) {
  [data-signoff='333'] {
    --s333-h: 170px;
    --s333-lift: 17%;
  }
  [data-signoff='333'] .s333-rise-far {
    height: 54%;
  }
  [data-signoff='333'] .s333-rise-near {
    height: 26%;
  }
  /* No room beside the cloud on a phone, so the drop lands on it once the
     third 3 is down and the mark steps back behind it. */
  [data-signoff='333'] .s333-drop-slot {
    left: 50%;
    translate: -50% 50%;
  }
  [data-signoff='333'] .s333-layer[data-drop] .s333-cloud {
    opacity: 0.35;
    transition-delay: 0s, 1.3s;
  }
}
