/* The stories: a story in the proportions of a phone on a white page, each with its own colour. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #1d1a16;
  --ring-a: #f2a33a;        /* the circle around the avatar */
  --ring-b: #e2463a;
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
}

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

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

.stories {
  position: relative;
  display: grid;
  place-items: center;
  width: min(320px, 100%);
}

/* ---------------------------------------------------------------- the viewer */
.viewer {
  position: relative;
  width: 100%;
  height: min(568px, calc(100svh - 48px));
  border-radius: 26px;
  overflow: hidden;
  background: #111111;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  cursor: pointer;
}

.viewer:focus-visible {
  box-shadow: 0 0 0 3px #ffffff, 0 0 0 5px var(--ink);
}

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

.viewer__stage {
  position: absolute;
  inset: 0;
  perspective: 900px;
}

/* a story: its colour, its drawing and its words */
.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 24px 44px;
  background: var(--bg);
  color: var(--fg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.scene__art {
  position: absolute;
  top: 70px;
  left: 0;
  width: 100%;
  height: 54%;
}

.scene__title {
  position: relative;
  margin: 0;
  font-size: 44px;
  font-weight: 800;
  line-height: 0.92;
  letter-spacing: -0.02em;
}

.scene__title span {
  display: inline-block;
}

.scene__note {
  position: relative;
  margin: 12px 0 0;
  font-size: 17px;
  font-weight: 500;
  opacity: 0.85;
}

/* the shade that darkens a story as it turns away */
.scene__shade {
  position: absolute;
  inset: 0;
  background: #000000;
  opacity: 0;
  pointer-events: none;
}

/* ---------------------------------------------------------------- bars and head */
.viewer__chrome {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  padding: 12px 12px 26px;
  background: linear-gradient(rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.viewer__bars {
  display: flex;
  gap: 4px;
}

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

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

.viewer__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: #ffffff;
}

.viewer__avatar,
.ring__avatar {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff4dc;
  color: #6d3b0f;
  font-weight: 800;
}

.viewer__avatar {
  width: 30px;
  height: 30px;
  font-size: 12px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.viewer__name {
  font-size: 14.5px;
  font-weight: 700;
}

.viewer__time {
  font-size: 13.5px;
  opacity: 0.75;
}

.viewer__close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  pointer-events: auto;
}

.viewer__close svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.viewer__close:focus-visible {
  outline: 2px solid #ffffff;
}

html[data-using='pointer'] .viewer__close:focus-visible {
  outline: none;
}

/* ---------------------------------------------------------------- the circle, when they are closed */
.ring {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 600 14px 'League Spartan Variable', system-ui, sans-serif;
  cursor: pointer;
  transform: translate(-50%, -50%);
}

.ring[hidden] {
  display: none;
}

.ring__avatar {
  width: 76px;
  height: 76px;
  font-size: 22px;
  box-shadow: 0 0 0 4px #ffffff, 0 0 0 7px var(--ring-a);
}

.ring {
  outline: none;
}

.ring:focus-visible .ring__avatar {
  box-shadow: 0 0 0 4px #ffffff, 0 0 0 7px var(--ring-a), 0 0 0 10px var(--ink);
}

html[data-using='pointer'] .ring:focus-visible .ring__avatar {
  box-shadow: 0 0 0 4px #ffffff, 0 0 0 7px var(--ring-a);
}

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