:root {
  color-scheme: light;
  --paper: #eeebe1;
  --ink: #192620;
  --accent: #40584a;
  --line: #bebfb1;
  --gutter: clamp(18px, 4.25vw, 78px);
  --nav: 60px;
  --controls: 76px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body { background: var(--paper); color: var(--ink); font-family: "Segoe UI", "Microsoft YaHei", sans-serif; }
button { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
[hidden] { display: none !important; }
.skip { position: fixed; z-index: 9; left: 1rem; top: 1rem; padding: .6em 1em; background: var(--paper); transform: translateY(-200%); }
.skip:focus { transform: none; }

.topbar { position: fixed; z-index: 6; inset: 0 0 auto; min-height: var(--nav); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 var(--gutter); background: var(--paper); color: var(--ink); border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; gap: clamp(20px, 3vw, 46px); }
.topbar a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; }
.topbar a:hover { text-decoration: underline; text-underline-offset: 5px; }
.topbar .brand { font-weight: 700; letter-spacing: -.03em; gap: .5em; justify-self: start; }
.brand span { font-size: 1.5em; color: var(--accent); }
.top-github { justify-self: end; }

.horizontal-rail { display: flex; width: 100%; height: 100vh; height: 100dvh; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain; }
.horizontal-rail::-webkit-scrollbar { display: none; }
.horizontal-rail:focus-visible { outline-offset: -3px; }
.horizontal-rail > section { position: relative; isolation: isolate; flex: 0 0 100%; min-width: 0; height: 100%; overflow-x: hidden; overflow-y: auto; scroll-snap-align: start; overscroll-behavior-y: contain; }
.opening { display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: clamp(14px, 2.8vh, 30px); padding: calc(var(--nav) + clamp(18px, 4vh, 50px)) var(--gutter) var(--controls); }
.cover { display: grid; grid-template-columns: minmax(310px, .62fr) minmax(0, 1fr); min-height: 0; border-bottom: 1px solid var(--line); }
.cover-copy { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; padding: 0 24px 18px 0; }
.cover h1, .closing h2 { margin: 0; font: normal clamp(75px, 9.1vw, 170px)/.77 Georgia, serif; letter-spacing: -.08em; }
.cover h1 span, .closing h2 span { color: #64806d; }
.cover-copy p { margin: clamp(14px, 3vh, 35px) 0 .45rem; font-size: clamp(16px, 1.45vw, 24px); line-height: 1.55; }
.cover-entry { display: inline-flex; gap: .7em; align-items: center; min-height: 44px; font-size: 14px; font-weight: 650; text-decoration: underline; text-underline-offset: 5px; }
.cover-art { margin: 0; background: #19312c; min-height: 0; overflow: hidden; }
.cover-art img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 61% 50%; transform: translate3d(var(--back-x, 0), var(--back-y, 0),0) scale(1.018); transition: transform .28s ease-out; }
.slices { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); border-block: 1px solid var(--line); }
.slice { display: grid; min-width: 0; grid-template-columns: minmax(36px, .6fr) minmax(0,1fr) auto; gap: clamp(7px, 1.2vw, 18px); align-items: center; padding: clamp(8px, 1.2vw, 17px); border-right: 1px solid var(--line); }
.slice:first-child { border-left: 1px solid var(--line); }
.still { display: block; overflow: hidden; aspect-ratio: 1.35; background: #dae1df; }
.slice img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .28s ease-out; }
.slice-ring .still { background: #241930 url("assets/ring/title.webp") 55% 50% / cover; }
.slice-ring img { object-position: 50% 13%; }
.slice:hover img, .slice:focus-visible img { transform: scale(1.09); }
.slice:hover, .slice:focus-visible { background: #e2e3d8; }
.slice:focus-visible { outline-offset: -3px; }
.slice-label { display: grid; gap: .35em; }
.slice-label strong { font-size: clamp(13px, 1.46vw, 23px); line-height: 1.15; letter-spacing: -.035em; }
.slice-label small { font-size: clamp(10px, 1vw, 13px); opacity: .78; }
.slice-arrow { font-size: clamp(12px, 1.4vw, 18px); }

.work { display: grid; place-items: center; padding: calc(var(--nav) + 28px) var(--gutter) var(--controls); color: var(--chapter-ink); background: var(--chapter); }
.work::before { content: ""; position: absolute; z-index: -1; inset: 0; background: var(--scene); }
.work-copy { position: relative; z-index: 2; justify-self: start; }
.work-copy h2 { margin: .22em 0; font-size: clamp(52px, 8vw, 133px); line-height: .99; letter-spacing: -.078em; }
.work-copy h2 em { font-style: normal; font-weight: 400; }
.work-copy > p { margin: 1em 0 1.5em; max-width: 21em; font-size: clamp(15px, 1.35vw, 21px); line-height: 1.6; }
.work-copy .work-index, .work-index { margin: 0; font-size: 13px; letter-spacing: .12em; }
.work-link, .sub-link { display: inline-flex; align-items: center; gap: 1.2em; min-height: 44px; font-weight: 650; font-size: 15px; }
.work-link { border-bottom: 1px solid currentColor; }
.work-link:hover span { transform: translate(3px,-3px); }
.work-link span { transition: transform .2s ease-out; }
.sub-link { margin-left: 1.3em; text-decoration: underline; text-underline-offset: 4px; }

.work-efin { --chapter: #dae5eb; --chapter-ink: #152f46; --scene: linear-gradient(90deg,#e2ebefd9,#e2ebef80 40%,transparent 70%),url("assets/exhibition/efin-vellum.webp") center/cover; grid-template-columns: .75fr 1fr; gap: clamp(12px,4vw,70px); }
.efin-art { position: relative; display: block; width: 100%; padding: 4% 8% 14% 0; }
.efin-window { position: relative; display: block; line-height: 0; transform: perspective(1200px) rotateY(-10deg) rotateX(4deg); box-shadow: 0 25px 55px #152f4645; border-radius: 4px; overflow: hidden; transition: transform .45s ease; }
.efin-window img { width: 100%; height: auto; }
.efin-art:hover .efin-window { transform: perspective(1200px) rotateY(-3deg); }
.model-mask { position: absolute; left: 47%; top: 94%; width: 14%; height: 4%; background: #fff; }
.efin-slide { position: absolute; width: 42%; right: -1%; bottom: 7%; transform: rotate(4deg); box-shadow: 0 12px 25px #152f4645; }

.work-elk { --chapter: #10251c; --chapter-ink: #e3f4e8; --scene: linear-gradient(90deg,transparent,#10251c32 50%,#10251c9e),url("assets/elk-handoff-art-20261117.webp") center/cover; grid-template-columns: 1fr .8fr; gap: 5vw; }
.work-elk .work-copy { grid-column: 2; grid-row: 1; }
.elk-art { grid-column: 1; grid-row: 1; position: relative; display: grid; place-items: center; width: 100%; min-height: 280px; height: min(56vh,520px); }
.elk-art img { display: block; width: min(48%,220px); filter: drop-shadow(0 0 40px #acd8a54a); }
.elk-node { position: absolute; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; cursor: pointer; border: 1px solid #c7f3d668; border-radius: 30px; background: #12251bed; color: #effcf3; font-size: 13px; }
.elk-node::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #cdf5d6; }
.elk-node[aria-pressed="true"] { color: #142719; background: #c7efd2; }
.elk-node[aria-pressed="true"]::before { background: #142719; }
.elk-node.n1 { left: 8%; top: 23%; }
.elk-node.n2 { right: 12%; top: 48%; }
.elk-node.n3 { left: 21%; top: 70%; }
.elk-node-status { position: absolute; inset: auto 0 1%; min-height: 1.5em; text-align: center; font-size: 13px; }

.work-pet { --chapter: #f4e5ca; --chapter-ink: #331f12; --scene: linear-gradient(90deg,#f4e5cafa,#f4e5cae8 25%,transparent 56%),url("assets/pet-nest-cottage.webp") center 84%/cover; }
.pet-art { position: absolute; inset: 0; pointer-events: none; }
.pet-touch { position: absolute; left: 50%; bottom: 8%; width: clamp(110px, 13vw, 205px); border: 0; padding: 0; background: transparent; transform: translateX(-50%); pointer-events: auto; cursor: pointer; }
.pet-touch img { display: block; width: 100%; image-rendering: pixelated; }
.pet-touch.bounce img { animation: hop .48s ease both; }
@keyframes hop { 0%,100% { transform: none; } 42% { transform: translateY(-26px) rotate(-5deg); } 74% { transform: scale(1.06,.94); } }
.pet-status { position: absolute; left: 50%; bottom: 4%; transform: translateX(-50%); padding: .4em .8em; white-space: nowrap; border-radius: 2em; background: #f4e5ca; font-size: 12px; }

.work-ring { --chapter: #150e20; --chapter-ink: #f3eafa; --scene: linear-gradient(90deg,#130b1def,#130b1d55 64%,#130b1d20),url("assets/ring/title.webp") center/cover; }
.work-ring h2 { font-family: "Noto Serif CJK SC", "Songti SC", SimSun, serif; font-weight: 500; letter-spacing: -.06em; }
.ring-art { position: absolute; z-index: -1; inset: var(--nav) 4% 0 38%; pointer-events: none; }
.ring-figure { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center bottom; }
.ring-choose { display: flex; flex-wrap: wrap; gap: 6px; margin-top: clamp(20px,5vh,55px); }
.ring-choose button { width: clamp(44px,4.3vw,65px); height: clamp(48px,5vw,72px); border: 1px solid #f4e0fa78; border-radius: 2px; padding: 2px; background: #261c30; cursor: pointer; }
.ring-choose button[aria-pressed="true"] { border-color: #efcfff; box-shadow: 0 0 0 1px #efcfff; }
.ring-choose img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 16%; }
.work-copy .ring-name, .work-copy .ring-status { margin: 10px 0 0; font-size: 12px; }
.ring-status:empty { display: none; }

.closing { display: grid; place-items: center start; padding: calc(var(--nav) + 24px) var(--gutter) var(--controls); background: #172820; color: #f5f0e4; }
.closing h2 { margin-top: .25em; font-size: clamp(53px,9vw,140px); }
.closing p:not(.work-index) { margin-top: 1.65em; line-height: 1.6; }
.closing h2 span { color: #a5bfa6; }
.rail-controls { position: fixed; z-index: 5; right: var(--gutter); bottom: max(12px, env(safe-area-inset-bottom)); display: flex; gap: 11px; align-items: center; background: #1b2822; color: #f9f6e9; border: 1px solid #f9f6e948; border-radius: 2em; padding: 3px 5px; }
.rail-controls button { width: 44px; height: 44px; border: 1px solid #f9f6e975; border-radius: 50%; background: transparent; cursor: pointer; font-size: 19px; }
.rail-controls button:disabled { opacity: .36; cursor: default; }
.rail-controls button:hover:not(:disabled) { background: #ffffff27; }
.rail-count { font: 12px Consolas, monospace; white-space: nowrap; }
.rail-line { display: block; width: 40px; height: 1px; background: #ffffff45; }
.rail-line i { display: block; height: 100%; background: #fbf1d2; transform: scaleX(.1667); transform-origin: left; transition: transform .25s ease; }

@media(max-width:850px) {
  .cover { grid-template-columns: minmax(210px,.64fr) minmax(0,1fr); }
  .cover h1 { font-size: clamp(64px,12vw,105px); }
  .slice { grid-template-columns: 1fr auto; gap: 8px; }
  .still { grid-column: span 2; aspect-ratio: 2.4; }
}

@media(max-width:600px) {
  :root { --nav: 54px; --controls: 70px; }
  .horizontal-rail { scroll-snap-type: x mandatory; }
  .topbar a { font-size: 12px; }
  .topbar nav { gap: 14px; }
  .opening { grid-template-rows: auto auto; align-content: start; gap: 12px; padding-top: calc(var(--nav) + 12px); }
  .cover { display: flex; flex-direction: column-reverse; border: 0; }
  .cover-art { height: clamp(110px,calc(100dvh - 365px),460px); }
  .cover-art img { object-position: 85% 50%; }
  .cover-copy { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; padding: 15px 0 0; }
  .cover h1 { grid-column: 1 / -1; font-size: clamp(48px,15vw,94px); line-height: .83; }
  .cover h1 br { display: none; }
  .cover-copy p { margin: 5px 0 0; font-size: 13px; line-height: 1.4; }
  .cover-entry { font-size: 12px; gap: .3em; }
  .slices { grid-template-columns: repeat(2,minmax(0,1fr)); border: 0; }
  .slice { grid-template-columns: 37px minmax(0,1fr) auto; padding: 6px; border: 1px solid var(--line); margin: 0 -1px -1px 0; min-height: 53px; }
  .still { grid-column: auto; aspect-ratio: 1; }
  .slice-label { gap: .15em; }
  .slice-label strong { font-size: 12px; }
  .slice-label small { font-size: 10px; }
  .work { align-content: start; padding-top: calc(var(--nav) + 26px); }
  .work-copy h2 { font-size: clamp(48px,16vw,92px); }
  .work-copy > p { margin: .55em 0 .65em; }
  .work-efin, .work-elk { grid-template-columns: 1fr; gap: 16px; }
  .work-efin { --scene: linear-gradient(#e2ebefe8,#e2ebef90 55%,transparent),url("assets/exhibition/efin-vellum.webp") center/cover; }
  .efin-art { max-width: 460px; }
  .work-elk { --scene: linear-gradient(#10251cd9,#10251c60 55%,#10251c24),url("assets/elk-handoff-art-20261117.webp") 32% 50%/cover; }
  .work-elk .work-copy { grid-area: auto; }
  .elk-art { grid-area: auto; height: clamp(150px,calc(100dvh - 359px),340px); min-height: 0; }
  .elk-art img { width: min(38%, 125px); }
  .elk-node.n1 { top: 5%; }
  .elk-node.n2 { top: 32%; right: 5%; }
  .elk-node.n3 { top: 60%; left: 12%; }
  .elk-node-status { bottom: -8px; }
  .work-pet { --scene: linear-gradient(#f4e5caf5,#f4e5caeb 27%,transparent 63%),url("assets/pet-nest-cottage.webp") center/auto 100%; }
  .pet-touch { bottom: 13%; width: clamp(100px,31vw,142px); }
  .pet-status { bottom: calc(13% + clamp(100px,31vw,142px) + 7px); }
  .work-ring { --scene: linear-gradient(#130b1dd9,#130b1d70 60%,#130b1d3d),url("assets/ring/title.webp") 66% 50%/cover; }
  .ring-art { inset: 19% -20% 0 18%; opacity: .78; }
  .ring-choose { margin-top: 30px; }
  .rail-line { width: 27px; }
}

@media(min-width:601px) and (max-height:680px) {
  .opening { grid-template-rows: minmax(265px,1fr) auto; }
  .cover h1 { font-size: clamp(62px,8vw,105px); }
}

@media(prefers-reduced-motion:reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .cover-art img { transform: none; }
}
