/* Page des viewers */

.wrap {
  width: min(100% - 2 * clamp(1rem, 4vw, 2.5rem), 62rem);
  margin-inline: auto;
}

.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: clamp(1.5rem, 5vw, 4rem);
  padding: clamp(2rem, 8vw, 5.5rem) 0 clamp(2rem, 5vw, 3.5rem);
}
.hero h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.5rem);
  text-shadow: 0 2px 30px rgba(0, 0, 0, .85);
  margin-bottom: 1.1rem;
}
.hero h1 .line { display: block; text-wrap: balance; }
.lead { max-width: 33rem; font-size: 1.22rem; margin: 0 0 1.4rem; text-shadow: 0 1px 14px rgba(0, 0, 0, .9); }
.waiting { margin: 0 0 1.4rem; color: var(--ember-soft); font-style: italic; }

/* Le seul moment orchestré de la page : le titre s'allume ligne par ligne, puis le reste apparaît. */
@keyframes ignite {
  0% { opacity: 0; filter: blur(9px); transform: translateY(.25em); }
  55% { opacity: 1; filter: blur(0); text-shadow: 0 0 34px rgba(255, 140, 40, .95), 0 2px 30px rgba(0, 0, 0, .85); }
  100% { opacity: 1; filter: blur(0); transform: none; text-shadow: 0 2px 30px rgba(0, 0, 0, .85); }
}
@keyframes settle { from { opacity: 0; transform: translateY(.6rem); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
  .hero h1 .line { opacity: 0; animation: ignite 1.15s cubic-bezier(.2, .7, .3, 1) .25s forwards; }
  .hero h1 .line + .line { animation-delay: .65s; }
  .hero .lead, .hero .countdown, .hero .waiting, .hero .btn-primary { opacity: 0; animation: settle .7s ease-out forwards; }
  .hero .lead { animation-delay: 1.05s; }
  .hero .countdown { animation-delay: 1.25s; }
  .hero .waiting { animation-delay: 1.4s; }
  .hero .btn-primary { animation-delay: 1.5s; }
  .portrait { animation: rise .9s ease-out .6s backwards; }
}

/* Compte à rebours vers le live */
.countdown {
  display: block; width: fit-content; max-width: 100%; margin: 0 0 1.4rem; padding: .8rem 1.1rem .9rem;
  background: rgba(8, 12, 10, .72); border: 1px solid var(--line); border-left: 4px solid var(--ember); border-radius: 3px;
  backdrop-filter: blur(2px);
}
.cd-label { margin: 0 0 .15rem; color: var(--lamp-dim); font-size: .98rem; }
.cd-clock { margin: 0; display: flex; align-items: baseline; flex-wrap: wrap; gap: .25rem .55rem; font-variant-numeric: tabular-nums; }
.cd-clock .n { font-family: var(--font-display); font-size: clamp(2rem, 6vw, 2.9rem); line-height: 1.05; color: var(--ember-soft); text-shadow: 0 0 22px rgba(255, 122, 26, .35); }
.cd-clock .u { color: var(--lamp-dim); font-size: .95rem; margin-right: .5rem; }
.cd-clock .now { font-family: var(--font-display); font-size: clamp(1.7rem, 5vw, 2.4rem); color: var(--ember-soft); }
.cd-clock a { color: var(--ember-soft); }
.countdown.is-live { border-left-color: var(--blood); }

/* Le médaillon : la photo éclairée par la lanterne. */
.portrait { position: relative; width: clamp(120px, 20vw, 190px); aspect-ratio: 1; }
.portrait::before {
  content: ''; position: absolute; inset: -22%; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 140, 40, .5), transparent 66%);
  animation: flicker 4.6s infinite;
}
.portrait img {
  position: relative; width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  border: 2px solid var(--ember); filter: contrast(1.06) saturate(.9);
}

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; }
  .portrait { order: -1; }
}

/* La feuille de papier où l'on écrit. */
.sheet {
  position: relative; scroll-margin-top: 1rem; overflow: hidden;
  background: linear-gradient(180deg, rgba(15, 23, 20, .94), rgba(10, 16, 14, .96));
  border: 1px solid var(--line); border-radius: 4px;
  padding: clamp(1.1rem, 3.5vw, 2.2rem);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
  margin-bottom: 3rem;
  transition: border-color .4s, box-shadow .4s;
}
.sheet:focus-within { border-color: #3a4a40; box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px rgba(255, 122, 26, .06); }
.sheet h2 { font-size: clamp(2rem, 4vw, 2.6rem); margin-bottom: .5rem; }
.intro { margin: 0 0 1.6rem; color: var(--lamp-dim); max-width: 38rem; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }

.sheet textarea {
  min-height: 15rem; resize: vertical; padding-top: .5rem;
  line-height: 1.9rem;
  background-image: repeating-linear-gradient(to bottom,
    transparent 0, transparent calc(1.9rem - 1px),
    rgba(241, 220, 174, .055) calc(1.9rem - 1px), rgba(241, 220, 174, .055) 1.9rem);
  background-attachment: local;
}

/* Barre de progression vers le minimum de caractères : orange tant que c'est trop court, verte ensuite. */
.meter { height: 3px; margin-top: .45rem; background: #16201b; border-radius: 2px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ember); transform: scaleX(0); transform-origin: left; transition: transform .25s ease-out, background-color .3s; }
.meter i.done { background: var(--moss); }
.counter { text-align: right; font-size: .92rem; color: var(--lamp-dim); margin-top: .3rem; }
.counter.low { color: var(--ember-soft); }

.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.rules { margin: 0 0 1.4rem; color: var(--lamp-dim); }
.rules summary { cursor: pointer; font-weight: 600; color: var(--lamp); }
.rules ul { margin: .6rem 0 0; padding-left: 1.2rem; }
.rules li { margin-bottom: .3rem; }

.check { display: flex; align-items: flex-start; gap: .75rem; font-weight: 400; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: .2rem 0 0; accent-color: var(--ember); flex: none; }

/* Bouton d'envoi : une braise qui s'allume au survol. */
.btn-send { position: relative; transition: background-color .15s, box-shadow .25s; }
.btn-send:hover:not([disabled]) { box-shadow: 0 0 26px rgba(255, 122, 26, .45); }
.btn-send[disabled] { cursor: progress; }

/* Envoi réussi : la feuille brûle du bas vers le haut, puis le message de confirmation apparaît. */
@property --burn { syntax: '<percentage>'; inherits: true; initial-value: 0%; }
@keyframes burn { to { --burn: 112%; } }
.sheet.burning { animation: burn 1.25s cubic-bezier(.55, .05, .75, .45) forwards; pointer-events: none; }
.sheet.burning > form {
  -webkit-mask-image: linear-gradient(to top, transparent var(--burn), #000 calc(var(--burn) + 14%));
  mask-image: linear-gradient(to top, transparent var(--burn), #000 calc(var(--burn) + 14%));
}
.sheet.burning::after {
  content: ''; position: absolute; left: -5%; right: -5%; bottom: var(--burn); height: 90px; transform: translateY(55%);
  background:
    radial-gradient(60% 55% at 22% 60%, rgba(255, 210, 120, .85), transparent 70%),
    radial-gradient(55% 60% at 70% 55%, rgba(255, 140, 40, .85), transparent 72%),
    radial-gradient(90% 70% at 50% 50%, rgba(255, 90, 10, .55), transparent 75%);
  filter: blur(7px); pointer-events: none;
}
.thanks { padding: .5rem 0; }
.thanks:focus { outline: none; }
.thanks p { max-width: 34rem; margin: .6rem 0 1.4rem; }
@media (prefers-reduced-motion: no-preference) {
  .thanks:not([hidden]) { animation: settle .6s ease-out both; }
}

.foot {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1rem 0 2.5rem; color: var(--lamp-dim); font-size: .95rem;
}
.foot p { margin: 0; }
.foot a { color: var(--lamp-dim); }
