/* The pasted stories: a story viewer in the proportions of a phone on a white page; the stories are posters on a wall,
   drawn on the canvas, and the bars, the head and the reply float over them. */
:root {
  --page: #ffffff;          /* the page */
  --night: #1b2a4a;         /* the dark ink of the posters, and the wall before the first one */
  --paper: #f6ecd8;         /* the paper, where it is not printed */
  --tomato: #e4472b;        /* the hall's red, in its mark */
  --sticker: #fffaf0;       /* the See you there sticker */
  --sticker-ink: #1b2a4a;   /* its words */
  --sticker-line: #e4472b;  /* the wave under its words */
  --chrome: #ffffff;        /* the bars, the name and the buttons over the posters */
  --focus: #f0b53c;         /* the focus rings, for the keys */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--night);
  font-family: 'Sofia Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.stories {
  position: relative;
  width: min(320px, 100%, calc((100svh - 48px) * 0.5634));
}

/* ---------------------------------------------------------------- the viewer and the wall */
.viewer {
  position: relative;
  width: 100%;
  aspect-ratio: 320 / 568;
  border-radius: 24px;
  overflow: hidden;
  background: var(--night);
  box-shadow: 0 1px 2px rgba(20, 24, 40, 0.18), 0 22px 50px -18px rgba(20, 24, 40, 0.45);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  isolation: isolate;
}

.wall {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* ---------------------------------------------------------------- tapping: back on the left, on everywhere else */
.tap {
  position: absolute;
  top: 70px;
  bottom: 72px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--night);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  outline: none;
}

.tap--back {
  left: 0;
  width: 32%;
}

.tap--next {
  left: 32%;
  right: 0;
}

/* the round sign with the chevron: shown to the mouse and to the keys */
.tap__sign {
  position: absolute;
  top: 50%;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-top: -17px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
  opacity: 0;
  transform: scale(0.86);
  transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.23, 1, 0.32, 1);
  pointer-events: none;
}

.tap--back .tap__sign {
  left: 10px;
}

.tap--next .tap__sign {
  right: 10px;
}

.tap__sign svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) and (pointer: fine) {
  .tap:hover .tap__sign {
    opacity: 1;
    transform: scale(1);
  }
}

.tap:focus-visible .tap__sign {
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 0 0 3px var(--focus), 0 2px 10px rgba(0, 0, 0, 0.22);
}

.tap:active .tap__sign {
  transform: scale(0.94);
}

.viewer[data-held] .tap__sign {
  opacity: 0;
}

/* ---------------------------------------------------------------- bars and head */
.top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 10px 10px 26px;
  background: linear-gradient(rgba(8, 10, 20, 0.42), rgba(8, 10, 20, 0));
  color: var(--chrome);
  pointer-events: none;
}

.bars {
  display: flex;
  gap: 3px;
}

.bar {
  flex: 1;
  height: 2.5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.38);
  overflow: hidden;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.18);
}

.bar i {
  display: block;
  height: 100%;
  background: var(--chrome);
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.head__mark {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.9);
}

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

.mark__ground {
  fill: var(--tomato);
}

.mark__house {
  fill: var(--paper);
}

.mark__door {
  fill: var(--night);
}

.mark__sea {
  fill: none;
  stroke: var(--night);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.head__name {
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.005em;
}

.head__when {
  font-size: 13.5px;
  font-weight: 500;
  opacity: 0.72;
}

.head__pause {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin: -4px -4px -4px auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--chrome);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: transform 0.16s ease-out;
}

.head__pause svg {
  grid-area: 1 / 1;
  width: 21px;
  height: 21px;
  fill: currentColor;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
  transition: opacity 0.18s ease, transform 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

.head__pause .i-play {
  opacity: 0;
  transform: scale(0.6) rotate(-30deg);
}

.head__pause[data-paused] .i-pause {
  opacity: 0;
  transform: scale(0.6) rotate(30deg);
}

.head__pause[data-paused] .i-play {
  opacity: 1;
  transform: none;
}

.head__pause:active {
  transform: scale(0.9);
}

.head__pause:focus-visible {
  box-shadow: 0 0 0 2.5px var(--focus);
}

/* ---------------------------------------------------------------- reply and sticker */
.foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 28px 12px 14px 12px;
  background: linear-gradient(rgba(8, 10, 20, 0), rgba(8, 10, 20, 0.42));
}

.reply {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.reply input {
  display: block;
  width: 100%;
  height: 42px;
  margin: 0;
  padding: 0 16px;
  border: 1.5px solid rgba(255, 255, 255, 0.72);
  border-radius: 21px;
  background: rgba(8, 10, 20, 0.12);
  color: var(--chrome);
  font: 500 16px 'Sofia Sans Variable', system-ui, sans-serif;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  -webkit-user-select: text;
  user-select: text;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.reply input::placeholder {
  color: rgba(255, 255, 255, 0.86);
  opacity: 1;
}

.reply input:focus {
  border-color: var(--chrome);
  background: rgba(8, 10, 20, 0.34);
}

.reply input:focus-visible {
  box-shadow: 0 0 0 2.5px var(--focus);
}

.reply[data-sent] input::placeholder {
  color: var(--chrome);
}

.react {
  flex: none;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin: 0 -2px 0 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--chrome);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  outline: none;
  transition: transform 0.16s ease-out;
}

.react svg {
  width: 28px;
  height: 28px;
  overflow: visible;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.react__sheet {
  fill: transparent;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linejoin: round;
  transition: fill 0.2s ease;
}

.react__fold,
.react__face {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s ease;
}

.react[aria-pressed='true'] .react__sheet {
  fill: var(--sticker);
  stroke: var(--sticker);
}

.react[aria-pressed='true'] .react__fold,
.react[aria-pressed='true'] .react__face {
  stroke: var(--sticker-ink);
}

.react:active {
  transform: scale(0.88);
}

.react:focus-visible {
  box-shadow: 0 0 0 2.5px var(--focus);
}

html[data-using='pointer'] .tap:focus-visible .tap__sign {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
}

html[data-using='pointer'] .head__pause:focus-visible,
html[data-using='pointer'] .react:focus-visible {
  box-shadow: none;
}

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