body:has(.scene-spine) {
  --scene-tone: #111713;
  background: var(--scene-tone);
}

body:has(.scene-spine) .topbar {
  color: #fbf1e1;
  background: color-mix(in srgb, var(--scene-tone) 94%, transparent);
  border-color: #fbf1e126;
}

body:has(.scene-spine) .topbar .brand span { color: #c6d4be; }

.horizontal-rail :is(.work,.closing) {
  --scene-top: 0px;
  --scene-edge: 0px;
  --scene-bottom: 0px;
  padding: calc(var(--nav) + 22px) var(--gutter) 73px;
  background: var(--chapter, #263d34);
}

.horizontal-rail :is(.work,.closing)::before { inset: 0; }

.scene-spine {
  position: fixed;
  z-index: 5;
  bottom: max(env(safe-area-inset-bottom), 8px);
  left: 50%;
  display: flex;
  transform: translateX(-50%);
  color: #fff6e7;
}

.scene-spine::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -32px -22px -8px;
  background: radial-gradient(ellipse at 50% 72%, var(--scene-tone), transparent 70%);
  pointer-events: none;
}

.scene-spine a {
  --frame: #e2d9c7;
  display: grid;
  place-items: center;
  position: relative;
  min-width: 44px;
  min-height: 44px;
  width: clamp(44px,4vw,60px);
  outline-offset: -4px;
}

.scene-spine a:nth-child(2) { --frame: #a5c9e3; }
.scene-spine a:nth-child(3) { --frame: #b4e7bc; }
.scene-spine a:nth-child(4) { --frame: #ffca86; }
.scene-spine a:nth-child(5) { --frame: #ddbaf7; }
.scene-spine a:nth-child(6) { --frame: #c6d4be; }

.scene-spine a i {
  width: 65%;
  height: 4px;
  background: var(--frame);
  border-radius: 1px;
  opacity: .56;
  box-shadow: 0 0 0 1px #16151254;
  transform: skewX(-18deg);
  transition: width .23s ease, height .23s ease, opacity .23s ease;
}

.scene-spine a span {
  position: absolute;
  bottom: calc(100% - 3px);
  width: max-content;
  padding: 3px 7px;
  border-radius: 2px;
  background: var(--scene-tone);
  color: #fff6e7;
  font-size: 11px;
  line-height: 1.3;
  opacity: 0;
  translate: 0 5px;
  transition: opacity .18s ease, translate .18s ease;
  pointer-events: none;
}

.scene-spine a:is([aria-current],:hover,:focus-visible) i {
  width: 83%;
  height: 8px;
  opacity: 1;
}

.scene-spine a:is([aria-current],:hover,:focus-visible) span { opacity: 1; translate: 0 0; }
.scene-spine:has(a:is(:hover,:focus-visible)) a[aria-current]:not(:hover,:focus-visible) span { opacity: 0; }

.work .work-link {
  gap: 7px;
  border: 0;
  background: linear-gradient(currentColor,currentColor) left bottom / 100% 1px no-repeat;
  transition: background-size .2s ease;
}

.work .work-link::after {
  content: "";
  width: .35em;
  height: .35em;
  border-radius: 50%;
  background: currentColor;
  opacity: .64;
  transition: transform .2s ease, opacity .2s ease;
}

.work .work-link:is(:hover,:focus-visible) { background-size: 70% 1px; }
.work .work-link:is(:hover,:focus-visible)::after { transform: scale(1.45); opacity: 1; }

.work-efin {
  --scene: linear-gradient(111deg,#e2edf1 11%,#d3e2eadc 49%,#92adbc89),
    #a8beca url("assets/exhibition/print-paper.webp") 70% 43% / cover;
  grid-template-columns: minmax(0,.72fr) minmax(0,1.28fr);
}

.work-efin .efin-mode { gap: 0; }
.work-efin .efin-mode button {
  border: 0;
  border-bottom: 1px solid #27495f5e;
  border-radius: 0;
  background: transparent;
  color: #162f42;
}

.work-efin .efin-mode button[aria-pressed="true"] {
  background: #e9f2f6;
  box-shadow: inset 0 -2px #294f6b;
}

.elk-art {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: clamp(15px,4vh,38px);
}

.elk-art img { width: min(42%, 210px); }
.elk-steps {
  --trace: 0%;
  position: relative;
  display: grid;
  grid-template-columns: repeat(4,1fr);
  width: min(100%,32rem);
}

.elk-steps::before {
  content: "";
  position: absolute;
  top: 10px;
  height: 1px;
  inset-inline: 12.5%;
  background: linear-gradient(90deg,#b9efc6 0 var(--trace),#b9efc64d var(--trace) 100%);
  pointer-events: none;
}

.elk-steps .elk-node {
  position: relative;
  display: grid;
  place-items: center;
  align-content: start;
  gap: 10px;
  padding: 6px 0 0;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #e8f6ea;
  white-space: nowrap;
}

.elk-steps .elk-node::before {
  width: 9px;
  height: 9px;
  background: #547e67;
  box-shadow: 0 0 0 1px #c7efd2;
  transition: background .2s, box-shadow .2s;
}

.elk-steps .elk-node[aria-pressed="true"]::before,
.elk-steps .elk-node:is(:hover,:focus-visible)::before {
  background: #e5fce5;
  box-shadow: 0 0 0 4px #b9efc64b, 0 0 16px #b9efc6a0;
}

.elk-art .elk-node-status {
  position: static;
  padding-inline: 0;
  min-height: 2.7em;
  max-width: 34em;
  text-wrap: balance;
  line-height: 1.4;
}

.nest-world {
  position: absolute;
  inset: 0;
  overflow: hidden;
  container-type: size;
  pointer-events: none;
}

.nest-plane {
  --floor-x: 49.8%;
  --floor-y: 89.6%;
  --actor-size: clamp(112px,17vw,248px);
  position: absolute;
  left: 50%;
  bottom: 0;
  width: max(100cqw,150cqh);
  aspect-ratio: 3 / 2;
  transform: translateX(-50%);
  isolation: isolate;
}

.nest-room {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.nest-shadow {
  position: absolute;
  z-index: 2;
  left: var(--floor-x);
  top: var(--floor-y);
  width: calc(var(--actor-size) * .61);
  height: calc(var(--actor-size) * .072);
  border-radius: 50%;
  background: #40241478;
  filter: blur(clamp(2px,.28vw,5px));
  transform: translate(-50%,-51%);
}

.nest-actor,
.pet-touch.nest-actor,
.fieldguide .pet-opening .pet-stage-touch.nest-actor {
  position: absolute;
  z-index: 3;
  left: var(--floor-x);
  top: var(--floor-y);
  bottom: auto;
  width: var(--actor-size);
  aspect-ratio: 1;
  transform: translate(-52.5%,-90.91%);
}

.nest-actor img {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  transform-origin: 52.5% 90.91%;
}

button.nest-actor, .nest-plane .cottage-hotspot { pointer-events: auto; }

.tile-nest {
  z-index: -1;
  inset-inline: -46%;
  transform: skewX(var(--card-unskew));
}

.tile-nest .nest-plane {
  --actor-size: clamp(104px,12.1vw,196px);
  bottom: 19%;
}

.tile-nest::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg,#492b20 13%,#492b20 19%,transparent 34%,#492b201a);
}

.tile-nest .nest-room { filter: saturate(.69) brightness(.75); }
.tile-actor img { filter: saturate(.86); }
.film-cards .slice-pet:is(:hover,:focus-visible,:active) .tile-actor img { animation: hop .54s ease both; }

.work-pet {
  --scene: none;
  --chapter: #56331e;
  --chapter-ink: #fff5e5;
}

.pet-art .nest-plane::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  background: linear-gradient(90deg,#2a160ee8 0%,#2a160eb0 25%,#2a160e22 52%,transparent 72%);
  pointer-events: none;
}

.pet-touch::before { content: none; }

.work-pet .pet-status {
  z-index: 3;
  left: var(--gutter);
  bottom: 66px;
  transform: none;
  background: #2b190dcc;
  color: #fff2d9;
  pointer-events: none;
}

.work-ring .ring-art { inset: var(--nav) 0 0 38%; }
.work-ring .ring-figure { object-position: center bottom; }
.work-ring .ring-choose button { background: #24182dd9; border-color: #d9c0e36e; }

.editorial { container-type: inline-size; }
.editorial :is(.case-head.elk-head,.pet-opening,.ring-opening,.ring-encounter) {
  width: 100cqw;
  max-width: none;
  margin-inline: calc((100% - 100cqw) / 2);
  border: 0;
  border-radius: 0;
}

.elk-case .case-head.elk-head {
  padding-inline: max(clamp(25px,7vw,88px), calc((100cqw - 1250px) / 2));
}

.elk-case .elk-brand { border: 0; background: transparent; }

.efindeck-case .efin-hero-art {
  background: radial-gradient(ellipse at 57% 55%,#a6c6d565,transparent 70%);
  border: 0;
  border-radius: 0;
}

.efindeck-case .efin-hero-art::before,
.efindeck-case .efin-hero-art::after { display: none; }

.efindeck-case .efin-hero-orbit {
  mask-image: radial-gradient(ellipse,#000,transparent 70%);
}

.elk-case.editorial .site-header {
  color: #e8f6ea;
  background: #10271e;
  border-color: #b9efc628;
}

.ring-case.editorial .site-header {
  color: #f4e9f9;
  background: #1d1428;
  border-color: #d9c0e32b;
}

.fieldguide .pet-opening .pet-demo-stage { background: #492b20; }
.fieldguide .pet-opening .nest-plane { --actor-size: clamp(85px,17cqw,220px); }

@media (min-width: 761px) {
  .fieldguide .pet-opening .pet-demo-stage {
    height: min(66.6667cqw, max(400px, calc(100svh - 152px)));
    aspect-ratio: auto;
  }

  .fieldguide .pet-opening .nest-world::before {
    content: "";
    position: absolute;
    inset: -18px;
    background: url("assets/pet-nest-cottage.webp") center 57% / cover;
    filter: blur(24px) brightness(.56) saturate(.76);
  }

  .fieldguide .pet-opening .nest-plane {
    width: min(100cqw,150cqh);
  }

  .fieldguide .pet-opening .nest-room {
    mask-image: linear-gradient(90deg,transparent,#000 7% 93%,transparent);
  }
}

.fieldguide .pet-opening .nest-plane .cottage-shade { z-index: 2; }
.fieldguide .pet-opening .pet-demo-stage:not(.is-bouncing) .pet-demo-sprite {
  animation-name: pet-rest;
}

@keyframes pet-rest {
  0%,100% { transform: none; }
  50% { transform: scale(1.018,.979); }
}

.ring-case.editorial .ring-opening .case-intro {
  padding-inline-start: max(clamp(24px,6vw,72px),calc((100cqw - 1250px) / 2));
}

.ring-case .story-enter {
  bottom: 20px;
  left: max(clamp(24px,6vw,72px),calc((100cqw - 1250px) / 2));
  right: auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: linear-gradient(currentColor,currentColor) left bottom / 58% 1px no-repeat;
  transition: background-size .2s;
}

.ring-case .story-enter::after {
  content: "";
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
  transform: rotate(45deg);
  transition: box-shadow .2s;
}

.ring-case .story-enter:is(:hover,:focus-visible) { background-size: 100% 1px; }
.ring-case .story-enter:is(:hover,:focus-visible)::after { box-shadow: 0 0 9px currentColor; }
.encounter-mark { width: .9em; height: .9em; color: #e2bdf5; position: relative; }
.encounter-mark::before,.encounter-mark::after { content: ""; position: absolute; inset: calc(50% - .5px) 0 auto; height: 1px; background: currentColor; }
.encounter-mark::after { transform: rotate(90deg); transition: transform .2s; }
details[open] .encounter-mark::after { transform: rotate(0); }

@media (max-width: 760px) {
  .horizontal-rail .work {
    padding: calc(var(--nav) + 20px) max(22px, var(--gutter)) 68px;
    align-content: start;
  }

  .horizontal-rail .work-efin {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0,1fr);
    gap: clamp(8px,3vh,27px);
    --scene: linear-gradient(#e2edf1,#d9e7eed9 55%,#93adbb81),
      #b2c4cf url("assets/exhibition/print-paper.webp") center / cover;
  }

  .horizontal-rail .work-elk { grid-template-columns: 1fr; grid-template-rows: auto minmax(0,1fr); gap: 12px; }
  .work-elk .work-copy, .work-elk .elk-art { grid-area: auto; }
  .elk-art { height: auto; align-self: stretch; gap: clamp(10px,3vh,27px); }
  .elk-art img { width: clamp(73px, min(36vw,18vh), 154px); }
  .tile-nest { inset-inline: -38%; }
  .tile-nest .nest-plane { --actor-size: clamp(58px,18vw,109px); bottom: 0; }
  .tile-nest::after { background: linear-gradient(0deg,#492b2052,transparent 24%,#492b201a); }
  .pet-art .nest-plane { --actor-size: clamp(124px,37vw,175px); }
  .pet-art .nest-plane::after {
    background: linear-gradient(#29180eea,#29180e9c 29%,transparent 65%);
  }

  .work-pet .pet-status { left: 50%; bottom: max(28%, 132px); transform: translateX(-50%); }
  .work-ring .ring-art { inset: 23% -10% 0 20%; }
  .work-ring .ring-figure { object-position: 90% bottom; }
  .fieldguide .pet-opening-copy { padding: 15px max(14px,var(--gutter,18px)); }
  .fieldguide .pet-opening .pet-demo-stage { aspect-ratio: 3/2; }
  .ring-case.editorial .ring-opening .case-intro { padding-inline: 24px 0; }
}

@media (max-width: 400px) and (max-height: 620px) {
  .horizontal-rail .work { padding-top: calc(var(--nav) + 13px); }
  .work-elk .work-copy h2 { font-size: clamp(40px,14vw,56px); }
  .horizontal-rail .work-efin { grid-template-rows: auto auto; }
  .work .work-index { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .fieldguide .pet-opening .pet-demo-stage:not(.is-bouncing) .pet-demo-sprite { animation: none; }
  .scene-spine a :is(i,span), .ring-case .story-enter, .ring-case .story-enter::after, .encounter-mark::after { transition: none; }
}
