/* ==========================================================================
   How It Works — starting-point video affordance + lightbox
   Loaded only by layouts/how-it-works/single.html via its head-extra block,
   the same way pricing.css and landing.css are scoped to their pages.

   The base row layout (the 160px/1fr grid, borders, title, description) stays
   in main.css alongside the rest of the section. Only what the videos add
   lives here.
   ========================================================================== */

/* ── Thumbnail as play surface ── */

.starting-point__play {
  position: relative;
  display: block;
  border-radius: 8px;
  /* Contains the scrim and badge; also clips the hover zoom on the image. */
  overflow: hidden;
  line-height: 0;
  text-decoration: none;
}

/* Scrim: without it the play badge is unreadable over a light photo (the
   craftsman house and the journal are both nearly white in the middle). */
.starting-point__play::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(33, 23, 18, 0.28) 0%, rgba(33, 23, 18, 0.05) 45%, rgba(33, 23, 18, 0.45) 100%);
  transition: background 0.2s ease;
}

.starting-point__play:hover::after,
.starting-point__play:focus-visible::after {
  background: linear-gradient(to bottom, rgba(33, 23, 18, 0.38) 0%, rgba(33, 23, 18, 0.15) 45%, rgba(33, 23, 18, 0.5) 100%);
}

.starting-point__play:focus-visible {
  outline: 3px solid var(--color-brand);
  outline-offset: 3px;
}

.starting-point__img {
  transition: transform 0.35s ease;
}

.starting-point__play:hover .starting-point__img,
.starting-point__play:focus-visible .starting-point__img {
  transform: scale(1.04);
}

/* ── Play badge ── */

.starting-point__badge {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--color-brand);
  box-shadow: 0 2px 10px rgba(33, 23, 18, 0.35);
  transition: transform 0.2s ease, background 0.2s ease;
}

/* Optical centring: a triangle's visual mass sits left of its bounding box. */
.starting-point__badge svg {
  margin-left: 3px;
}

.starting-point__play:hover .starting-point__badge,
.starting-point__play:focus-visible .starting-point__badge {
  background: #ffffff;
  transform: translate(-50%, -50%) scale(1.08);
}

/* ── Duration pill ── */

.starting-point__duration {
  position: absolute;
  right: 6px;
  bottom: 6px;
  z-index: 1;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(33, 23, 18, 0.8);
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

/* ── "Watch the video" text trigger ──
   A second trigger for the same action as the thumbnail, on purpose: at the
   110px mobile thumbnail size the badge alone is easy to miss. */

.starting-point__watch {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.6rem;
  color: var(--color-brand);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
}

.starting-point__watch:hover,
.starting-point__watch:focus-visible {
  text-decoration: underline;
}

.starting-point__watch-len {
  color: var(--color-muted);
  font-weight: 400;
}

/* ── Lightbox ──
   Native <dialog>, so the focus trap, Esc-to-close, background inertness and
   ::backdrop come from the platform instead of being hand-rolled. */

.video-modal {
  /* The frame is 960x1140 portrait — height-led, so the width is derived from
     the aspect ratio rather than the other way round. Capping on both vh and
     vw keeps it whole on a short laptop screen and a narrow window alike. */
  width: min(92vw, calc(82vh * 960 / 1140));
  max-width: 640px;
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: #14100e;
  color: #ffffff;
  overflow: hidden;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5);
}

.video-modal::backdrop {
  background: rgba(33, 23, 18, 0.72);
}

.video-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0.85rem 0.85rem 1.15rem;
}

.video-modal__title {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: #ffffff;
}

.video-modal__close {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  cursor: pointer;
  transition: background 0.2s ease;
}

.video-modal__close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.video-modal__close:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.video-modal__player {
  display: block;
  width: 100%;
  /* Holds the portrait frame at every viewport instead of letting it be
     letterboxed into a 16:9 box. */
  aspect-ratio: 960 / 1140;
  background: #000000;
}

@media (max-width: 700px) {
  /* Thumbnail drops to 110px here (main.css), so the badge and pill shrink
     with it or they swamp the photo. */
  .starting-point__badge {
    width: 38px;
    height: 38px;
  }

  .starting-point__badge svg {
    width: 18px;
    height: 18px;
  }

  .starting-point__duration {
    right: 4px;
    bottom: 4px;
    font-size: 0.7rem;
  }

  .video-modal {
    /* A portrait video wants the whole phone screen. */
    width: 100vw;
    max-width: none;
    max-height: 100vh;
    border-radius: 0;
  }

  .video-modal__player {
    /* Below the header there is not a full frame's worth of height left, so
       let the player take what remains rather than overflow the viewport. */
    aspect-ratio: auto;
    height: calc(100vh - 4.2rem);
    object-fit: contain;
  }
}

@media (prefers-reduced-motion: reduce) {
  .starting-point__play::after,
  .starting-point__img,
  .starting-point__badge,
  .video-modal__close {
    transition: none;
  }

  .starting-point__play:hover .starting-point__img,
  .starting-point__play:focus-visible .starting-point__img {
    transform: none;
  }

  .starting-point__play:hover .starting-point__badge,
  .starting-point__play:focus-visible .starting-point__badge {
    transform: translate(-50%, -50%);
  }
}
