/*
 * .photo-caption — photo card: rounded frame, gradient overlay, optional wordmark and caption
 * (template-parts/global/photo-caption.php).
 * Figma: Strategy "What will we discuss?" D 18:42908 / M 18:50460 (plain caption, logo top left).
 * Caption looks are modifiers (`photo-caption--plain` now; a caption panel for About is added later).
 *
 * The parent block sets the size (width, or a grid cell) and may set --pc-ratio; the frame keeps
 * its proportions and the photo covers it. --pc-angle: overlay direction (depends on the
 * proportions and on whether the photo is mirrored, Figma 329° D / 334° M for Strategy).
 */

.photo-caption {
  --pc-ratio: 335 / 385;
  --pc-angle: 334deg;

  position: relative;
  aspect-ratio: var(--pc-ratio);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  border-radius: var(--nv-radius-s);
  background-color: var(--nv-navy);
  overflow: hidden;
  overflow: clip; /* unlike hidden it keeps the automatic minimum height: a long caption grows the frame instead of running out of it */
  isolation: isolate;

  /* @media (width >= 64.0625em) .photo-caption */
  @media (width >= 64.0625em) {
    --pc-angle: 329deg;
  }
}

/* .photo-caption__image — covers the frame (the <picture> around it has no box of its own) */
.photo-caption__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* .photo-caption__overlay — Figma overlay: same stops everywhere, layer opacity 70 % */
.photo-caption__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    var(--pc-angle),
    #132132 17.9%,
    rgba(19, 33, 50, 0.6) 62.4%,
    rgba(26, 121, 191, 0.6) 87.7%
  );
  opacity: 0.7;
  pointer-events: none;
}

/* .photo-caption__logo — white wordmark, 150 px, 24 → 30 px from the top */
.photo-caption__logo {
  position: absolute;
  top: clamp(1.5rem, 1.3667rem + 0.5687vw, 1.875rem);
  left: 1.25rem;
  width: 9.375rem;
  color: var(--nv-white);
  line-height: 0;

  & svg {
    width: 100%;
    height: auto;
  }

  /* @media (width >= 64.0625em) .photo-caption__logo */
  @media (width >= 64.0625em) {
    left: 1.875rem;
  }
}

/* .photo-caption__logo--center — top centre */
.photo-caption__logo--center {
  left: 50%;
  translate: -50% 0;

  /* @media (width >= 64.0625em) .photo-caption__logo--center */
  @media (width >= 64.0625em) {
    left: 50%;
  }
}

/* .photo-caption__caption — pinned to the bottom of the frame; the baseline of the last line sits
   42 px from the edge (line box bottom trim .24em at line-height 1.2). In flow: a long caption makes the
   frame taller instead of running under the logo */
.photo-caption__caption {
  position: relative;
  padding:
    0 clamp(1.25rem, 0.7168rem + 2.2749vw, 2.75rem)
    calc(2.625rem - 0.24em)
    clamp(1.25rem, 0.9390rem + 1.3270vw, 2.125rem);
  font-size: clamp(1.25rem, 1.1834rem + 0.2844vw, 1.4375rem);
}

/* .photo-caption__logo + .photo-caption__caption — a caption never reaches the wordmark */
.photo-caption__logo + .photo-caption__caption {
  padding-top: 5rem;
}

/* .photo-caption__text — bold white, 20 → 23 px; bold text inside turns green (field hint) */
.photo-caption__text {
  color: var(--nv-white);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;

  & > * {
    margin: 0;
  }

  & > * + * {
    margin-top: 0.5em;
  }

  & strong {
    color: var(--nv-green);
    font-weight: inherit;
  }
}

/* .photo-caption--panel-center — About intro: the caption stands on a dark glass panel, centred; the panel
   is 30 → 10 px from the edges of the frame (desktop → phone), the wordmark sits at the top centre.
   Figma: About D 18:42360 / M 18:50044 */
.photo-caption--panel-center {
  --pc-inset: clamp(0.625rem, 0.1806rem + 1.8957vw, 1.875rem);
  --pc-pad: clamp(1.25rem, 0.6944rem + 2.3697vw, 2.8125rem);

  /* .photo-caption--panel-center .photo-caption__logo — 30 px from the top at every width */
  & .photo-caption__logo {
    top: 1.875rem;
  }

  /* .photo-caption--panel-center .photo-caption__caption */
  & .photo-caption__caption {
    padding-inline: var(--pc-inset);
    padding-bottom: var(--pc-inset);
    font-size: clamp(1.4375rem, 0.8375rem + 2.5592vw, 3.125rem);
  }

  /* .photo-caption--panel-center .photo-caption__text — #132132 at 50 % (phone) / 70 % (desktop), blur 4 */
  & .photo-caption__text {
    padding: calc(var(--pc-pad) - 0.14em) 1.25rem;
    border-radius: var(--nv-radius-s);
    background-color: rgba(19, 33, 50, 0.5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.03em;
    text-align: center;

    /* @media (width >= 48em) .photo-caption--panel-center .photo-caption__text */
    @media (width >= 48em) {
      background-color: rgba(19, 33, 50, 0.7);
    }
  }
}

/* .photo-caption--panel-gradient — About experts: the caption stands on a panel with the overlay gradient
   under #132132 at 70 %, left aligned, 10 px from the edges; bold text turns green.
   Figma: About D 18:42481 / M 18:50173 */
.photo-caption--panel-gradient {
  /* .photo-caption--panel-gradient .photo-caption__caption */
  & .photo-caption__caption {
    padding: 0.625rem;
    font-size: clamp(1.4375rem, 1.2375rem + 0.8531vw, 2rem);
  }

  /* .photo-caption--panel-gradient .photo-caption__text */
  & .photo-caption__text {
    padding:
      calc(clamp(1.25rem, 0.8611rem + 1.6588vw, 2.34375rem) - 0.14em)
      clamp(1.25rem, 0.8056rem + 1.8957vw, 2.5rem);
    border-radius: var(--nv-radius-s);
    background:
      linear-gradient(rgba(19, 33, 50, 0.7), rgba(19, 33, 50, 0.7)),
      linear-gradient(
        185deg,
        #132132 15%,
        rgba(19, 33, 50, 0.6) 59.6%,
        rgba(26, 121, 191, 0.6) 84.9%
      );
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    font-weight: 500;
    line-height: 1;
    letter-spacing: -0.03em;
  }
}
