@font-face {
  font-family: "B612";
  font-weight: 400;
  font-display: swap;
  src: url(./assets/fonts/B612-Regular.ttf) format("truetype");
}
@font-face {
  font-family: "B612";
  font-weight: 700;
  font-display: swap;
  src: url(./assets/fonts/B612-Bold.ttf) format("truetype");
}
@font-face {
  font-family: "B612 Mono";
  font-weight: 400;
  font-display: swap;
  src: url(./assets/fonts/B612Mono-Regular.ttf) format("truetype");
}

@view-transition {
  navigation: auto;
}

:root {
  color-scheme: light;
  --mist: #ecefe9;
  --ink: #10211e;
  --ink-soft: #46574f;
  --azurite: #1d4f78;
  --deep: #12324a;
  --deeper: #0d2637;
  --malachite: #2c7a64;
  --gold: #a8741a;
  --gold-bright: #e0b25a;
  --foam: #e9eee8;
  --foam-soft: #b9c8c8;
  --line: rgba(16, 33, 30, 0.16);
  --line-light: rgba(233, 238, 232, 0.22);
  --gutter: clamp(20px, 6vw, 96px);
  --sans: "B612", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --mono: "B612 Mono", "SF Mono", Menlo, "PingFang SC", monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 96px;
}
html.motion { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--mist);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, p, ol, ul, figure { margin: 0; }
ol, ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }

::selection { background: var(--azurite); color: var(--foam); }

:focus-visible {
  outline: 2px solid var(--azurite);
  outline-offset: 4px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip {
  position: fixed;
  left: 12px; top: 12px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--ink);
  color: var(--mist);
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ---- top bar */
.top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: 22px var(--gutter) 30px;
  background: linear-gradient(to bottom, var(--mist) 45%, rgba(236, 239, 233, 0));
  transition: transform 0.5s var(--ease-out);
}
.top.is-away { transform: translateY(-110%); }
.mark {
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.top-links {
  display: flex;
  gap: clamp(16px, 2.4vw, 34px);
  font-size: 0.9rem;
}
.top-links a,
.text-link,
.shore-end a {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) left bottom / 0 1px no-repeat;
  padding-bottom: 3px;
  transition: background-size 0.45s var(--ease-out);
}
.top-links a:hover,
.top-links a:focus-visible,
.text-link:hover,
.shore-end a:hover { background-size: 100% 1px; }

/* ---- river rail */
.rail {
  position: fixed;
  right: 20px;
  top: 21svh;
  height: 58svh;
  width: 28px;
  z-index: 30;
  color: var(--ink);
  transition: color 0.4s ease, opacity 0.4s ease;
}
.rail.is-light { color: var(--foam); }
.rail-line {
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 1px;
  background: currentColor;
  opacity: 0.32;
}
.rail-ticks a {
  position: absolute;
  left: 50%;
  top: calc(var(--p) * 100%);
  width: 11px; height: 1px;
  margin-left: -5px;
  background: currentColor;
  opacity: 0.6;
  transition: transform 0.3s var(--ease-out), opacity 0.3s ease;
}
.rail-ticks a::before {
  content: "";
  position: absolute;
  inset: -11px -8px;
}
.rail-ticks a:hover,
.rail-ticks a.is-passed { opacity: 1; }
.rail-ticks a:hover { transform: scaleX(1.8); }
.rail-boat {
  position: absolute;
  left: 50%;
  top: calc(var(--boat, 0) * 100%);
  width: 22px;
  transform: translate(-50%, -60%) rotate(90deg);
}
.boat { width: 100%; height: auto; fill: var(--gold); }
.rail.is-light .boat,
.arrival-boat .boat { fill: var(--gold-bright); }
.rail-label {
  position: absolute;
  left: 50%;
  top: calc(var(--boat, 0) * 100% + 22px);
  transform: translateX(-50%);
  writing-mode: vertical-rl;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  white-space: nowrap;
  opacity: 0.78;
}

/* ---- opening gorge */
.gorge {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
}
.gorge-copy {
  position: relative;
  z-index: 2;
  padding: clamp(104px, 17svh, 176px) var(--gutter) 0;
}
.motto {
  font-size: clamp(2.35rem, 6.3vw, 5.6rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -0.02em;
  max-width: 15ch;
}
.motto-line {
  display: block;
  overflow: hidden;
  padding-bottom: 0.12em;
}
.motto-line > span { display: block; }
.motto-line--aside {
  margin-top: 0.5em;
  font-size: 0.4em;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1.3;
  color: var(--azurite);
  max-width: none;
}
.gorge-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 26px;
  margin-top: clamp(18px, 3svh, 30px);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.gorge-scene {
  position: absolute;
  inset: auto 0 0 0;
  height: 62svh;
  z-index: 1;
}
.ridge {
  position: absolute;
  left: -3%;
  bottom: 8svh;
  width: 106%;
  height: calc(100% - 8svh);
  max-width: none;
  transform: translate3d(calc(var(--px, 0) * var(--d) * -22px), calc(var(--sy, 0) * var(--d) * 0.16px + var(--py, 0) * var(--d) * -7px), 0);
  will-change: transform;
}
.water {
  position: absolute;
  inset: auto 0 0 0;
  height: calc(8svh + 2px);
  background: var(--deep);
}
.gorge-boat {
  position: absolute;
  left: clamp(24%, 30vw, 34%);
  top: -24px;
  width: clamp(44px, 4.4vw, 64px);
  transform-origin: 50% 80%;
}
.gorge-boat .boat { fill: var(--gold-bright); }
.ripple {
  position: absolute;
  left: clamp(24%, 30vw, 34%);
  top: calc(10px + var(--i) * 9px);
  width: calc(70px + var(--i) * 46px);
  height: 1px;
  margin-left: calc(var(--i) * -18px);
  background: var(--foam);
  opacity: calc(0.42 - var(--i) * 0.11);
  transform-origin: 30% 50%;
}
.downstream {
  position: absolute;
  left: var(--gutter);
  bottom: calc(4svh - 0.7em);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--foam);
  font-size: 0.86rem;
  letter-spacing: 0.08em;
  text-decoration: none;
}
.downstream-line {
  width: 46px; height: 1px;
  background: currentColor;
  transform-origin: left center;
  transition: transform 0.5s var(--ease-out);
}
.downstream:hover .downstream-line { transform: scaleX(1.6); }

/* ---- ranges and works */
.ranges { padding: 0 var(--gutter); }
.range {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) 1fr;
  gap: clamp(28px, 5vw, 88px);
  padding: clamp(72px, 13svh, 148px) 0;
  border-top: 1px solid var(--line);
  max-width: 1280px;
  margin-right: 44px;
}
.range:first-child { border-top: 0; }
.range-head {
  position: sticky;
  top: 17svh;
  align-self: start;
}
.range-no,
.range-count {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.range-title {
  margin: 10px 0 8px;
  font-size: clamp(2rem, 4.2vw, 3.7rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.range-glyph {
  width: min(100%, 300px);
  height: 62px;
  margin-top: 26px;
  overflow: visible;
}
.range-glyph path {
  fill: none;
  stroke: var(--azurite);
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.work { border-bottom: 1px solid var(--line); }
.work:first-child { border-top: 1px solid var(--line); }
.work-link {
  position: relative;
  display: grid;
  grid-template-columns: 2.6rem minmax(0, 1fr) auto 9.5rem 1.4rem;
  align-items: baseline;
  gap: 0 18px;
  padding: 1.2rem 0;
  text-decoration: none;
}
.work-link::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.6s var(--ease-out);
}
.work-no,
.work-kind,
.work-span {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.work-no { transition: color 0.3s ease; }
.work-title {
  font-size: clamp(1.25rem, 2.3vw, 1.95rem);
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
  transition: transform 0.5s var(--ease-out);
}
.work-span { text-align: right; }
.work-arrow {
  justify-self: end;
  transition: transform 0.5s var(--ease-out);
}
.work-link:focus-visible::after { transform: scaleX(1); }
.work-link:focus-visible .work-no { color: var(--malachite); }
@media (hover: hover) and (pointer: fine) {
  .work-link:hover::after { transform: scaleX(1); }
  .work-link:hover .work-title { transform: translateX(10px); }
  .work-link:hover .work-arrow { transform: translateX(5px); }
  .work-link:hover .work-no { color: var(--malachite); }
}
.work-link:active .work-title { transform: translateX(4px); }

.peek {
  position: fixed;
  left: 0; top: 0;
  z-index: 35;
  width: clamp(190px, 17vw, 260px);
  aspect-ratio: 4 / 5;
  pointer-events: none;
  overflow: hidden;
  clip-path: inset(100% 0 0 0);
  transition: clip-path 0.45s var(--ease-out);
  will-change: transform;
}
.peek.is-open { clip-path: inset(0 0 0 0); }
.peek img {
  width: 100%; height: 100%;
  object-fit: cover;
  transform: scale(1.12);
  transition: transform 0.9s var(--ease-out);
}
.peek.is-open img { transform: scale(1); }

/* ---- arrival */
.arrival {
  position: relative;
  margin-top: clamp(150px, 24svh, 260px);
  padding: clamp(110px, 18svh, 190px) var(--gutter) clamp(70px, 12svh, 130px);
  background: linear-gradient(to bottom, var(--deep), var(--deeper));
  color: var(--foam);
}
.horizon {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(100% - 1px);
  width: 100%;
  height: clamp(90px, 15svh, 160px);
  max-width: none;
}
.horizon-far { fill: #6f9aa5; opacity: 0.5; }
.horizon-near { fill: var(--deep); }
.arrival-water {
  position: absolute;
  left: var(--gutter); right: var(--gutter);
  top: clamp(46px, 8svh, 84px);
  height: 1px;
  background: var(--line-light);
}
.arrival-boat {
  position: absolute;
  left: calc(4% + var(--drift, 0.7) * 82%);
  top: -25px;
  width: clamp(40px, 3.6vw, 52px);
}
.arrival-inner { max-width: 1180px; margin-right: 44px; }
.arrival-title img {
  width: min(100%, 980px);
  height: auto;
  filter: invert(1) brightness(0.96);
}
.arrival-copy {
  max-width: 64ch;
  margin-top: clamp(40px, 8svh, 84px);
  margin-left: auto;
}
.arrival-copy p {
  font-size: 1.04rem;
  line-height: 2;
  color: var(--foam-soft);
}
.arrival-copy p + p { margin-top: 1.25em; }
.arrival-copy .arrival-final {
  margin-top: 2.2em;
  color: var(--foam);
  font-weight: 700;
}
.hotline-inline { color: var(--gold-bright); }
.hotline {
  display: inline-flex;
  flex-direction: column;
  margin-top: 2.2rem;
  text-decoration: none;
}
.hotline-label {
  font-size: 0.82rem;
  letter-spacing: 0.1em;
  color: var(--foam-soft);
}
.hotline-number {
  font-family: var(--mono);
  font-size: clamp(3.2rem, 9vw, 6rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
  color: var(--gold-bright);
  background: linear-gradient(currentColor, currentColor) left bottom / 0 2px no-repeat;
  transition: background-size 0.6s var(--ease-out);
}
.hotline:hover .hotline-number,
.hotline:focus-visible .hotline-number { background-size: 100% 2px; }
.arrival :focus-visible,
.shore :focus-visible { outline-color: var(--gold-bright); }

/* ---- shore */
.shore {
  padding: clamp(60px, 10svh, 110px) var(--gutter) 44px;
  background: var(--deeper);
  color: var(--foam);
}
.shore-title {
  font-size: 0.82rem;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--foam-soft);
  margin-bottom: 18px;
}
.contacts { max-width: 1180px; margin-right: 44px; border-top: 1px solid var(--line-light); }
.contacts a {
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr) 1.4rem;
  align-items: baseline;
  gap: 0 18px;
  padding: 1.05rem 0;
  border-bottom: 1px solid var(--line-light);
  text-decoration: none;
}
.contact-label {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--foam-soft);
}
.contact-value {
  font-size: clamp(1.02rem, 1.7vw, 1.4rem);
  overflow-wrap: anywhere;
  transition: transform 0.5s var(--ease-out);
}
.contact-arrow { justify-self: end; transition: transform 0.5s var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .contacts a:hover .contact-value { transform: translateX(10px); }
  .contacts a:hover .contact-arrow { transform: translateX(5px); }
}
.shore-end {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin: 64px 44px 0 0;
  max-width: 1180px;
  font-size: 0.86rem;
  color: var(--foam-soft);
}

/* ---- log pages */
.log,
.lost { padding: clamp(118px, 19svh, 190px) var(--gutter) 0; }
.lost { min-height: 100svh; }
.lost p { margin-top: 2rem; }
.log-head { max-width: 1180px; margin-right: 44px; }
.log-no {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.log-title {
  margin-top: 12px;
  font-size: clamp(2.2rem, 5.6vw, 4.6rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
  view-transition-name: work-title;
}
.log-sub {
  margin-top: 16px;
  font-size: 1.1rem;
  color: var(--ink-soft);
}
.log-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 26px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.log-body {
  margin: clamp(48px, 9svh, 96px) 44px 0 0;
  max-width: 1180px;
}
.log--timeline .log-body {
  display: grid;
  grid-template-columns: minmax(150px, 0.3fr) minmax(0, 1fr);
  gap: clamp(28px, 5vw, 88px);
}
.timeline {
  position: sticky;
  top: 17svh;
  align-self: start;
}
.timeline ol { border-left: 1px solid var(--line); }
.timeline a {
  position: relative;
  display: block;
  padding: 7px 0 7px 16px;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color 0.3s ease, transform 0.4s var(--ease-out);
}
.timeline a::before {
  content: "";
  position: absolute;
  left: -1px; top: 0; bottom: 0;
  width: 2px;
  background: var(--azurite);
  transform: scaleY(0);
  transition: transform 0.4s var(--ease-out);
}
.timeline a:hover,
.timeline a.is-current { color: var(--ink); }
.timeline a.is-current { transform: translateX(4px); }
.timeline a.is-current::before { transform: scaleY(1); }

.entries, .letter { max-width: 46rem; }
.entry + .entry {
  margin-top: clamp(64px, 11svh, 120px);
  padding-top: clamp(40px, 6svh, 64px);
  border-top: 1px solid var(--line);
}
.entry { scroll-margin-top: 110px; }
.entry-date {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.6rem;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 400;
  color: var(--azurite);
}
.entry-tick {
  flex: none;
  width: 22px; height: 1px;
  background: currentColor;
}
.entry p {
  font-size: 1.06rem;
  line-height: 2;
  overflow-wrap: anywhere;
}
.entry p + p { margin-top: 1.1em; }
.entry-link a {
  display: inline-flex;
  gap: 10px;
  font-weight: 700;
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat;
  padding-bottom: 3px;
  transition: color 0.3s ease;
}
.entry-link a:hover { color: var(--azurite); }
.shot { margin: 2rem 0; }
.shot-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #dfe5e0;
  cursor: zoom-in;
  overflow: hidden;
}
.shot img {
  width: 100%;
  height: auto;
  transition: transform 0.9s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .shot-btn:hover img { transform: scale(1.025); }
}
.letter-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: clamp(40px, 7svh, 72px);
}
.letter-gallery .shot { margin: 0; }
.letter-gallery .shot-btn { aspect-ratio: 3 / 4; }
.letter-gallery .shot img { height: 100%; object-fit: cover; }

.passage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 clamp(20px, 4vw, 64px);
  margin: clamp(90px, 16svh, 170px) 44px 0 0;
  max-width: 1180px;
  padding-bottom: clamp(70px, 12svh, 130px);
}
.passage-link {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--ink);
  text-decoration: none;
}
.passage-link--empty { border-top-color: transparent; }
.passage-link--next { text-align: right; align-items: flex-end; }
.passage-dir {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.passage-title {
  font-size: clamp(1.3rem, 2.8vw, 2.3rem);
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
  transition: transform 0.5s var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .passage-link--prev:hover .passage-title { transform: translateX(-10px); }
  .passage-link--next:hover .passage-title { transform: translateX(10px); }
}

.lightbox {
  width: 100vw; height: 100dvh;
  max-width: none; max-height: none;
  margin: 0;
  padding: 56px 20px 64px;
  border: 0;
  background: rgba(13, 38, 55, 0.96);
  color: var(--foam);
}
.lightbox::backdrop { background: transparent; }
.lightbox-stage { width: 100%; height: 100%; }
.lightbox img {
  width: 100%; height: 100%;
  object-fit: contain;
}
.lightbox button {
  border: 0;
  background: none;
  cursor: pointer;
  padding: 10px 14px;
}
.lightbox-close {
  position: absolute;
  right: 12px; top: 10px;
  font-size: 0.9rem;
}
.lightbox-bar {
  position: absolute;
  left: 0; right: 0; bottom: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 18px;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.lightbox :focus-visible { outline-color: var(--gold-bright); }

/* ---- motion: everything below only applies when the reader has not asked for less motion */
html.motion .ridge {
  animation: ridge-rise 1.5s var(--ease-out) calc(var(--i) * 110ms) both;
}
@keyframes ridge-rise {
  from { translate: 0 calc(26% + var(--i) * 7%); opacity: 0; }
  to { translate: 0 0; opacity: 1; }
}
html.motion .motto-line > span {
  animation: line-surface 1.1s var(--ease-out) calc(320ms + var(--i) * 150ms) both;
}
@keyframes line-surface {
  from { transform: translateY(108%); }
  to { transform: translateY(0); }
}
html.motion .gorge-meta,
html.motion .downstream,
html.motion .top {
  animation: settle 0.9s var(--ease-out) 950ms both;
}
@keyframes settle {
  from { opacity: 0; translate: 0 10px; }
  to { opacity: 1; translate: 0 0; }
}
html.motion .water {
  animation: water-in 1.2s var(--ease-out) 500ms both;
  transform-origin: center bottom;
}
@keyframes water-in {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
html.motion .gorge-boat {
  animation: boat-arrive 3.2s var(--ease-out) 900ms both, boat-bob 5.5s ease-in-out 4.1s infinite;
}
@keyframes boat-arrive {
  from { translate: -34vw 0; opacity: 0; }
  20% { opacity: 1; }
  to { translate: 0 0; opacity: 1; }
}
@keyframes boat-bob {
  0%, 100% { rotate: -1.6deg; }
  50% { rotate: 1.8deg; }
}
html.motion .ripple {
  animation: ripple-run 3.6s ease-in-out calc(1.8s + var(--i) * 0.5s) infinite backwards;
}
@keyframes ripple-run {
  0% { transform: scaleX(0.2); opacity: 0; }
  35% { opacity: calc(0.42 - var(--i) * 0.11); }
  100% { transform: scaleX(1.25); opacity: 0; }
}
html.motion .gorge.is-away .gorge-boat,
html.motion .gorge.is-away .ripple { animation-play-state: paused; }

html.motion .range-glyph path {
  stroke-dashoffset: 1;
  transition: stroke-dashoffset 1.8s var(--ease-in-out) 0.15s;
}
html.motion .range.is-in .range-glyph path { stroke-dashoffset: 0; }
html.motion .range-title {
  clip-path: inset(0 0 100% 0);
  transform: translateY(22px);
  transition: clip-path 1s var(--ease-out), transform 1s var(--ease-out);
}
html.motion .range.is-in .range-title {
  clip-path: inset(0 0 -12% 0);
  transform: none;
}
html.motion .work {
  opacity: 0;
  translate: 0 20px;
  transition: opacity 0.7s ease calc(var(--i) * 70ms), translate 0.9s var(--ease-out) calc(var(--i) * 70ms);
}
html.motion .range.is-in .work {
  opacity: 1;
  translate: 0 0;
}

html.motion .arrival-title img {
  -webkit-mask-image: linear-gradient(90deg, #000 calc(var(--write, 1) * 116% - 16%), transparent calc(var(--write, 1) * 116%));
  mask-image: linear-gradient(90deg, #000 calc(var(--write, 1) * 116% - 16%), transparent calc(var(--write, 1) * 116%));
}
html.motion .arrival-copy > * {
  opacity: 0;
  translate: 0 18px;
  transition: opacity 0.8s ease, translate 1s var(--ease-out);
}
html.motion .arrival-copy > .is-in {
  opacity: 1;
  translate: 0 0;
}

html.motion .log-title,
html.motion .log-no,
html.motion .log-sub,
html.motion .log-meta {
  animation: settle 0.9s var(--ease-out) both;
}
html.motion .log-sub { animation-delay: 120ms; }
html.motion .log-meta { animation-delay: 200ms; }
html.motion .shot-btn {
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.1s var(--ease-out);
}
html.motion .shot-btn.is-in { clip-path: inset(0 0 0 0); }
html.motion .shot-btn img { scale: 1.08; transition: scale 1.4s var(--ease-out), transform 0.9s var(--ease-out); }
html.motion .shot-btn.is-in img { scale: 1; }
html.motion .entry-date .entry-tick {
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.8s var(--ease-out);
}
html.motion .entry.is-in .entry-tick { transform: scaleX(1); }

html.motion .lightbox {
  opacity: 0;
  transition: opacity 0.18s ease, overlay 0.18s allow-discrete, display 0.18s allow-discrete;
}
html.motion .lightbox[open] {
  opacity: 1;
  transition-duration: 0.3s;
}
@starting-style {
  html.motion .lightbox[open] { opacity: 0; }
}
html.motion .lightbox img { transition: opacity 0.2s ease; }
html.motion .lightbox img.is-swapping { opacity: 0; }

::view-transition-group(work-title) {
  animation-duration: 0.6s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}
::view-transition-old(root) { animation-duration: 0.25s; }
::view-transition-new(root) { animation-duration: 0.4s; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) { animation: none !important; }
}

/* ---- narrow screens: the rail turns into a waterline along the bottom edge */
@media (max-width: 900px) {
  body { padding-bottom: 46px; }
  .rail {
    inset: auto 18px 12px 18px;
    width: auto; height: 22px;
  }
  .rail-line {
    inset: 50% 0 auto 0;
    width: auto; height: 1px;
  }
  .rail-ticks a {
    left: calc(var(--p) * 100%);
    top: 50%;
    width: 1px; height: 9px;
    margin: -4px 0 0 0;
  }
  .rail-ticks a:hover { transform: scaleY(1.6); }
  .rail-boat {
    left: calc(var(--boat, 0) * 100%);
    top: 50%;
    transform: translate(-50%, -78%);
  }
  .rail-label { display: none; }
  .downstream { bottom: 46px; }
  .water { height: calc(8svh + 34px); }
  .ridge { bottom: calc(8svh + 32px); height: calc(100% - 8svh - 32px); }
  .rail::before {
    content: "";
    position: absolute;
    inset: -12px -18px;
    background: linear-gradient(to top, var(--mist) 55%, rgba(236, 239, 233, 0));
    z-index: -1;
    transition: opacity 0.4s ease;
  }
  .rail.is-light::before { opacity: 0; }
  .range,
  .arrival-inner,
  .contacts,
  .shore-end,
  .log-head,
  .log-body,
  .passage { margin-right: 0; }
  .range {
    grid-template-columns: minmax(0, 1fr);
    gap: 30px;
    padding: 64px 0;
  }
  .range-head,
  .timeline { position: static; }
  .range-glyph { margin-top: 16px; height: 44px; }
  .work-link {
    grid-template-columns: 2.2rem minmax(0, 1fr) 1.2rem;
    gap: 2px 12px;
    padding: 1rem 0;
  }
  .work-title { grid-column: 2; }
  .work-kind { grid-column: 2; grid-row: 2; }
  .work-span { grid-column: 2; grid-row: 3; text-align: left; }
  .work-span:empty { display: none; }
  .work-arrow { grid-column: 3; grid-row: 1; }
  .log--timeline .log-body { grid-template-columns: minmax(0, 1fr); }
  .timeline { min-width: 0; }
  .timeline ol {
    display: flex;
    gap: 4px 18px;
    overflow-x: auto;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .timeline ol::-webkit-scrollbar { display: none; }
  .timeline a { padding: 8px 0 10px; white-space: nowrap; }
  .timeline a::before { inset: auto 0 -1px 0; width: auto; height: 2px; transform: scaleX(0); }
  .timeline a.is-current { transform: none; }
  .timeline a.is-current::before { transform: scaleX(1); }
  .arrival-copy { margin-left: 0; }
  .contacts a { grid-template-columns: 4.6rem minmax(0, 1fr) 1.2rem; gap: 0 10px; }
  .letter-gallery { gap: 6px; }
  .passage { grid-template-columns: 1fr; gap: 26px; }
  .passage-link--empty { display: none; }
}

@media (max-width: 520px) {
  .top-links { gap: 14px; font-size: 0.84rem; }
  .motto { font-size: clamp(2.5rem, 11.4vw, 3.2rem); }
  .motto-line--aside { font-size: 0.44em; }
  .gorge-scene { height: 60svh; }
}
