/* The bridge button, its corner mark, the play mark and the whoosh layers. */
.bridge-button {
  position: relative;
  display: inline-block;
  padding: 0.02em 0.2em 0.1em 0.17em;
  /* Pulled back over its own padding so the word sits right against the underscore. */
  margin-left: -0.16em;
  border-radius: 0.3em;
  isolation: isolate;
  color: inherit;
  font-weight: 560;
  text-decoration: none;
  vertical-align: baseline;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}
.bridge-button__fill {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  fill: var(--bridge-fill, var(--red));
  pointer-events: none;
  /* Clipped here, not by overflow on the link: that would move the link's baseline. */
  clip-path: inset(0 round 0.3em);
}
.bridge-button__label {
  display: block;
  pointer-events: none;
}
.bridge-button__label--on {
  position: absolute;
  inset: 0;
  padding: inherit;
  color: var(--bridge-on, var(--warm-white));
}
.corner-mark {
  position: fixed;
  right: max(26px, env(safe-area-inset-right));
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 21px;
  font-weight: 300;
  letter-spacing: -0.035em;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
  --bridge-fill: var(--red);
  --bridge-on: var(--warm-white);
  /* Far enough to start wholly below the bottom edge of the screen. */
  --below: calc(100% + max(22px, env(safe-area-inset-bottom)) + 14px);
}
.corner-mark img {
  display: block;
  width: 32px;
  height: auto;
}
/* Each piece rises out of the bottom edge on its own, the mark a beat before the words.
   Transform and opacity only, so the compositor keeps it smooth while the 3D scene is busy. */
.corner-mark > * {
  opacity: 0;
  transform: translateY(var(--below));
  transition:
    transform 1300ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 900ms cubic-bezier(0.33, 0, 0.2, 1);
  will-change: transform, opacity;
}
.corner-mark > :nth-child(2) {
  transition-delay: 110ms, 110ms;
}
.corner-mark[data-state='shown'] {
  pointer-events: auto;
}
.corner-mark[data-state='shown'] > * {
  opacity: 1;
  transform: none;
}
/* Leaving after play: the words go first and sink back below the edge, quicker than they came. */
.corner-mark[data-state='wiped'] > * {
  opacity: 0;
  transform: translateY(var(--below));
  transition:
    transform 720ms cubic-bezier(0.55, 0, 0.8, 0.25),
    opacity 520ms cubic-bezier(0.4, 0, 1, 1) 120ms;
}
.corner-mark[data-state='wiped'] > :first-child {
  transition-delay: 90ms, 210ms;
}
.corner-mark[data-state='wiped'] > :nth-child(2) {
  transition-delay: 0ms, 120ms;
}
#wordmark {
  --bridge-fill: var(--warm-white);
  --bridge-on: var(--red);
}
/* A zero-width anchor at the end of the sentence; the mark hangs from it, outside the line. */
.play-anchor {
  position: relative;
  display: inline-block;
  width: 0;
  height: 0;
  vertical-align: baseline;
}
.play-button {
  position: absolute;
  /* Its centre sits on the lowercase letters' optical middle, not the line box's. */
  --size: 0.86em;
  --centre: 0.255em;
  left: 0.38em;
  bottom: calc(var(--centre) - var(--size) / 2);
  width: var(--size);
  height: var(--size);
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--red);
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  border-radius: 0.24em;
  transition: transform 260ms var(--flow);
  -webkit-tap-highlight-color: transparent;
}
/* A larger, invisible target than the mark itself. */
.play-button::before {
  content: '';
  position: absolute;
  inset: -0.45em;
  border-radius: 0.4em;
}
.play-button svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: currentColor;
  overflow: visible;
}
@media (hover: hover) {
  .play-button:not([data-state='leaving']):hover {
    transform: scale(1.08);
  }
}
.play-button:active {
  transform: scale(0.94);
  transition-duration: 90ms;
}
.play-button[data-state='leaving'] {
  transform: scale(0.9);
  transition: transform 620ms var(--flow);
}
.play-button:focus-visible {
  outline: 1px solid var(--rose);
  outline-offset: 5px;
}
.whoosh-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
/* Painted before the next page's first frame; whoosh.arrive() replaces it with a seep. */
html[data-arrival]::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1003;
  background: var(--arrival, var(--warm-white));
}
@media (prefers-reduced-motion: reduce) {
  .corner-mark > *,
  .corner-mark[data-state='wiped'] > * {
    transform: none;
    transition: opacity 300ms linear;
    transition-delay: 0ms;
  }
}
/* The whoosh's red, painted inside the story (src/main.js paintWhoosh). The copy inside the
   platform is not clipped to its rounded edge: it paints over the edge onto the red behind it,
   so no antialiased paper seam survives where the two meet. */
.whoosh-ink {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  pointer-events: none;
  z-index: 0;
}
/* Paper copies of text and marks, laid over the red under the front (whoosh.js inkCopy). */
.is-inked,
.is-inked * {
  pointer-events: none !important;
  transition: none !important;
}
.is-inked .play-button {
  color: var(--paper);
}
/* The pages: View, Join, Why, bottom-left, each sliding in from the left edge, the lowest first.
   Colours come from the page's layering (styles/layers.css). */
.page-nav {
  position: fixed;
  left: max(var(--border, 26px), env(safe-area-inset-left));
  bottom: max(var(--border, 22px), env(safe-area-inset-bottom));
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  color: var(--layer-ink, var(--ink));
  font-size: 23.625px;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.2;
  white-space: nowrap;
  --bridge-fill: var(--layer-2, var(--red));
  --bridge-on: var(--layer-2-ink, var(--warm-white));
}
.page-nav .bridge-button {
  margin: 0;
  padding: 0.04em 0.3em 0.1em;
  font-weight: 400;
}
.page-nav > *,
.home-mark {
  opacity: 0;
  transition:
    transform 1300ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 900ms cubic-bezier(0.33, 0, 0.2, 1);
}
.page-nav > * {
  transform: translateX(calc(-100% - var(--border, 26px) - 12px));
}
.page-nav > :nth-child(2) {
  transition-delay: 80ms, 80ms;
}
.page-nav > :nth-child(1) {
  transition-delay: 160ms, 160ms;
}
.page-nav[data-state='shown'] > *,
.home-mark[data-state='shown'] {
  opacity: 1;
  transform: none;
}
/* The corner area beside the page names (src/ui/page-nav.js sets its box): from the top of Join
   to the bottom of Why, about five Whys wide. It comes in just after the names. */
.page-corner {
  position: fixed;
  z-index: 8;
  pointer-events: none;
  color: var(--layer-ink, var(--ink));
  font-size: 23.625px;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.2;
  opacity: 0;
  transform: translateX(-14px);
  transition:
    transform 1300ms cubic-bezier(0.16, 1, 0.3, 1) 240ms,
    opacity 900ms cubic-bezier(0.33, 0, 0.2, 1) 240ms;
}
.page-corner[data-state='shown'] {
  opacity: 1;
  transform: none;
}
/* Light or dark (src/ui/mode-toggle.js): "D | L" at the foot of the corner area, level with Why,
   the mode you are in filled like the page you are on. Quick controls, so no liquid. Its right
   edge is the first column's (--rail-edge), and never nearer the names than 1.1em. */
.mode-toggle {
  position: absolute;
  left: 1.1em;
  right: calc(100% + var(--corner-left, 0px) - var(--rail-edge));
  bottom: 0;
  display: flex;
  justify-content: safe flex-end;
  align-items: baseline;
  gap: 0.08em;
  white-space: nowrap;
}
.mode-toggle button {
  padding: 0.04em 0.3em 0.1em;
  border: 0;
  border-radius: 0.3em;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 400;
  cursor: pointer;
  transition:
    color 110ms linear,
    background-color 140ms linear;
}
.mode-toggle button[aria-pressed='true'] {
  background: var(--layer-2);
  color: var(--layer-2-ink);
}
.mode-toggle button:hover:not([aria-pressed='true']) {
  color: var(--layer-accent);
}
.mode-toggle button:focus-visible {
  outline: 1px solid var(--rose);
  outline-offset: 2px;
}
.mode-toggle__bar {
  color: color-mix(in srgb, var(--layer-ink) 35%, transparent);
}
/* D | L's box reaches from the names to the column edge; only the letters take presses. */
.page-corner > .mode-toggle {
  pointer-events: none;
}
.mode-toggle > button {
  pointer-events: auto;
}
/* Arriving from another regular page: already in place (src/ui/page-nav.js). */
.page-nav.is-held > *,
.page-corner.is-held,
.home-mark.is-held {
  transition: none !important;
}
/* The mark, bottom-right, sliding in from the right edge: home, to the opening. */
.home-mark {
  position: fixed;
  right: max(var(--border, 26px), env(safe-area-inset-right));
  bottom: max(var(--border, 22px), env(safe-area-inset-bottom));
  z-index: 8;
  display: block;
  width: 38px;
  height: 36px;
  transform: translateX(calc(100% + var(--border, 26px) + 12px));
  -webkit-tap-highlight-color: transparent;
}
.home-mark__logo {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--layer-mark, var(--red));
  -webkit-mask: url('../assets/logo-red.svg') center / contain no-repeat;
  mask: url('../assets/logo-red.svg') center / contain no-repeat;
  transition: transform 320ms var(--flow);
}
@media (hover: hover) {
  .home-mark:hover .home-mark__logo {
    transform: scale(1.08) rotate(-4deg);
  }
}
.home-mark:focus-visible {
  outline: 1px solid var(--rose);
  outline-offset: 6px;
  border-radius: 8px;
}
/* The top-right corner: the page's own tools (src/ui/page-tools.js), set like the page names,
   right-aligned, each sliding in from the right edge, the top one first. */
.page-tools {
  position: fixed;
  top: max(var(--border, 22px), env(safe-area-inset-top));
  right: max(var(--border, 26px), env(safe-area-inset-right));
  z-index: 8;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  color: var(--layer-ink, var(--ink));
  font-size: 23.625px;
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.2;
  white-space: nowrap;
  --bridge-fill: var(--layer-2, var(--red));
  --bridge-on: var(--layer-2-ink, var(--warm-white));
}
.page-tools__item {
  display: flex;
  align-items: baseline;
  gap: 0.45em;
  opacity: 0;
  transform: translateX(calc(100% + var(--border, 26px) + 12px));
  transition:
    transform 1300ms cubic-bezier(0.16, 1, 0.3, 1),
    opacity 900ms cubic-bezier(0.33, 0, 0.2, 1);
}
.page-tools__item:nth-child(2) {
  transition-delay: 80ms, 80ms;
}
.page-tools__item:nth-child(3) {
  transition-delay: 160ms, 160ms;
}
.page-tools[data-state='shown'] .page-tools__item {
  opacity: 1;
  transform: none;
}
.page-tools button {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.page-tools .bridge-button {
  margin: 0;
  padding: 0.04em 0.3em 0.1em;
  font-weight: 400;
}
/* A word that only says, set as the words to press are. ‹ and › with nothing to go to: there, and
   quiet. */
.page-tools__word {
  padding: 0.04em 0.3em 0.1em;
  font-weight: 400;
}
.page-tools button:disabled {
  padding: 0.04em 0.3em 0.1em;
  font-weight: 400;
  opacity: 0.3;
  cursor: default;
}
.page-tools .page-tools__arrow {
  min-width: 1.3em;
  font-size: 1.3em;
  line-height: 0.92;
}
/* Drawn again in place, or leaving with the tab. */
.page-tools.is-held .page-tools__item {
  transition: none;
}
.page-tools.is-leaving {
  opacity: 0;
  transition: opacity 160ms linear;
}
/* A word that gives way to the words beside it, cut short with an ellipsis (a long community's name). */
.page-tools__word--fit {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (prefers-reduced-motion: reduce) {
  .page-tools__item,
  .page-nav > *,
  .page-corner,
  .home-mark {
    transform: none;
    transition: opacity 300ms linear;
    transition-delay: 0ms;
  }
}
/* After play, lingering on the opening line: how to go on. Set like the example lines. */
#story-hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  width: min(86vw, 950px);
  margin: 0;
  color: var(--red);
  font-size: clamp(18px, 1.7vw, 25px);
  font-weight: 300;
  line-height: 1.35;
  letter-spacing: -0.018em;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, 6px);
  transition:
    opacity 1100ms var(--flow),
    transform 1300ms var(--flow);
}
#story-hint[data-state='shown'] {
  opacity: 1;
  transform: translate(-50%, 0);
}
#story-hint[data-state='gone'] {
  opacity: 0;
  transform: translate(-50%, 0);
  transition-duration: 350ms;
}
@media (max-width: 700px) {
  #story-hint {
    font-size: clamp(17px, 3.6vw, 22px);
    width: 92vw;
  }
}
/* A second line of a scene sits on its own line beneath the first. */
#story-text .text-part + .text-part {
  display: block;
  margin-top: 0.28em;
}
/* A note of settings under a top-right word (src/ui/settings-note.js): a letter's Text, in the right margin. Set in the site's own face and size whatever the page's, on the page colour
   so what scrolls under it does not show through. Quick controls: no liquid; the chosen one is filled red. */
.settings-note {
  position: fixed;
  z-index: 7;
  display: grid;
  gap: 0.4em;
  padding: 0.1em 0 0.5em;
  background: var(--layer-0);
  color: var(--layer-ink);
  font:
    300 16px/1.3 Fraunces,
    Georgia,
    serif;
  letter-spacing: -0.01em;
}
.settings-note__row {
  display: grid;
  grid-template-columns: 2.8em 1fr;
  align-items: baseline;
}
.settings-note--wide .settings-note__row {
  grid-template-columns: 3.9em 1fr;
}
.settings-note .settings-note__row--whole {
  grid-template-columns: minmax(0, 1fr);
}
/* In place of the corner's words, set right as they are; where those are on the panel, as they are there. */
.settings-note__row--whole .settings-note__options {
  justify-content: flex-end;
}
/* A row set apart from those above it (under a list, what adds to it). */
.settings-note__row--apart {
  margin-top: 0.35em;
}
.settings-note--inset {
  padding: 4px 6px;
  border-radius: 14px;
}
.settings-note__row--whole button {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-note__options {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.1em 0.15em;
}
.settings-note button {
  position: relative;
  padding: 0.04em 0.32em 0.1em;
  border: 0;
  border-radius: 0.3em;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 400;
  cursor: pointer;
  transition:
    color 110ms linear,
    background-color 140ms linear,
    box-shadow 110ms linear;
}
.settings-note button[aria-pressed='true'] {
  background: var(--layer-2);
  color: var(--layer-2-ink);
}
.settings-note button:focus-visible {
  outline: 1px solid var(--rose);
  outline-offset: 2px;
}
.settings-note button:hover:not([aria-pressed='true']) {
  color: var(--layer-accent);
}
.settings-note__label {
  color: color-mix(in srgb, var(--layer-ink) 45%, transparent);
}
