:root {
  color-scheme: light;
  --paper: #fbfaf6;
  --paper-shade: #f2efe7;
  --ink: #1f1d1a;
  --ink-soft: #5b564d;
  --rule: #dcd6ca;
  --night: #0b111c;
  --night-sky: radial-gradient(ellipse 80% 55% at 43% 48%, #1b2740 0%, #0a1222 55%, #03060c 100%);
  --moon: #ece6d8;
  --moon-bright: #f6f0e2;
  --moon-soft: #aca89c;
  --moon-rule: rgb(236 230 216 / 0.16);
  --shu: #c63b2a;
  --shu-light: #e2674f;
  --cedar: #3b2a1e;
  --hand-ink: #2a1f16;

  --font-body: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
  --font-hand: "Zen Kurenaido", "Klee One", "Hiragino Maru Gothic ProN", cursive;

  --fs-caption: 13px;
  --fs-small: 14px;
  --fs-body: 17px;
  --fs-h3: 19px;
  --fs-lead: 21px;
  --fs-time: 26px;
  --fs-title: clamp(34px, 3vw, 46px);
  --fs-hero: clamp(42px, 3.4vw, 56px);
  --lh-body: 1.8;
  --track-title: 0.22em;
  --track-label: 0.14em;

  --gutter: clamp(20px, 5vw, 72px);
  --measure: 36rem;
  --head-col: 7rem;
  --col-gap: clamp(40px, 5.5vw, 96px);

  --dur-ui: 500ms;
  --dur-slow: 1200ms;
  --dur-intro: 1500ms;
  --ease-ui: cubic-bezier(0.24, 0.5, 0.49, 0.94);
  --ease-soft: cubic-bezier(0.26, 0.06, 0, 1);
}

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

html {
  background: var(--paper);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: var(--lh-body);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

i {
  font-style: normal;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 5px;
}

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

.skip {
  position: absolute;
  top: -120px;
  left: 16px;
  z-index: 20;
  padding: 8px 14px;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--fs-small);
  text-decoration: none;
  transition: top var(--dur-ui) var(--ease-ui);
}

.skip:focus {
  top: 16px;
}

.svg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.seal {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.seal-ink {
  fill: var(--shu);
}

.seal-glyph {
  font-family: var(--font-body);
  font-size: 60px;
  font-weight: 800;
  fill: #000;
}

.river {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: block;
  width: 100%;
  height: 100%;
  will-change: transform;
}

.v-title {
  margin: 0;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-size: var(--fs-title);
  font-weight: 600;
  line-height: 1;
  letter-spacing: var(--track-title);
  white-space: nowrap;
}

.masthead {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 3;
  padding-inline: var(--gutter);
  color: var(--moon);
}

.masthead-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  max-width: 1240px;
  margin-inline: auto;
  padding-top: clamp(20px, 3vw, 40px);
}

.brand {
  display: block;
  width: 30px;
  border-radius: 2px;
}

.index {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 6;
  height: 64px;
  pointer-events: none;
}

.index + .sheet {
  margin-top: -64px;
}

.index-list {
  position: absolute;
  top: 14px;
  pointer-events: auto;
  right: var(--gutter);
  display: flex;
  gap: clamp(16px, 2vw, 28px);
  margin: 0;
  padding: 6px 18px;
  list-style: none;
  border: 1px solid var(--rule);
  border-radius: 25px;
  background: rgb(251 250 246 / 0.94);
  color: var(--ink);
}

.index a,
.to-top {
  display: inline-block;
  font-size: var(--fs-caption);
  line-height: 1.6;
  letter-spacing: var(--track-label);
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 50% 100% / 0 1px no-repeat;
  transition: opacity var(--dur-ui) var(--ease-ui), background-size var(--dur-ui) var(--ease-ui);
}

.index a {
  color: var(--ink-soft);
}

.index a:hover,
.index a[aria-current="true"] {
  color: var(--ink);
  background-size: 100% 1px;
}

.to-top {
  color: var(--moon);
}

.to-top:hover {
  opacity: 0.7;
}

.key {
  color: var(--shu-light);
  font-weight: inherit;
}

.hero {
  position: relative;
  z-index: 2;
  height: 100vh;
  height: 100svh;
  min-height: 540px;
  padding-inline: var(--gutter);
  overflow: hidden;
  background: var(--night-sky);
  color: var(--moon);
}

.hero-grid,
.masthead-inner,
.coda-grid {
  position: relative;
  z-index: 1;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--head-col);
  max-width: 1240px;
  height: 100%;
  margin-inline: auto;
}

.hero-head {
  display: flex;
  flex-direction: column;
  grid-column: 2;
  align-items: center;
  padding-top: 21vh;
  padding-top: 21svh;
}

.hero-title {
  font-size: var(--fs-hero);
  color: var(--moon-bright);
  text-shadow: 0 0 22px rgb(2 4 10 / 0.7);
}

.hero-note {
  margin: 30px 0 0;
  color: rgb(236 230 216 / 0.84);
  font-size: var(--fs-caption);
  line-height: 1.6;
  letter-spacing: var(--track-label);
  white-space: nowrap;
  text-shadow: 0 0 12px rgb(2 4 10 / 0.8);
}

.thread {
  position: relative;
  flex: none;
  width: 1px;
  height: 14vh;
  margin-top: auto;
  overflow: hidden;
  background: linear-gradient(to bottom, rgb(236 230 216 / 0), rgb(236 230 216 / 0.45));
}

.thread::after {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 36%;
  background: linear-gradient(to bottom, rgb(255 246 224 / 0), #fff6e0);
  content: "";
  transform: translateY(-100%);
}

.sheet {
  position: relative;
  z-index: 2;
  padding: clamp(104px, 13vw, 190px) var(--gutter);
}

.paper {
  background: var(--paper);
  color: var(--ink);
}

.paper::before {
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='f'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.36 0 0 0 0 0.3 0 0 0 0 0.22 0 0 0 1.1 -0.52'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23f)'/%3E%3C/svg%3E");
  opacity: 0.32;
  content: "";
  pointer-events: none;
}

.night {
  background: var(--night);
  color: var(--moon);
}

.sheet-grid {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) var(--head-col);
  grid-template-areas: "aside body head";
  column-gap: var(--col-gap);
  align-items: start;
  max-width: 1240px;
  margin-inline: auto;
}

.sheet-head {
  position: sticky;
  top: 16vh;
  display: flex;
  flex-direction: column;
  grid-area: head;
  align-items: center;
  gap: 26px;
}

.kicker span {
  display: block;
}

.kicker {
  max-width: 9em;
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--fs-caption);
  line-height: 1.6;
  letter-spacing: var(--track-label);
  text-align: center;
}

.night .kicker {
  color: var(--moon-soft);
}

.sheet-body {
  grid-area: body;
}

.sheet-aside {
  grid-area: aside;
}

.sheet-body p {
  margin: 0 0 1.1em;
  text-wrap: pretty;
}

.sheet-body .lead {
  margin-bottom: 1.5em;
  font-size: var(--fs-lead);
  line-height: 1.75;
}

.sheet-body .item-title {
  margin: 0 0 6px;
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.5;
  text-wrap: balance;
}

.seal-note {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 32px;
  align-items: start;
  margin-top: 72px;
  padding-top: 44px;
  border-top: 1px solid var(--rule);
}

.seal-title {
  grid-row: 1;
  grid-column: 3;
  font-size: 24px;
}

.seal-figure {
  margin: 0;
}

.seal-figure .seal {
  width: 92px;
}

.seal-figure figcaption {
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: var(--fs-caption);
  line-height: 1.5;
  letter-spacing: 0.06em;
}

.seal-note p {
  margin: 0;
}

.chronology {
  max-width: 21rem;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.chronology li {
  display: grid;
  grid-template-columns: 4rem minmax(0, 1fr);
  gap: 18px;
  padding-block: 14px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink-soft);
  font-size: var(--fs-small);
  line-height: 1.7;
}

.year {
  color: var(--ink);
  font-size: var(--fs-h3);
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.schedule {
  margin: 64px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--moon-rule);
}

.schedule li {
  display: grid;
  grid-template-columns: 6.2rem minmax(0, 1fr);
  gap: 20px;
  padding-block: 26px;
  border-bottom: 1px solid var(--moon-rule);
}

.schedule time {
  font-size: var(--fs-time);
  line-height: 1.15;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

.schedule .event p {
  margin: 0;
  color: var(--moon-soft);
}

.schedule .is-key time,
.schedule .is-key .item-title {
  color: var(--shu-light);
}

.notes {
  display: grid;
  gap: 10px;
  margin: 44px 0 0;
  padding: 0;
  color: var(--moon-soft);
  font-size: var(--fs-small);
  line-height: 1.7;
  list-style: none;
}

.notes li {
  position: relative;
  padding-left: 22px;
}

.notes li::before {
  position: absolute;
  top: 0.85em;
  left: 0;
  width: 10px;
  height: 1px;
  background: currentColor;
  content: "";
}

.route {
  position: sticky;
  top: 14vh;
  margin: 0 0 0 auto;
  max-width: 300px;
}

.route svg {
  display: block;
  width: 100%;
  height: auto;
}

.route-water {
  fill: rgb(120 150 195 / 0.1);
}

.route-bank,
.route-hill,
.route-scale path {
  fill: none;
  stroke: rgb(236 230 216 / 0.42);
  stroke-width: 1;
}

.route-current {
  fill: none;
  stroke: rgb(236 230 216 / 0.34);
  stroke-width: 1;
  stroke-dasharray: 2 7;
}

.route-arrow {
  fill: none;
  stroke: rgb(236 230 216 / 0.6);
  stroke-width: 1;
}

.route-bridge,
.route-temple,
.route-weir {
  fill: none;
  stroke: var(--moon);
  stroke-width: 1.5;
}

.route-pier {
  stroke: var(--moon);
  stroke-width: 3;
}

.route-dot {
  fill: var(--shu-light);
}

.route text {
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0.04em;
  fill: var(--moon);
}

.route .route-sub,
.route-scale text {
  font-size: 12px;
  fill: var(--moon-soft);
}

.route .is-key .route-sub {
  fill: var(--shu-light);
}

.route figcaption {
  margin-top: 18px;
  color: var(--moon-soft);
  font-size: var(--fs-caption);
  line-height: 1.6;
  letter-spacing: 0.06em;
}

.steps {
  display: grid;
  gap: 36px;
  margin: 60px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  display: grid;
  grid-template-columns: 2.4rem minmax(0, 1fr);
  column-gap: 16px;
  counter-increment: step;
}

.steps li::before {
  grid-row: span 2;
  color: var(--ink-soft);
  font-size: var(--fs-time);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  content: counter(step);
}

.steps .item-title,
.steps p {
  grid-column: 2;
}

.sheet-body .steps p {
  margin: 0;
}

.lantern {
  position: sticky;
  top: 16vh;
  margin: 0 0 0 auto;
  max-width: 452px;
}

.net {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.panel + .panel .face {
  border-left-width: 0;
}

.face {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 5;
  padding: 16% 12%;
  border: 2px solid var(--cedar);
  background: radial-gradient(120% 95% at 50% 92%, #fffaf0 0%, #fcf0d3 46%, #f2ddb1 100%);
  text-align: center;
}

.hand {
  color: var(--hand-ink);
  font-family: var(--font-hand);
  font-size: 15px;
  font-weight: 400;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.face--front .hand {
  font-size: 22px;
  line-height: 1.2;
}

.seal--face {
  position: absolute;
  bottom: 8%;
  left: 10%;
  width: 11px;
}

.face-label {
  margin: 12px 0 0;
  color: var(--ink-soft);
  font-size: var(--fs-caption);
  line-height: 1.5;
  letter-spacing: var(--track-label);
  text-align: center;
}

.lantern figcaption {
  margin-top: 26px;
  color: var(--ink-soft);
  font-size: var(--fs-caption);
  line-height: 1.7;
  letter-spacing: 0.04em;
}

.coda {
  position: relative;
  z-index: 2;
  display: grid;
  align-content: start;
  min-height: 100vh;
  min-height: 100svh;
  padding: clamp(72px, 10vh, 112px) var(--gutter) clamp(56px, 7vw, 88px);
  overflow: hidden;
  background: var(--night-sky);
  color: var(--moon);
}

.coda::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(to bottom, rgb(4 7 13 / 0.8), rgb(4 7 13 / 0.45) 42%, rgb(4 7 13 / 0) 62%);
  content: "";
  pointer-events: none;
}

.coda-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, var(--measure)) var(--head-col);
  grid-template-areas: ". body head";
  column-gap: var(--col-gap);
  align-items: start;
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
}

.coda-head {
  display: flex;
  grid-area: head;
  justify-content: center;
}

.coda-head .v-title {
  color: var(--moon-bright);
  text-shadow: 0 0 18px rgb(2 4 10 / 0.7);
}

.coda-body {
  grid-area: body;
  text-shadow: 0 0 14px rgb(2 4 10 / 0.8);
}

.seal--coda {
  width: 52px;
  margin-bottom: 28px;
}

.coda-line {
  margin: 0 0 16px;
  color: var(--moon-bright);
  font-size: var(--fs-lead);
  line-height: 1.7;
  text-wrap: balance;
}

.coda-org,
.coda-fiction {
  max-width: 30rem;
  margin: 0 0 10px;
  color: var(--moon-soft);
  font-size: var(--fs-small);
  line-height: 1.75;
}

.to-top {
  margin-top: 8px;
  background-position: 0 100%;
  background-size: 100% 1px;
}

@keyframes write-in {
  from {
    clip-path: inset(-20% -60% 100% -60%);
  }
  to {
    clip-path: inset(-20% -60% -20% -60%);
  }
}

@keyframes stamp-in {
  from {
    opacity: 0;
    transform: scale(1.14) rotate(-2deg);
  }
  55% {
    opacity: 1;
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0deg);
  }
}

@keyframes thread-run {
  0% {
    opacity: 0;
    transform: translateY(-100%);
  }
  16% {
    opacity: 1;
  }
  62%,
  100% {
    opacity: 0;
    transform: translateY(280%);
  }
}

.js .hero-title {
  animation: write-in var(--dur-intro) var(--ease-soft) 250ms both;
}

.js .brand .seal {
  animation: stamp-in 900ms var(--ease-soft) 1250ms both;
}

.thread::after {
  animation: thread-run 2400ms var(--ease-soft) 1800ms infinite;
}

@media (min-width: 901px) {
  .sheet-head::before {
    width: 1px;
    height: 64px;
    margin-bottom: 4px;
    background: currentColor;
    content: "";
    opacity: 0.28;
  }
}

@media (max-width: 900px) {
  :root {
    --head-col: 4.75rem;
  }

  .sheet-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "head" "body" "aside";
  }

  .sheet-head {
    position: static;
    flex-direction: row-reverse;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 48px;
  }

  .kicker {
    max-width: none;
    text-align: left;
  }

  .sheet-aside {
    margin-top: 72px;
  }

  .chronology,
  .route,
  .lantern {
    position: static;
    max-width: none;
    margin-left: 0;
  }

  .route svg {
    max-width: 320px;
  }

  .coda-grid {
    grid-template-columns: minmax(0, 1fr) var(--head-col);
    grid-template-areas: "body head";
    column-gap: 20px;
  }

  .coda::after {
    background: linear-gradient(to bottom, rgb(4 7 13 / 0.86), rgb(4 7 13 / 0.74) 48%, rgb(4 7 13 / 0.3) 64%, rgb(4 7 13 / 0) 80%);
  }
}

@media (max-width: 560px) {
  :root {
    --fs-lead: 19px;
    --fs-time: 22px;
    --fs-title: 34px;
    --fs-hero: 36px;
  }

  .hero-town {
    display: none;
  }

  .hero-head {
    padding-top: 12vh;
    padding-top: 12svh;
  }

  .hero-note {
    align-self: flex-end;
  }

  .schedule li {
    grid-template-columns: 4.4rem minmax(0, 1fr);
    gap: 14px;
  }

  .seal-note {
    grid-template-columns: 64px minmax(0, 1fr) auto;
    gap: 18px;
  }

  .seal-title {
    font-size: 21px;
  }

  .seal-figure .seal {
    width: 64px;
  }

  .net {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 22px;
  }

  .panel:nth-child(3) .face {
    border-left-width: 2px;
  }

  .face--front .hand {
    font-size: 26px;
  }

  .hand {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .js .hero-title,
  .js .brand .seal {
    animation: none;
  }

  .thread::after {
    display: none;
    animation: none;
  }
}
