/* The YouTube video section (see the comment above it in index.html). */

/* Shares the paper band with the intro above, so it reads as one band. */
.trailer { padding-top: 8px; }

.trailer__intro {
  max-width: 40rem;
  margin: -0.4em auto 1.4em;
  text-align: center;
}

.trailer__note {
  margin: 1.4em auto 0;
  text-align: center;
  font-size: 0.9rem;
  opacity: 0.85;
}

.trailer__note a { color: inherit; font-weight: 700; white-space: nowrap; }

.trailer__frame {
  position: relative;
  display: block;
  max-width: 900px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  background: var(--sky);
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--ink);
  text-decoration: none;
  transform: rotate(-0.6deg);
}

.trailer__poster,
.trailer__frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.trailer__poster {
  object-fit: cover;
  transition: transform 0.3s ease;
}

/* ---------- No video yet: "Trailer coming soon" ---------- */

.trailer__soon {
  position: absolute;
  left: 50%;
  bottom: 9%;
  translate: -50% 0;
  rotate: -3deg;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: clamp(1rem, 0.75rem + 1.4vw, 1.6rem);
  line-height: 1.2;
  white-space: nowrap;
  color: #fff;
  background: #ff5a5a;
  border: var(--outline);
  border-radius: 999px;
  box-shadow: 0 5px 0 var(--ink);
  padding: 0.35em 1.1em;
  text-shadow: 0 2px 0 rgba(74, 47, 31, 0.45);
}

/* ---------- A video is set: a big round play button ---------- */

/* Sits low, on the path, so the game's title on the poster stays readable. */
.trailer__cta {
  position: absolute;
  left: 50%;
  bottom: 7%;
  translate: -50% 0;
  display: none;
  align-items: center;
}

.trailer__frame[data-youtube-id]:not([data-youtube-id=""]) { cursor: pointer; }
.trailer__frame[data-youtube-id]:not([data-youtube-id=""]) .trailer__soon { display: none; }
.trailer__frame[data-youtube-id]:not([data-youtube-id=""]) .trailer__cta { display: flex; }

.trailer__play {
  position: relative;
  z-index: 1;
  flex: none;
  width: clamp(58px, 10vw, 96px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--sun);
  border: var(--outline);
  box-shadow: 0 6px 0 var(--ink);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

/* The triangle, nudged right so it looks centred. */
.trailer__play::before {
  content: "";
  position: absolute;
  left: 55%;
  top: 50%;
  translate: -50% -50%;
  font-size: clamp(22px, 4vw, 38px);
  border-style: solid;
  border-width: 0.42em 0 0.42em 0.7em;
  border-color: transparent transparent transparent var(--ink);
}

/* A soft ring that keeps inviting a tap. */
.trailer__play::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 4px solid var(--card);
  animation: trailer-ring 2s ease-out infinite;
  pointer-events: none;
}

@keyframes trailer-ring {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(1.5); opacity: 0; }
}

/* The label tucks in behind the button, like a paper tab. */
.trailer__label {
  margin-left: -0.9em;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(1rem, 0.8rem + 0.9vw, 1.4rem);
  white-space: nowrap;
  background: var(--card);
  border: var(--outline);
  border-radius: 0 999px 999px 0;
  box-shadow: 0 5px 0 var(--ink);
  padding: 0.2em 1em 0.2em 1.4em;
}

.trailer__frame:hover .trailer__poster,
.trailer__frame:focus-visible .trailer__poster { transform: scale(1.03); }

.trailer__frame:hover .trailer__play,
.trailer__frame:focus-visible .trailer__play { transform: translateY(-2px) scale(1.06); box-shadow: 0 8px 0 var(--ink); }

.trailer__frame:active .trailer__play { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }

.trailer__frame:focus-visible { outline: 4px solid var(--sky-deep); outline-offset: 4px; }

/* "Coming soon" is only a picture: nothing to hover. */
.trailer__frame:not([href]):hover .trailer__poster { transform: none; }

/* The video is playing: no tilt, nothing on top. */
.trailer__frame.is-playing { transform: none; background: #000; }

/* ---------- Small screens and reduced motion ---------- */

@media (max-width: 760px) {
  .trailer__frame { transform: none; border-radius: var(--radius-small); }
  .trailer__cta { bottom: 5%; }
  .trailer__play { width: 46px; box-shadow: 0 4px 0 var(--ink); }
  .trailer__play::before { font-size: 19px; }
  .trailer__label { font-size: 0.92rem; box-shadow: 0 4px 0 var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  .trailer__poster,
  .trailer__play { transition: none; }
  .trailer__play::after { animation: none; opacity: 0; }
  .trailer__frame:hover .trailer__poster,
  .trailer__frame:focus-visible .trailer__poster { transform: none; }
}
