/* The reading room (screenplays/_reading_room): a share link, a guest reading, and the writer's Read it as a reader.
   One bar: the title, where you are, the scenes, View and the PDF, with a hairline along its foot of how far. */
.reading-bar { position: sticky; }
.reading-bar__back { padding-inline: 0.6rem; }
.reading-bar__where { font-variant-numeric: tabular-nums; }
.reading-bar__where > span:empty { display: none; }
.reading-bar__aside::before { content: "·"; margin-right: 0.75rem; }
.reading-bar__where > span:first-child:empty + .reading-bar__aside::before { content: none; }
.reading-bar__hairline {
  position: absolute;
  inset: auto 0 -1px;
  height: 2px;
  background: var(--brass);
  transform: scaleX(0);
  transform-origin: 0 50%;
  pointer-events: none;
}
@media (max-width: 40rem) {
  .reading-bar__aside { display: none; }
  .toolbar.reading-bar .toolbar__actions .button { padding: 0.35em 0.7em; font-size: 0.8rem; }
}

/* A scene opened from the list or a link lands below the bar, not under it. */
.reading-room .scene { scroll-margin-top: 6rem; }

/* A note on the title page, written in by hand for this reader. */
.paper__cover-note {
  max-width: 22rem;
  margin: 0.75rem auto 0;
  color: var(--ink);
  font: 1.35rem/1.25 var(--font-hand);
  rotate: -2deg;
}
.paper--typed .paper__cover-note { margin-top: 4em; }

/* The bookmark: coming back, a skinny canary post-it is pressed onto the paper's edge beside the scene, once,
   sticking out past it with the page pencilled on, and a slip under the bar says where you were, until you
   move on. The sticky end is on the paper (a touch darker), the free end lifts a little. */
.bookmark { display: contents; }
.bookmark__flag {
  position: absolute;
  right: -2.4rem;
  z-index: 2;
  width: 4.6rem;
  height: 1.55rem;
  margin-top: -0.2rem;
  padding-right: 0.45rem;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background:
    linear-gradient(to right, rgb(0 0 0 / 0.06) 0 1.6rem, transparent 1.6rem),
    linear-gradient(to top left, rgb(0 0 0 / 0.1), transparent 35%),
    #fff59d;
  color: #2b2a24;
  font: 1rem/1 var(--font-hand);
  white-space: nowrap;
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.18), 2px 4px 8px rgb(0 0 0 / 0.25);
  rotate: -3deg;
  animation: flag-sticks 450ms cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  pointer-events: none;
}
@keyframes flag-sticks { from { opacity: 0; scale: 1.25; translate: 1.5rem -0.5rem; } }
.bookmark__slip {
  position: fixed;
  left: 50%;
  z-index: 9;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.45rem 0.6rem 0.45rem 1rem;
  translate: -50% 0;
  border-left: 6px solid #fff59d;
  border-radius: 4px;
  background: var(--page);
  color: var(--page-ink);
  box-shadow: 0 8px 22px rgb(0 0 0 / 0.35);
  white-space: nowrap;
  animation: fade-in 400ms 500ms both;
}
.bookmark__note { margin: 0; color: var(--page-ink); font: 1.2rem/1.2 var(--font-hand); rotate: -1.5deg; }
.bookmark__top { font-size: 0.85rem; color: var(--page-ink); }
@keyframes fade-in { from { opacity: 0; } }
/* Moved on: the post-it stays as a marker, the slip goes. */
.bookmark--settled .bookmark__slip { opacity: 0; visibility: hidden; transition: opacity 0.6s, visibility 0s 0.6s; }
/* On a phone the paper fills the width, so the post-it sits just inside its edge. */
@media (max-width: 40rem) {
  .bookmark__flag { right: -6px; width: 3.2rem; height: 1.35rem; font-size: 0.9rem; }
  .bookmark__slip { gap: 0.5rem; padding-left: 0.75rem; }
}
@media (prefers-reduced-motion: reduce) { .bookmark__flag, .bookmark__slip { animation: none; } }

/* The end. */
.reading-end {
  max-width: 34rem;
  margin: 3rem auto 6rem;
  padding: 0 16px;
  text-align: center;
  color: var(--chrome);
}
.reading-end__thanks { margin: 0; color: var(--brass); font: 2.2rem/1.1 var(--font-hand); rotate: -2deg; }
.reading-end__line { margin: 0.9rem 0 0; color: var(--chrome-muted); }

/* In Read it as a reader, readers' words back stuck on the end, a little askew. */
.words-back { display: flex; flex-wrap: wrap; justify-content: center; gap: 1.1rem; margin: 1.75rem 0 0; padding: 0; list-style: none; }
.words-back__note {
  display: grid; align-content: space-between; gap: 0.75rem;
  width: 12rem; min-height: 9rem; box-sizing: border-box; padding: 0.9rem 0.9rem 0.7rem;
  background: var(--note); color: #3d3830; text-align: left;
  box-shadow: 0 1px 1px rgb(0 0 0 / 0.15), 0 8px 14px -8px rgb(0 0 0 / 0.45);
  rotate: -2deg;
}
.words-back__note:nth-child(even) { rotate: 1.5deg; translate: 0 0.4rem; }
.words-back__note:nth-child(3n) { rotate: -0.5deg; }
.words-back__note q { font: 1.15rem/1.3 var(--font-hand); quotes: none; }
.words-back__who { font: 600 0.72rem var(--font-ui); letter-spacing: 0.03em; color: #6b6255; }

/* A word back for the writer, from the end. */
.word-back { margin-top: 1.75rem; }
.word-back__form { display: grid; gap: 0.45rem; text-align: left; }
.word-back__label { color: var(--chrome); font-weight: 600; }
.word-back__row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.5rem; }
.word-back__row input, .reading-scenes__filter {
  width: 100%;
  box-sizing: border-box;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--brass-line);
  border-radius: 6px;
  background: var(--desk);
  color: var(--chrome);
}
.word-back__hint { margin: 0; color: var(--chrome-muted); font-size: 0.8rem; }
.word-back__sent { margin: 0; color: var(--chrome-muted); }
.word-back__sent q { color: var(--chrome); font-style: italic; }

/* Go to scene, for readers. */
.reading-scenes[popover] {
  margin: 0;
  padding: 1rem 16px 1.25rem;
  box-sizing: border-box;
  border: 1px solid var(--chrome-rule);
  background: var(--desk-light);
  color: var(--chrome);
  font-family: var(--font-ui);
}
.reading-scenes[popover]:popover-open {
  position: fixed;
  inset: 4.5rem 16px auto auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(26rem, calc(100% - 32px));
  max-height: calc(100dvh - 6rem);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.45);
}
.reading-scenes::backdrop { background: rgb(0 0 0 / 0.35); }
.reading-scenes__head { display: flex; align-items: center; justify-content: space-between; }
.reading-scenes__head h2 { margin: 0; font-size: 1.05rem; }
.reading-scenes__filter { font: 1rem var(--font-typed); }
.reading-scenes__list { margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.reading-scenes__list li:has(> [hidden]) { display: none; }
.reading-scenes__scene {
  display: grid;
  grid-template-columns: 2.5rem 1fr auto;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--chrome-rule);
  color: var(--chrome);
  text-decoration: none;
}
.reading-scenes__scene:hover, .reading-scenes__scene:focus-visible { background: var(--chrome-rule); }
.reading-scenes__number { color: var(--chrome-muted); font: 700 0.9rem var(--font-typed); }
.reading-scenes__heading { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 0.95rem var(--font-typed); text-transform: uppercase; }
.reading-scenes__page { color: var(--chrome-muted); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
/* On a phone, a sheet up from the foot, like On set's. */
@media (max-width: 40rem) {
  .reading-scenes[popover]:popover-open { inset: auto 0 0; width: 100%; max-height: 85dvh; border-radius: 16px 16px 0 0; }
}

/* Who has it: the end reached, and a word back. */
.guest__finished { color: var(--primary-on-paper); font-weight: 700; }
.guest__word-back { flex: 1 1 100%; color: var(--sheet-ink); font: 1.05rem/1.3 var(--font-hand); }
.share-link__note { font: 1.05rem/1.3 var(--font-hand); }
