/*
 * Le portrait : flou tant qu'elle n'a pas découvert ce que je vois en elle.
 *
 * Invariant : --sharpness va de 0 (très flou) à 1 (net) et est posé par portrait.js
 * sur .portrait__frame. Le flou et la saturation en dépendent.
 */
.portrait {
  padding: var(--space-section) var(--space-m);
}

.portrait__inner {
  max-width: 40rem;
  margin: 0 auto;
  text-align: center;
}

.portrait__title {
  margin: 0;
  font-size: var(--text-title);
  font-weight: 300;
  font-style: italic;
  line-height: 1.1;
}

.portrait__intro {
  margin: var(--space-s) auto var(--space-l);
  max-width: 32rem;
  color: var(--ink-soft);
}

.portrait__frame {
  --sharpness: 0;
  position: relative;
  margin: 0 auto;
  width: min(100%, 26rem);
}

.portrait__photo {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 50% 50% 0.5rem 0.5rem / 38% 38% 0.5rem 0.5rem;
  box-shadow: 0 0 80px -10px rgb(240 140 110 / 0.5);
  filter: blur(calc((1 - var(--sharpness)) * 22px)) saturate(calc(0.3 + var(--sharpness) * 0.7));
  transition: filter var(--duration-slow) var(--ease-out-expo);
}

.portrait__caption {
  margin: var(--space-m) 0 0;
  font-size: var(--text-large);
  font-style: italic;
  line-height: 1.45;
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity var(--duration-slow) var(--ease-out-expo) 600ms,
    transform var(--duration-slow) var(--ease-out-expo) 600ms;
}

.portrait.is-revealed .portrait__caption {
  opacity: 1;
  transform: none;
}

.portrait__counter {
  min-height: 1.6em;
  margin: var(--space-m) 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-small);
  color: var(--ink-muted);
}

.portrait__button {
  margin-top: var(--space-s);
  padding: 0.8rem 1.6rem;
  border: 1px solid var(--rose);
  border-radius: 999px;
  background: transparent;
  color: var(--rose);
  transition: background var(--duration-fast), color var(--duration-fast);
}

.portrait__button:hover {
  background: var(--rose);
  color: #2a1218;
}

/* ── Vidéo : bouton sur le flou, décompte, plein écran ──────────────────── */
.portrait__stage {
  position: relative;
  display: grid;
}

.portrait__stage > * {
  grid-area: 1 / 1;
}

.portrait__play {
  place-self: center;
  display: grid;
  justify-items: center;
  gap: 0.9rem;
  padding: 1rem;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: var(--text-small);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 1px 8px rgb(0 0 0 / 0.6);
}

.portrait__play-icon {
  position: relative;
  width: 5.5rem;
  height: 5.5rem;
  border: 1px solid rgb(246 236 225 / 0.7);
  border-radius: 50%;
  background: rgb(20 10 16 / 0.35);
  backdrop-filter: blur(4px);
  box-shadow: 0 0 0 0 rgb(255 143 171 / 0.5);
  animation: play-pulse 2.4s ease-out infinite;
  transition: transform var(--duration-fast) var(--ease-out-expo), background var(--duration-fast);
}

/* Pastille sombre : le libellé reste lisible même sur une zone claire de la vidéo. */
.portrait__play-label {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background: rgb(20 10 16 / 0.6);
  backdrop-filter: blur(4px);
}

/* Triangle « lecture ». */
.portrait__play-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 0;
  height: 0;
  border-block: 0.95rem solid transparent;
  border-left: 1.55rem solid var(--ink);
  transform: translateX(0.2rem);
}

.portrait__play:hover .portrait__play-icon,
.portrait__play:focus-visible .portrait__play-icon {
  transform: scale(1.08);
  background: rgb(255 143 171 / 0.35);
}

.portrait__countdown {
  place-self: center;
  margin: 0;
  font-size: clamp(6rem, 3rem + 14vw, 16rem);
  font-weight: 300;
  font-style: italic;
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 0 40px rgb(255 143 171 / 0.8);
  pointer-events: none;
}

.portrait__countdown.is-ticking {
  animation: count-tick 1s var(--ease-out-expo) both;
}

/* Pendant le décompte, le flou se dissipe ; pendant la lecture, la vidéo est nette. */
.portrait__stage.is-counting .portrait__photo,
.portrait__stage.is-playing .portrait__photo {
  filter: none;
  transition: filter 3s ease-in;
}

.portrait__stage.is-counting .portrait__play,
.portrait__stage.is-playing .portrait__play {
  visibility: hidden;
}

.portrait__stage:fullscreen {
  background: #000;
  place-items: center;
}

.portrait__stage:fullscreen .portrait__photo {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 0;
  box-shadow: none;
}

/* Repli si le navigateur a refusé la lecture : message cliquable sur tout l'écran. */
.portrait__stage.needs-tap {
  cursor: pointer;
}

.portrait__stage.needs-tap .portrait__countdown {
  font-family: var(--font-mono);
  font-size: var(--text-large);
  font-style: normal;
  padding: 0.8rem 1.6rem;
  border-radius: 999px;
  background: rgb(20 10 16 / 0.7);
}

@keyframes play-pulse {
  70% { box-shadow: 0 0 0 1.4rem rgb(255 143 171 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(255 143 171 / 0); }
}

@keyframes count-tick {
  from {
    opacity: 0;
    transform: scale(1.6);
  }
  60% {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.9);
  }
}
