.story-design {
  position: relative;
  isolation: isolate;
  overflow: clip;
  background:
    radial-gradient(ellipse at 0 0, var(--rm-paper-warm), transparent 42%),
    var(--rm-paper);
  --story-frame: #fffbf2;
  --story-tape: color-mix(in srgb, var(--rm-line) 69%, var(--rm-paper));
  --story-pencil: color-mix(in srgb, var(--rm-brown) 71%, var(--rm-best-seller-gold));
}

.story-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--rm-space-2);
  padding: var(--rm-space-1) var(--rm-space-3) var(--rm-space-1) var(--rm-space-1);
  border-radius: 10px;
  background: var(--rm-brown-dark);
  color: var(--rm-cream);
  font-size: var(--rm-text-small);
  font-weight: var(--rm-weight-label);
  margin-block-end: var(--rm-eyebrow-gap);
}

.story-eyebrow span {
  display: grid;
  width: 30px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 7px;
  background: var(--rm-brown);
  color: var(--rm-cream);
}

.story-eyebrow--center {
  position: relative;
  border-radius: 24px;
  background: var(--story-tape);
  color: var(--rm-ink);
}
.story-eyebrow--center span { border-radius: 50%; }
.story-eyebrow--center::before, .story-eyebrow--center::after {
  content: "";
  position: absolute;
  width: var(--rm-space-12);
  height: 1px;
  top: 50%;
  background: var(--rm-line);
}
.story-eyebrow--center::before { right: calc(100% + var(--rm-space-4)); }
.story-eyebrow--center::after { left: calc(100% + var(--rm-space-4)); }

.story-photo {
  position: relative;
  padding: clamp(5px, .65vw, 10px);
  background: var(--story-frame);
  box-shadow: 2px 7px 13px rgb(81 36 15 / .19);
  rotate: var(--photo-tilt, -4deg);
}

.story-photo img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--photo-ratio, 1.57);
  object-fit: cover;
  object-position: var(--photo-focus, center);
}

.story-photo::after {
  content: "";
  position: absolute;
  z-index: 2;
  width: 29%;
  height: clamp(16px, 2.8vw, 38px);
  top: 0;
  left: 50%;
  translate: -50% -45%;
  rotate: -3deg;
  background: linear-gradient(115deg, rgb(255 255 255 / .22), transparent 42%), var(--story-tape);
  opacity: .92;
  clip-path: polygon(2% 0, 98% 0, 96% 19%, 100% 33%, 97% 54%, 99% 79%, 98% 100%, 1% 100%, 3% 83%, 0 65%, 4% 46%, 0 24%);
}

.story-timeline::before, .story-timeline::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: clamp(100px, 24vw, 300px);
  pointer-events: none;
}
.story-timeline::before {
  inset: -29px auto auto -39px;
  aspect-ratio: 1.45;
  background: url("assets/boardgame/cabinet-reference-vine.webp") left top / contain no-repeat;
  rotate: -29deg;
  opacity: .85;
}
.story-timeline::after {
  inset: auto -70px -37px auto;
  aspect-ratio: 2.4;
  background: url("assets/boardgame/cabinet-foreground-foliage.webp") right bottom / contain no-repeat;
  opacity: .73;
}

.timeline-heading {
  text-align: center;
  margin-block-end: var(--rm-section-content-gap);
}
.timeline-heading h2 { max-width: 23ch; margin-inline: auto; text-wrap: balance; }
.timeline-heading h2::after, .timeline-entry p::after, .postcard-note::after {
  content: "";
  display: block;
  width: var(--rm-space-16);
  height: var(--rm-space-1);
  margin-block-start: var(--rm-space-3);
  border-radius: 80% 40% 0 0;
  background: var(--story-pencil);
  rotate: -3deg;
}
.timeline-heading h2::after { margin-inline: auto; }
.timeline-list {
  display: grid;
  gap: var(--rm-space-6);
  max-width: 1070px;
  margin-inline: auto;
  padding: 0;
  list-style: none;
}
.timeline-entry {
  display: grid;
  position: relative;
  grid-template-columns: minmax(0, 1fr) clamp(58px, 8vw, 100px) minmax(0, 1fr);
  align-items: center;
  gap: var(--rm-space-4);
}
.timeline-entry p {
  grid-area: 1 / 3;
  max-width: 36ch;
}
.timeline-entry:nth-child(even) p { grid-column: 1; justify-self: end; }
.timeline-entry:nth-child(even) p::after { background: var(--rm-line); }
.timeline-entry .story-photo {
  grid-area: 1 / 1;
  width: min(93%, 370px);
  justify-self: center;
}
.timeline-entry:nth-child(even) .story-photo { grid-column: 3; --photo-tilt: 4deg; }
.timeline-entry:first-child .story-photo { --photo-focus: center 55%; }
.timeline-entry:nth-child(2) .story-photo { --photo-focus: center 61%; }
.timeline-marker {
  grid-area: 1 / 2;
  position: relative;
  align-self: stretch;
  display: grid;
  place-items: center;
}
.timeline-marker::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 50% 28% calc(-50% - var(--rm-space-6)) 33%;
  border-inline-end: 1.5px solid var(--story-pencil);
  border-radius: 0 75% 45% 0;
  rotate: -9deg;
}
.timeline-entry:nth-child(even) .timeline-marker::before {
  border-inline-start: 1.5px solid var(--story-pencil);
  border-inline-end: 0;
  border-radius: 85% 0 0 45%;
  rotate: 9deg;
}
.timeline-entry:last-child .timeline-marker::before { inset-block-end: 3%; }
.timeline-marker img {
  width: clamp(38px, 5vw, 61px);
  aspect-ratio: 1;
  padding: var(--rm-space-1);
  background: var(--rm-paper);
  border-radius: 50%;
}

.timeline-photo-with-stamp {
  grid-area: 1 / 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 23%;
  align-items: start;
  gap: var(--rm-space-3);
}

.timeline-entry .timeline-photo-with-stamp .story-photo {
  grid-area: auto;
  width: 100%;
}

.timeline-stamp {
  width: 100%;
  height: auto;
  rotate: -8deg;
}

@media (width >= 1100px) {
  .timeline-photo-with-stamp { width: min(490px, calc(100% + 64px)); }
}

@media (width < 768px) {
  .timeline-list { gap: var(--rm-space-8); }
  .timeline-entry {
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: var(--rm-space-2);
    row-gap: var(--rm-space-4);
    align-items: start;
  }
  .timeline-entry p, .timeline-entry:nth-child(even) p { grid-area: 1 / 2; justify-self: start; }
  .timeline-marker {
    grid-area: 1 / 1 / 3 / 2;
    place-items: start center;
  }
  .timeline-marker::before, .timeline-entry:nth-child(even) .timeline-marker::before {
    inset: var(--rm-space-4) 50% calc(-1 * var(--rm-space-8)) auto;
    border: 0;
    border-inline-end: 1px solid var(--rm-line);
    border-radius: 0;
    rotate: none;
  }
  .timeline-entry:last-child .timeline-marker::before { inset-block-end: 0; }
  .timeline-marker img { width: 36px; }
  .timeline-entry > .story-photo, .timeline-entry:nth-child(even) > .story-photo {
    grid-area: 2 / 2;
    width: min(96%, 370px);
    rotate: calc(var(--photo-tilt, -4deg) / 2);
  }
  .timeline-photo-with-stamp {
    grid-area: 2 / 2;
    width: min(96%, 460px);
    gap: var(--rm-space-2);
  }
  .timeline-photo-with-stamp .story-photo { rotate: calc(var(--photo-tilt) / 2); }
}
