/* Section 9 — the story bento */

.story {
  padding-block: clamp(78px, 10vh, 122px);
}

.story__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  margin-bottom: clamp(24px, 3.4vw, 40px);
}

.story__title {
  margin-top: 16px;
  max-width: 16ch;
}

.story__title .rv-line {
  display: block;
}

.story__copy {
  max-width: 44ch;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.story__bento {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: clamp(154px, 15.5vw, 196px) clamp(132px, 12.2vw, 166px) clamp(132px, 12.2vw, 166px);
  gap: clamp(10px, 1.1vw, 16px);
}

.story-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 0;
  padding: clamp(15px, 1.65vw, 22px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: 0 2px 5px rgba(24, 24, 27, 0.035), 0 24px 46px -38px rgba(24, 24, 27, 0.4);
  transition: transform var(--dur-3) var(--ease-out), box-shadow var(--dur-3) ease;
}

.story-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 10px rgba(24, 24, 27, 0.05), 0 34px 58px -34px rgba(24, 24, 27, 0.5);
}

.story-card__eyebrow {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  opacity: 0.7;
}

.story-card__eyebrow i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.story-card h3 {
  position: relative;
  z-index: 2;
  max-width: 17ch;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

.story-card p {
  position: relative;
  z-index: 2;
  max-width: 33ch;
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.5;
  opacity: 0.72;
}

.story-card__foot {
  position: relative;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.story-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: transform var(--dur-2) var(--ease-out), background var(--dur-2) ease, color var(--dur-2) ease;
}

.story-pill:hover {
  transform: translateY(-1px);
}

.story-pill svg {
  width: 9px;
  height: 9px;
}

.story-pill--ghost {
  border-color: rgba(24, 24, 27, 0.16);
  background: color-mix(in srgb, var(--paper-raised) 86%, transparent);
  color: var(--ink);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.story-pill--light {
  background: var(--paper-raised);
  color: var(--ink);
}

.story-pill--on-blue {
  background: #fff;
  color: var(--electric);
}

.story-pill--on-black {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.story-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

/* Large play card */

.story-card--play {
  grid-column: 1 / 3;
  grid-row: 1 / 3;
  justify-content: flex-start;
  padding: clamp(16px, 1.8vw, 24px);
}

.story-card--play .story-card__foot {
  position: relative;
  z-index: 5;
  margin-top: auto;
  padding-top: 12px;
}

.story-play__stage {
  position: absolute;
  left: 50%;
  bottom: 2%;
  width: min(78%, 440px);
  height: 54%;
  transform: translateX(-50%);
}

.story-play__card {
  position: absolute;
  width: 57%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  background: var(--paper-raised);
  box-shadow: 0 1px 3px rgba(24, 24, 27, 0.08), 0 22px 34px -24px rgba(24, 24, 27, 0.55);
  transition: transform var(--dur-4) var(--ease-soft);
}

.story-play__card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.story-play__card--a {
  left: 0;
  bottom: 12%;
  transform: rotate(-7deg);
}

.story-play__card--b {
  right: 0;
  bottom: 22%;
  transform: rotate(6deg);
}

.story-play__card--c {
  left: 21%;
  bottom: 0;
  width: 60%;
  transform: rotate(-1deg);
}

.story-play__bubble {
  top: 2%;
  right: 6%;
  z-index: 6;
}

.story-card--play.is-playing .story-play__card--a {
  transform: rotate(-10deg) translate(-7px, -7px);
}

.story-card--play.is-playing .story-play__card--b {
  transform: rotate(9deg) translate(7px, -5px);
}

.story-card--play.is-playing .story-play__card--c {
  transform: rotate(0deg) translateY(-10px) scale(1.02);
}

.story-card--play.is-playing .story-play__card--c img {
  animation: story-pan 7s var(--ease-soft) infinite alternate;
}

@keyframes story-pan {
  from {
    object-position: top center;
  }
  to {
    object-position: bottom center;
  }
}

/* Electric card */

.story-card--blue {
  grid-column: 3;
  grid-row: 1;
  border-color: rgba(255, 255, 255, 0.16);
  background: var(--electric);
  color: #fff;
}

.story-card--blue p {
  max-width: 26ch;
  opacity: 0.74;
}

.story-blue__visual {
  position: absolute;
  right: -16px;
  bottom: -22px;
  width: 58%;
  opacity: 0.9;
  pointer-events: none;
}

.story-blue__visual svg {
  width: 100%;
  height: auto;
}

/* Spin card */

.story-card--spin {
  grid-column: 1 / 3;
  grid-row: 3;
  border-color: #e3e3e8;
  background: #f0f0f3;
}

[data-theme="dark"] .story-card--spin {
  border-color: var(--line);
  background: #202024;
}

.story-card--spin p {
  max-width: 30ch;
}

.story-spin__visual {
  position: absolute;
  right: -8%;
  bottom: -34%;
  width: min(52%, 300px);
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 12px;
  box-shadow: 0 20px 38px -24px rgba(24, 24, 27, 0.6);
  transform: rotate(-5deg);
  transition: transform var(--dur-4) var(--ease-out);
  pointer-events: none;
}

.story-spin__visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.story-card--spin:hover .story-spin__visual {
  transform: rotate(-2deg) translateY(-4px);
}

/* Vertical identity card */

.story-card--identity {
  grid-column: 3;
  grid-row: 2 / 4;
  border-color: rgba(255, 255, 255, 0.12);
  background: var(--black);
  color: #fafafa;
}

.story-card--identity p {
  max-width: 24ch;
  opacity: 0.62;
}

.story-identity__visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  flex: 1;
  min-height: 58px;
  margin-block: 10px;
}

.story-identity__avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(58px, 5.8vw, 78px);
  height: clamp(58px, 5.8vw, 78px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 36%, #fff 0%, #f3f3f4 45%, #d8d8de 100%);
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.04), 0 16px 26px -18px rgba(0, 0, 0, 0.85);
}

.story-identity__avatar::before,
.story-identity__avatar::after {
  content: "";
  position: absolute;
  top: 47%;
  width: 7px;
  height: 13px;
  border-radius: var(--radius-pill);
  background: #0b0b0f;
}

.story-identity__avatar::before {
  left: 36%;
}

.story-identity__avatar::after {
  right: 36%;
}

.story-identity__avatar span {
  position: absolute;
  bottom: -22px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 4px;
  background: #141418;
  color: rgba(255, 255, 255, 0.72);
  font-family: var(--font-mono);
  font-size: 6px;
  letter-spacing: 0.14em;
  line-height: 1;
}

.story-identity__visual::before {
  content: "";
  position: absolute;
  width: 108px;
  height: 108px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
}

@media (max-width: 900px) {
  .story__bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: minmax(230px, 34vw) minmax(170px, 21vw) minmax(170px, 21vw);
  }

  .story-card--play {
    grid-column: 1 / 3;
    grid-row: 1;
  }

  .story-card--blue {
    grid-column: 1;
    grid-row: 2;
  }

  .story-card--identity {
    grid-column: 2;
    grid-row: 2;
  }

  .story-card--spin {
    grid-column: 1 / 3;
    grid-row: 3;
  }
}

@media (max-width: 640px) {
  .story__bento {
    display: flex;
    flex-direction: column;
  }

  .story-card {
    min-height: 180px;
  }

  .story-card--play {
    min-height: 310px;
  }

  .story-card--identity {
    min-height: 230px;
  }

  .story-card--spin {
    min-height: 200px;
  }

  .story-spin__visual {
    width: 50%;
    bottom: -22%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .story-card,
  .story-play__card,
  .story-spin__visual {
    transform: none !important;
    transition: none !important;
  }

  .story-card--play.is-playing .story-play__card--c img {
    animation: none;
  }
}
