/*
  One identity with the film behind it: a marble god in a gold chain.
  So the words are inscription capitals (Cinzel, the letters carved on Roman stone) cast in the
  same polished gold as his chain, the button is a gold ingot, and the ornament is a Greek key.
*/

/* The typeface lives on this site (no third party), trimmed to the characters French needs. */
@font-face {
  font-family: 'Cinzel';
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url('/fonts/cinzel.v1.woff2') format('woff2');
}

:root {
  --noir: #000000;
  --marbre: #efe9df;
  --marbre-doux: rgba(239, 233, 223, 0.74);
  --or: #e3bb55;
  --or-clair: #fff3c4;
  --or-sombre: #7a5512;
  /* Polished gold, lit from above: bright rim, warm body, a dark horizon, then reflected light. */
  --or-poli: linear-gradient(180deg, #fff6cf 0%, #f6dc8a 17%, #e2b84f 39%, #b3832a 51%, #efcd6c 63%, #cc9b33 83%, #8f6418 100%);
  /* Greek key frieze, one tile of it, in gold. */
  --grecque: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='14' viewBox='0 0 22 14'%3E%3Cpath d='M0 12.5H22M3 12.5V2H17V9H8V5.5H12.5' fill='none' stroke='%23d9ae4a' stroke-width='1.7'/%3E%3C/svg%3E");

  --lettres: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);

  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--noir);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--noir);
  color: var(--marbre);
  font-family: var(--lettres);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

[hidden] {
  display: none !important;
}

/* ---------- The film ---------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--noir);
}

/* Still and film fill the screen and keep the face in view whatever the screen shape. */
.stage img,
.stage video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 47% 24%;
}

/* Tall phones get a version already cropped around the face. */
@media (max-aspect-ratio: 9/16) {
  .stage img,
  .stage video {
    object-position: 50% 30%;
  }
}

.stage video {
  opacity: 0;
  transition: opacity 0.8s ease;
}

.stage video.is-playing {
  opacity: 1;
}

/* The veil that keeps the words readable: light over the face, heavy where the text sits. */
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.38) 0%,
    rgba(0, 0, 0, 0.26) 24%,
    rgba(0, 0, 0, 0.66) 50%,
    rgba(0, 0, 0, 0.92) 74%,
    #000 100%
  );
  transition: background-color 0.6s ease;
}

html[data-state='pay'] .stage::after,
html[data-state='crowned'] .stage::after {
  background-color: rgba(0, 0, 0, 0.62);
}

/* ---------- Layout ---------- */

main {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-height: 100svh;
  padding: clamp(2rem, 8vh, 5rem) max(var(--gutter), env(safe-area-inset-right))
    max(clamp(2rem, 7vh, 4.5rem), env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  text-align: center;
}

html[data-state='pay'] main {
  justify-content: flex-start;
}

html[data-state='crowned'] main {
  justify-content: center;
}

.pitch {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

html[data-state='crowned'] .pitch,
html:not([data-state='crowned']) .certificate {
  display: none;
}

/* ---------- Gold lettering ---------- */

/* Each line of text gets its own top-to-bottom sweep of polished gold, like a row of cast letters.
   The dark edge underneath gives them thickness; the soft shadow lifts them off the marble. */
.gold {
  background-image: var(--or-poli);
  background-size: 100% 1lh;
  background-repeat: repeat-y;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0.035em 0 var(--or-sombre)) drop-shadow(0 0.07em 0 #2a1c04) drop-shadow(0 0.25em 0.5em rgba(0, 0, 0, 0.75));
}

/* ---------- The sentence ---------- */

.say {
  margin: 0;
  max-width: 100%;
  font-size: clamp(2.05rem, 9.6vw, 6.75rem);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: 0.005em;
  text-wrap: balance;
}

html[data-state='pay'] .say {
  font-size: clamp(1.6rem, 6.4vw, 3.25rem);
}

/* ---------- Step 1: the amount ---------- */

#ask {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 30rem;
  margin-top: clamp(1.5rem, 5vw, 2.5rem);
}

.amount {
  --size: clamp(3.25rem, 15.5vw, 5.5rem);
  position: relative;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.14em;
  padding: 0 0.3em 0.24em;
  color: var(--or);
  font-size: calc(var(--size) * var(--fit, 1));
  font-weight: 800;
  line-height: 1.08;
  text-shadow: 0 0.03em 0 var(--or-sombre), 0 0.06em 0 #2a1c04, 0 0.2em 0.45em rgba(0, 0, 0, 0.8);
  cursor: text;
}

/* The amount stands on a Greek key frieze. */
.amount::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 14px;
  background: var(--grecque) center bottom / 22px 14px repeat-x;
  opacity: 0.85;
}

.amount:focus-within::after {
  opacity: 1;
  filter: brightness(1.35);
}

.amount input,
.amount .euro {
  flex: none;
}

/* Invisible copy of the typed number, used by app.js to size the field to its content. */
.amount-mirror {
  position: absolute;
  visibility: hidden;
  white-space: pre;
  pointer-events: none;
}

.amount input {
  width: 1ch;
  min-width: 0.5em;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: right;
  text-shadow: inherit;
  caret-color: var(--or-clair);
  appearance: none;
}

.amount input::placeholder {
  color: rgba(227, 187, 85, 0.38);
  opacity: 1;
}

.amount input:focus {
  outline: none;
}

.euro {
  font-size: 0.62em;
}

.hint {
  min-height: 1.45em;
  margin: 0.8rem 0 0;
  color: var(--marbre-doux);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
}

.hint[data-tone='error'] {
  color: var(--or-clair);
  font-weight: 700;
  letter-spacing: 0.06em;
}

/* The button is a gold ingot: bevelled edges, engraved lettering, a glint now and then. */
.cta {
  position: relative;
  overflow: hidden;
  margin-top: 1.4rem;
  min-width: 15rem;
  min-height: 3.6rem;
  padding: 1rem 2.5rem 0.9rem;
  border: 0;
  border-radius: 5px;
  background: var(--or-poli);
  color: #1d1303;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 900;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-transform: uppercase;
  text-shadow: 0 1px 0 rgba(255, 246, 207, 0.65);
  box-shadow:
    inset 0 1px 0 #fffbe6,
    inset 0 -4px 0 rgba(122, 85, 18, 0.9),
    inset 0 0 0 1px #a8791f,
    0 0 0 1px #2a1c04,
    0 14px 34px rgba(0, 0, 0, 0.7),
    0 0 42px rgba(227, 187, 85, 0.16);
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.08s ease;
  -webkit-tap-highlight-color: transparent;
}

.cta::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 45%;
  background: linear-gradient(105deg, transparent 0%, rgba(255, 255, 255, 0.7) 50%, transparent 100%);
  transform: translateX(-130%);
  animation: glint 6.5s ease-in-out 2s infinite;
  pointer-events: none;
}

.cta:hover {
  filter: brightness(1.1);
}

.cta:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 1px 0 #fffbe6,
    inset 0 -2px 0 rgba(122, 85, 18, 0.9),
    inset 0 0 0 1px #a8791f,
    0 0 0 1px #2a1c04,
    0 8px 22px rgba(0, 0, 0, 0.7);
}

.cta:focus-visible {
  outline: 2px solid var(--marbre);
  outline-offset: 5px;
}

.cta[aria-busy='true'] {
  cursor: progress;
  filter: saturate(0.5) brightness(0.8);
}

@keyframes glint {
  0%,
  78% {
    transform: translateX(-130%);
  }
  100% {
    transform: translateX(330%);
  }
}

/* ---------- Step 2: Stripe's form ---------- */

#pay {
  width: 100%;
  max-width: 31rem;
  margin-top: clamp(1rem, 3.5vw, 1.75rem);
}

.recap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 1rem;
  margin: 0 0 1.1rem;
}

#recap-amount {
  color: var(--or);
  font-size: clamp(1.8rem, 6.6vw, 2.5rem);
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 0.03em 0 var(--or-sombre), 0 0.2em 0.45em rgba(0, 0, 0, 0.8);
}

.link {
  /* Roomy enough for a thumb */
  min-height: 2.75rem;
  padding: 0.5rem 0.25rem;
  border: 0;
  background: none;
  color: var(--marbre-doux);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-decoration: underline;
  text-decoration-color: var(--or);
  text-underline-offset: 0.3em;
  cursor: pointer;
}

.link:hover {
  color: var(--marbre);
}

.link:focus-visible {
  outline: 2px solid var(--marbre);
  outline-offset: 4px;
}

#checkout {
  min-height: 12rem;
  padding: clamp(0.5rem, 2.5vw, 1rem);
  border: 1px solid rgba(227, 187, 85, 0.6);
  background: var(--noir);
  text-align: left;
}

/* ---------- Paid: the certificate ---------- */

.certificate {
  position: relative;
  width: min(100%, 44rem);
  padding: clamp(0.4rem, 1.4vw, 0.6rem);
  background: linear-gradient(105deg, #8f6418 0%, #e2b84f 22%, #fff6cf 40%, #cc9b33 58%, #f6dc8a 78%, #8f6418 100%);
  background-size: 220% 100%;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8), 0 0 70px rgba(227, 187, 85, 0.14);
}

.certificate:focus {
  outline: none;
}

.certificate-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(3rem, 11vw, 5rem) clamp(1.25rem, 6vw, 4rem) clamp(3.25rem, 12vw, 5.5rem);
  background:
    radial-gradient(120% 70% at 50% 0%, rgba(227, 187, 85, 0.2), transparent 62%),
    #080604;
}

/* A Greek key frieze runs along the top and bottom, as on a temple. */
.certificate-sheet::before,
.certificate-sheet::after {
  content: '';
  position: absolute;
  left: clamp(0.75rem, 3vw, 1.25rem);
  right: clamp(0.75rem, 3vw, 1.25rem);
  height: 14px;
  background: var(--grecque) center / 22px 14px repeat-x;
  pointer-events: none;
}

.certificate-sheet::before {
  top: clamp(0.75rem, 3vw, 1.25rem);
  transform: scaleY(-1);
}

.certificate-sheet::after {
  bottom: clamp(0.75rem, 3vw, 1.25rem);
}

.crown {
  width: clamp(3.75rem, 14vw, 5.5rem);
  height: auto;
  overflow: visible;
}

.crown path {
  fill: none;
  stroke: url(#foil);
  stroke-width: 12;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 0;
}

.vow {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: clamp(1.25rem, 4vw, 2rem) 0 0;
}

.vow-first {
  font-size: clamp(1.7rem, 8.3vw, 4.1rem);
  font-weight: 900;
  line-height: 1.08;
  letter-spacing: 0.01em;
}

.vow-rule {
  width: clamp(3rem, 12vw, 5rem);
  height: 2px;
  margin: clamp(0.9rem, 3.2vw, 1.5rem) 0;
  background: var(--or);
}

.vow-second {
  color: var(--marbre);
  font-size: clamp(0.98rem, 4.3vw, 1.9rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-wrap: balance;
}

/* Played only at the moment of payment, not when a certified visitor comes back. */
html[data-fresh] .certificate {
  animation: unveil 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both, gleam 2.4s ease-in-out 0.9s both;
}

html[data-fresh] .crown-points {
  animation: draw 0.9s cubic-bezier(0.6, 0, 0.3, 1) 0.7s backwards;
}

html[data-fresh] .crown-base {
  animation: draw 0.35s ease-out 1.55s backwards;
}

@keyframes unveil {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.97);
  }
}

@keyframes gleam {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0% 0;
  }
}

@keyframes draw {
  from {
    stroke-dashoffset: 1;
  }
}

/* ---------- Short screens: phones held sideways, small laptop windows ---------- */

@media (max-height: 32rem) {
  main {
    padding-top: 1.25rem;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }

  .say {
    font-size: clamp(1.7rem, 8vh, 2.9rem);
  }

  #ask {
    margin-top: 0.6rem;
  }

  .amount {
    --size: clamp(2.4rem, 14vh, 3.6rem);
  }

  .hint {
    margin-top: 0.35rem;
  }

  .cta {
    margin-top: 0.7rem;
    min-height: 3rem;
    padding-top: 0.75rem;
    padding-bottom: 0.65rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
