@font-face {
  font-family: "Album Song"; src: url("assets/album-song.woff2") format("woff2");
  font-weight: 480; font-display: swap;
}
@font-face {
  font-family: "Instrument Serif"; src: url("assets/instrument-regular.ttf") format("truetype");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Instrument Serif"; src: url("assets/instrument-italic.ttf") format("truetype");
  font-weight: 400; font-style: italic; font-display: swap;
}

:root {
  --ground: #131411; --white: #f2f0e7; --muted: #bbbcb0; --line: #44463e;
  --paper: #eeeade; --ink: #302f28;
  --serif: "Album Song", "Songti SC", "STSong", "Noto Serif CJK SC", serif;
  --latin: "Instrument Serif", Georgia, serif;
  --sans: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --edge: clamp(22px, 4.1vw, 82px);
  --top: max(19px, env(safe-area-inset-top));
  --bottom: max(21px, env(safe-area-inset-bottom));
  --head: calc(var(--top) + 53px);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; }
body { background: var(--ground); color: var(--white); font: 1rem/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
button { appearance: none; color: inherit; font: inherit; background: none; border: 0; padding: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, [tabindex]:focus-visible { outline: 2px solid currentColor; outline-offset: 5px; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
h1, h2, p, figure { margin: 0; }
a { color: inherit; }
img { display: block; }
main { height: 100%; height: 100dvh; min-height: 285px; position: relative; overflow: hidden; isolation: isolate; }

.mast {
  position: absolute; z-index: 12; left: max(var(--edge), env(safe-area-inset-left)); right: max(var(--edge), env(safe-area-inset-right));
  top: var(--top); display: flex; align-items: center; justify-content: space-between; height: 42px;
  color: var(--white); transition: color .4s;
}
.wordmark { font: 400 clamp(29px, 2.55vw, 44px)/1 var(--latin); letter-spacing: -.036em; white-space: nowrap; }
.wordmark i { font-weight: 400; }
.utilities { display: flex; gap: clamp(16px, 2.3vw, 38px); align-items: center; }
.utility { display: inline-flex; align-items: center; gap: 9px; min-height: 42px; font-size: .875rem; letter-spacing: .04em; }
.utility:hover, .plain:hover:not(:disabled), .underlined:hover { opacity: .72; }
.grid-icon { width: 12px; height: 12px; display: inline-block; background: linear-gradient(currentColor,currentColor) 0 0/5px 5px,linear-gradient(currentColor,currentColor) 100% 0/5px 5px,linear-gradient(currentColor,currentColor) 0 100%/5px 5px,linear-gradient(currentColor,currentColor) 100% 100%/5px 5px; background-repeat: no-repeat; }
.wave { height: 14px; width: 14px; display: flex; gap: 2px; align-items: center; }
.wave i { width: 2px; height: 5px; background: currentColor; }
.wave i:nth-child(2) { height: 12px; }.wave i:nth-child(3) { height: 8px; }.wave i:nth-child(4) { height: 4px; }
[aria-pressed="true"] .wave i { animation: sound-bars .75s alternate infinite ease-in-out; }
.wave i:nth-child(2) { animation-delay: -.4s; }.wave i:nth-child(3) { animation-delay: -.23s; }.wave i:nth-child(4) { animation-delay: -.54s; }
@keyframes sound-bars { from { transform: scaleY(.4); } to { transform: scaleY(1.25); } }

.scene { position: absolute; inset: 0; }
.cover { z-index: 3; background: var(--ground); display: flex; flex-direction: column; padding-block: var(--head) var(--bottom); }
.contact-field {
  isolation: isolate; flex: 1 1 0; min-height: 0; position: relative; overflow: hidden;
  perspective: 1200px; perspective-origin: 50% 48%; --dx: 0px; --dy: 0px;
}
.print {
  position: absolute; left: var(--x); top: var(--y); height: var(--s); aspect-ratio: var(--r, .75); width: auto;
  transform: translate(-50%, -50%) translate3d(calc(var(--dx) * var(--d)),calc(var(--dy) * var(--d)),0);
  will-change: transform; pointer-events: none;
}
.print img { width: 100%; height: 100%; object-fit: cover; user-select: none; }
.blossom { --x: 8%; --y: 28%; --s: 34%; --r: 1.453; --d: .44; }
.cable { --x: 29%; --y: 16%; --s: 26%; --d: -.32; }
.station { --x: 25%; --y: 70%; --s: 43%; --d: .55; }
.light { --x: 75%; --y: 18%; --s: 28%; --d: -.35; }
.mirror { --x: 94%; --y: 42%; --s: 46%; --d: .64; }
.river { --x: 75%; --y: 80%; --s: 34%; --d: .42; }
.balloons { --x: 5%; --y: 86%; --s: 20%; --r: 1.5; --d: -.28; }
.church { --x: 94%; --y: 94%; --s: 24%; --d: -.36; }
.hero-print { --x: 50.8%; --y: 49%; --s: 83%; --d: -.1; z-index: 2; cursor: pointer; pointer-events: auto; }
.cover-foot {
  flex: none; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px;
  margin-inline: var(--edge); padding: clamp(13px, 2.25vh, 30px) 0 clamp(5px, 1vh, 15px);
}
.dedication p, .address { font: 500 .875rem/1.4 var(--sans); letter-spacing: .15em; color: var(--muted); }
.dedication h1 { font: 480 clamp(48px, min(6.65vw, 10.8vh), 126px)/1.13 var(--serif); letter-spacing: -.055em; margin-top: 7px; }
.enter-group { display: flex; align-items: center; gap: clamp(13px, 1.8vw, 32px); margin-bottom: 5px; }
.extent { color: var(--muted); font-size: .875rem; }
.enter {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  min-height: 48px; padding: 0 1.45rem; color: var(--ground); background: var(--white);
  border: 1px solid var(--white); border-radius: 100px; font-size: 1rem; transition: background .2s,color .2s;
}
.enter:hover { background: transparent; color: var(--white); }
.play-glyph { width: 0; height: 0; border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-left: 8px solid currentColor; }

.gallery { z-index: 1; display: flex; flex-direction: column; padding-top: var(--head); padding-bottom: var(--bottom); }
.rail { flex: 1 1 0; position: relative; min-height: 0; overflow: hidden; touch-action: pan-y pinch-zoom; user-select: none; cursor: grab; -webkit-user-select: none; }
.rail.dragging { cursor: grabbing; }
.image-track, #filmCanvas { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.photo-plane { position: absolute; left: 0; top: 0; overflow: hidden; will-change: transform; }
.photo-plane img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
.photo-plane.rendered { visibility: hidden; }
.gallery-info {
  flex: none; display: flex; justify-content: space-between; align-items: center; gap: 18px;
  margin-inline: var(--edge); padding-block: clamp(6px, 1.2vh, 16px);
}
.current-caption { display: flex; gap: clamp(13px, 1.5vw, 27px); align-items: baseline; }
.counter { font: 400 .82rem/1 var(--mono); letter-spacing: .02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.counter-total { color: var(--muted); }
.current-caption h2 { font: 480 clamp(22px, 2.1vw, 36px)/1.35 var(--serif); letter-spacing: -.04em; }
.current-caption h2:focus { outline: none; }
.page-actions { display: flex; align-items: center; gap: clamp(13px, 1.6vw, 28px); }
.plain, .underlined, .step { min-height: 42px; font-size: .875rem; white-space: nowrap; }
.plain:disabled { color: #84867a; }
.step { padding-inline: 17px; border-radius: 100px; border: 1px solid #838477; transition: color .2s,background .2s; }
.step:hover { background: var(--white); color: var(--ground); }
.divider { width: 1px; height: 14px; background: var(--line); }
.filmstrip {
  display: flex; flex: none; justify-content: safe center; align-items: center; gap: 6px;
  margin-inline: var(--edge); padding: 3px 2px 1px; overflow-x: auto; overflow-y: hidden;
  overscroll-behavior-inline: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.filmstrip::-webkit-scrollbar { display: none; }
.thumb { position: relative; display: grid; flex: 0 0 clamp(31px, 2.8vw, 52px); height: clamp(37px, 5.2vh, 62px); place-items: center; opacity: .51; padding: 3px 2px 5px; transition: opacity .25s; }
.thumb img { width: 100%; height: 100%; object-fit: cover; overflow: hidden; }
.thumb[aria-current="true"], .thumb:hover, .thumb:focus-visible { opacity: 1; }
.thumb[aria-current="true"]::after { content: ""; position: absolute; bottom: 0; left: 2px; right: 2px; height: 2px; background: var(--white); }
.thumb:focus-visible { outline-offset: -1px; }

.shared-print { position: fixed; z-index: 10; pointer-events: none; object-fit: contain; transform-origin: left top; max-width: none; }
body[data-scene="letter"] .mast { color: var(--ink); }
.letter { z-index: 2; display: grid; grid-template-rows: 1fr auto; background: var(--paper); color: var(--ink); padding: var(--head) var(--edge) var(--bottom); overflow-y: auto; }
.letter-body { width: min(100%, 570px); align-self: center; justify-self: center; padding: clamp(22px, 4vh, 65px) 0; }
.address { color: #615f53; }
.letter-body h2 { font: 480 clamp(53px, min(6vw, 9.5vh), 105px)/1.21 var(--serif); margin: .38em 0 .43em; letter-spacing: -.055em; }
.letter-body h2:focus { outline: none; }
.wish { font: 480 clamp(21px, 2.1vw, 35px)/1.75 var(--serif); letter-spacing: .015em; }
.letter-foot { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid #bab7a8; padding-top: 8px; }
.underlined { text-decoration: underline; text-underline-offset: 5px; }
.noscript { display: grid; align-content:center; justify-items:center; height:100%; text-align:center; padding:1rem; gap:.5rem; }
.noscript img { max-height:45vh; max-width:80vw; }

dialog { color: var(--white); border: 0; padding: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none; background: var(--ground); }
dialog::backdrop { background: #11120fef; }
dialog[open] { animation: dialog-in .22s ease-out both; }
@keyframes dialog-in { from { opacity: 0; } to { opacity: 1; } }
.index-inner { min-height: 100%; padding: var(--top) var(--edge) var(--bottom); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 13px; }
.dialog-head h2 { font: 480 clamp(25px, 2.7vw, 42px)/1.4 var(--serif); letter-spacing: -.045em; }
.close { min-width: 48px; }
.index-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 36px clamp(16px, 2.6vw, 55px); padding: clamp(22px,4vh,55px) 0; }
.index-card { min-width: 0; text-align: left; }
.index-mat { height: clamp(140px, 19vw, 320px); background: #1a1b18; padding: clamp(8px, 1.2vw, 22px); display: grid; place-items: center; }
.index-mat img { width: 100%; height: 100%; min-height: 0; object-fit: contain; transition: transform .3s ease; }
@media (hover:hover) { .index-card:hover img { transform: scale(1.035); } }
.index-label { display: flex; align-items: baseline; gap: 9px; margin-top: 8px; }
.index-label small { font: .75rem var(--mono); color: var(--muted); }
.index-label strong { font: 480 clamp(15px,1.25vw,22px)/1.45 var(--serif); }
.index-end { border-top: 1px solid var(--line); text-align: right; padding-top: 8px; }
.original-inner { height: 100%; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: var(--top) var(--edge) var(--bottom); }
.original-image { min-height: 0; padding-top: 10px; touch-action: pinch-zoom; }
.original-image img { height: 100%; width: 100%; object-fit: contain; }
@media (max-width: 850px) { .index-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
@media (max-width: 650px) {
  :root { --edge: 20px; --top: max(13px, env(safe-area-inset-top)); --head: calc(var(--top) + 48px); --bottom: max(16px, env(safe-area-inset-bottom)); }
  .utilities { gap: 17px; }.utility { gap: 6px; font-size: .875rem; }
  .cover-foot { flex-wrap: wrap; align-items: end; gap: 12px; padding: 12px 0 3px; }
  .dedication p { font-size: .8125rem; }
  .dedication h1 { font-size: clamp(39px, 11.7vw, 70px); margin-top: 5px; }
  .enter-group { align-items: flex-end; flex-direction: column; gap: 4px; margin: 0; }
  .extent { font-size: .75rem; }
  .enter { min-height: 42px; padding-inline: 14px; font-size: .875rem; gap: 8px; }
  .hero-print { --x: 50%; --y: 47%; --s: min(52%, 65vw); }
  .blossom { --x: 7%; --y: 15%; --s: min(20%, 23vw); }
  .cable { --x: 52%; --y: 9%; --s: min(16%, 20vw); }
  .station { --x: 3%; --y: 57%; --s: min(30%, 40vw); }
  .light { --x: 91%; --y: 17%; --s: min(24%, 31vw); }
  .mirror { --x: 101%; --y: 52%; --s: min(31%, 42vw); }
  .river { --x: 76%; --y: 83%; --s: min(26%, 33vw); }
  .balloons { --x: 23%; --y: 86%; --s: min(17%, 23vw); }
  .church { display: none; }
  .gallery-info { display: grid; grid-template-columns: 1fr; gap: 2px; padding-block: 4px 6px; }
  .current-caption { justify-content: center; align-items: baseline; gap: 11px; }
  .current-caption h2 { font-size: 24px; }.counter { font-size: .75rem; }
  .page-actions { justify-content: center; gap: 16px; }
  .step { padding-inline: 14px; min-height: 37px; }.plain { min-height: 38px; }
  .filmstrip { margin-inline: 10px; gap: 4px; }
  .thumb { height: 40px; flex-basis: 32px; }
  .index-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 21px 15px; }
  .index-mat { height: clamp(158px, 51vw, 280px); padding: 9px; }
  .index-label { gap: 6px; }.index-label strong { font-size: 1rem; }
  .letter-body { width: min(100%, 345px); padding-inline: 6%; }
  .letter-body h2 { font-size: clamp(49px, 13.7vw, 80px); }
  .wish { font-size: clamp(19px, 4.9vw, 27px); }
}
@media (max-width: 365px) { :root { --edge: 14px; }.utility { gap:4px; }.utilities { gap:12px; }.dedication h1 {font-size: 38px;} }
@media (max-height: 450px) and (min-aspect-ratio: 1/1) {
  :root { --top: 5px; --head: 43px; --bottom: 5px; }
  .mast { height: 33px; }.wordmark { font-size: 27px; }
  .cover-foot { padding-block: 4px; }.dedication { display: flex; gap: 14px; align-items: baseline; }.dedication h1 { font-size: 37px; }.dedication p { font-size: .75rem; }
  .gallery-info { display: flex; padding-block: 0; }.current-caption h2 { font-size: 19px; }.page-actions button { min-height: 32px; }
  .filmstrip { gap: 4px; }.thumb { height: 27px; flex-basis: 24px; }
  .letter-body { display: grid; grid-template-columns: 1fr 1fr; align-items: end; width: min(88%, 720px); padding: 7px 0; }
  .address { grid-column: 1/-1; }.letter-body h2 { font-size: 42px; margin: .15em 0; }.wish {font-size: 20px;}
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .001s !important; animation-duration: .001s !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; }
}
