/* ═══════════════ Djouney v3 — l'arrivée, écrire, partager (module G) ═══════════════
   L'invitation qui séduit : la goutte d'encre suspendue, la feuille scellée d'un cachet de cire
   qu'on déchire, l'encre qui fleurit, la première lettre, le panneau de partage.
   Classes préfixées .ar- (arrivée), .wr- (écrire), .sh- (partage).
   Voir ARCHITECTURE.md § 8, § 10 G, § 11 et § 16. */

/* ═════════════════════════ L'arrivée ═════════════════════════ */

.ar {
  /* Encre aubergine adoucie : contraste ≥ 5,3:1 sur la porcelaine, le lait, le bord du fond
     et la lumière de la scène d'encre. */
  --ar-soft: rgba(var(--ink-rgb), .74);
  --ar-line: 36px;
  --ar-rule: rgba(var(--hollow-rgb), .5);
  /* Place laissée en haut à l'encre qui fleurit, au-dessus de la carte de papier (la feuille, son
     cachet et « Déchirer » tiennent dans 290 px de haut ; tout tient sans défiler dès 360 × 600). */
  --ar-open: clamp(120px, 24vh, 330px);
  --ar-sheet-h: clamp(290px, 46vh, 480px);
  --ar-wax: clamp(42px, 8vh, 60px);
}
@supports (height: 1dvh) {
  .ar {
    --ar-open: clamp(120px, 24dvh, 330px);
    --ar-sheet-h: clamp(290px, 46dvh, 480px);
    --ar-wax: clamp(42px, 8dvh, 60px);
  }
}

.ar-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: calc(14px + var(--safe-top)) max(16px, env(safe-area-inset-right, 0px)) calc(22px + var(--safe-bottom)) max(16px, env(safe-area-inset-left, 0px));
}

.ar-brand {
  flex: none;
  margin: 0;
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 400;
  letter-spacing: .08em;
  color: var(--ar-soft);
}

/* Centré verticalement, sans couper le haut quand la page déborde. */
.ar-center {
  width: 100%;
  margin: auto 0;
  padding: 18px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

/* ─── La scène d'encre : en haut, sous le nom, derrière la feuille ─── */
.ar-scene {
  position: absolute;
  z-index: 0;
  top: calc(40px + var(--safe-top));
  bottom: 20%;
  left: 0;
  right: 0;
  pointer-events: none;
  /* Le haut de l'image se fond dans le papier : pas d'arête sous le nom (la goutte reste nette). */
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 16px);
  mask-image: linear-gradient(180deg, transparent 0, #000 16px);
}
.ar-scene__frame {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  width: min(100%, 600px);
  margin: 0 auto;
}
/* Colonne plus large que la scène : ses côtés se fondent aussi. */
@media (min-width: 640px) {
  .ar-scene__frame {
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000 84%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 16%, #000 84%, transparent 100%);
  }
}
/* Mise en page basse (attente, lettre, feuilles douces) : la feuille descend dans la partie basse,
   le haut reste à l'encre ; le nom et la feuille passent devant la scène. */
.ar-stage--low > .ar-brand,
.ar-stage--low > .ar-center {
  position: relative;
  z-index: 1;
}
.ar-stage--low > .ar-center {
  margin: auto 0 0;
  padding-top: var(--ar-open);
}

/* ─── La feuille (format lettre) : une carte de papier crème ─── */
.ar-sheet {
  position: relative;
  flex: none;
  width: min(86vw, 420px);
  height: min(62vh, 560px);
  min-height: 300px;
  border-radius: 24px;
  background: linear-gradient(176deg, #FFFDF9 0%, var(--milk) 46%, #F7F0E6 100%);
  box-shadow:
    var(--emboss),
    inset 1px 1px 0 rgba(var(--light-rgb), calc(.95 * var(--hl-a))),
    inset -1px -1px 0 rgba(var(--hollow-rgb), .38);
}
@supports (height: 1dvh) {
  .ar-sheet { height: min(62dvh, 560px); }
}
.ar-stage--low .ar-sheet {
  width: min(100%, 420px);
  height: var(--ar-sheet-h);
  min-height: 0;
}
/* La feuille a cédé : la carte se pose, comme une lettre qu'on vient de déplier. */
.ar-sheet.is-open { animation: ar-settle 900ms var(--ease) both; }
@keyframes ar-settle {
  from { transform: translateY(-6px) scale(1.012); }
}

/* Le cachet de cire, au haut de la feuille scellée ; il part avec elle. */
.ar-wax {
  display: block;
  flex: none;
  width: var(--ar-wax, 60px);
  height: var(--ar-wax, 60px);
  margin: 0 auto 10px;
  pointer-events: none;
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}
.ar-wax > * {
  width: 100% !important;
  height: 100% !important;
}
.ar-wax--over {
  position: absolute;
  z-index: 4;
  top: 18px;
  left: 50%;
  margin: 0;
  transform: translateX(-50%);
  transition: opacity 420ms var(--ease);
}
.ar-sheet.is-open .ar-wax--over { opacity: 0; }
/* Règle à part : un navigateur sans :has() n'ignore qu'elle. */
.ar-sheet:has(.pc-tear.is-torn) .ar-wax--over { opacity: 0; }
/* La feuille scellée, resserrée pour laisser la place au cachet. */
.ar .pc-tear__sheet { padding: 18px 20px; }
.ar .pc-tear__title { font-size: clamp(30px, 8.6vw, 42px); }
.ar .pc-tear__perf { margin: 16px auto 10px; }
.ar-sheet--waiting { animation: ar-breathe 2.6s ease-in-out infinite both; }
@keyframes ar-breathe {
  0%, 100% { opacity: .5; }
  50% { opacity: .95; }
}

/* ─── La lettre, sous la feuille scellée ─── */
.ar-letter {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  outline: none;
}
/* Le fil rouge court dans la marge : c'est le premier lien entre vous. */
.ar-letter::before {
  content: "";
  position: absolute;
  z-index: 1;
  left: 15px;
  top: 22px;
  bottom: 22px;
  width: 1.5px;
  border-radius: 1px;
  background: var(--thread);
  opacity: 0;
  transform: scaleY(.2);
  transform-origin: top;
  transition: opacity var(--slow) var(--ease), transform 1200ms var(--ease);
  pointer-events: none;
}
.ar-letter.is-open::before { opacity: .78; transform: none; }

.ar-letter__scroll {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding: 28px 24px 24px 30px;
  /* Réglure fine sous chaque ligne d'écriture ; elle défile avec la lettre. */
  background-image: linear-gradient(to bottom, transparent calc(var(--ar-line) - 1px), var(--ar-rule) calc(var(--ar-line) - 1px), var(--ar-rule) var(--ar-line));
  background-size: 100% var(--ar-line);
  background-origin: content-box;
  background-clip: content-box;
  background-attachment: local;
}

.ar-letter__body {
  min-height: var(--ar-line);
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 26px;
  line-height: var(--ar-line);
  color: var(--sepia);
}

.ar-letter__sign {
  margin: 0; /* reste posée sur la réglure */
  padding-right: .3em; /* la manuscrite déborde à droite : la signature ne touche pas le bord */
  text-align: right;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 30px;
  line-height: var(--ar-line);
  color: var(--sepia);
  overflow-wrap: anywhere;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 900ms var(--ease), transform 900ms var(--ease);
}
.ar-letter__sign.is-shown { opacity: 1; transform: none; }

/* ─── Sous la feuille : le son, puis « Lui répondre » ─── */
.ar-below {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-height: 56px;
}

.ar-sound {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ar-soft);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: .2px;
  transition: opacity var(--mid) var(--ease), background-color .25s var(--ease), box-shadow .25s var(--ease);
}
.ar-sound svg { flex: none; width: 18px; height: 18px; }
.ar-sound:active { background: var(--porcelain); box-shadow: var(--deboss); }
.ar-sound.is-leaving { opacity: 0; pointer-events: none; }

.ar-reply { min-width: 220px; min-height: 52px; font-size: 16px; }
.ar-reply.is-rising { animation: ar-rise 700ms var(--ease) both; }
@keyframes ar-rise {
  from { opacity: 0; transform: translateY(10px); }
}

/* ─── Feuilles douces : introuvable, refermée, déjà ouverte ─── */
.ar-soft {
  width: min(100%, 420px);
  padding: 34px 24px 26px;
  text-align: center;
}
.ar-soft__mark {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.ar-soft__mark .pc-eyelid { opacity: .75; }
.ar-soft__mark > * { flex: none; }
.ar-stage--low .ar-soft { padding-top: 28px; }
.ar-soft__title {
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: clamp(30px, 8.5vw, 36px);
  line-height: 1.12;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.ar-soft__text {
  margin: 10px auto 0;
  max-width: 32ch;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ar-soft);
  overflow-wrap: anywhere;
}
.ar-soft__actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
}
.ar-soft__btn { min-width: 220px; }
.ar-soft__btn.btn--quiet { min-width: 0; min-height: 44px; color: var(--ar-soft); }

/* ═════════════════════════ Écrire ═════════════════════════ */

.wr {
  --wr-soft: rgba(var(--ink-rgb), .74);
  --wr-line: 36px;
  --wr-rule: rgba(var(--hollow-rgb), .58);
  --wr-sep: rgba(var(--hollow-rgb), .55);
  /* La photo de la plume : grande au premier temps, une bande de lumière ensuite. */
  --wr-hero-h: min(94vw, 56vh, 520px);
  --wr-hero-y: 64%;
}
.wr--compact {
  --wr-hero-h: min(44vw, 26vh, 230px);
  --wr-hero-y: 24%;
}

/* « Revenir » flotte au-dessus de la photo et de la feuille. */
.wr-head {
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  padding: calc(8px + var(--safe-top)) 0 0 max(10px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}
.wr-back {
  color: var(--stem);
  pointer-events: auto;
  background: rgba(var(--milk-rgb), .82);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.wr-scroll {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 max(16px, env(safe-area-inset-right, 0px)) calc(28px + var(--safe-bottom)) max(16px, env(safe-area-inset-left, 0px));
}

/* ─── En tête : la plume dorée qui écrit, et le titre manuscrit dans sa lumière ─── */
.wr-hero {
  position: relative;
  height: var(--wr-hero-h);
  margin: 0 calc(-1 * max(16px, env(safe-area-inset-right, 0px))) 0 calc(-1 * max(16px, env(safe-area-inset-left, 0px)));
  overflow: hidden;
  transition: height 700ms var(--ease);
}
.wr-hero__img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% var(--wr-hero-y);
  /* Le bas de la photo se fond dans le papier crème. */
  -webkit-mask-image: linear-gradient(180deg, #000 52%, rgba(0, 0, 0, .55) 76%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 52%, rgba(0, 0, 0, .55) 76%, transparent 100%);
  transition: object-position 700ms var(--ease);
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.wr-title {
  position: absolute;
  z-index: 1;
  top: calc(var(--safe-top) + 62px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 0 56px;
  text-align: center;
  font-family: var(--font-hand);
  font-weight: 600;
  font-size: clamp(40px, 11.5vw, 52px);
  line-height: 1.02;
  color: var(--ink);
  overflow-wrap: anywhere;
  text-wrap: balance;
  /* Halo de lumière : le titre reste net sur la photo. */
  text-shadow: 0 0 18px rgba(var(--milk-rgb), .9), 0 0 3px rgba(var(--milk-rgb), .8);
  transform-origin: 50% 0;
  transition: transform 700ms var(--ease);
}
/* Bande de lumière : le titre remonte (à 12 px sous la zone sûre) et se resserre. */
.wr--compact .wr-title { transform: translateY(-50px) scale(.72); }
/* La feuille se pose sur le bas de la photo. */
.wr-hero + .wr-sheet { margin-top: -32px; }
/* Fenêtre d'écoute du Salon dans un coin du bas (de 84 à 345 px au-dessus de la zone sûre) : la fin de la feuille
   défile au-dessus d'elle. Dans un coin du haut, rien n'est réservé. */
html[data-salon="dock"]:not([data-salon-coin^="haut"]) .wr-scroll { padding-bottom: calc(357px + var(--safe-bottom)); }

/* ─── La feuille : une seule, qui se compose en trois temps ─── */
.wr-sheet {
  position: relative;
  z-index: 1;
  min-height: min(66vh, 600px);
  padding: 30px 22px 22px 42px;
  background: linear-gradient(176deg, #FFFDF9 0%, var(--milk) 46%, #F7F0E6 100%);
  box-shadow:
    var(--emboss),
    inset 1px 1px 0 rgba(var(--light-rgb), calc(.95 * var(--hl-a))),
    inset -1px -1px 0 rgba(var(--hollow-rgb), .38);
}

/* Le fil rouge s'allonge à chaque temps : la lettre se noue. */
.wr-thread {
  position: absolute;
  left: 21px;
  top: 26px;
  bottom: 26px;
  width: 1.5px;
  border-radius: 1px;
  background: var(--thread);
  opacity: .82;
  transform: scaleY(.34);
  transform-origin: top;
  transition: transform 900ms var(--ease);
  pointer-events: none;
}
.wr-sheet[data-step="2"] .wr-thread { transform: scaleY(.67); }
.wr-sheet[data-step="3"] .wr-thread,
.wr-sheet[data-step="sealed"] .wr-thread { transform: none; }

.wr-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.wr-to {
  flex: 1;
  min-width: 0;
  margin: 0 0 12px;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 28px;
  line-height: 1.15;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.wr-corner {
  flex: none;
  display: flex;
  margin: -14px -8px 6px auto;
}

/* ─── Les temps ─── */
.wr-step.is-entering { animation: wr-in 600ms var(--ease) both; }
@keyframes wr-in {
  from { opacity: 0; transform: translateY(10px); }
}

.wr-q {
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: clamp(32px, 9vw, 40px);
  line-height: 1.08;
  color: var(--ink);
}
.wr-help {
  margin: 8px 0 22px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 15.5px;
  line-height: 1.5;
  color: var(--wr-soft);
}
/* Le prénom s'écrit déjà à la main, comme il le sera sur la feuille scellée. */
.wr-name {
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 25px;
  line-height: 1.2;
}

.wr-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px 12px;
  margin-top: 28px;
}
.wr-prev { margin-right: auto; min-height: 44px; color: var(--wr-soft); }
.wr-next { min-width: 140px; }

/* ─── Votre cachet : cinq cachets de cire, le choisi vivant, les autres au repos ─── */
.wr-flowers,
.wr-tags {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  justify-items: center;
  margin: 0 -6px;
}
.wr-flower {
  display: grid;
  place-items: center;
  width: min(72px, 100%);
  min-width: 44px;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}
/* Le cachet garde 64 px tant qu'il a la place, et se resserre à 360 px de large (≥ 44 px). */
.wr-flower__seal {
  display: grid;
  place-items: center;
  width: min(64px, 100%);
  aspect-ratio: 1;
  pointer-events: none;
  transition: transform .5s var(--ease);
}
.wr-flower__seal > * {
  width: 100% !important;
  height: 100% !important;
}
.wr-flower[aria-checked="true"] .wr-flower__seal { transform: translateY(-2px) scale(1.07); }
.wr-flower:focus-visible { border-radius: 50%; outline-offset: 1px; }

/* L'étiquette du cachet choisi, pendue à lui par le fil rouge. */
.wr-tags { margin-top: 2px; min-height: 46px; }
.wr-tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  min-width: 0;
}
.wr-tag[data-col="1"] { align-items: flex-start; }
.wr-tag[data-col="5"] { align-items: flex-end; }
.wr-tag__thread {
  align-self: center;
  width: 1.5px;
  height: 12px;
  border-radius: 1px;
  background: var(--thread);
  opacity: .85;
  transform-origin: top;
}
.wr-tag__label {
  flex: none;
  margin-top: -1px;
  padding: 4px 11px 5px;
  border-radius: 7px;
  background: var(--milk);
  box-shadow: var(--emboss-sm);
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 14.5px;
  line-height: 1.25;
  white-space: nowrap;
  color: var(--ink);
}
.wr-tag.is-new .wr-tag__thread { animation: wr-thread-in 420ms var(--ease) both; }
.wr-tag.is-new .wr-tag__label { animation: wr-tag-in 560ms var(--ease) 80ms both; }
@keyframes wr-thread-in {
  from { transform: scaleY(0); }
}
@keyframes wr-tag-in {
  from { opacity: 0; transform: translateY(-5px) rotate(-3deg); }
}

/* ─── Votre ton ─── */
.wr-tone-block {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--wr-sep);
}
.wr-tone__label {
  margin: 0 0 10px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .3px;
  color: var(--wr-soft);
}
.wr-tone {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  max-width: 100%;
  padding: 4px;
  border-radius: 999px;
  background: var(--porcelain);
  box-shadow: var(--deboss);
}
.wr-tone__opt {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--wr-soft);
  font-family: var(--font-ui);
  font-size: 14.5px;
  font-weight: 500;
  transition: background-color .3s var(--ease), box-shadow .3s var(--ease), color .3s var(--ease);
}
.wr-tone__opt[aria-checked="true"] {
  background: var(--milk);
  color: var(--ink);
  box-shadow: var(--emboss-sm);
}
.wr-tone__desc {
  margin: 10px 0 0;
  min-height: 1.5em;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--wr-soft);
}

/* ─── La lettre : papier réglé, encre manuscrite, aucun cadre ─── */
.wr-letter {
  display: block;
  width: 100%;
  min-height: calc(var(--wr-line) * 7 + 8px);
  margin: 0;
  padding: 4px 0;
  border: 0;
  border-radius: 0;
  outline: none;
  resize: none;
  overflow: hidden;
  background-color: transparent;
  background-image: linear-gradient(to bottom, transparent calc(var(--wr-line) - 1px), var(--wr-rule) calc(var(--wr-line) - 1px), var(--wr-rule) var(--wr-line));
  background-size: 100% var(--wr-line);
  background-origin: content-box;
  background-clip: content-box;
  background-repeat: repeat-y;
  color: var(--ink);
  caret-color: var(--flower);
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: 26px;
  line-height: var(--wr-line);
}
.wr-letter::placeholder { color: var(--ink-faint); opacity: 1; }
/* Le focus se lit dans la réglure, qui s'affirme à l'encre. */
.wr-letter:focus { --wr-rule: rgba(var(--ink-rgb), .3); }
.wr-letter:focus-visible { outline: none; }
.wr-letter[readonly] { opacity: .72; }

.wr-count {
  margin: 8px 0 0;
  text-align: right;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
  color: var(--wr-soft);
  transition: color .3s var(--ease);
}
.wr-count.is-near { color: var(--ink); }

/* ─── « Laisser voir comment j'écris » ─── */
.wr-consent {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--wr-sep);
}
.wr-consent__row {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  cursor: pointer;
}
.wr-consent__box {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  border-radius: 7px;
  background: var(--porcelain) center / 14px 14px no-repeat;
  box-shadow: var(--deboss);
  cursor: pointer;
  transition: background-color .3s var(--ease), box-shadow .3s var(--ease);
}
.wr-consent__box:checked {
  background-color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M2.6 7.4l2.9 2.9 6-6.6' fill='none' stroke='%23FCF8F2' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  box-shadow: var(--emboss-sm);
}
.wr-consent__box:disabled { opacity: .6; cursor: default; }
.wr-consent__label {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
}
.wr-consent__why {
  margin: 2px 0 0 36px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--wr-soft);
}

.wr-seal { min-width: 180px; }
.wr-seal[aria-disabled="true"] { opacity: .5; box-shadow: none; }

/* ─── Sceller : la feuille se replie, le sceau se pose ─── */
.wr-sheet.is-folding > :not(.wr-thread) { animation: wr-fold 560ms var(--ease) forwards; }
@keyframes wr-fold {
  to { opacity: 0; transform: translateY(-12px) scale(.98); filter: blur(1px); }
}

.wr-sealed {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 6px;
  text-align: center;
}
.wr-sealed__seal {
  display: flex;
  width: 88px;
  height: 88px;
  margin: 0 0 14px;
  animation: wr-seal 900ms var(--ease) both;
}
.wr-sealed__seal > *,
.wr-corner > * {
  width: 100% !important;
  height: 100% !important;
}
.wr-corner { width: 46px; height: 46px; }
@keyframes wr-seal {
  from { opacity: 0; transform: translateY(-24px) scale(1.22); }
  60% { opacity: 1; }
}
.wr-sealed__title {
  margin: 0;
  font-family: var(--font-hand);
  font-weight: 500;
  font-size: clamp(32px, 9vw, 40px);
  line-height: 1.1;
  color: var(--ink);
  animation: wr-in 700ms var(--ease) 160ms both;
}
.wr-sealed__text {
  margin: 8px 0 24px;
  max-width: 34ch;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  color: var(--wr-soft);
  overflow-wrap: anywhere;
  animation: wr-in 700ms var(--ease) 260ms both;
}
.wr-share {
  width: 100%;
  text-align: left;
  animation: wr-in 700ms var(--ease) 380ms both;
}
.wr-home { margin-top: 24px; }
/* « Le lien suffit » : plus de code à transmettre avec la lettre (16 octobre 2026). */
.wr-direct {
  margin: -12px 0 22px;
  max-width: 34ch;
  font-size: 14px;
  line-height: 1.45;
  color: var(--wr-soft);
  animation: wr-in 700ms var(--ease) 320ms both;
}
.wr-url {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--porcelain);
  box-shadow: var(--deboss);
  font-size: 13px;
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}

/* Feuille « Laisser cette lettre ? » */
.wr-leave { display: flex; flex-direction: column; gap: 10px; }
.wr-leave__go { color: var(--carmine); }

/* ═════════════════════════ Partager ═════════════════════════ */

.sh {
  --sh-soft: rgba(var(--ink-rgb), .74);
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--ink);
}

/* ─── Par son numéro ─── */
.sh-phone { margin: 0; }
.sh-label {
  display: block;
  margin: 0 0 8px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--sh-soft);
  overflow-wrap: anywhere;
}
.sh-phone__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sh-phone__input { grid-column: 1 / -1; min-width: 0; letter-spacing: .3px; }
.sh-phone__input[aria-invalid="true"] { box-shadow: var(--deboss), inset 3px 0 0 var(--thread); }
@container (min-width: 440px) {
  .sh-phone__row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .sh-phone__input { grid-column: auto; }
}
.sh-send { min-height: 48px; padding: 0 18px; }
.sh-hint {
  margin: 8px 2px 0;
  font-family: var(--font-ui);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--sh-soft);
}

/* ─── Par une application ─── */
.sh-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 14px;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 14.5px;
  color: var(--sh-soft);
}
.sh-or::before,
.sh-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(var(--hollow-rgb), .7);
}

.sh-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 10px;
}
.sh-cell { display: flex; min-width: 0; }
.sh-tile {
  flex: 1;
  min-width: 0;
  min-height: 78px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 6px;
  border: 0;
  border-radius: 18px;
  background: var(--milk);
  box-shadow: var(--emboss-sm);
  color: var(--stem);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  transition: transform .15s var(--ease), box-shadow .25s var(--ease);
}
.sh-tile:active { transform: translateY(1px); box-shadow: var(--deboss); }
.sh-tile__icon { display: grid; place-items: center; width: 26px; height: 26px; }
.sh-tile__icon svg { width: 24px; height: 24px; }
.sh-tile__label { color: var(--ink); overflow-wrap: anywhere; }

/* ─── Le lien, lisible et sélectionnable ─── */
.sh-link {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--porcelain);
  box-shadow: var(--deboss);
  font-family: var(--font-ui);
  font-size: 13px;
  letter-spacing: .2px;
  color: var(--ink);
  overflow-wrap: anywhere;
  user-select: all;
  -webkit-user-select: all;
}
.sh-note {
  margin: 10px 2px 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--sh-soft);
}

/* ═════════════ Focus clavier : l'anneau épouse la forme de chaque élément ═════════════ */

.ar .btn:focus-visible,
.wr .btn:focus-visible,
.sh .btn:focus-visible,
.ar-sound:focus-visible,
.wr-tone__opt:focus-visible { border-radius: 999px; }
.sh-tile:focus-visible { border-radius: 18px; }
.wr-consent__box:focus-visible { border-radius: 7px; }
/* La lettre est une zone de lecture qui défile : l'anneau se pose à l'intérieur de la feuille. */
.ar-letter__scroll:focus-visible { outline-offset: -5px; border-radius: inherit; }

/* ═════════════════════════ Petits écrans ═════════════════════════ */

@media (max-width: 380px) {
  .wr-sheet { padding: 26px 16px 18px 34px; }
  .wr-thread { left: 17px; }
  .wr-tone__opt { padding: 0 14px; }
  .ar-letter__scroll { padding: 24px 18px 20px 26px; }
}

/* ═════════════ Mouvement réduit : plus de mise en scène, seulement des fondus ═════════════ */

/* porcelaine.css ramène toutes les durées à 0,01 ms : les fondus voulus ici le reprennent
   (sélecteurs plus précis et !important), sans aucun déplacement. */
@media (prefers-reduced-motion: reduce) {
  .ar-sheet--waiting { animation: none; opacity: .75; }
  .ar-sheet.is-open,
  .wr-tag.is-new .wr-tag__thread,
  .wr-tag.is-new .wr-tag__label { animation: none; }
  /* La photo de la plume change de cadrage d'un coup, sans glisser. */
  .wr-hero,
  .wr-hero__img,
  .wr-title { transition: none; }
  .wr-sealed__seal,
  .wr-sealed__title,
  .wr-sealed__text,
  .wr-share,
  .wr-sheet.is-folding > :not(.wr-thread) { animation: none; }
  .ar-reply.is-rising,
  .wr-step.is-entering,
  .wr-sealed { animation: ar-fade 500ms ease both !important; }
  .ar-letter::before,
  .ar-letter.is-open::before { transform: none; transition: opacity 600ms ease !important; }
  .ar-letter__sign { transform: none; transition: opacity 700ms ease !important; }
  .wr-thread { transition: none; }
}
@keyframes ar-fade {
  from { opacity: 0; }
}
