/* Palette taken from the couple's engagement shoot: ivory piña cloth and champagne embroidery,
   on a warm linen ground. */
:root {
  --paper: #f6f0e6;
  --linen: #b9ad9d;
  --gold: #b08a52;
  --ink: #3b2e25;
  --ink-soft: #6f5c4b;

  /* Classic serif for the spaced capitals and body; a high-contrast italic for names and headings */
  --serif: "Cormorant Garamond", Garamond, Georgia, serif;
  --display: "Playfair Display", Didot, Georgia, serif;

  --vh: 100vh;
  --col: min(100vw, 480px);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
}

@supports (height: 100svh) {
  :root { --vh: 100svh; }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--linen);
}

html.is-locked,
html.is-locked body { overflow: hidden; }

body {
  margin: 0;
  min-height: var(--vh);
  color: var(--ink);
  font-family: var(--serif);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Linen tablecloth the envelope and cards rest on; fixed so it never stretches with the page.
   Images hidden under the closed envelope wait for .is-ready, so the envelope's own layers load first. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--linen) center / cover;
}

.is-ready::before { background-image: url("assets/linen.jpg"); }

/* ---------- Cards ---------- */

.sheet {
  position: relative;
  z-index: 1;
  /* Letterpress: the upper wall of each impression falls into shadow and the lower lip catches the light */
  text-shadow:
    0 -.5px .4px rgba(45, 28, 12, .3),
    0 1px .4px rgba(255, 255, 255, .9);
  width: var(--col);
  margin: 0 auto;
  container-type: inline-size;
  box-shadow: 0 0 90px rgba(20, 14, 8, .35);
}

/* Each card is a photographed sheet of the envelope's cotton stock, blind-embossed with peonies in a different place */
.page {
  position: relative;
  min-height: var(--vh);
  background: var(--paper) center / cover no-repeat;
}

.page--cover {
  /* Anchored to the bottom left so any crop falls on the top and right, pushing the peonies further into their corner */
  background-position: left bottom;
}

.is-ready .page--cover { background-image: url("assets/card-invitation.jpg"); }

/* Shorter screens crop a little more off the top so the peonies stay clear of the first line */
@media (max-height: 800px) {
  .page--cover { background-size: max(100%, calc(var(--vh) * .6)) auto; }
}

@media (max-height: 700px) {
  .page--cover { background-size: max(100%, calc(var(--vh) * .66)) auto; }
}

.page--details {
  background-image: url("assets/card-details.jpg");
  background-position: center bottom;
}

.page--closing {
  background-image: url("assets/card-closing.jpg");
  background-position: center top;
}

/* Each following card's edge casts a soft shadow, as if laid over the one before */
.rest .page {
  box-shadow:
    0 -1px 0 rgba(120, 95, 60, .14),
    0 -16px 28px -20px rgba(60, 40, 20, .45);
}

.caps {
  margin: 0;
  padding-left: .3em;
  font-size: max(11.5px, min(3.3cqw, 14.5px));
  font-weight: 500;
  letter-spacing: .3em;
  line-height: 1.75;
  font-variant-numeric: lining-nums;
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* ---------- Cover: the first full screen ---------- */

.page--cover {
  min-height: max(var(--vh), 600px);
  transform-origin: 50% 50%;
}

.cover-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(5px, 1.3svh, 14px);
  min-height: max(var(--vh), 600px);
  padding: 28px 32px calc(10px + env(safe-area-inset-bottom));
  text-align: center;
}

/* The cue sits in the card's own column, below the button, so the two can never meet;
   the space above the headline and above the cue is shared equally */
.intro {
  margin-top: auto;
  letter-spacing: .24em;
}

.cover-inner .cue {
  position: static;
  margin: auto 0 0;
}

.names {
  margin: clamp(2px, .8svh, 8px) 0 0;
  font-family: var(--display);
  font-size: min(10.4cqw, 6svh, 46px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.15;
  white-space: nowrap;
  color: var(--ink);
}

/* Large type sits deeper in the paper */
.names,
.num,
.venue,
.sentiment {
  text-shadow:
    0 -1px .8px rgba(45, 28, 12, .3),
    0 1.4px .5px rgba(255, 255, 255, .92);
}

/* Cameo: an oval portrait between the names and the date */
.medallion-frame {
  position: relative;
  flex: none;
  width: min(56cqw, calc((var(--vh) - 400px) * .75), 250px);
  aspect-ratio: 3 / 4;
  margin: clamp(10px, 2svh, 20px) 0;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Two foil-stamped rings around the oval: a foil fill masked down to its padding */
.medallion-frame::before,
.medallion-frame::after {
  content: "";
  position: absolute;
  padding: 1.2px;
  border-radius: 50%;
  background: var(--gold) center / cover;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

.is-ready .medallion-frame::before,
.is-ready .medallion-frame::after { background-image: url("assets/foil.jpg"); }

.medallion-frame::before { inset: -13px; }
.medallion-frame::after { inset: -5px; padding: 1px; }

.medallion {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  box-shadow:
    inset 1px 1.5px 2px rgba(110, 80, 46, .2),
    inset -1px -1px 1px rgba(255, 255, 255, .9);
}

/* While the foil is on, it sits on the paper like an applied seal */
.page--cover:not(.is-revealed) .medallion {
  box-shadow:
    0 1px 1.5px rgba(70, 48, 22, .35),
    0 7px 16px -7px rgba(70, 48, 22, .45);
}

.medallion img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 28%;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* The photo sits in a debossed well: shadow along the upper rim, light along the lower */
.medallion::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow:
    inset 1.5px 2.5px 4px rgba(60, 40, 18, .35),
    inset -1px -1.5px 1.5px rgba(255, 255, 255, .55);
  pointer-events: none;
}

.foil { z-index: 1; }

/* Confetti falling inside the portrait, under the well's rim shadow */
.confetti {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.when { margin: 0; }

.foil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity 1.1s var(--ease-out);
}

.foil.is-cleared { opacity: 0; }
.foil:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 12px; border-radius: 50%; }

.is-open .page--cover:not(.is-revealed) .medallion-frame {
  touch-action: none;
  cursor: pointer;
}

.reveal {
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 1.4s var(--ease-out) var(--d, 0ms),
    transform 1.4s var(--ease-out) var(--d, 0ms);
}

.is-revealed .reveal {
  opacity: 1;
  transform: none;
}

.countdown {
  display: flex;
  justify-content: center;
}

.countdown > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 20cqw;
  padding: 0 3cqw;
}

.countdown > div + div { border-left: 1px solid rgba(96, 78, 58, .16); }

/* The countdown is blind-debossed: pressed into the paper with no ink */
.num {
  font-size: min(8.8cqw, 40px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.05;
  font-variant-numeric: lining-nums tabular-nums;
}

.num,
.unit {
  color: rgba(96, 78, 58, .48);
  text-shadow:
    0 -1px .6px rgba(45, 28, 12, .26),
    0 1.2px .4px rgba(255, 255, 255, .95);
}

.unit {
  margin-top: 2px;
  padding-left: .3em;
  font-size: max(10.5px, min(2.8cqw, 12.5px));
  font-weight: 600;
  letter-spacing: .3em;
  text-transform: uppercase;
}

.countdown-done {
  margin: 0;
  font-family: var(--display);
  font-size: min(5cqw, 22px);
  font-style: italic;
}

.cue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(18px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: max-content;
  margin: 0 auto;
  padding: 6px 14px;
  color: #54443a;
  font-size: min(4.4cqw, 18px);
  font-style: italic;
  text-decoration: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s var(--ease-out) 2.1s;
}

/* A gold arrow drifting upward: the cards lift away upward */
.cue-arrow {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(176, 138, 82, .75);
  border-radius: 50%;
  animation: drift 2.4s ease-in-out infinite;
}

.cue-arrow::before {
  content: "";
  width: 7px;
  height: 7px;
  border-top: 1.3px solid var(--gold);
  border-left: 1.3px solid var(--gold);
  transform: translateY(2px) rotate(45deg);
}

@keyframes drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.is-revealed .cue,
.page--details .cue {
  opacity: 1;
  pointer-events: auto;
}

/* On the details card the cue sits over the peonies, so the embossing fades out behind it */
.page--details .cue {
  bottom: calc(14px + env(safe-area-inset-bottom));
  padding: 14px 44px 12px;
  background: radial-gradient(closest-side, rgba(204, 197, 186, .94) 30%, rgba(204, 197, 186, .6) 62%, rgba(204, 197, 186, 0));
}

.cue:focus-visible { outline: 1.5px solid var(--gold); outline-offset: 2px; }


/* ---------- Buttons ---------- */

/* Buttons carry a thin gold inner ring, like the rings around the portrait */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  min-height: 52px;
  padding: 0 2.4em 0 calc(2.4em + .26em);
  border: 1px solid rgba(132, 102, 60, .75);
  border-radius: 999px;
  background: rgba(255, 252, 244, .28);
  color: var(--ink);
  font: 600 max(11.5px, min(3cqw, 13.5px)) / 1 var(--serif);
  letter-spacing: .26em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7), inset 0 1px 1px rgba(110, 80, 46, .12);
  transition: background-color .25s, box-shadow .25s, transform .15s;
}

.btn::before {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(176, 138, 82, .55);
  border-radius: inherit;
  pointer-events: none;
}

.btn:hover { background-color: rgba(255, 252, 244, .55); }
.btn:active { transform: translateY(1px); }

.btn--solid {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  text-shadow: none;
  box-shadow:
    0 1px 1.5px rgba(40, 26, 12, .3),
    0 10px 20px -10px rgba(40, 26, 12, .6);
}

.btn--solid::before { border-color: rgba(214, 186, 130, .65); }
.btn--solid:hover { background-color: #2b2019; }
.btn--solid:active { box-shadow: 0 1px 1px rgba(40, 26, 12, .3), 0 4px 10px -6px rgba(40, 26, 12, .5); }

.btn:focus-visible,
.cal-menu a:focus-visible {
  outline: 1.5px solid var(--gold);
  outline-offset: 3px;
}

.cal { position: relative; }

.cal-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 3;
  display: flex;
  flex-direction: column;
  min-width: 100%;
  padding: 6px;
  translate: -50% 0;
  border: 1px solid rgba(59, 46, 37, .14);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: 0 14px 34px -12px rgba(30, 20, 10, .4);
}

.cal-menu a {
  padding: 13px 18px;
  border-radius: 11px;
  color: var(--ink);
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}

.cal-menu a:hover { background: rgba(59, 46, 37, .06); }

/* ---------- Details ---------- */

.rest {
  opacity: 0;
  transition: opacity 1.2s var(--ease-out) .8s;
}

.rest.is-visible { opacity: 1; }

.page-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--vh);
  padding: 64px 36px;
  text-align: center;
}

/* Keep the words clear of each card's embossing */
.page--details .page-inner { padding-bottom: max(30svh, 200px); }

/* A foil-stamped sun over the sea: the ceremony is on the beach */
.seaside {
  --emblem: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='M15 21a17 17 0 0 1 34 0'/%3E%3Cpath d='M4 21h56'/%3E%3Cpath d='M10 27.5q5-3 10 0t10 0 10 0 10 0 10 0'/%3E%3Cpath d='M18 33.5q3.5-2.2 7 0t7 0 7 0 7 0'/%3E%3C/g%3E%3C/svg%3E");
  width: 72px;
  height: 45px;
  margin-bottom: 12px;
  background: var(--gold) url("assets/foil.jpg") center / 140px;
  -webkit-mask: var(--emblem) center / contain no-repeat;
  mask: var(--emblem) center / contain no-repeat;
}

/* Date and time side by side between foil hairlines */
.when-band {
  position: relative;
  display: grid;
  grid-template-columns: auto 1px auto;
  justify-content: center;
  align-items: center;
  gap: 0 22px;
  width: min(100%, 340px);
  margin: 0 0 30px;
  padding: 20px 0;
}

/* Tapered gold hairlines, fading out at their ends */
.when-band::before,
.when-band::after {
  background: linear-gradient(90deg, rgba(176, 138, 82, 0), rgba(176, 138, 82, .8) 22%, rgba(176, 138, 82, .8) 78%, rgba(176, 138, 82, 0));
}

.when-divider { background: linear-gradient(rgba(176, 138, 82, 0), rgba(176, 138, 82, .75) 25%, rgba(176, 138, 82, .75) 75%, rgba(176, 138, 82, 0)); }

.when-band::before,
.when-band::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
}

.when-band::before { top: 0; }
.when-band::after { bottom: 0; }

.when-divider { align-self: stretch; }

.when {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
}

.when-value {
  font-family: var(--display);
  font-size: min(6.4cqw, 28px);
  font-style: italic;
  line-height: 1.15;
  white-space: nowrap;
  color: var(--ink);
  text-shadow:
    0 -1px .8px rgba(45, 28, 12, .3),
    0 1.4px .5px rgba(255, 255, 255, .92);
}

.when .caps {
  font-size: max(10px, min(2.8cqw, 12px));
  letter-spacing: .18em;
  white-space: nowrap;
}

.venue {
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  color: var(--ink);
}


.rule {
  width: 1px;
  height: 34px;
  margin: 26px 0;
  background: url("assets/foil.jpg") center / cover;
}

.venue {
  margin: 10px 0 0;
  font-size: min(9.4cqw, 42px);
  line-height: 1.12;
}

.venue-area { margin: 8px 0 30px; }

/* Short screens: pull the details up and closer together so they stay clear of the peonies */
@media (max-height: 700px) {
  .page--details .page-inner {
    padding-top: 36px;
    padding-bottom: max(36svh, 220px);
  }

  .page--details .venue-area { margin-bottom: 22px; }
  .when-band { margin-bottom: 22px; padding: 16px 0; }
}

/* Closing card: a note from the couple, signed with their initials, and the practical lines at the foot like a printed footnote */
.closing {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: var(--vh);
  padding: 0 36px max(11svh, 64px);
  text-align: center;
}

.closing-note {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-block: auto;
  padding-top: 24svh;
}

.sentiment {
  margin: 0;
  font-family: var(--display);
  font-size: min(8.2cqw, 36px);
  font-style: italic;
  font-weight: 400;
  line-height: 1.22;
  white-space: nowrap;
  color: var(--ink);
}

.closing-foot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.place-date {
  display: flex;
  align-items: center;
  gap: 13px;
  letter-spacing: .25em;
}

.place-date .bar {
  width: 1px;
  height: 13px;
  background: rgba(176, 138, 82, .8);
}

.footnote {
  margin: 0;
  font-size: min(4.2cqw, 17px);
  font-style: italic;
  color: var(--ink-soft);
}

/* Foil-stamped monogram. The foil only paints inside the box, so padding makes room for the italic overhang */
.monogram {
  margin: calc(20px - .3em) 0 -.3em;
  padding: .3em .4em;
  font-family: var(--display);
  font-size: min(11cqw, 46px);
  font-style: italic;
  line-height: 1.1;
  color: transparent;
  text-shadow: none;
  background: url("assets/foil.jpg") center / 260px;
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 1px 0 rgba(255, 255, 255, .8)) drop-shadow(0 -.5px .3px rgba(70, 48, 22, .35));
}

/* ---------- Loading: shown until every layer of the envelope is ready, so no guest sees it half-built ---------- */

.loader {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: radial-gradient(70% 55% at 50% 45%, #c4b8a8, var(--linen));
  transition: opacity .9s var(--ease-out), visibility 0s .9s;
}

.is-ready .loader {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-mono {
  margin: 0;
  font-family: var(--display);
  font-size: 34px;
  font-style: italic;
  color: rgba(59, 46, 37, .62);
}

.loader-line {
  width: 72px;
  height: 1px;
  overflow: hidden;
  background: rgba(59, 46, 37, .16);
}

.loader-line span {
  display: block;
  height: 100%;
  background: var(--ink-soft);
  transform: scaleX(var(--loaded, 0));
  transform-origin: left;
  transition: transform .5s var(--ease-out);
}

/* ---------- Envelope: photographed layers, opened by script.js ---------- */

/* --env-w is set by script.js: the envelope's width when it fills the screen */
.env-layer {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

.env-back { z-index: 0; }
.env-front { z-index: 2; }

.envelope {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--env-w, 150vh);
  aspect-ratio: 1.5;
  margin: calc(var(--env-w, 150vh) / -3) 0 0 calc(var(--env-w, 150vh) / -2);
  perspective: calc(var(--env-w, 150vh) * 1.1);
  perspective-origin: 50% 45%;
  will-change: transform;
}

.env-back .envelope {
  border-radius: 3px;
  box-shadow:
    0 1px 2px rgba(40, 28, 15, .25),
    0 22px 40px -14px rgba(40, 28, 15, .5);
}

/* The inside, seen through the opening: the liner, deeper in shadow */
.env-inside {
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: linear-gradient(rgba(58, 40, 20, .16), rgba(58, 40, 20, .34)) #e6d6c0;
}

.is-ready .env-inside {
  background:
    linear-gradient(rgba(58, 40, 20, .16), rgba(58, 40, 20, .34)),
    url("assets/env-liner.jpg") center / cover;
}

.opening-shade,
.pocket,
.flap-shadow,
.flap,
.flap-open {
  position: absolute;
  left: 0;
  width: 100%;
  background: 0 0 / 100% 100% no-repeat;
  pointer-events: none;
}

.opening-shade {
  top: 0;
  height: 100%;
}

.is-ready .opening-shade { background-image: url("assets/env-opening-shade.webp"); }

.pocket {
  top: 0;
  height: 100%;
  background-image: url("assets/env-pocket.webp");
}

/* Cast by the flap and seal: a contact shadow at rest that stretches and softens as the flap lifts */
.flap-shadow {
  top: 0;
  aspect-ratio: 2400 / 1330;
  background: rgb(66, 44, 22);
  -webkit-mask: url("assets/env-flap-shadow.webp") 0 0 / 100% 100%;
  mask: url("assets/env-flap-shadow.webp") 0 0 / 100% 100%;
  transform-origin: 50% 0;
  opacity: .62;
}

/* Hinged along the envelope's top edge */
.flap {
  top: 0;
  aspect-ratio: 2400 / 1251;
  background-image: url("assets/env-flap.webp");
  transform-origin: 50% 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Inside of the flap with its liner, lying open above the envelope */
.flap-open {
  bottom: 100%;
  aspect-ratio: 2400 / 1251;
  transform-origin: 50% 100%;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  visibility: hidden;
}

/* Light falls off as each face of the flap turns away from it */
.flap::after,
.flap-open::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgb(92, 66, 38);
  -webkit-mask: var(--face) 0 0 / 100% 100%;
  mask: var(--face) 0 0 / 100% 100%;
  opacity: var(--shade, 0);
}

.flap { --face: url("assets/env-flap.webp"); }
.is-ready .flap-open {
  --face: url("assets/env-flap-inside.webp");
  background-image: url("assets/env-flap-inside.webp");
}

/* Sits over the wax seal in the photograph */
.seal {
  position: absolute;
  top: 63.75%;
  left: 49.17%;
  z-index: 1;
  width: 17.8%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  translate: -50% -50%;
  cursor: pointer;
}

.seal:focus-visible { outline: 1.5px solid var(--ink); outline-offset: 8px; }
.is-opening .seal { visibility: hidden; }

.seal::after {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(176, 138, 82, .7);
  border-radius: 50%;
  opacity: 0;
  animation: beckon 3.4s var(--ease-out) 1.8s infinite;
}

.seal:disabled::after { animation: none; }

@keyframes beckon {
  0% { transform: scale(.94); opacity: 0; }
  15% { opacity: .9; }
  70%, 100% { transform: scale(1.32); opacity: 0; }
}

.hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(38px + env(safe-area-inset-bottom));
  text-align: center;
  transition: opacity .5s;
}

.is-opening .hint { opacity: 0; }

.is-open .env-layer { display: none; }

/* A card's shadow while it is handled: close against the envelope, then lifted */
.page::before,
.page::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

.page::before {
  box-shadow: 0 1px 2px rgba(40, 28, 15, .3), 0 3px 8px rgba(40, 28, 15, .18);
  opacity: var(--near-shadow, 0);
}

.page::after {
  box-shadow: 0 18px 36px -6px rgba(40, 28, 15, .4), 0 40px 80px -20px rgba(40, 28, 15, .35);
  opacity: var(--far-shadow, 0);
}

.is-sealed .sheet,
.is-opening .sheet { box-shadow: none; }

/* ---------- The cards as a stack, turned one at a time by script.js ---------- */

.is-deck { overscroll-behavior: none; }

.is-deck .sheet {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 50%;
  margin: 0;
  translate: -50% 0;
  touch-action: none;
  box-shadow: none;
}

.is-deck .rest { display: contents; }

.is-deck .page {
  position: absolute;
  inset: 0;
  min-height: 0;
  transform-origin: 50% 100%;
  will-change: transform;
}

.is-deck .rest .page { box-shadow: none; }

/* Darkens a card while another lies over it */
.page-shade {
  position: absolute;
  inset: 0;
  z-index: 4;
  background: rgb(38, 26, 14);
  opacity: 0;
  pointer-events: none;
}

.deck-dots { display: none; }

.is-deck .deck-dots {
  position: absolute;
  top: 50%;
  right: max(14px, env(safe-area-inset-right));
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 11px;
  translate: 0 -50%;
}

.deck-dots span {
  width: 5px;
  height: 5px;
  border: 1px solid rgba(176, 138, 82, .85);
  transform: rotate(45deg);
  transition: background-color .5s;
}

.deck-dots .is-current { background: var(--gold); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
  }
}
