:root {
  color-scheme: light;
  --paper: #f5f0e5;
  --ink: #22251f;
  --muted: #575c50;
  --green: #3b633c;
  --rule: #454d3933;
  --margin: clamp(1.3rem, 8vw, 9rem);
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }

.story { min-height: 100vh; min-height: 100svh; }
.has-story .story { height: 365vh; height: 365svh; }

.sheet {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(ellipse at 27% 35%, #fbf8ee 3%, var(--paper) 65%, #efe7d5);
}

.sheet::before,
.sheet::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.sheet::before {
  z-index: 1;
  inset: auto 0 0;
  height: 5rem;
  background: linear-gradient(to top, var(--paper) 12%, #f5f0e5f2 55%, #f5f0e500);
  opacity: var(--dusk, 0);
}

.sheet::after {
  z-index: 2;
  inset: 0;
  background: url("art/washi.svg") repeat;
  opacity: .9;
}

.scene {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.title {
  position: absolute;
  z-index: 3;
  top: 43%;
  left: var(--margin);
  transform: translateY(-42%);
}

.ink-mark {
  width: 2.4rem;
  height: .15rem;
  margin: 0 0 1.1rem .17rem;
  background: var(--green);
  clip-path: polygon(0 35%, 12% 9%, 100% 0, 94% 72%, 2% 100%);
}

h1 {
  margin: 0;
  font-size: clamp(3.25rem, 8vw, 8.6rem);
  font-weight: 400;
  letter-spacing: -.066em;
  line-height: .96;
}

h1 span { color: var(--green); }
.title p {
  margin: 1.1rem 0 0 .18rem;
  color: var(--muted);
  font-size: clamp(1.08rem, 2vw, 1.5rem);
  font-style: italic;
}

.controls {
  position: absolute;
  z-index: 4;
  right: var(--margin);
  bottom: max(1.15rem, env(safe-area-inset-bottom));
  left: var(--margin);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(.45rem, 2vw, 1.6rem);
  color: var(--muted);
  font: 500 .69rem/1.2 system-ui, sans-serif;
  letter-spacing: .105em;
}

.play {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 44px;
  padding: 0 .15rem;
  color: var(--green);
  border: 0;
  background: transparent;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.play:hover { color: var(--ink); }
.play:focus-visible { outline: 1px solid var(--green); outline-offset: 5px; border-radius: 2px; }
.play svg { flex: none; }
.play .pause-icon, .play .replay-icon { display: none; }
.play[data-state="playing"] .play-icon,
.play[data-state="ended"] .play-icon { display: none; }
.play[data-state="playing"] .pause-icon,
.play[data-state="ended"] .replay-icon { display: inline; }

.scroll-cue {
  display: flex;
  align-items: center;
  gap: .25rem;
  text-transform: uppercase;
  transition: opacity 160ms ease-out;
}

.sheet[data-advanced="true"] .scroll-cue { opacity: 0; }
.track {
  width: min(100%, 6.5rem);
  height: 1px;
  justify-self: end;
  background: var(--rule);
}
.track i { display: block; height: 100%; background: var(--green); transform: scaleX(0); transform-origin: left; }

@media (max-aspect-ratio: 11/10) {
  .has-story .story { height: 320vh; height: 320svh; }
  .title {
    top: clamp(4.5rem, 19%, 11rem);
    right: var(--margin);
    left: var(--margin);
    text-align: center;
    transform: none;
  }
  .ink-mark { margin: 0 auto .85rem; width: 1.85rem; }
  h1 { font-size: clamp(2.8rem, 13.4vw, 6.2rem); }
  .title p { margin: .8rem 0 0; }
  .controls { grid-template-columns: minmax(0, 1fr) auto; }
  .scroll-cue, .track { grid-area: 1 / 2; justify-self: end; }
  .track { width: 3.6rem; opacity: 0; }
  .sheet[data-advanced="true"] .track { opacity: 1; }
}

@media (max-height: 420px) and (min-aspect-ratio: 11/10) {
  h1 { font-size: clamp(2.6rem, 7.6vw, 5.4rem); }
  .title { top: 43%; }
  .controls { bottom: max(.35rem, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-cue { transition: none; }
}
