/* fire-card.css
 *
 * The card the lit campfire opens (js/scenes/day-beach/fire-card.js): a
 * handwritten note on light paper, slightly tilted, rising gently beside
 * the fire, with three dance previews in a row (stacked on a phone). For
 * visitors who want less motion, it only fades in.
 */

.fire-card {
  /* The card: its width, tilt, paper and ink (the cat card's). */
  --card-width: min(88vw, 37rem);
  --card-tilt: -2deg;
  --card-paper: #f8f4ec;
  --card-ink: #262a3d;
  --card-link-underline: rgba(38, 42, 61, 0.45);
  --card-shadow: 0 2px 4px rgba(10, 20, 40, 0.25), 0 18px 40px rgba(10, 20, 40, 0.35);
  --card-backdrop: rgba(8, 18, 40, 0.25);
  --card-text-size: 1.6rem;
  --card-title-size: 2.2rem;

  /* Rising: from this far below, turned this much further, over
     --card-rises; fading in (less motion) over --card-fades-in; closing
     over --card-closes. */
  --card-rise-from: 30vh;
  --card-rise-turn: 3deg;
  --card-rises: 1.1s;
  --card-fades-in: 0.5s;
  --card-closes: 0.3s;

  /* The previews: their shape, corners, and the play icon (a soft dark
     disc with a white triangle). */
  --preview-shape: 16 / 9;
  --preview-radius: 4px;
  --preview-gap: 0.6rem;
  --play-size: 2.4rem;
  --play-disc: rgba(20, 22, 35, 0.55);
  --play-disc-hover: rgba(20, 22, 35, 0.75);

  width: var(--card-width);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

/* Beside the fire (fire-card.js works out where); otherwise the browser
   centres it. */
.fire-card.is-placed {
  inset: auto;
  left: var(--card-left);
  top: var(--card-top);
  margin: 0;
}

.fire-card::backdrop {
  background: var(--card-backdrop);
  animation: fire-card-fade-in var(--card-fades-in) ease both;
}

.fire-card__paper {
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 1.1rem 1.3rem 1.2rem;
  border-radius: 3px;
  background: var(--card-paper);
  box-shadow: var(--card-shadow);
  color: var(--card-ink);
  font-family: "Nanum Pen Script", cursive;
  font-weight: 400;
  font-synthesis: none;
  font-size: var(--card-text-size);
  line-height: 1.1;
  rotate: var(--card-tilt);
  transform-origin: 50% 100%;
  animation: fire-card-rise var(--card-rises) cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

.fire-card__paper:focus {
  outline: none;
}

.fire-card__paper p {
  margin: 0 0 0.35em;
}

.fire-card__paper .fire-card__title {
  font-size: var(--card-title-size);
  line-height: 1;
}

.fire-card__videos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--preview-gap);
  margin: 0.55em 0 0.6em;
  padding: 0;
  list-style: none;
}

/* A phone: one above the other. The card is tall then, and a tall card's
   corners swing further out at the same tilt: it tilts less. */
@media (max-width: 520px) {
  .fire-card {
    --card-tilt: -1deg;
  }

  .fire-card__videos {
    grid-template-columns: 1fr;
  }
}

.fire-card__video {
  position: relative;
  display: block;
  aspect-ratio: var(--preview-shape);
  overflow: hidden;
  border-radius: var(--preview-radius);
  background: #d9d2c4;
}

.fire-card__video:focus-visible {
  outline: 2px solid var(--card-ink);
  outline-offset: 2px;
}

.fire-card__media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* The play icon, in the middle. */
.fire-card__play {
  position: absolute;
  left: 50%;
  top: 50%;
  display: grid;
  place-items: center;
  width: var(--play-size);
  height: var(--play-size);
  border-radius: 50%;
  background: var(--play-disc);
  translate: -50% -50%;
  transition: background-color 0.2s ease;
}

.fire-card__play svg {
  width: 55%;
  height: 55%;
  fill: #ffffff;
}

@media (hover: hover) {
  .fire-card__video:hover .fire-card__play {
    background: var(--play-disc-hover);
  }
}

.fire-card__paper a:not(.fire-card__video) {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--card-link-underline);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.12em;
}

.fire-card__paper a:not(.fire-card__video):focus-visible {
  outline: 2px solid var(--card-ink);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Closing: the card and the backdrop fade out. */
.fire-card.is-closing .fire-card__paper,
.fire-card.is-closing::backdrop {
  animation: fire-card-fade-out var(--card-closes) ease both;
}

@media (prefers-reduced-motion: reduce) {
  .fire-card__paper {
    animation: fire-card-fade-in var(--card-fades-in) ease both;
  }
}

@keyframes fire-card-rise {
  from {
    opacity: 0;
    translate: 0 var(--card-rise-from);
    rotate: calc(var(--card-tilt) + var(--card-rise-turn));
  }
  45% {
    opacity: 1;
  }
  to {
    opacity: 1;
    translate: 0 0;
    rotate: var(--card-tilt);
  }
}

@keyframes fire-card-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fire-card-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
