/* The stories page (views/stories.templ, stories.js), as the old site had it (stories.css), on Daybook's tokens: a
   business's stories, made from its schedule, in a phone's story viewer, and a week of them. The stories themselves
   are story.css; the phone, the dock, the held stage and the menus' miniatures the feature pages' kit (feature.css).
   The business's colour is a Daybook field (the phone, the schedule's drawings, the dock, the week). Type in the
   phone keeps a 15px floor. */

/* ---------------------------------------------------------------- the held stage
   On a wide screen, three columns: what the story is made from, the phone with the counts under it, where its link
   goes. Narrower, the phone alone */
.st-mid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.st-side {
  display: none;
}
@media (min-width: 1024px) {
  .st-stage .bl-stage__stick {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 48px;
    max-width: 80rem;
    margin-inline: auto;
  }
  .st-side {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 290px;
  }
  .st-src {
    justify-self: end;
  }
  .st-out {
    justify-self: start;
  }
}
.st-side__k {
  margin: 0;
  color: var(--db-fg);
  font: 500 1.0625rem/1.3 var(--font-db);
  letter-spacing: -0.02em;
}
.st-side__note {
  margin: 4px 0 0;
  color: var(--db-fg-3);
  font: 400 0.9375rem/1.4 var(--font-db);
  letter-spacing: -0.01em;
}
.st-src__rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
/* a record from the schedule: its kind's drawing on the colour's tint, its name over its details; a new story's
   records slide in, and the first story's lift off towards it (a copy, .st-fly, flies over) */
.st-src__row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px;
  border-radius: var(--radius-db-card);
  background: var(--db-raised);
  box-shadow: 0 0 0 1px var(--db-edge), var(--shadow-db-float);
  animation: st-in 0.45s var(--ease-db) backwards;
  transition: opacity var(--duration-db) var(--ease-db);
}
.st-src__row:nth-child(2) {
  animation-delay: 0.05s;
}
.st-src__row:nth-child(3) {
  animation-delay: 0.1s;
}
@keyframes st-in {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
}
.st-src__row.is-lift {
  opacity: 0.4;
}
.st-fly {
  position: fixed;
  z-index: 40;
  box-sizing: border-box;
  transform-origin: 0 0;
  pointer-events: none;
  animation: none;
}
.st-src__g {
  display: grid;
  flex: none;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--db-field-soft);
  color: var(--db-field-text);
}
.st-src__t {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  font: 400 0.9375rem/1.3 var(--font-db);
  letter-spacing: -0.01em;
}
.st-src__t b {
  font-weight: 500;
}
.st-src__t span {
  color: var(--db-fg-3);
}
.st-out__url {
  margin: 0;
  padding: 12px 16px;
  overflow: hidden;
  border-radius: var(--radius-db-full);
  background: var(--db-raised);
  box-shadow: 0 0 0 1px var(--db-edge), var(--shadow-db-float);
  font: 500 1rem/1.2 var(--font-db);
  white-space: nowrap;
  text-overflow: ellipsis;
}
.st-out__opens {
  margin: 0;
  font: 400 0.9375rem/1.4 var(--font-db);
  letter-spacing: -0.01em;
}

/* ---------------------------------------------------------------- the phone: a story viewer
   Its bars and who posted it on the screen's black, the story under them (white on black reads on any story), a tap
   on either side under it (the story lets every press through but its sticker's), the reply bar at the foot */
.st-scr {
  background: var(--color-black);
  color: var(--color-white);
}
.st-scr::before {
  background: var(--color-black);
}
.st-view {
  position: relative;
  flex: 1;
  min-height: 0;
}
.st-canvas {
  position: absolute;
  z-index: 1;
  inset: 44px 0 0;
  overflow: hidden;
  border-radius: 10px;
  container-type: inline-size;
  pointer-events: none;
  transition: opacity 0.16s var(--ease-db);
}
.st-canvas.is-switching {
  opacity: 0;
}
.st-canvas .st-s__link {
  pointer-events: auto;
}
/* the first story, being made: its rows land one by one, then its sticker and the business come */
.st-canvas .st-s__rows li,
.st-canvas .st-s__link,
.st-canvas .st-s__brand {
  transition: opacity 0.4s var(--ease-db), translate 0.5s var(--ease-db);
}
.st-canvas.is-making .st-s__rows li:not(.is-in) {
  opacity: 0;
  translate: 0 6px;
}
.st-canvas.is-making :is(.st-s__link, .st-s__brand) {
  opacity: 0;
  translate: 0 8px;
}
/* Save: a flash, as a screenshot gives */
.st-canvas.is-flash::after {
  content: "";
  position: absolute;
  z-index: 5;
  inset: 0;
  background: var(--color-white);
  animation: st-flash 0.55s var(--ease-db) forwards;
}
@keyframes st-flash {
  from {
    opacity: 0.85;
  }
  to {
    opacity: 0;
  }
}
.st-tap {
  position: absolute;
  z-index: 0;
  top: 44px;
  bottom: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.st-tap--prev {
  left: 0;
  width: 30%;
}
.st-tap--next {
  right: 0;
  width: 70%;
}
.st-tap:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: -4px;
}
/* the viewer's bars: one per story, those before full, the one shown full or, on the tour, running out its time */
.st-bars {
  position: absolute;
  z-index: 2;
  top: 4px;
  right: 8px;
  left: 8px;
  display: flex;
  gap: 3px;
  margin: 0;
  pointer-events: none;
}
.st-bars i {
  flex: 1;
  height: 2px;
  overflow: hidden;
  border-radius: 1px;
  background: color-mix(in srgb, var(--color-white) 38%, transparent);
}
.st-bars b {
  display: block;
  height: 100%;
  background: var(--color-white);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.st-bars :is(.is-done, .is-now) b {
  transform: none;
}
.st-bars .is-run b {
  animation: st-bar var(--tour, 5s) linear forwards;
}
@keyframes st-bar {
  to {
    transform: none;
  }
}
.st-who {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  left: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font: 500 15px/1.2 var(--font-db);
  pointer-events: none;
}
.st-who__av {
  display: grid;
  flex: none;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--db-field);
  box-shadow: 0 0 0 1.5px var(--color-white);
  color: var(--db-field-ink);
  font: 500 15px/1 var(--font-db);
}
.st-who b {
  overflow: hidden;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.st-who__t {
  flex: none;
  color: color-mix(in srgb, var(--color-white) 72%, transparent);
  font-weight: 400;
}
.st-who .bl-icon {
  flex: none;
  margin-left: auto;
}
.st-reply {
  display: flex;
  flex: none;
  align-items: center;
  gap: 14px;
  height: 56px;
  margin: 0;
  padding: 0 14px 4px;
}
.st-reply__in {
  display: block;
  flex: 1;
  min-width: 0;
  height: 40px;
  overflow: hidden;
  padding: 0 16px;
  text-overflow: ellipsis;
  border-radius: var(--radius-db-full);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-white) 42%, transparent);
  color: color-mix(in srgb, var(--color-white) 86%, transparent);
  font: 400 15px/40px var(--font-db);
  white-space: nowrap;
}
.st-reply .bl-icon {
  flex: none;
  width: 22px;
  height: 22px;
}
.st-scr .bl-toast {
  bottom: 72px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.st-scr .bl-toast .bl-icon {
  flex: none;
  width: 18px;
  height: 18px;
}

/* where the sticker lands: the business's page rises in the app's browser, with what the story books */
.st-land {
  position: absolute;
  z-index: 3;
  inset: 50px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px 14px 0 0;
  background: var(--db-card);
  color: var(--db-fg);
  visibility: hidden;
  transform: translateY(102%);
  transition: transform 0.5s var(--ease-db), visibility 0s 0.5s;
}
.st-land.is-on {
  visibility: visible;
  transform: none;
  transition-delay: 0s;
}
.st-land .bl-ph__bar {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  flex: none;
  height: 44px;
  margin: 0;
  padding: 0 10px;
  border-bottom: 1px solid var(--db-edge);
  background: var(--db-raised);
  font: 500 15px/1 var(--font-db);
}
.st-land .bl-ph__x {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--db-fg);
  cursor: pointer;
}
.st-land .bl-ph__bar > span {
  overflow: hidden;
  color: var(--db-fg-3);
  text-align: center;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.st-land .bl-ph__more {
  display: grid;
  place-items: center;
}
.st-land__page {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  min-height: 0;
  padding: 14px 14px 20px;
  overflow-y: auto;
  scrollbar-width: none;
  font: 400 15px/1.35 var(--font-db);
}
.st-land__pic {
  flex: none;
  height: 140px;
  margin-bottom: 6px;
  overflow: hidden;
  border-radius: 18px;
}
.st-land__pic img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.st-land__t {
  font: 500 22px/1.15 var(--font-db);
  letter-spacing: -0.03em;
}
.st-land__m {
  color: var(--db-fg-3);
}
.st-land__rows {
  display: flex;
  flex-direction: column;
  margin: 8px 0 0;
  padding: 4px 12px;
  border-radius: 18px;
  background: var(--db-raised);
  list-style: none;
}
.st-land__rows li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--db-edge);
}
.st-land__rows li:first-child {
  border-top: 0;
}
.st-land__w {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.st-land__w b {
  font-weight: 500;
}
.st-land__w span {
  color: var(--db-fg-3);
}
.st-land__go {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 4px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--radius-db-full);
  background: var(--db-field);
  color: var(--db-field-ink);
  cursor: pointer;
  font: 500 15px/1 var(--font-db);
  transition: background-color var(--duration-db) var(--ease-db), color var(--duration-db) var(--ease-db), box-shadow var(--duration-db) var(--ease-db);
}
.st-land__go.is-done {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px var(--db-field-edge);
  color: var(--db-field-text);
  cursor: default;
}
.st-land__go .bl-icon {
  width: 16px;
  height: 16px;
}
.st-land__by {
  margin: auto 0 0;
  padding-top: 12px;
  color: var(--db-fg-3);
  text-align: center;
}

/* ---------------------------------------------------------------- a week of stories
   One row past the column to the screen's edges, the first story lined up with the column; each story with the day
   it went up and what it is. They rise in once, the first time the row is seen */
.st-week__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: end;
  gap: 32px;
  padding-bottom: 0;
}
.st-week__head h2,
.st-week__head p {
  margin: 0;
}
.st-week__head p {
  max-width: 32em;
}
.st-week__track {
  --in: max(var(--spacing-db-gutter), (100% - 80rem) / 2 + var(--spacing-db-gutter));
  margin-top: 48px;
  padding: 0 var(--in) 12px;
  overflow-x: auto;
  scroll-padding-inline: var(--in);
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.st-week__track::-webkit-scrollbar {
  display: none;
}
.st-week__row {
  display: flex;
  gap: 20px;
  width: max-content;
  margin: 0;
  padding: 0;
  list-style: none;
}
.st-week__item {
  flex: none;
  width: clamp(220px, 19vw, 272px);
  scroll-snap-align: start;
  transition: opacity 0.6s var(--ease-db), translate 0.8s var(--ease-db);
  transition-delay: calc(var(--i) * 70ms);
}
.st-week__row:not(.is-in) .st-week__item {
  opacity: 0;
  translate: 0 24px;
}
/* each story in a black phone's corners */
.st-frame {
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 5px solid var(--db-fg);
  border-radius: 22px;
  background: var(--db-fg);
  box-shadow: var(--shadow-db-float);
  container-type: inline-size;
}
.st-week__cap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 14px 2px 0;
  font: 400 0.9375rem/1.35 var(--font-db);
  letter-spacing: -0.01em;
}
.st-week__cap b {
  color: var(--db-fg);
  font: 500 1rem/1.3 var(--font-db);
  letter-spacing: -0.02em;
}
.st-week__cap span {
  color: var(--db-fg-3);
}
@media (max-width: 1023px) {
  .st-week__head {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .st-week__track {
    margin-top: 32px;
  }
}

/* ---------------------------------------------------------------- the dock's own parts
   the miniatures are stories (9:16 in a small black frame); Photo's button shows the photo, Language its code; Save:
   the button, the link to copy, a note */
.bl-menus .bl-mini {
  height: 113px;
}
.bl-menus .bl-mini__screen {
  height: 534px;
  container-type: inline-size;
}
.st-thumb {
  display: block;
  width: 22px;
  height: 26px;
  overflow: hidden;
  border-radius: 5px;
}
.st-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.st-code {
  font: 600 15px/1 var(--font-db);
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.st-save {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(420px, calc(100vw - 52px));
}
.st-save__btn {
  justify-content: center;
}
.st-save__btn .bl-icon {
  width: 20px;
  height: 20px;
}
.st-save .bl-menu__note {
  margin-top: 2px;
}
@media (max-width: 767px) {
  .st-save {
    width: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .st-canvas,
  .st-canvas *,
  .st-land,
  .st-land__go,
  .st-src__row,
  .st-week__item {
    transition: none !important;
  }
  .st-src__row,
  .st-bars .is-run b,
  .st-canvas.is-flash::after {
    animation: none !important;
  }
  .st-week__row:not(.is-in) .st-week__item {
    opacity: 1;
    translate: none;
  }
}
