/* Daylight and ink share one neutral ground. Artwork keeps its own color space. */
:root {
  --atmosphere-ground: #07090d;
  --atmosphere-panel: #12171f;
  --atmosphere-cool: 124 165 180;
  --atmosphere-warm: 186 146 160;
  --atmosphere-glint: .14;
  --index-panel: var(--atmosphere-panel);
  --index-ink: #f8f4ed;
  --index-soft: #c1c8d1;
}
html[data-theme="light"] {
  --atmosphere-ground: #fffefb;
  --atmosphere-panel: #faf9f6;
  --atmosphere-cool: 93 135 152;
  --atmosphere-warm: 153 118 136;
  --atmosphere-glint: .11;
  --index-panel: var(--atmosphere-panel);
  --index-ink: #191e25;
  --index-soft: #414c57;
}
html body.house-page,
html body#top {
  --house-night: var(--atmosphere-ground);
  --house-paper: var(--index-ink);
  --house-muted: var(--index-soft);
  background: var(--atmosphere-ground) !important;
}
html[data-theme] body.house-page {
  --ink: var(--atmosphere-ground);
  --paper: var(--index-ink);
  --silver: var(--index-soft);
  color: var(--paper);
}
html[data-theme] body footer.house-end,
html[data-theme] #top footer.house-end#contact {
  position: relative;
  background:
    radial-gradient(ellipse 37% 110% at 92% 0%, rgb(var(--atmosphere-cool) / .045), transparent 98%),
    var(--atmosphere-ground) !important;
  border-top-color: color-mix(in srgb, var(--index-ink) 17%, transparent);
}
html body footer.house-end::before {
  content: "";
  position: absolute;
  top: -1px;
  inset-inline: 0;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 10%, rgb(var(--atmosphere-warm) / .18) 36%, rgb(var(--atmosphere-cool) / .50) 63%, transparent 87%);
}

/* An edge-lit print crossing the colophon, clear of every label and link. */
.crossing-field {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  overflow: clip;
  width: min(100%, 78rem);
  height: clamp(4.25rem, 8vw, 7rem);
  margin: clamp(1.25rem, 3vw, 2.75rem) auto 0;
  pointer-events: none;
  --runner-size: clamp(4.6rem, 8.5vw, 7.65rem);
  --runner-ink: .8;
  --stride: .54s;
  --crossing-time: 10s;
}
.crossing-field + footer.house-end,
#top .crossing-field + footer#contact.house-end {
  margin-block-start: 0;
}
.crossing-field::before {
  content: "";
  position: absolute;
  inset: 28% 1% 0;
  background:
    radial-gradient(ellipse 22% 15% at 63% 77%, rgb(var(--atmosphere-cool) / var(--atmosphere-glint)), transparent),
    radial-gradient(ellipse 21% 18% at 46% 82%, rgb(var(--atmosphere-warm) / .09), transparent);
  transform: skewY(-1.4deg);
}
.crossing-journey {
  position: absolute;
  width: calc(100% - var(--runner-size));
  inset-inline-start: 0;
  bottom: .35rem;
  transform: translateX(62%);
}
.crossing-hyena {
  display: block;
  width: var(--runner-size);
  height: auto;
  overflow: visible;
  opacity: var(--runner-ink);
  filter: grayscale(.75) brightness(1.32);
}
html[data-theme=light] .crossing-hyena { filter: grayscale(.75) contrast(.94); }
.crossing-hyena .fore-near { transform-origin: 332px 215px; }
.crossing-hyena .fore-far { transform-origin: 365px 219px; }
.crossing-hyena .hind-near { transform-origin: 234px 217px; }
.crossing-hyena .hind-far { transform-origin: 173px 217px; }
.crossing-hyena .near-hock { transform-origin: 216px 277px; }
.crossing-hyena .far-wrist { transform-origin: 404px 272px; }
.crossing-hyena .torso { transform-origin: 273px 198px; }

@media (prefers-reduced-motion: no-preference) {
  .crossing-in-view .crossing-journey {
    animation: house-crossing-pass var(--crossing-time) linear infinite;
  }
  .crossing-in-view .crossing-hyena .torso {
    animation: house-crossing-lift var(--stride) ease-in-out infinite;
  }
  .crossing-in-view .crossing-hyena :is(.fore-near, .fore-far, .hind-near, .hind-far, .near-hock, .far-wrist) {
    animation: house-crossing-limb var(--stride) ease-in-out infinite;
  }
  .crossing-hyena .fore-near { --reach: -25deg; --return: 24deg; }
  .crossing-hyena .fore-far { --reach: 28deg; --return: -25deg; }
  .crossing-hyena .hind-near { --reach: 26deg; --return: -23deg; }
  .crossing-hyena .hind-far { --reach: -23deg; --return: 20deg; }
  .crossing-hyena .near-hock { --reach: -18deg; --return: 8deg; }
  .crossing-hyena .far-wrist { --reach: 2deg; --return: 24deg; }
  .crossing-in-view::before { animation: house-crossing-light 11s ease-in-out alternate infinite; }
}
html.motion-paused .crossing-field *,
html.motion-paused .crossing-field::before { animation: none !important; }

html:has(#house-index[open]) .crossing-field *,
html:has(#house-index[open]) .crossing-field::before {
  animation-play-state: paused;
}
@keyframes house-crossing-pass {
  0% { transform: translateX(-8%); opacity: 0; }
  8% { opacity: 1; }
  76% { opacity: 1; }
  85%, 100% { transform: translateX(103%); opacity: 0; }
}
@keyframes house-crossing-limb {
  0%, 100% { transform: rotate(var(--reach)); }
  50% { transform: rotate(var(--return)); }
}
@keyframes house-crossing-lift {
  0%, 100% { transform: translateY(2px) rotate(.8deg); }
  49% { transform: translateY(-5px) rotate(-1.2deg); }
}
@keyframes house-crossing-light {
  to { transform: translateX(-7%) skewY(.6deg); opacity: .6; }
}
@media (forced-colors: active), print {
  .crossing-field, html body footer.house-end::before { display: none; }
}
