/* A winter night, ivory paper, red wax. Colours for the envelope and wax come from content.js. */
:root {
  --night: #16100e;      /* the table at midnight */
  --night-2: #241b18;    /* one step lighter: the voice-note strips */
  --night-3: #2e2420;
  --glow: #e8e3dc;       /* text on the night */
  --glow-soft: #bfae9a;  /* secondary text on the night */
  --paper: #f2ece2;      /* the letter */
  --paper-2: #e8e0d4;    /* slips, the postcard */
  --ink: #2a211e;        /* text on paper */
  --ink-soft: #6a5c52;   /* secondary text on paper */
  --envelope: #e7dfd2;
  --envelope-flap: #eee8de;
  --envelope-in: #cbbca5;
  --wax: #8a2329;
  --wax-light: #ad6569;
  --wax-dark: #501418;

  /* A posh script for titles and names, a softer cursive for reading. */
  --script: "Parisienne", "Snell Roundhand", "Apple Chancery", cursive;
  --serif: "Dancing Script", "Snell Roundhand", "Segoe Script", cursive;
  --step-small: 1rem;                                       /* 16px */
  --step-body: clamp(1.3125rem, 1.25rem + 0.3vw, 1.4375rem); /* 21–23px */
  --step-lead: clamp(1.625rem, 1.45rem + 0.8vw, 2rem);       /* 26–32px */
  --step-head: clamp(2.75rem, 2rem + 3vw, 4.25rem);          /* 44–68px */
  --margin: clamp(16px, 5vw, 32px);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* paper grain */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .22 0 0 0 0 .14 0 0 0 .45 -.17'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html {
  background: var(--night);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none; /* a pull-to-refresh would reload the envelope */
}

body {
  margin: 0;
  min-height: 100svh;
  background: var(--night);
  color: var(--glow);
  font: 400 var(--step-body)/1.5 var(--serif);
  -webkit-font-smoothing: antialiased;
  font-synthesis: none;
}
body.no-scroll { overflow: hidden; }

h1, h2, h3 { margin: 0; font-family: var(--script); font-weight: 400; letter-spacing: 0; line-height: 1.1; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; }
button, [role="button"] { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

/* Photos of his handwriting, when content.js has them */
.ink { display: block; max-width: 100%; height: auto; pointer-events: none; -webkit-user-select: none; user-select: none; }

/* ---------- The envelope, on a winter night ---------- */

.landing {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  gap: clamp(22px, 4.5vh, 44px);
  padding: calc(env(safe-area-inset-top) + 24px) var(--margin) calc(env(safe-area-inset-bottom) + 24px);
  overflow: hidden;
  background: var(--night);
  text-align: center;
  transition: opacity 0.55s ease, transform 0.9s ease;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.fonts-pending .landing { opacity: 0; animation: failsafe-show 0.6s ease 3s forwards; }
@keyframes failsafe-show { to { opacity: 1; } }
.landing.gone { opacity: 0; transform: scale(1.04); pointer-events: none; }

.night {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 140%; /* taller than the screen and anchored low, so the lamp glows up and left of the title */
  object-fit: cover;
  object-position: 42% 40%;
  filter: none;
  pointer-events: none;
  -webkit-user-drag: none;
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift { from { transform: scale(1.02); } to { transform: scale(1.09) translate(-1%, -1%); } }
.snow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

.landing-title { position: relative; font-size: calc(var(--step-head) * 1.1); color: var(--glow); transition: opacity 0.5s ease; }
.landing.opening .landing-title { opacity: 0; }

.envelope {
  position: relative;
  width: min(84vw, 420px);
  aspect-ratio: 1.5;
  perspective: 1400px;
}
.env-back {
  position: absolute;
  inset: 0;
  background: var(--envelope-in);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.55), 0 3px 6px rgba(0, 0, 0, 0.35); /* taste-skill-ignore: a paper envelope lying on a table */
}
.env-letter {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 6%;
  bottom: 7%;
  z-index: 3;
  padding: 7% 8%;
  background: var(--paper) var(--grain);
  color: var(--ink);
  text-align: left;
  transition: transform 1s var(--ease-out);
}
.env-letter span { display: block; margin-bottom: 5%; font-family: var(--script); font-size: clamp(1.15rem, 5.2vw, 1.6rem); line-height: 1.1; }
.env-letter p { margin: 0; white-space: pre-line; font-size: clamp(0.8rem, 3.4vw, 1rem); line-height: 1.45; color: var(--ink); }
.envelope.letter-out .env-letter { transform: translateY(-62%); }

.env-pocket { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; }
.env-pocket .p-left { fill: #e3d8c5; }
.env-pocket .p-right { fill: #e0d4c0; }
.env-pocket .p-bottom { fill: var(--envelope); }
.env-pocket .p-fold { fill: none; stroke: rgba(60, 40, 20, 0.22); stroke-width: 1.2; vector-effect: non-scaling-stroke; }

.env-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 60%;
  z-index: 5;
  transform-origin: 50% 0;
  transition: transform 0.85s cubic-bezier(0.45, 0, 0.2, 1);
  filter: drop-shadow(0 2px 2.5px rgba(40, 25, 10, 0.32)); /* taste-skill-ignore: the flap's edge over the pocket */
}
.env-flap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--envelope-flap) var(--grain);
  clip-path: polygon(0 0, 100% 0, 53% 96%, 50% 100%, 47% 96%);
}
.envelope.open .env-flap { transform: rotateX(180deg); }
.envelope.flap-behind .env-flap { z-index: 2; filter: none; }
.envelope.flap-behind .env-flap::before { background-color: var(--envelope-in); }

/* His handwriting on the envelope, only when a photo of it exists */
.env-name { position: absolute; z-index: 6; left: 8%; bottom: 9%; margin: 0; transition: opacity 0.25s ease; }
.env-name:empty { display: none; }
.env-name .ink { height: clamp(2.2rem, 9vw, 3.2rem); width: auto; max-width: none; transform: rotate(-4deg); }
.envelope.open .env-name { opacity: 0; }

/* ---------- Wax seal ---------- */

.seal {
  position: absolute;
  z-index: 7;
  left: 50%;
  top: 57%;
  width: 26%;
  aspect-ratio: 1;
  margin: -13% 0 0 -13%; /* half its width, so it centres on the flap tip */
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  filter: drop-shadow(0 3px 3px rgba(20, 4, 4, 0.45)); /* taste-skill-ignore: raised wax */
}
.seal:focus-visible { outline: 2px solid var(--glow); outline-offset: 6px; border-radius: 50%; }
.seal .half { position: absolute; inset: 0; display: block; transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.4s; }
.seal .half > * { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.seal .crackline { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.seal .crackline polyline {
  fill: none;
  stroke: rgba(25, 4, 4, 0.75);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
  stroke-dasharray: 130;
  stroke-dashoffset: 130;
  transition: stroke-dashoffset 0.09s ease-in;
}
.seal.cracking .crackline polyline { stroke-dashoffset: 0; }
.seal.broken .crackline { opacity: 0; transition: opacity 0.15s; }

/* The halves burst apart, slow to an apex, then fall. */
.landing .seal.broken .half.l { animation: fall-l 1.15s linear forwards; }
.landing .seal.broken .half.r { animation: fall-r 1.2s linear forwards; }
@keyframes fall-l {
  0% { transform: none; animation-timing-function: cubic-bezier(0.12, 0.7, 0.35, 1); }
  18% { transform: translate(-14%, -7%) rotate(-14deg); opacity: 1; animation-timing-function: cubic-bezier(0.5, 0, 0.85, 0.45); }
  100% { transform: translate(-75%, 460%) rotate(-85deg); opacity: 0; }
}
@keyframes fall-r {
  0% { transform: none; animation-timing-function: cubic-bezier(0.12, 0.7, 0.35, 1); }
  18% { transform: translate(13%, -6%) rotate(11deg); opacity: 1; animation-timing-function: cubic-bezier(0.5, 0, 0.85, 0.45); }
  100% { transform: translate(62%, 440%) rotate(100deg); opacity: 0; }
}

.seal.nope { animation: nope 0.5s ease; }
@keyframes nope {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-7deg); }
  45% { transform: rotate(6deg); }
  70% { transform: rotate(-3deg); }
}

.seal-ring {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 57%;
  width: 26%;
  aspect-ratio: 1;
  margin: -13% 0 0 -13%;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(236, 229, 218, 0.55); /* taste-skill-ignore: the pulsing ring, not a shadow */
  opacity: 0;
  pointer-events: none;
}
.landing.ready .seal-ring { animation: ring 2.8s ease-out infinite 0.6s; }
.landing.opening .seal-ring { display: none; }
@keyframes ring {
  0% { transform: scale(0.96); opacity: 0.5; }
  70%, 100% { transform: scale(1.4); opacity: 0; }
}

/* On a return visit the seal is already broken; one tap opens it again */
.seal.was-broken .half.l { transform: translate(-10%, 2%) rotate(-10deg); }
.seal.was-broken .half.r { transform: translate(10%, 2%) rotate(9deg); }
.seal.was-broken .crackline { opacity: 0; }
.landing.again .seal-ring { display: none; }
.landing.again.opening .seal { opacity: 0; transition: opacity 0.25s ease; }

/* Fairy lights in the jar, twinkling gently */
.bulb { animation: twinkle var(--t, 3s) ease-in-out infinite alternate; animation-delay: var(--dl, 0s); }
@keyframes twinkle { from { opacity: 1; } to { opacity: 0.45; } }

/* ---------- Under the envelope ---------- */

.below {
  position: relative;
  min-height: 150px; /* at midnight app.js holds it at the countdown's height so the envelope doesn't jump */
  max-width: 30ch;
  transition: opacity 0.4s ease;
}
.landing.opening .below { opacity: 0; }
.lead { font-size: var(--step-lead); line-height: 1.2; }
.count { margin-top: 6px; color: var(--glow); }
.count b { display: block; font-family: var(--script); font-size: clamp(4rem, 3rem + 5vw, 6rem); font-weight: 400; line-height: 1; }
.count span { display: block; margin-top: 6px; font-size: var(--step-lead); line-height: 1.2; text-wrap: balance; }
.go-line { margin-top: 4px; font-size: var(--step-lead); line-height: 1.2; }
.small { margin-top: 10px; font-size: var(--step-small); color: var(--glow-soft); }
.nudge { min-height: 1.6em; margin-top: 12px; color: var(--glow-soft); }

/* ---------- Inside ---------- */

.page {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 28px) var(--margin) 0;
}
.page.shown { animation: page-in 0.9s 0.4s var(--ease-out) both; }
@keyframes page-in { from { opacity: 0; } }

/* Each part of a section rises in as it arrives, a beat after the one before. */
[data-rise] { opacity: 0; transform: translateY(20px); transition: opacity 0.7s ease, transform 0.8s var(--ease-out); transition-delay: var(--d, 0ms); }
[data-rise].in { opacity: 1; transform: none; }

.page h2 { font-size: var(--step-head); color: var(--glow); }
.page .intro { margin-top: 14px; max-width: 34ch; color: var(--glow); }
.page > section, .postcard { margin-top: clamp(96px, 16vw, 168px); }

/* Keep line breaks from content.js ("\n\n" = a new paragraph). */
.letter-body, .note-text, .slip p, .ps, .ow-note { white-space: pre-line; }

/* The letter: a sheet of deckle-edged paper */
.letter {
  position: relative;
  padding: clamp(28px, 7vw, 56px) clamp(22px, 6vw, 56px) clamp(36px, 8vw, 64px);
  background: var(--paper) var(--grain);
  color: var(--ink);
  clip-path: polygon(0 4px, 6% 1px, 13% 5px, 21% 2px, 30% 6px, 38% 1px, 47% 4px, 55% 2px, 63% 6px, 71% 1px, 80% 5px, 88% 2px, 95% 5px, 100% 1px,
    100% calc(100% - 3px), 94% calc(100% - 6px), 86% calc(100% - 1px), 77% calc(100% - 5px), 69% calc(100% - 2px), 60% calc(100% - 6px), 51% calc(100% - 1px), 42% calc(100% - 4px), 33% calc(100% - 2px), 24% calc(100% - 6px), 16% calc(100% - 1px), 8% calc(100% - 5px), 0 calc(100% - 2px));
}
.date { margin-top: 28px; text-align: right; font-size: var(--step-small); color: var(--ink-soft); }
.letter .greet { font-size: clamp(2.5rem, 1.9rem + 2.6vw, 3.5rem); color: var(--ink); }
.letter-body { margin-top: 18px; color: var(--ink); line-height: 1.65; }

/* The jar */
.jar-section { text-align: left; }
.jar {
  position: relative;
  display: block;
  width: min(74vw, 300px);
  aspect-ratio: 200 / 280;
  margin: 28px auto 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform-origin: 50% 94%; /* squash onto its base */
}
.jar:focus-visible { outline: 2px solid var(--glow); outline-offset: 8px; }
.jar-layer { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.cork-layer { z-index: 3; }
.lip-layer { z-index: 4; }
#lid, #jar-note, #pile { transform-box: fill-box; transform-origin: center; }

/* A paper label stuck on the glass */
.jar-label {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 53%;
  width: max-content;
  max-width: 62%;
  padding: 10px 14px 11px;
  background: var(--paper) var(--grain);
  color: var(--ink);
  transform: translateX(-50%) rotate(-1.5deg);
  font-family: var(--script);
  font-size: clamp(1.15rem, 4.8vw, 1.35rem);
  border-radius: 999px;
  line-height: 1.2;
  text-align: center;
}
.jar-label .ink { width: 100%; }
.jar-label:has(.ink) { width: 54%; } /* a photo's natural width would stretch the paper */

.jar-count { margin-top: 18px; text-align: center; font-size: var(--step-small); color: var(--glow-soft); }

/* The notes she has found, standing in a row like slips of paper */
.found { margin-top: 48px; }
.found h3 { font-size: var(--step-lead); color: var(--glow); }
.slips {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 16px calc(-1 * var(--margin)) 0;
  padding: 6px var(--margin) 18px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 var(--margin);
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.slips::-webkit-scrollbar { display: none; }
.slip {
  flex: none;
  width: min(62vw, 240px);
  min-height: var(--h, 200px);
  padding: 18px 18px 22px;
  background: var(--paper-2) var(--grain);
  color: var(--ink);
  scroll-snap-align: start;
}
.slip:nth-child(3n + 2) { transform: rotate(1.4deg); }
.slip:nth-child(5n + 4) { transform: rotate(-1.2deg); }
.slip .rule { display: block; margin: 0 0 8px; color: var(--wax); font-size: var(--step-small); }
.slip p { font-size: 1.15rem; line-height: 1.4; }
.slip.new { animation: slip-in 0.6s var(--ease-out); }
@keyframes slip-in { from { opacity: 0; transform: translateY(-18px) rotate(-3deg); } }

/* A few photographs of them, each a print with its strip attached */
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 28px; }
.photo { margin: 0; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.photo figcaption { display: flex; justify-content: space-between; gap: 8px; padding: 10px 12px 12px; background: var(--paper) var(--grain); color: var(--ink); font-size: var(--step-small); font-variant-numeric: tabular-nums; }
.photo figcaption span:last-child { color: var(--ink-soft); }
.photo:nth-child(4n + 2) figcaption, .photo:nth-child(4n + 3) figcaption { background: var(--night-3); color: var(--glow); }
.photo:nth-child(4n + 2) figcaption span:last-child, .photo:nth-child(4n + 3) figcaption span:last-child { color: var(--glow-soft); }
@media (min-width: 720px) { .photo-grid { grid-template-columns: repeat(3, 1fr); } }

/* Film, as a print with its strip attached */
.film .print { margin: 28px 0 0; }
.frame {
  --arn: 1.7778;
  position: relative;
  width: 100%;
  aspect-ratio: var(--arn);
  max-height: 78svh;
  margin: 0 auto;
  overflow: hidden;
  background: #0d0908;
}
.frame video { display: block; width: 100%; height: 100%; object-fit: contain; background: #0d0908; }
.missing {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  text-align: center;
  color: var(--glow-soft);
}
.strip {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 16px;
  padding: 14px 16px 16px;
  background: var(--paper) var(--grain);
  color: var(--ink);
  font-size: var(--step-small);
  font-variant-numeric: tabular-nums;
}
.strip span:nth-child(even) { text-align: right; color: var(--ink-soft); }
.strip span:first-child { font-family: var(--script); font-size: 1.35rem; line-height: 1; }

/* Open when… */
.ow { container-type: inline-size; }
.ow-title { font-size: 21cqw !important; line-height: 1 !important; white-space: nowrap; }
.ow-list { display: grid; gap: 6px; margin-top: 28px; }
.ow-item { background: var(--night-2); transition: background 0.3s ease, opacity 0.7s ease var(--d, 0ms), transform 0.8s var(--ease-out) var(--d, 0ms); }
.ow-item.open { background: var(--night-3); }
.ow-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 68px;
  padding: 10px 14px 10px 20px;
  border: 0;
  background: none;
  text-align: left;
  font-size: var(--step-body);
  cursor: pointer;
}
.ow-bar:focus-visible { outline: 2px solid var(--glow); outline-offset: -2px; }
.ow-bar .seal { position: relative; left: auto; top: auto; flex: none; width: 46px; margin: 0; pointer-events: none; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5)); } /* taste-skill-ignore: raised wax */
.ow-bar .seal .crackline polyline { stroke-width: 2.2; }
.ow-bar .seal.was-broken .half.l { transform: translate(-10%, 2%) rotate(-10deg); }
.ow-bar .seal.was-broken .half.r { transform: translate(10%, 2%) rotate(9deg); }
.ow-bar .seal.was-broken .crackline { opacity: 0; }
.ow-panel { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.45s var(--ease-out); }
.ow-item.open .ow-panel { grid-template-rows: 1fr; }
.ow-panel > div { overflow: hidden; }
.ow-inner { padding: 0 20px 22px; }
.ow-note { margin-bottom: 16px; color: var(--glow-soft); }
.player { display: flex; align-items: center; gap: 14px; }
.play {
  flex: none;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 47% 53% 50% 48% / 52% 46% 54% 48%;
  background: var(--wax);
  cursor: pointer;
  transition: transform 0.12s var(--ease-out);
}
.play:active { transform: scale(0.94); }
.play svg { width: 22px; height: 22px; fill: var(--glow); }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }
.track { position: relative; flex: 1; height: 44px; cursor: pointer; touch-action: pan-y; }
.track::before, .track .fill { content: ""; position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; }
.track::before { right: 0; background: rgba(241, 230, 212, 0.16); }
.track .fill { width: 0; background: var(--glow); }
.time { flex: none; min-width: 5.6em; text-align: right; font-size: var(--step-small); font-variant-numeric: tabular-nums; color: var(--glow-soft); }
.ow-missing { color: var(--glow-soft); }

/* The back of the postcard */
.postcard { position: relative; margin-left: calc(-1 * var(--margin)); margin-right: calc(-1 * var(--margin)); }
.scallops { display: block; width: 100%; height: 14px; }
.scallops path { fill: var(--paper-2); }
.card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px 20px;
  padding: 30px var(--margin) calc(env(safe-area-inset-bottom) + 28px);
  background: var(--paper-2) var(--grain);
  color: var(--ink);
}
.stamp { grid-column: 2; grid-row: 1; align-self: start; margin: 0; width: clamp(64px, 18vw, 96px); padding: 5px; background: #fbf6ec; rotate: 2deg; }
.stamp img { pointer-events: none; }
.stamp img { display: block; width: 100%; height: auto; }
.message { grid-column: 1; grid-row: 1; }
.signoff { font-size: var(--step-lead) !important; color: var(--ink) !important; }
.from { margin-top: 6px; font-family: var(--script); font-size: clamp(2.25rem, 1.6rem + 3vw, 3.25rem); line-height: 1.1; color: var(--ink); }
.from .ink { display: inline-block; height: 3.4rem; width: auto; vertical-align: middle; }
.ps { margin-top: 18px; max-width: 32ch; color: var(--ink); }
.address { grid-column: 1 / -1; margin: 0; display: grid; gap: 10px; }
.address div { display: grid; grid-template-columns: 5.5em 1fr; gap: 12px; }
.address dt { color: var(--ink-soft); }
.address dd { margin: 0; }

/* ---------- A note from the jar ---------- */

.note-stage { position: fixed; inset: 0; z-index: 60; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.note-backdrop { position: absolute; inset: 0; background: rgba(10, 6, 5, 0.9); opacity: 0; }
.note-pos { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; pointer-events: none; }
.note {
  --w: min(84vw, 340px, calc((100svh - 200px) / 1.18));
  --roll: 22px;
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 1.18);
  transform-origin: 50% 50%;
  will-change: transform;
  outline: none;
}
.note-paper { position: absolute; inset: 0; color: var(--ink); clip-path: inset(50% 0 50% 0); }
.note-sheet {
  position: absolute;
  inset: 0;
  background: var(--note-paper, var(--paper)) var(--grain);
  clip-path: polygon(0 3px, 9% 1px, 18% 4px, 29% 1px, 41% 3px, 52% 0, 63% 3px, 74% 1px, 86% 4px, 100% 1px,
    calc(100% - 1px) 30%, 100% 62%, calc(100% - 2px) 100%, 88% calc(100% - 3px), 76% calc(100% - 1px), 63% calc(100% - 4px), 50% calc(100% - 1px), 37% calc(100% - 3px), 24% calc(100% - 1px), 12% calc(100% - 4px), 0 calc(100% - 1px), 1px 66%, 0 33%);
}
.note-content { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 13% 11% 11%; }
.note-text { margin: auto 0; font-size: clamp(1.6rem, 7vw, 1.9rem); line-height: 1.35; }
.note-sign { text-align: right; font-family: var(--script); font-size: 1.6rem; color: var(--wax); }
.roll { position: absolute; left: -1px; right: -1px; top: calc(50% - var(--roll) / 2); width: calc(100% + 2px); height: var(--roll); border-radius: calc(var(--roll) / 2); overflow: hidden; }
.tie { position: absolute; left: calc(50% - 5px); top: calc(50% - var(--roll) / 2 - 2px); width: 10px; height: calc(var(--roll) + 4px); background: var(--wax); border-radius: 2px; }
.note-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(26px + env(safe-area-inset-bottom));
  padding: 0 var(--margin);
  text-align: center;
  color: var(--glow);
  opacity: 0;
  pointer-events: none;
}
.note-meta small { font-size: var(--step-small); color: var(--glow-soft); }

/* Particles (wax crumbs, midnight flecks) */
.fx { position: fixed; inset: 0; z-index: 70; width: 100%; height: 100%; pointer-events: none; }

.noscript { position: fixed; inset: 0; z-index: 99; display: grid; place-items: center; margin: 0; padding: 24px; background: var(--night); color: var(--glow); text-align: center; }

@media (hover: hover) and (pointer: fine) {
  .ow-bar:hover { background: rgba(241, 230, 212, 0.04); }
}

@media (min-width: 720px) {
  .card { grid-template-columns: 1fr 1fr auto; padding-left: 48px; padding-right: 48px; }
  .address { grid-column: 2; grid-row: 1; align-self: end; }
  .stamp { grid-column: 3; }
}

@media (prefers-reduced-motion: reduce) {
  .night { animation: none; }
  .landing .seal.broken .half.l, .landing .seal.broken .half.r { animation: none; opacity: 0; }
  .landing.gone { transform: none; }
  [data-rise] { transform: none; transition: opacity 0.6s ease; }
  .landing.ready .seal-ring { animation: none; }
  .slip.new { animation: none; }
  .bulb { animation: none; }
}
