/* About page: Presi's story told as chapters along one thread of yarn. */

/* Opening */

.story-hero {
  background: var(--surface-brand);
  overflow: hidden;
}

.story-hero__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-7);
  padding-block: var(--space-7) var(--space-9);
}

.story-hero__hello {
  display: inline-block;
  margin-bottom: var(--space-2);
  font-size: 1.9rem;
  transform: rotate(-4deg);
  transform-origin: left center;
}

.story-hero__copy .lead {
  margin-top: var(--space-4);
}

/* A polaroid-style photo, pinned slightly crooked. */
.story-hero__photo {
  justify-self: center;
  width: min(82%, 22rem);
  margin: 0;
  padding: var(--space-3) var(--space-3) var(--space-2);
  background: var(--color-white);
  box-shadow: var(--shadow-lg);
  transform: rotate(3deg);
}

.story-hero__photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.story-hero__photo figcaption {
  padding-top: var(--space-2);
  text-align: center;
}

/* Her words */

.story-quote {
  padding-block: var(--space-9);
}

.story-quote__text {
  max-width: 40rem;
  margin: 0 auto;
  text-align: center;
}

.story-quote__text p {
  font-family: var(--font-display);
  font-size: var(--text-h2);
  line-height: 1.2;
  color: var(--text-brand);
  text-wrap: balance;
}

.story-quote__text p::before {
  content: '“';
  display: block;
  height: 0.55em;
  font-size: 2.6em;
  line-height: 1;
  color: var(--color-blush-300);
}

.story-quote__text footer {
  margin-top: var(--space-4);
}

/* Timeline: one thread down the left, a ball of yarn marks each chapter. */

/* ol.story-timeline: must outrank the list reset in base.css (ol[class]). */
ol.story-timeline {
  --thread-x: 0.9rem;
  position: relative;
  display: grid;
  gap: var(--space-9);
  margin: 0;
  padding: 0 0 0 calc(var(--thread-x) * 2 + var(--space-4));
  list-style: none;
}

/* The thread still to be crocheted: dashed. */
.story-timeline::before {
  content: '';
  position: absolute;
  top: 0.4rem;
  bottom: 0;
  left: calc(var(--thread-x) - 1px);
  border-left: 2px dashed var(--color-blush-300);
}

/* The crocheted part grows with scrolling where scroll-driven animations exist. */
.story-timeline::after {
  content: '';
  position: absolute;
  top: 0.4rem;
  bottom: 0;
  left: calc(var(--thread-x) - 1.5px);
  width: 3px;
  border-radius: 3px;
  background: var(--color-coral-500);
  transform-origin: top;
  transform: scaleY(1);
}

@supports (animation-timeline: view()) {
  .story-timeline {
    view-timeline: --story block;
  }

  .story-timeline::after {
    animation: thread-grow linear both;
    animation-timeline: --story;
    animation-range: entry 10% exit 60%;
  }

  @keyframes thread-grow {
    from {
      transform: scaleY(0);
    }
    to {
      transform: scaleY(1);
    }
  }
}

.chapter {
  position: relative;
  display: grid;
  gap: var(--space-4);
}

/* Ball of yarn on the thread. */
.chapter::before {
  content: '';
  position: absolute;
  top: 0.15rem;
  left: calc(-1 * (var(--thread-x) + var(--space-4)) - 0.8rem);
  z-index: 1;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, rgb(255 255 255 / 0.5), transparent 46%),
    repeating-linear-gradient(38deg, rgb(0 0 0 / 0.14) 0 1.5px, transparent 1.5px 5px),
    var(--ball, var(--color-coral-500));
  box-shadow:
    0 0 0 4px var(--surface-page),
    0 2px 4px rgb(43 18 22 / 0.2);
}

.chapter__when {
  display: inline-block;
  padding: 0.15rem var(--space-3);
  border-radius: var(--radius-pill);
  background: var(--surface-quiet);
  color: var(--color-coral-700);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chapter__title {
  margin: var(--space-3) 0 var(--space-2);
  font-family: var(--font-display);
  font-size: var(--text-h2);
  font-weight: 400;
  line-height: 1.12;
  color: var(--text-primary);
  text-wrap: balance;
}

.chapter__text > p:not(.chapter__when) {
  max-width: var(--measure);
  color: var(--text-secondary);
  font-size: var(--text-lg);
}

.chapter__photo {
  width: min(78%, 20rem);
  margin: 0;
  padding: var(--space-2);
  background: var(--color-white);
  box-shadow: var(--shadow-md);
  transform: rotate(-2.5deg);
}

.chapter:nth-child(even) .chapter__photo {
  justify-self: end;
  transform: rotate(2.5deg);
}

.chapter__photo img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

/* The "day has 24 hours" chapter is the heart of the story. */
.chapter--highlight .chapter__text {
  padding: var(--space-5);
  border: 2px dashed var(--color-coral-500);
  border-radius: var(--radius-lg);
  background: var(--color-white);
}

.chapter__day {
  display: grid;
  gap: var(--space-2);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
}

.chapter__day li {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  font-weight: 500;
}

.chapter__time {
  flex: none;
  min-width: 6.5rem;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-denim-700);
}

.chapter__press {
  margin: var(--space-4) 0 0;
  padding-left: var(--space-4);
  border-left: 3px solid var(--color-coral-500);
}

.chapter__press p {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  line-height: 1.2;
  color: var(--text-brand);
}

.chapter__press footer {
  margin-top: var(--space-1);
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.chapter--now::before {
  animation: ball-glow 2.4s ease-in-out infinite;
}

@keyframes ball-glow {
  50% {
    box-shadow:
      0 0 0 4px var(--surface-page),
      0 0 0 10px rgb(240 85 64 / 0.18);
  }
}

.chapter--now .link-arrow {
  margin-top: var(--space-2);
}

/* Facts */

.facts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-6) var(--space-4);
  margin: var(--space-6) 0 0;
}

.facts-grid__item dt {
  font-family: var(--font-display);
  font-size: var(--text-display);
  line-height: 1;
  color: var(--text-brand);
}

.facts-grid__item dd {
  margin-top: var(--space-2);
  color: var(--text-secondary);
}

/* Closing */

.story-end__inner {
  display: grid;
  justify-items: center;
  gap: var(--space-5);
  max-width: 44rem;
  text-align: center;
}

.story-end__quote {
  font-size: var(--text-h1);
}

.story-end__actions {
  display: grid;
  gap: var(--space-3);
  width: 100%;
  max-width: 22rem;
}

@media (min-width: 48rem) {
  .story-hero__inner {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    align-items: center;
    padding-block: var(--space-10);
  }

  ol.story-timeline {
    --thread-x: 1.2rem;
  }

  .chapter {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    align-items: center;
    gap: var(--space-8);
  }

  .chapter .chapter__photo,
  .chapter:nth-child(even) .chapter__photo {
    justify-self: center;
    width: 100%;
  }

  .facts-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .story-end__actions {
    display: flex;
    justify-content: center;
    max-width: none;
  }
}
