/* ============ OPEN WHEN… ============
   Seven cream envelopes with maroon wax seals on a snap rail (phone) or a
   4+3 grid (desktop). Tapping one flies it into a dark maroon reading room
   where the seal cracks, the flap opens, the letter slides out and the words
   ink in. Logic in when.js. Everything is prefixed wn-. */

.when { padding: 5rem 1.2rem 7rem; }
.when .section-head { margin-bottom: 2.2rem; }
.wn-sub { max-width: 30em; margin-left: auto; margin-right: auto; }

/* ---- Rail ---- */
.wn-rail-wrap { position: relative; margin: 0 -1.2rem; }
.wn-rail-wrap::before,
.wn-rail-wrap::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1.5rem;
  z-index: 2;
  pointer-events: none;
}
.wn-rail-wrap::before { left: 0; background: linear-gradient(90deg, var(--cream), rgba(253, 248, 245, 0)); }
.wn-rail-wrap::after { right: 0; background: linear-gradient(270deg, var(--cream), rgba(253, 248, 245, 0)); }
.wn-rail {
  display: flex;
  gap: 0.9rem;
  padding: 1rem 1.2rem 1.6rem;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 1.2rem;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.wn-rail::-webkit-scrollbar { display: none; }

.wn-env {
  position: relative;
  flex: 0 0 min(78vw, 340px);
  scroll-snap-align: start;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  border-radius: 16px;
}
.wn-env:focus-visible { outline: none; }
.wn-env:focus-visible .wn-e { outline: 2px solid var(--rose); outline-offset: 5px; }
.wn-env.is-lifted { visibility: hidden; }

/* ---- Envelope anatomy (shared by the rail, the flying copy and the paper's mini seal) ---- */
.wn-e {
  --wn-seal: 3rem;
  --wn-r: 14px;
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1.32;
  border-radius: var(--wn-r);
  isolation: isolate;
  transform-origin: 50% 100%;
  transition: transform 0.5s var(--ease-out-strong);
}
.wn-env:active .wn-e { transform: scale(0.975); }
.wn-e > * { position: absolute; }
.wn-e-back {
  inset: 0;
  z-index: 1;
  border-radius: inherit;
  background: linear-gradient(180deg, #FFFDFB 0%, #FBF2EC 100%);
  border: 1px solid rgba(110, 36, 54, 0.16);
  box-shadow:
    0 22px 44px -24px rgba(82, 26, 40, 0.42),
    0 3px 8px -3px rgba(82, 26, 40, 0.14),
    var(--shadow-ambient);
}
.wn-e-pocket {
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  background: linear-gradient(180deg, #FAF0EA 0%, #F5E6DF 100%);
  clip-path: polygon(0 0, 50% 54%, 100% 0, 100% 100%, 0 100%);
}
.wn-e-pocket::before,
.wn-e-pocket::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.wn-e-pocket::before {
  clip-path: polygon(0 0, 50% 54%, 0 100%);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0) 70%);
}
.wn-e-pocket::after {
  clip-path: polygon(100% 0, 50% 54%, 100% 100%);
  background: linear-gradient(270deg, rgba(110, 36, 54, 0.07), rgba(110, 36, 54, 0) 70%);
}
.wn-e-folds {
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 5;
  overflow: visible;
  fill: none;
  stroke: rgba(110, 36, 54, 0.14);
  stroke-width: 1;
  pointer-events: none;
}
.wn-e-folds path { vector-effect: non-scaling-stroke; }
.wn-e-flap-sh {
  left: 0;
  top: 0;
  width: 100%;
  height: 54%;
  z-index: 5;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background: linear-gradient(180deg, rgba(82, 26, 40, 0.02), rgba(82, 26, 40, 0.16));
  transform: translateY(3px);
  filter: blur(1.5px);
  transition: opacity 0.3s ease;
}
.wn-e-flap {
  left: 0;
  top: 0;
  width: 100%;
  height: 54%;
  z-index: 6;
  transform-origin: 50% 0;
  will-change: transform;
}
/* once it has turned past edge-on it lives behind the letter (when.js swaps the class at 90°) */
.wn-e-flap.is-behind { z-index: 2; }
.wn-e-flap-f {
  position: absolute;
  inset: 0;
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  border-radius: var(--wn-r) var(--wn-r) 0 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 40%),
    linear-gradient(180deg, #FFFDFB 0%, #F8ECE6 100%);
}
.wn-e-flap.is-behind .wn-e-flap-f {
  background: linear-gradient(0deg, #FBF1EC, #F6E7E0);
  box-shadow: inset 0 -1px 0 rgba(110, 36, 54, 0.1);
}
.wn-e-flap-b { display: none; }
.wn-e-num {
  top: 8%;
  left: 7%;
  z-index: 7;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: rgba(110, 36, 54, 0.42);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.wn-e-label {
  left: 8%;
  right: 8%;
  top: 65%;
  bottom: 15%;
  z-index: 7;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
  pointer-events: none;
}
.wn-e-label small {
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--rose);
  margin-bottom: 0.28rem;
}
.wn-e-label span {
  font-size: clamp(1rem, 4.4vw, 1.22rem);
  font-weight: 300;
  letter-spacing: -0.005em;
  color: var(--ink);
  text-wrap: balance;
}
.wn-e-count {
  left: 0;
  right: 0;
  bottom: 6.5%;
  z-index: 7;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  line-height: 1;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.5s ease, transform 0.6s var(--ease-out-strong);
}
.wn-env.is-opened .wn-e-count { opacity: 0.85; transform: none; }
.wn-e-sheen {
  inset: 0;
  z-index: 9;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}
.wn-e-sheen i {
  position: absolute;
  top: -20%;
  bottom: -20%;
  left: 0;
  width: 34%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.65) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-140%) skewX(-14deg);
}

/* ---- Wax seal: two halves along a jagged crack, a stamped ∞, a melted drip ---- */
.wn-seal {
  left: 50%;
  top: 54%;
  width: var(--wn-seal);
  height: var(--wn-seal);
  margin: calc(var(--wn-seal) / -2) 0 0 calc(var(--wn-seal) / -2);
  z-index: 8;
  transform: rotate(-7deg);
  pointer-events: none;
}
/* rail seals get a static shadow (cheap under the glint loop); the flying
   envelope's seal uses a drop-shadow so the shadow falls with the halves */
.wn-seal::before {
  content: '';
  position: absolute;
  left: -4%;
  right: -4%;
  top: 14%;
  bottom: -14%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(40, 8, 16, 0.38) 0%, rgba(40, 8, 16, 0.16) 45%, rgba(40, 8, 16, 0) 72%);
}
.wn-fly .wn-seal,
.wn-p-seal .wn-seal { filter: drop-shadow(0 5px 6px rgba(40, 8, 16, 0.32)); }
.wn-fly .wn-seal::before,
.wn-p-seal .wn-seal::before { display: none; }
.wn-seal-h {
  position: absolute;
  inset: 0;
  will-change: transform;
}
.wn-seal-l {
  clip-path: polygon(0 0, 52% 0, 46% 30%, 55% 52%, 47% 74%, 53% 100%, 0 100%);
  transform-origin: 20% 55%;
}
.wn-seal-r {
  clip-path: polygon(52% 0, 46% 30%, 55% 52%, 47% 74%, 53% 100%, 100% 100%, 100% 0);
  transform-origin: 80% 55%;
}
.wn-seal-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle at 34% 28%, #B24E68 0%, #7C2B3F 48%, #521A28 100%);
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.28),
    inset 0 -4px 7px rgba(0, 0, 0, 0.32);
}
.wn-seal-face::before {
  content: '';
  position: absolute;
  inset: 15%;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 36%, #8E3A50 0%, #61202F 72%);
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.42),
    inset 0 -1px 1px rgba(255, 255, 255, 0.14),
    0 1px 0 rgba(255, 255, 255, 0.16);
}
.wn-seal-face::after {
  content: '';
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: -40%;
  width: 34%;
  background: linear-gradient(100deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.34) 50%, rgba(255, 255, 255, 0) 100%);
  transform: translateX(-100%) skewX(-18deg);
}
.wn-seal-face svg {
  position: absolute;
  inset: 27%;
  width: 46%;
  height: 46%;
  fill: none;
  stroke: rgba(255, 226, 233, 0.92);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.45));
}
.wn-seal-blob {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #A24660 0%, #6A2236 70%);
  box-shadow: inset 0 -1px 2px rgba(0, 0, 0, 0.32), inset 0 1px 1px rgba(255, 255, 255, 0.18);
}
.wn-seal-blob-a { width: 18%; height: 18%; left: 4%; top: 12%; }
.wn-seal-blob-b { width: 24%; height: 24%; right: 1%; bottom: 10%; }
.wn-seal-crack {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: rgba(30, 6, 12, 0.7);
  stroke-width: 1.1;
  stroke-linejoin: round;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.wn-seal-crack polyline { vector-effect: non-scaling-stroke; }
/* cracked (opened before) */
.wn-env.is-opened .wn-seal-l,
.wn-seal.is-cracked .wn-seal-l { transform: translate(-3.5%, 1.5%) rotate(-4deg); }
.wn-env.is-opened .wn-seal-r,
.wn-seal.is-cracked .wn-seal-r { transform: translate(3%, 0) rotate(3deg); }
.wn-env.is-opened .wn-seal-crack,
.wn-seal.is-cracked .wn-seal-crack { opacity: 1; }
.wn-env.is-opened .wn-seal-face { filter: saturate(0.85) brightness(0.96); }

/* ---- Entrance + life on the rail (only without reduced motion) ---- */
.wn-anim .wn-env {
  opacity: 0;
  transform: translate3d(0, 30px, 0);
}
.wn-anim .wn-rail-wrap.in .wn-env {
  opacity: 1;
  transform: none;
  transition:
    opacity 0.6s ease calc(var(--i) * 70ms),
    transform 1s var(--ease-out-strong) calc(var(--i) * 70ms);
}
.wn-anim .wn-rail-wrap.in .wn-e-sheen i {
  animation: wn-sheen 1.5s var(--ease-out-strong) calc(0.55s + var(--i) * 90ms) both;
}
@keyframes wn-sheen {
  from { transform: translateX(-140%) skewX(-14deg); }
  to { transform: translateX(420%) skewX(-14deg); }
}
.wn-anim .wn-rail-wrap.is-live .wn-env:not(.is-opened) .wn-seal-face::after {
  animation: wn-glint 6.5s ease-in-out calc(1.6s + var(--i) * 0.9s) infinite;
}
@keyframes wn-glint {
  0% { transform: translateX(-100%) skewX(-18deg); opacity: 1; }
  7% { transform: translateX(420%) skewX(-18deg); opacity: 1; }
  7.01%, 100% { transform: translateX(-100%) skewX(-18deg); opacity: 0; }
}

.wn-instant *,
.wn-instant *::before,
.wn-instant *::after { transition: none !important; animation-delay: 0s !important; }

/* ---- Dots + caption ---- */
.wn-dots {
  display: flex;
  justify-content: center;
  gap: 0.42rem;
  margin-top: -0.2rem;
}
.wn-dots i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(217, 108, 138, 0.26);
  transition: transform 0.3s var(--ease-out-strong), background-color 0.3s ease;
}
.wn-dots i.is-on { background: var(--rose); transform: scale(1.4); }
.wn-caption {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.86rem;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.wn-caption strong { font-weight: 700; color: var(--rose); }

/* ---- Hover (fine pointers only) ---- */
@media (hover: hover) and (pointer: fine) {
  .wn-env:hover .wn-e { transform: translateY(-6px); }
  .wn-env:hover .wn-e-back {
    box-shadow:
      0 30px 54px -26px rgba(82, 26, 40, 0.5),
      0 3px 8px -3px rgba(82, 26, 40, 0.14),
      var(--shadow-ambient);
  }
  .wn-e-back { transition: box-shadow 0.5s var(--ease-out-strong); }
}

/* ---- Desktop: a 3-col grid, 4+3 when wide enough ---- */
@media (min-width: 768px) {
  .when { padding: 8rem 1.2rem 10rem; }
  .when .section-head { margin-bottom: 3rem; }
  .wn-rail-wrap { max-width: 1100px; margin: 0 auto; }
  .wn-rail-wrap::before,
  .wn-rail-wrap::after { display: none; }
  .wn-rail {
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.6rem;
    padding: 1rem 0 0.4rem;
    overflow: visible;
    scroll-snap-type: none;
  }
  .wn-env { flex: 0 0 calc((100% - 3.2rem) / 3); scroll-snap-align: none; }
  .wn-e { --wn-seal: 3.1rem; }
  .wn-e-label span { font-size: 1.12rem; }
  .wn-dots { display: none; }
  .wn-caption { margin-top: 2.4rem; }
}
@media (min-width: 1040px) {
  .wn-env { flex-basis: calc((100% - 4.8rem) / 4); }
  .wn-e-label span { font-size: 1.05rem; }
}

/* ============ THE READING SHEET ============ */
html.wn-lock,
html.wn-lock body { overflow: hidden; }
html.wn-lock body { position: fixed; left: 0; right: 0; width: 100%; }

.wn-sheet {
  position: fixed;
  inset: 0;
  z-index: 100;
  color: var(--maroon-paper);
  -webkit-tap-highlight-color: transparent;
}
.wn-sheet[hidden] { display: none; }
.wn-room {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 70% at 50% -10%, #7C2B3F 0%, #3E1422 46%, #1B0910 100%);
  opacity: 0;
  transition: opacity 0.45s var(--ease-out-strong);
}
.wn-room::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(90% 60% at 50% 40%, transparent 0%, rgba(27, 9, 16, 0.45) 70%, rgba(27, 9, 16, 0.85) 100%),
    linear-gradient(180deg, rgba(27, 9, 16, 0.4) 0%, transparent 20%, transparent 70%, rgba(27, 9, 16, 0.7) 100%);
}
.wn-grain {
  position: absolute;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.wn-sheet.is-open .wn-room { opacity: 1; }

/* the flying envelope */
.wn-fly {
  position: fixed;
  left: 0;
  top: 0;
  width: 300px;
  z-index: 3;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none;
}
.wn-fly[hidden] { display: none; }
.wn-fly .wn-e {
  --wn-seal: 3.6rem;
  --wn-r: 18px;
  perspective: 1100px;
  transition: none;
}
.wn-fly .wn-e-back {
  box-shadow:
    0 50px 90px -30px rgba(10, 2, 5, 0.85),
    0 8px 20px -8px rgba(10, 2, 5, 0.5);
}
.wn-fly .wn-e-num { font-size: 0.68rem; }
.wn-fly .wn-e-label span { font-size: clamp(1.15rem, 5.2vw, 1.4rem); }
.wn-fly .wn-e-label small { font-size: 0.64rem; }
.wn-e-letter {
  left: 7%;
  right: 7%;
  top: 9%;
  bottom: 7%;
  z-index: 3;
  border-radius: 6px;
  padding: 9% 9% 0;
  text-align: left;
  background: linear-gradient(180deg, #FFFDFB 0%, #FCF3EE 100%);
  box-shadow: 0 -10px 24px -14px rgba(40, 8, 16, 0.5), inset 0 0 0 1px rgba(110, 36, 54, 0.08);
  will-change: transform;
}
.wn-e-letter::before {
  content: '';
  position: absolute;
  inset: 5%;
  border: 1px solid rgba(110, 36, 54, 0.13);
  border-radius: 3px;
}
.wn-e-letter small {
  display: block;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--rose);
  margin-bottom: 0.3rem;
}
.wn-e-letter b {
  display: block;
  font-size: 0.98rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 0.7rem;
}
.wn-e-letter i {
  display: block;
  height: 2px;
  margin: 0 0 0.42rem;
  border-radius: 2px;
  background: rgba(61, 44, 51, 0.16);
}
.wn-e-letter i:nth-child(4) { width: 86%; }
.wn-e-letter i:nth-child(5) { width: 94%; }
.wn-e-letter i:nth-child(6) { width: 72%; }
.wn-e-letter i:nth-child(7) { width: 48%; }

/* the reading column */
.wn-scroll {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  scrollbar-width: none;
  padding:
    calc(max(env(safe-area-inset-top), 1rem) + 4rem)
    1rem
    calc(max(env(safe-area-inset-bottom), 1rem) + 4rem);
  transform-origin: 50% 0;
  opacity: 0;
  pointer-events: none;
  will-change: transform;
}
.wn-scroll::-webkit-scrollbar { display: none; }
.wn-sheet.is-read .wn-scroll { opacity: 1; pointer-events: auto; }

.wn-paper {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
  border-radius: 1.4rem;
  color: var(--ink);
  background:
    radial-gradient(120% 40% at 50% 0%, #FFFFFF 0%, rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, #FFFDFB 0%, #FCF3EE 100%);
  box-shadow:
    0 60px 120px -36px rgba(5, 1, 2, 0.9),
    0 0 0 1px rgba(255, 255, 255, 0.35),
    inset 0 1px 1px rgba(255, 255, 255, 0.95);
  transform-origin: 50% 0;
  outline: none;
  will-change: transform;
}
.wn-paper::before {
  content: '';
  position: absolute;
  inset: 0.7rem;
  border: 1px solid rgba(110, 36, 54, 0.15);
  border-radius: calc(1.4rem - 0.55rem);
  pointer-events: none;
}
.wn-paper::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.05;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.wn-paper-in {
  position: relative;
  z-index: 1;
  padding: clamp(2.3rem, 7vw, 3.4rem) clamp(1.5rem, 6vw, 3.2rem) clamp(2rem, 6vw, 2.8rem);
}
/* the seal she cracked, resting on the corner of the paper */
.wn-p-seal {
  position: absolute;
  top: 1.15rem;
  right: 1.35rem;
  width: 2.5rem;
  height: 2.5rem;
  z-index: 2;
  pointer-events: none;
}
.wn-p-seal .wn-seal {
  --wn-seal: 2.5rem;
  position: absolute;
  left: 50%;
  top: 50%;
  transform: rotate(9deg);
}
.wn-p-kick {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--rose);
}
.wn-p-num { color: var(--ink-soft); opacity: 0.7; font-variant-numeric: tabular-nums; letter-spacing: 0.16em; }
.wn-p-title {
  margin-top: 0.55rem;
  font-size: clamp(1.7rem, 7vw, 2.3rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
  padding-right: 2.6rem;
}
.wn-p-orn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1.4rem 0 1.6rem;
  color: var(--rose);
}
.wn-p-orn svg { width: 0.8rem; height: 0.8rem; fill: currentColor; }
.wn-p-orn span {
  width: 3rem;
  height: 1px;
  background: linear-gradient(270deg, transparent, rgba(217, 108, 138, 0.55));
}
.wn-p-orn span:last-child { background: linear-gradient(90deg, rgba(217, 108, 138, 0.55), transparent); flex: 0 0 5rem; }
.wn-p-salute {
  font-size: clamp(1.22rem, 5vw, 1.5rem);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.01em;
  margin-bottom: 0.9rem;
}
.wn-p-body p {
  font-size: clamp(1.04rem, 4.1vw, 1.2rem);
  font-weight: 400;
  line-height: 1.95;
  color: var(--ink);
  text-wrap: pretty;
  margin-bottom: 1.1em;
}
.wn-p-body p:last-child { margin-bottom: 0; }
.wn-p-ar {
  margin-top: 1.7rem;
  font-size: clamp(1.2rem, 4.9vw, 1.45rem);
  font-weight: 700;
  line-height: 1.9;
  color: var(--maroon);
  text-align: right;
}
.wn-p-sign {
  margin-top: 1.4rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--rose);
  line-height: 1.6;
}
.wn-p-name { display: inline-block; }
.wn-p-line {
  display: block;
  width: min(11rem, 60%);
  height: 0.85rem;
  margin-top: 0.15rem;
  overflow: visible;
  fill: none;
  stroke: var(--rose-soft);
  stroke-width: 2;
  stroke-linecap: round;
}
.wn-p-line path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

/* ---- Ink: masked words rise once the paper has landed ---- */
.wn-w {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding: 0.1em 0.03em 0.2em;
  margin: -0.1em -0.03em -0.2em;
}
.wn-p-ar .wn-w { padding: 0.18em 0.06em 0.3em; margin: -0.18em -0.06em -0.3em; }
.wn-wi {
  display: inline-block;
  transform: translate3d(0, 110%, 0);
}
.wn-paper.is-ink .wn-wi {
  transform: none;
  transition: transform 0.62s var(--ease-out-strong) calc(var(--i, 0) * 28ms);
}
.wn-paper.is-ink .wn-p-line path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 1.1s var(--ease-in-out-strong) var(--wn-sign-delay, 3s);
}

/* ---- Voice note ---- */
.wn-voice {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  margin-top: 1.9rem;
  padding: 0.8rem 1rem 0.8rem 0.8rem;
  border-radius: 1.1rem;
  background: rgba(110, 36, 54, 0.045);
  border: 1px solid rgba(110, 36, 54, 0.12);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.6s ease, transform 0.75s var(--ease-out-strong);
}
.wn-voice[hidden] { display: none; }
.wn-voice.is-in { opacity: 1; transform: none; }
.wn-voice-btn {
  flex: 0 0 3rem;
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 28%, #B24E68 0%, #7C2B3F 48%, #521A28 100%);
  color: #FFE1E8;
  cursor: pointer;
  box-shadow: 0 12px 24px -10px rgba(82, 26, 40, 0.7), inset 0 1px 2px rgba(255, 255, 255, 0.25), inset 0 -3px 5px rgba(0, 0, 0, 0.25);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s var(--ease-out-strong);
}
.wn-voice-btn:active { transform: scale(0.94); }
.wn-voice-btn:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; }
.wn-voice-btn svg { grid-area: 1 / 1; width: 1.15rem; height: 1.15rem; }
.wn-voice-play { fill: currentColor; stroke: none; transform: translateX(1px); }
.wn-voice-pause { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; opacity: 0; }
.wn-voice.is-playing .wn-voice-play { opacity: 0; }
.wn-voice.is-playing .wn-voice-pause { opacity: 1; }
.wn-voice-meta { flex: 1; min-width: 0; display: block; }
.wn-voice-title { display: block; font-size: 0.95rem; font-weight: 700; color: var(--maroon); line-height: 1.3; }
.wn-voice-line {
  display: block;
  height: 2px;
  margin: 0.55rem 0 0.4rem;
  border-radius: 2px;
  background: rgba(110, 36, 54, 0.14);
  overflow: hidden;
}
.wn-voice-line i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--rose-soft), var(--rose) 60%, var(--maroon-soft));
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.wn-voice-time {
  display: block;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.wn-voice-time b { font-weight: 700; color: var(--maroon); }

/* ---- Chrome: top bar, close, hint ---- */
.wn-top {
  position: absolute;
  left: 0;
  right: 0;
  top: max(env(safe-area-inset-top), 1rem);
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.1rem;
  opacity: 0;
  transition: opacity 0.35s ease;
  pointer-events: none;
}
.wn-sheet.is-open .wn-top { opacity: 1; transition-delay: 0.4s; }
.wn-top > * { pointer-events: auto; }
.wn-top-kick {
  transition: opacity 0.3s ease, transform 0.4s var(--ease-out-strong);
}
.wn-sheet.is-scrolled .wn-top-kick { opacity: 0; transform: translateY(-8px); pointer-events: none; }
.wn-sheet.is-scrolled .wn-x {
  background: rgba(61, 44, 51, 0.72);
  border-color: rgba(255, 249, 244, 0.1);
  box-shadow: 0 10px 24px -10px rgba(30, 6, 12, 0.6);
}
.wn-top-kick {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 249, 244, 0.55);
}
.wn-top-kick svg {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  fill: none;
  stroke: var(--rose-soft);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.wn-top-kick em {
  font-style: normal;
  font-weight: 500;
  font-size: 0.86rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--maroon-paper);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wn-x {
  flex-shrink: 0;
  width: 2.7rem;
  height: 2.7rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 249, 244, 0.16);
  background: rgba(255, 249, 244, 0.08);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  color: var(--maroon-paper);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.16s var(--ease-out-strong);
}
.wn-x:active { transform: scale(0.94); }
.wn-x:focus-visible { outline: 2px solid var(--rose-soft); outline-offset: 3px; }
.wn-x svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (hover: hover) and (pointer: fine) {
  .wn-x:hover { background: rgba(255, 249, 244, 0.18); }
  .wn-hint { display: none; }
}
.wn-hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(max(env(safe-area-inset-bottom), 1rem) + 0.5rem);
  z-index: 1; /* under the paper: only shows where the room is bare */
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: rgba(255, 249, 244, 0.45);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.wn-sheet.is-read .wn-hint { opacity: 1; transition-delay: 1.4s; }
.wn-sheet.was-dragged .wn-hint { opacity: 0; transition-delay: 0s; }

@media (min-width: 768px) {
  .wn-scroll {
    padding-top: calc(max(env(safe-area-inset-top), 1rem) + 5rem);
    padding-bottom: 5rem;
  }
  .wn-top { padding: 0 1.6rem; }
  .wn-p-body p { line-height: 2.05; }
}

/* ---- Reduced motion: the room fades, the text is simply there ---- */
.wn-reduced .wn-room { transition: opacity 0.3s ease; }
.wn-reduced .wn-wi { transform: none !important; transition: none !important; }
.wn-reduced .wn-p-line path { stroke-dashoffset: 0 !important; transition: none !important; }
.wn-reduced .wn-voice { transition: none; }
.wn-reduced .wn-hint,
.wn-reduced .wn-top { transition: none; }
@media (prefers-reduced-motion: reduce) {
  .wn-e,
  .wn-e-count,
  .wn-dots i { transition: none; }
  .wn-e-sheen,
  .wn-seal-face::after { display: none; }
}
