/* The photobook (specs/themes.md "Its stylesheet"): an old bound book. Cloth boards a little larger than its pages with
   a gilt line tooled into them, gilded fore-edges stacked under the open leaves, laid paper, cloth index tabs and a
   leather bookmark. How a book works is the app's (renderer.css); this is only how this one looks, and every value in
   it is one of the wedding's tokens (defaults.json, installed into their tree), never a value of its own. */

.book {
  --leaf: var(--color-book-leaf);
  --gold: var(--color-photobook-gold);
  --gilt: color-mix(in srgb, var(--gold) 62%, var(--leaf));
  --case: var(--color-book-case);
  --shadow: var(--color-book-shadow);
  --light: var(--color-book-light);
  --shade: var(--color-book-shade);
  --dusk: var(--color-book-dusk);
  --book-turn: var(--motion-book-turn);
  --book-ease: var(--motion-book-ease);
  background:
    radial-gradient(ellipse 70% 62% at 50% 44%, color-mix(in srgb, var(--color-book-glow) 7%, transparent), transparent 70%),
    radial-gradient(ellipse 150% 130% at 50% 50%, transparent 52%, color-mix(in srgb, var(--shadow) 40%, transparent)),
    var(--color-book-desk);
}

/* The case: cloth over boards, its weave, the hollow of the spine, the lift off the desk. */
.book-spread::before {
  content: ""; position: absolute; z-index: -2; pointer-events: none;
  inset: calc(-16 * var(--u)) calc(-18 * var(--u)) calc(-20 * var(--u));
  border-radius: calc(7 * var(--u));
  background:
    linear-gradient(to right, transparent 46.5%, color-mix(in srgb, var(--shadow) 42%, transparent) 50%, transparent 53.5%),
    linear-gradient(to bottom, color-mix(in srgb, var(--light) 6%, transparent), transparent 30%, color-mix(in srgb, var(--shadow) 18%, transparent)),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--light) 3%, transparent) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--shadow) 7%, transparent) 0 1px, transparent 1px 3px),
    var(--case);
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--light) 6%, transparent), inset 0 0 calc(24 * var(--u)) color-mix(in srgb, var(--shadow) 40%, transparent),
    0 2px 3px color-mix(in srgb, var(--shadow) 45%, transparent), 0 22px 46px color-mix(in srgb, var(--shadow) 42%, transparent),
    0 60px 130px color-mix(in srgb, var(--shadow) 40%, transparent);
}
/* The front cover: the cloth board, a gilt frame tooled into it, the names stamped in gilt; its inside the endpaper, as
   the left page it lands as. */
.book-front { inset: calc(-16 * var(--u)) calc(-18 * var(--u)) calc(-20 * var(--u)) 50%; width: auto; height: auto; }
.book-front-face, .book-front-back { border-radius: 0 calc(7 * var(--u)) calc(7 * var(--u)) 0; }
.book-front-back {
  background:
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--gold) 10%, transparent) 0 1px, transparent 1px calc(22 * var(--u))),
    repeating-linear-gradient(-45deg, color-mix(in srgb, var(--gold) 10%, transparent) 0 1px, transparent 1px calc(22 * var(--u))),
    var(--case);
  box-shadow: inset 0 0 0 calc(18 * var(--u)) var(--case), inset 0 0 0 calc(19 * var(--u)) color-mix(in srgb, var(--gold) 60%, transparent);
}
.book-front-face {
  background:
    linear-gradient(to right, color-mix(in srgb, var(--shadow) 40%, transparent), transparent 6%),
    linear-gradient(to bottom, color-mix(in srgb, var(--light) 6%, transparent), transparent 30%, color-mix(in srgb, var(--shadow) 18%, transparent)),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--light) 3%, transparent) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--shadow) 7%, transparent) 0 1px, transparent 1px 3px),
    var(--case);
  /* Its depth: a bevel catching the light, the board's own edge, the page block under it along the fore-edge and the foot
     in fine paper and gilt lines, then its shadow on the desk. */
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--light) 14%, transparent), inset 0 0 0 1px color-mix(in srgb, var(--light) 6%, transparent),
    inset -2px -2px 4px color-mix(in srgb, var(--shadow) 35%, transparent),
    1px 1px 0 color-mix(in srgb, var(--case) 70%, var(--shadow)), 2px 2px 0 color-mix(in srgb, var(--case) 60%, var(--shadow)),
    3px 3px 0 var(--leaf), 4px 4px 0 var(--gilt), 5px 5px 0 var(--leaf), 6px 6px 0 var(--gilt), 7px 7px 0 var(--leaf),
    8px 8px 0 var(--gilt), 9px 9px 0 color-mix(in srgb, var(--leaf) 80%, var(--shadow)),
    10px 10px 0 color-mix(in srgb, var(--case) 70%, var(--shadow)), 11px 11px 0 color-mix(in srgb, var(--case) 55%, var(--shadow)),
    0 30px 60px color-mix(in srgb, var(--shadow) 50%, transparent), 0 8px 16px color-mix(in srgb, var(--shadow) 35%, transparent);
  padding: calc(60 * var(--u));
}
.book-front-face::after {
  content: ""; position: absolute; inset: calc(28 * var(--u)); pointer-events: none;
  border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent);
}
.book-front .book-front-names {
  font-size: calc(64 * var(--u)); line-height: 1.05; letter-spacing: 0.01em;
  color: var(--gold); text-shadow: 0 1px 0 color-mix(in srgb, var(--shadow) 50%, transparent); text-wrap: balance;
}

/* A gilt line tooled into the boards, all round, just outside the pages. */
.book-spread::after {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: calc(-9 * var(--u)) calc(-11 * var(--u)) calc(-13 * var(--u));
  border: 1px solid color-mix(in srgb, var(--gold) 55%, transparent); border-radius: calc(4 * var(--u));
}
/* The pages under the open ones: gilded fore-edges, stacked fine along the outer edge and the foot. */
/* Each side's stack as thick as the pages lying on it (--pages-left, --pages-right): a line of gilt and paper per page,
   none with none. */
.book-base-left {
  --e: min(var(--pages-left, 0), 6);
  box-shadow: calc(-1px * min(var(--e), 1)) calc(1px * min(var(--e), 1)) 0 var(--gilt),
    calc(-1px * min(var(--e), 2)) calc(1px * min(var(--e), 2)) 0 var(--leaf),
    calc(-1px * min(var(--e), 3)) calc(1px * min(var(--e), 3)) 0 var(--gilt),
    calc(-1px * min(var(--e), 4)) calc(1px * min(var(--e), 4)) 0 var(--leaf),
    calc(-1px * min(var(--e), 5)) calc(1px * min(var(--e), 5)) 0 var(--gilt),
    calc(-1px * var(--e)) calc(1px * var(--e)) 0 color-mix(in srgb, var(--gilt) 70%, var(--shadow));
}
.book-base-right {
  --e: min(var(--pages-right, 0), 6);
  box-shadow: calc(1px * min(var(--e), 1)) calc(1px * min(var(--e), 1)) 0 var(--gilt),
    calc(1px * min(var(--e), 2)) calc(1px * min(var(--e), 2)) 0 var(--leaf),
    calc(1px * min(var(--e), 3)) calc(1px * min(var(--e), 3)) 0 var(--gilt),
    calc(1px * min(var(--e), 4)) calc(1px * min(var(--e), 4)) 0 var(--leaf),
    calc(1px * min(var(--e), 5)) calc(1px * min(var(--e), 5)) 0 var(--gilt),
    calc(1px * var(--e)) calc(1px * var(--e)) 0 color-mix(in srgb, var(--gilt) 70%, var(--shadow));
}

/* What lies on the desk at the book's top left: a small gold seal; taken, the page it marks opens over everything. */
.book .frame-mark {
  width: clamp(54px, 7svh, 76px); aspect-ratio: 1; border-radius: 50%; border: 1px solid var(--gold);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--light) 18%, transparent), transparent 60%), var(--color-book-desk);
  color: var(--gold);
  font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase; cursor: pointer; padding: 6px; line-height: 1.3;
  box-shadow: 0 6px 18px color-mix(in srgb, var(--shadow) 35%, transparent), inset 0 0 0 4px color-mix(in srgb, var(--shadow) 15%, transparent);
  transition: transform var(--motion-duration-quick) ease, box-shadow var(--motion-duration-quick) ease;
}
.book .frame-mark:hover {
  transform: translateY(-2px) rotate(-4deg);
  box-shadow: 0 10px 24px color-mix(in srgb, var(--shadow) 40%, transparent), inset 0 0 0 4px color-mix(in srgb, var(--shadow) 15%, transparent);
}
.book .frame-pop { border-radius: 6px; background: var(--color-book-desk); box-shadow: 0 40px 120px color-mix(in srgb, var(--shadow) 55%, transparent); }
.book .frame-pop::backdrop { background: color-mix(in srgb, var(--shadow) 55%, transparent); backdrop-filter: blur(3px); }

/* The turning sheet's shade: a dark sweep from its spine that peaks halfway through the turn and is gone at either end. */
.book-face > .book-leaf::after { background: linear-gradient(to right, color-mix(in srgb, var(--dusk) 70%, transparent), color-mix(in srgb, var(--dusk) 18%, transparent) 55%, transparent); }
.book-face-back > .book-leaf::after { background: linear-gradient(to left, color-mix(in srgb, var(--dusk) 70%, transparent), color-mix(in srgb, var(--dusk) 18%, transparent) 55%, transparent); }
.book-leaf { background: var(--leaf); }
/* Bound: a page bows up from its outer edge and dives into the spine, so its top and bottom edges sag toward the
   binding, never straight; its outer corners a touch rounded. */
.book-leaf-left {
  border-radius: calc(3 * var(--u)) 0 0 calc(3 * var(--u));
  clip-path: polygon(0 0, 65% 0, 80% 0.15%, 90% 0.45%, 96% 0.9%, 100% 1.5%, 100% 98.5%, 96% 99.1%, 90% 99.55%, 80% 99.85%, 65% 100%, 0 100%);
}
.book-leaf-right {
  border-radius: 0 calc(3 * var(--u)) calc(3 * var(--u)) 0;
  clip-path: polygon(0 1.5%, 4% 0.9%, 10% 0.45%, 20% 0.15%, 35% 0, 100% 0, 100% 100%, 35% 100%, 20% 99.85%, 10% 99.55%, 4% 99.1%, 0 98.5%);
}
/* Never two sheets quite the same paper. */
.book-sheet:nth-child(3n) .book-leaf { background-color: color-mix(in srgb, var(--leaf) 98%, var(--shade)); }
.book-sheet:nth-child(3n + 1) .book-leaf { background-color: color-mix(in srgb, var(--leaf) 99%, var(--light)); }
/* The gutter: where the paper bows up a soft light catches it, then it falls steeply into the spine's shade. */
.book-leaf-left::before, .book-leaf-right::before {
  content: ""; position: absolute; top: 0; bottom: 0; width: calc(130 * var(--u)); pointer-events: none; z-index: 2;
}
.book-leaf-left::before {
  right: 0;
  background: linear-gradient(to left, color-mix(in srgb, var(--shade) 42%, transparent), color-mix(in srgb, var(--shade) 16%, transparent) 9%,
    color-mix(in srgb, var(--shade) 4%, transparent) 22%, color-mix(in srgb, var(--light) 18%, transparent) 38%, transparent 60%);
}
.book-leaf-right::before {
  left: 0;
  background: linear-gradient(to right, color-mix(in srgb, var(--shade) 38%, transparent), color-mix(in srgb, var(--shade) 14%, transparent) 9%,
    color-mix(in srgb, var(--shade) 3%, transparent) 22%, color-mix(in srgb, var(--light) 18%, transparent) 38%, transparent 60%);
}

/* The tabs: cloth slips glued to their pages, rounded at the free end, a little light along the top and shade where
   they leave the page; each keeps its own cloth, open or not. */
.book-tab { --tab: var(--color-book-tab-1); }
.book-tab-c1 { --tab: var(--color-book-tab-2); }
.book-tab-c2 { --tab: var(--color-book-tab-3); }
.book-tab { --tab-font: clamp(12px, calc(15 * var(--u)), 15px); }
.book-tab .button, .book-tab .button:not(:disabled):hover {
  font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-book-tab-text); background-color: var(--tab);
  text-shadow: 0 1px 0 color-mix(in srgb, var(--light) 35%, transparent);
}
/* The whole window is the desk, from the first frame. */
html, body { background: var(--color-book-desk); }

/* The book sits just low enough on the desk for the bookmark standing out of its top. */
.book { padding-top: calc(18px + min(calc(104 * var(--u)), 9svh) - 6 * var(--u)); justify-content: flex-start; --book-reserve: calc(9svh + 140px); }
/* Open at its first spread there's nothing before it, at its last nothing after: no page edges under that side. */
.book-at-first .book-base-left, .book-at-last .book-base-right { box-shadow: none; }

/* The tabs over one pointed at slide along the edge off it, gently. */
.book-tab { transition: top var(--motion-duration-settle) var(--book-ease), height var(--motion-duration-settle) var(--book-ease),
  transform var(--motion-duration-settle) var(--book-ease); }
.book-tab .button * { color: var(--color-book-tab-text); }
.book-tab-right .button, .book-tab-right .button:not(:disabled):hover {
  border-radius: 0 calc(8 * var(--u)) calc(8 * var(--u)) 0;
  background-image: linear-gradient(to right, color-mix(in srgb, var(--shadow) 24%, transparent), transparent 38%), linear-gradient(to bottom, color-mix(in srgb, var(--light) 16%, transparent), transparent 30%);
  box-shadow: 2px 2px 5px color-mix(in srgb, var(--shadow) 32%, transparent), inset -1px 0 0 color-mix(in srgb, var(--light) 8%, transparent);
}
.book-tab-left .button, .book-tab-left .button:not(:disabled):hover {
  border-radius: calc(8 * var(--u)) 0 0 calc(8 * var(--u));
  background-image: linear-gradient(to left, color-mix(in srgb, var(--shadow) 24%, transparent), transparent 38%), linear-gradient(to bottom, color-mix(in srgb, var(--light) 16%, transparent), transparent 30%);
  box-shadow: -2px 2px 5px color-mix(in srgb, var(--shadow) 32%, transparent), inset 1px 0 0 color-mix(in srgb, var(--light) 8%, transparent);
}

/* The bookmark: leather with a body: a grain, light along its top edge and shade along its bottom, a side edge showing
   its thickness, gold thread stitched just inside its edge, and a shadow where it lies. */
.book-bookmark { --mark: var(--color-book-mark); }
.book-bookmark a, .book-bookmark .button, .book-bookmark .button:not(:disabled):hover, .book-bookmark a:hover {
  border-radius: calc(3 * var(--u));
  font-size: clamp(10px, calc(14 * var(--u)), 14px); font-weight: 500; letter-spacing: 0.16em; line-height: 1.3; text-transform: uppercase;
  color: var(--color-photobook-on-dark);
  text-shadow: 0 -1px 0 color-mix(in srgb, var(--shadow) 35%, transparent);
  background-color: var(--mark);
  background-image:
    linear-gradient(to bottom, color-mix(in srgb, var(--light) 16%, transparent), color-mix(in srgb, var(--light) 4%, transparent) 12%, transparent 40%, color-mix(in srgb, var(--shadow) 14%, transparent)),
    linear-gradient(to right, color-mix(in srgb, var(--shadow) 12%, transparent), transparent 18%, transparent 82%, color-mix(in srgb, var(--shadow) 16%, transparent)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.22 0'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, var(--light) 22%, transparent), inset 0 -1px 0 color-mix(in srgb, var(--shadow) 30%, transparent),
    1px 1px 0 color-mix(in srgb, var(--mark) 62%, var(--shadow)), 2px 2px 0 color-mix(in srgb, var(--mark) 50%, var(--shadow)),
    3px 4px 6px color-mix(in srgb, var(--shadow) 28%, transparent), 6px 12px 22px color-mix(in srgb, var(--shadow) 18%, transparent);
  outline: 1px dashed color-mix(in srgb, var(--gold) 80%, transparent); outline-offset: calc(-6 * var(--u));
}
.book-bookmark .button *, .book-bookmark a * { color: var(--color-photobook-on-dark); }
/* Standing up out of the book: its foot goes down between the pages, in their shade. */
.book-bookmark-out a, .book-bookmark-out .button, .book-bookmark-out .button:not(:disabled):hover, .book-bookmark-out a:hover {
  border-radius: calc(3 * var(--u)) calc(3 * var(--u)) 0 0;
  background-image:
    linear-gradient(to bottom, color-mix(in srgb, var(--light) 16%, transparent), color-mix(in srgb, var(--light) 4%, transparent) 14%, transparent 45%, color-mix(in srgb, var(--shadow) 38%, transparent)),
    linear-gradient(to right, color-mix(in srgb, var(--shadow) 12%, transparent), transparent 18%, transparent 82%, color-mix(in srgb, var(--shadow) 16%, transparent)),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='g'><feTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.22 0'/></filter><rect width='100%' height='100%' filter='url(%23g)'/></svg>");
  box-shadow: inset 0 1px 0 color-mix(in srgb, var(--light) 22%, transparent), 1px 0 0 color-mix(in srgb, var(--mark) 62%, var(--shadow)),
    2px 0 0 color-mix(in srgb, var(--mark) 50%, var(--shadow)), 3px -2px 8px color-mix(in srgb, var(--shadow) 30%, transparent);
}

/* Pointed at while it stands, it rises out of the pages along its own lean. */
.book-bookmark-out { transition: transform var(--motion-duration-quick) var(--book-ease); }
@media (hover: hover) {
  .book-bookmark-out:hover { transform: rotate(7deg) translateY(-10px); }
}

/* The foot: small and tracked on the desk. */
.book-foot .text, .book-foot .button, .book-foot a {
  font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; font-weight: 400;
  color: var(--color-book-turn); transition: color var(--motion-duration-quick) ease;
}
@media (hover: hover) {
  .book-foot .button:not(:disabled):hover, .book-foot a:hover { color: var(--color-photobook-on-dark); }
}
@media (max-width: 720px) {
  .book-tab { --tab-font: 9px; }
  .book-foot .text, .book-foot .button, .book-foot a { font-size: 8px; letter-spacing: 0.16em; }
}

/* On a leaf: links underline as they're pointed at, in gilt. */
.book-leaf .button-plain { padding: 3px 0; justify-content: flex-start; text-align: left; }
.book-leaf .button-link {
  text-decoration: none; padding: 5px 0; background-repeat: no-repeat; background-position: 0 100%; background-size: 0 1px;
  background-image: linear-gradient(currentColor, currentColor);
  transition: color var(--motion-duration-quick) ease, background-size var(--motion-duration-settle) var(--book-ease);
}
@media (hover: hover) {
  .book-leaf .button-link:not(:disabled):hover { color: var(--gold); background-size: 100% 1px; }
}

/* What a leaf holds: its paper's room. */
.book-leaf .paper { padding: calc(64 * var(--u)) calc(62 * var(--u)) calc(52 * var(--u)); gap: calc(14 * var(--u)); }
/* Laid paper: its fine chain lines, a grain, a little foxing toward the edges; never a flat fill. */
.book-leaf .paper-leaf, .paper-leaf.paper-grow {
  background-image:
    radial-gradient(ellipse 120% 110% at 50% 48%, transparent 58%, color-mix(in srgb, var(--color-book-foxing) 10%, transparent)),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--color-book-foxing) 2.8%, transparent) 0 1px, transparent 1px calc(26 * var(--u))),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.06 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
/* A page's title: large, with a short gilt rule under it; its rows each over a hairline. */
.book-leaf .paper-leaf > .text-eyebrow:first-child { color: var(--gold); }
.book-leaf .paper-leaf > .text-leaf-title { font-size: calc(54 * var(--u)); line-height: 1.04; letter-spacing: -0.01em; text-wrap: balance; }
.book-leaf .paper-leaf > .text-leaf-title::after {
  content: ""; display: block; width: calc(64 * var(--u)); margin: calc(22 * var(--u)) 0 calc(8 * var(--u));
  border-top: 1px solid color-mix(in srgb, var(--gold) 70%, transparent);
}
.book-leaf .paper-leaf > .stack-v > .stack-v:not(.align-center) { padding-bottom: calc(16 * var(--u)); border-bottom: 1px solid color-mix(in srgb, var(--color-photobook-rule) 80%, transparent); }
.book-leaf .paper-leaf > .stack-v > .stack-v:last-child { border-bottom: 0; }
.book-leaf .text-row-kicker { color: var(--gold); }
.book-leaf .paper-leaf > .stack-h:last-child { margin-top: auto; padding-top: calc(18 * var(--u)); }
/* A chapter's opener: its number large in gilt italic, its title under it, a rule. */
.book-leaf .text-chapter-no { font-size: calc(170 * var(--u)); line-height: 0.82; letter-spacing: -0.03em; color: var(--gold); }
.book-leaf .stack-v.align-center:has(> .text-chapter-no) > .text-leaf-title { font-size: calc(58 * var(--u)); text-align: center; }
/* The way in, on a page: its field and buttons as wide as a column of the page, in the book's words; a field is its
   one hairline. */
.book-leaf .stack-v.align-center > .stack-v { width: min(100%, calc(380 * var(--u) + 120px)); }
.book-leaf .stack-v.align-center > .stack-v.align-start { width: min(100%, calc(440 * var(--u) + 80px)); }
.book-leaf .field { background: transparent; border: 0; border-radius: 0; padding: 0; width: 100%; }
.book-leaf input:not([type]), .book-leaf input[type="text"], .book-leaf input[type="email"] {
  background: transparent; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--color-photobook-rule) 90%, transparent);
  border-radius: 0; padding: 6px 0; color: var(--color-photobook-ink); width: 100%;
}
.book-leaf input:focus { outline: none; border-bottom-color: var(--gold); }
/* The ways in, in the book's hand: Apple and the QR code as quiet outlined buttons in its ink, each one line. */
.book-leaf .button-apple, .book-leaf .button-apple:not(:disabled):hover,
.book-leaf .button-qr, .book-leaf .button-qr:not(:disabled):hover {
  height: 44px; min-height: 44px; box-sizing: border-box; border-radius: calc(3 * var(--u)); box-shadow: none;
  background: transparent; color: var(--color-photobook-ink);
  border: 1px solid color-mix(in srgb, var(--color-photobook-ink) 55%, transparent);
  font-family: inherit; font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; white-space: nowrap;
  transition: background-color var(--motion-duration-quick) ease, border-color var(--motion-duration-quick) ease;
}
.book-leaf .button-apple { flex: 1 1 auto; gap: 10px; padding: 0 18px; }
.book-leaf .button-qr { flex: none; width: 44px; padding: 0; }
.book-leaf .button-apple .icon, .book-leaf .button-qr .icon { width: 16px; height: 16px; flex: none; }
.book-leaf .button-apple *, .book-leaf .button-qr * { color: var(--color-photobook-ink); }
@media (hover: hover) {
  .book-leaf .button-apple:not(:disabled):hover, .book-leaf .button-qr:not(:disabled):hover {
    background: color-mix(in srgb, var(--color-photobook-ink) 6%, transparent); border-color: var(--color-photobook-ink);
  }
}
.book-leaf .stack-h:has(> .button-apple) { gap: 10px; width: 100%; }
/* What sends it (Email a Link, Sign In): the one filled button, the book's ink with the page's paper in it. */
.book-leaf .button-solid, .book-leaf .button-solid:not(:disabled):hover {
  width: 100%; height: 44px; min-height: 44px; box-sizing: border-box; border-radius: calc(3 * var(--u)); box-shadow: none;
  background: var(--color-photobook-ink); border: 1px solid var(--color-photobook-ink); color: var(--leaf);
  font-family: inherit; font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase; white-space: nowrap;
  transition: background-color var(--motion-duration-quick) ease;
}
.book-leaf .button-solid * { color: var(--leaf); }
@media (hover: hover) {
  .book-leaf .button-solid:not(:disabled):hover { background: color-mix(in srgb, var(--color-photobook-ink) 86%, var(--leaf)); }
}
.book-leaf .button-solid:disabled { opacity: 0.5; }
/* Sent: the line in the book's italic, the code boxes as six ruled places for figures, Back small and tracked. */
.book-leaf .stack-v.align-center > .text-body { font-style: italic; font-size: clamp(15px, calc(20 * var(--u)), 20px); line-height: 1.35;
  color: var(--color-photobook-muted); text-align: center; text-wrap: balance; }
.book-leaf .digits { gap: 10px; }
.book-leaf .digits-box, .book-leaf input.digits-box {
  aspect-ratio: 4 / 5; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--color-photobook-rule) 90%, transparent); border-radius: 0;
  background: transparent; font-family: inherit; font-size: clamp(22px, calc(30 * var(--u)), 30px); color: var(--color-photobook-ink); padding: 0;
}
.book-leaf .digits-box:focus { border-bottom-color: var(--gold); transform: none; }
.book-leaf .stack-v.align-center > .button-plain, .book-leaf .stack-v.align-center > .button-plain:not(:disabled):hover {
  align-self: center; justify-content: center; padding: 6px 0; background: none; border: 0;
  font-size: 10px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; color: var(--color-photobook-muted);
}
@media (hover: hover) { .book-leaf .stack-v.align-center > .button-plain:not(:disabled):hover { color: var(--gold); } }
/* The QR code printed on the page: the leaf's paper, the book's ink, so a camera reads it. */
.book-leaf .qr { background: var(--leaf); color: var(--color-photobook-ink); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-photobook-rule) 90%, transparent); }
/* The photo: the caption low at the left over a soft fall-off, where the paper's own padding sits it. */
.book-leaf .paper-cover { padding: calc(52 * var(--u)) calc(52 * var(--u)) calc(64 * var(--u)); }
.book-leaf .paper-photo::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(to top, color-mix(in srgb, var(--dusk) 50%, transparent), color-mix(in srgb, var(--dusk) 14%, transparent) 34%, transparent 56%),
    linear-gradient(to bottom, color-mix(in srgb, var(--dusk) 22%, transparent), transparent 18%);
}
.book-leaf .paper-photo > *, .book-leaf .paper-cover > * { position: relative; z-index: 1; }
/* No photo yet: the inside of the cover is an endpaper, a fine gilt lattice on the cloth's color within a double gilt
   frame, the caption inside it. */
.book-leaf .paper-cover:not(.paper-photo) {
  background-image:
    radial-gradient(ellipse 80% 60% at 36% 30%, color-mix(in srgb, var(--color-book-glow) 9%, transparent), transparent 65%),
    radial-gradient(ellipse 130% 120% at 50% 50%, transparent 48%, color-mix(in srgb, var(--shadow) 40%, transparent)),
    repeating-linear-gradient(45deg, color-mix(in srgb, var(--gold) 10%, transparent) 0 1px, transparent 1px calc(22 * var(--u))),
    repeating-linear-gradient(-45deg, color-mix(in srgb, var(--gold) 10%, transparent) 0 1px, transparent 1px calc(22 * var(--u)));
}
.book-leaf .paper-cover:not(.paper-photo)::before, .book-leaf .paper-cover:not(.paper-photo)::after {
  content: ""; position: absolute; pointer-events: none; z-index: 0; border: 1px solid color-mix(in srgb, var(--gold) 60%, transparent);
}
.book-leaf .paper-cover:not(.paper-photo)::before { inset: calc(26 * var(--u)); }
.book-leaf .paper-cover:not(.paper-photo)::after { inset: calc(32 * var(--u)); border-color: color-mix(in srgb, var(--gold) 32%, transparent); }
.book-leaf .text-cover-line { font-size: calc(62 * var(--u)); line-height: 1.06; white-space: pre-line; text-shadow: 0 2px 28px color-mix(in srgb, var(--shadow) 35%, transparent); max-width: 100%; }
/* The cover's right leaf: the names stacked and centered, the ampersand on its own line. */
.book-leaf .text-names { font-size: calc(98 * var(--u)); line-height: 0.92; letter-spacing: -0.012em; text-align: center; }
.book-leaf .text-names .text-amp { display: block; font-size: calc(62 * var(--u)); line-height: 0.95; margin: calc(2 * var(--u)) 0 calc(-2 * var(--u)); }
.book-leaf .stack-v.align-center > .text-welcome { font-size: calc(24 * var(--u)); line-height: 1.3; max-width: 17em; text-wrap: balance; text-align: center; margin-top: calc(36 * var(--u)); }
.book-leaf .stack-v.align-center > .divider { width: calc(140 * var(--u)); margin-top: calc(22 * var(--u)); border-top-color: color-mix(in srgb, var(--gold) 60%, transparent); }
.book-leaf .stack-v.align-center > .text-day { font-size: calc(90 * var(--u)); line-height: 0.86; letter-spacing: -0.01em; margin-top: calc(10 * var(--u)); }
.book-leaf .stack-v.align-center > .text-dateline { margin-top: calc(6 * var(--u)); }
.book-leaf .stack-v.align-center > .text-place { margin-top: calc(10 * var(--u)); }
.book-leaf .stack-v.align-center > .spacer:nth-child(2) { flex-grow: 1.35; }
.book-leaf .stack-v.align-center > .button-link { margin-top: calc(6 * var(--u)); }


/* ---------- the cover's notes: each update and share pinned to the endpaper ---------- */
/* A slip of the leaf's laid paper, its own height, a little askew (never two the same way), held by a gilt pin; its
   words the leaf's own ink. Pointed at, it lifts toward you. */
.book-leaf .paper-cover .paper-note {
  position: relative; overflow: visible; flex: none;
  padding: calc(22 * var(--u)) calc(26 * var(--u)) calc(20 * var(--u)); gap: calc(5 * var(--u));
  border-radius: calc(2 * var(--u));
  background-color: var(--leaf);
  background-image:
    radial-gradient(ellipse 120% 110% at 50% 40%, transparent 60%, color-mix(in srgb, var(--color-book-foxing) 12%, transparent)),
    repeating-linear-gradient(0deg, transparent 0 calc(23 * var(--u)), color-mix(in srgb, var(--color-photobook-rule) 55%, transparent) calc(23 * var(--u)) calc(24 * var(--u)));
  box-shadow: 0 1px 1px color-mix(in srgb, var(--shadow) 30%, transparent), 0 calc(8 * var(--u)) calc(18 * var(--u)) color-mix(in srgb, var(--shadow) 38%, transparent);
  transform: rotate(-0.8deg);
  transition: transform var(--motion-duration-quick) var(--book-ease), box-shadow var(--motion-duration-quick) var(--book-ease);
}
.book-leaf .paper-cover .stack-v > :nth-child(2n) > .paper-note, .book-leaf .paper-cover .stack-v > .paper-note:nth-child(2n) { transform: rotate(0.7deg) translateX(calc(10 * var(--u))); }
.book-leaf .paper-cover .stack-v > :nth-child(3n) > .paper-note, .book-leaf .paper-cover .stack-v > .paper-note:nth-child(3n) { transform: rotate(-0.3deg) translateX(calc(-6 * var(--u))); }
/* Its pin: a gilt head with a highlight, and the little shadow it throws. */
.book-leaf .paper-cover .paper-note::before {
  content: ""; position: absolute; top: calc(-6 * var(--u)); left: 50%; width: calc(13 * var(--u)); height: calc(13 * var(--u));
  min-width: 8px; min-height: 8px; margin-left: calc(-6.5 * var(--u)); border-radius: 50%; z-index: 2; pointer-events: none;
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--light) 70%, var(--gold)), var(--gold) 45%, color-mix(in srgb, var(--gold) 55%, var(--shadow)));
  box-shadow: 1px 2px 2px color-mix(in srgb, var(--shadow) 45%, transparent);
}
.book-leaf .paper-cover .paper-note > * { position: relative; z-index: 1; }
.book-leaf .paper-cover .paper-note .text-row-title { font-size: clamp(15px, calc(21 * var(--u)), 21px); line-height: 1.2; }
.book-leaf .paper-cover .paper-note .text-row-kicker { font-size: clamp(9px, calc(11 * var(--u)), 11px); }
.book-leaf .paper-cover .paper-note .text-row-meta, .book-leaf .paper-cover .paper-note .text-row-note { font-size: clamp(11px, calc(13 * var(--u)), 13px); }
@media (hover: hover) {
  .book-leaf .paper-cover .paper-note.paper-tap:hover, .book-leaf .paper-cover a:hover > .paper-note {
    transform: rotate(0deg) translateY(calc(-3 * var(--u)));
    box-shadow: 0 1px 1px color-mix(in srgb, var(--shadow) 30%, transparent), 0 calc(14 * var(--u)) calc(28 * var(--u)) color-mix(in srgb, var(--shadow) 45%, transparent);
  }
}
.book-leaf .paper-cover .paper-note.paper-tap { cursor: pointer; }

/* ---------- what opens over the book: a letter laid on it ---------- */
/* An update, a share, Ida: the book stays where it was under a dusk; what's opened is a sheet of the leaf's laid paper
   with a gilt rule inside its edge, its words the book's. Closing it leaves the book as it was. */
body:has(.book) .sheet-scrim {
  align-items: center; padding: 24px;
  background: radial-gradient(ellipse 80% 70% at 50% 45%, color-mix(in srgb, var(--dusk) 45%, transparent), color-mix(in srgb, var(--dusk) 70%, transparent));
  backdrop-filter: blur(2px);
  animation: letter-dusk var(--motion-duration-settle) ease both;
}
body:has(.book) .sheet {
  position: relative; width: min(620px, 100%); max-height: min(86svh, 860px); border-radius: 4px;
  background-color: var(--color-book-leaf); color: var(--color-photobook-ink);
  background-image:
    radial-gradient(ellipse 120% 110% at 50% 48%, transparent 58%, color-mix(in srgb, var(--color-book-foxing) 10%, transparent)),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--color-book-foxing) 2.8%, transparent) 0 1px, transparent 1px 20px);
  box-shadow: 0 2px 4px color-mix(in srgb, var(--color-book-shadow) 30%, transparent), 0 40px 90px color-mix(in srgb, var(--color-book-shadow) 55%, transparent);
  animation: letter-in var(--motion-duration-settle) var(--motion-book-ease, ease) both;
}
body:has(.book) .sheet::after {
  content: ""; position: absolute; inset: 10px; pointer-events: none; border-radius: 2px;
  border: 1px solid color-mix(in srgb, var(--color-photobook-gold) 55%, transparent);
}
body:has(.book) .sheet-head { padding: 22px 26px 0; position: relative; z-index: 1; }
body:has(.book) .sheet-body { padding: 8px 44px 40px; position: relative; z-index: 1; }
body:has(.book) .sheet .text-title, body:has(.book) .sheet .text-headline { font-family: "Bodoni Moda", serif; color: var(--color-photobook-ink); }
body:has(.book) .sheet-close { color: var(--color-photobook-muted); }
/* A thing opened on the letter: each of its words that can change on its own ruled line in the book's ink, the first
   (its name) in the display type; taking it away a quiet outlined word in the bookmark's red, as wide as it is. */
body:has(.book) .sheet .field-inline {
  color: var(--color-photobook-ink); font-size: 17px; line-height: 1.5; padding: 4px 0; margin: 0; border-radius: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--color-photobook-rule) 70%, transparent);
}
body:has(.book) .sheet .field-inline.is-empty { opacity: 1; color: var(--color-photobook-muted); }
body:has(.book) .sheet .field-inline.is-empty:empty { border-bottom-style: dashed; }
body:has(.book) .sheet-body > .field-inline:first-child { font-family: "Bodoni Moda", serif; font-size: 28px; line-height: 1.2; }
@media (hover: hover) { body:has(.book) .sheet .field-inline:hover { background: transparent; border-bottom-color: var(--color-photobook-gold); } }
body:has(.book) .sheet .field-editing { background: transparent; border-bottom-color: var(--color-photobook-gold); }
body:has(.book) .sheet .button-destructive, body:has(.book) .sheet .button-destructive:not(:disabled):hover {
  align-self: flex-start; margin-top: 12px; padding: 9px 18px; border-radius: 3px; background: transparent;
  border: 1px solid color-mix(in srgb, var(--color-book-mark) 55%, transparent); color: var(--color-book-mark);
  font-family: inherit; font-size: 11px; font-weight: 500; letter-spacing: 0.18em; text-transform: uppercase;
}
body:has(.book) .sheet .button-destructive * { color: var(--color-book-mark); }
@media (hover: hover) { body:has(.book) .sheet .button-destructive:not(:disabled):hover { background: color-mix(in srgb, var(--color-book-mark) 8%, transparent); } }
@media (hover: hover) { body:has(.book) .sheet-close:hover { color: var(--color-photobook-gold); background: transparent; } }
@keyframes letter-dusk { from { opacity: 0; } to { opacity: 1; } }
@keyframes letter-in { from { opacity: 0; transform: translateY(14px) rotate(-0.6deg) scale(0.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { body:has(.book) .sheet, body:has(.book) .sheet-scrim { animation: none; } }

/* Ida's conversation on the letter: her words in the book's italic, theirs in its ink; the field one hairline; the mic
   and Send quiet outlined buttons; recording, the mic glows the bookmark's red. */
body:has(.book) .sheet .message-text { color: var(--color-photobook-ink); }
body:has(.book) .sheet .message-me .message-text { background: transparent; box-shadow: none; border-radius: 0; padding: 2px 0 2px 12px; border-left: 2px solid color-mix(in srgb, var(--color-photobook-gold) 70%, transparent); }
body:has(.book) .sheet .message-ida .message-text { background: transparent; box-shadow: none; padding-left: 0; padding-right: 0; font-family: "Bodoni Moda", serif; font-style: italic; font-size: 18px; line-height: 1.45; }
body:has(.book) .sheet .stack-pin-bottom-end { background: linear-gradient(to bottom, transparent, var(--color-book-leaf) 30%); width: 100%; }
body:has(.book) .sheet .stack-pin-bottom-end > .field { background: transparent; border: 0; border-bottom: 1px solid color-mix(in srgb, var(--color-photobook-rule) 90%, transparent); border-radius: 0; }
body:has(.book) .sheet .stack-pin-bottom-end textarea, body:has(.book) .sheet .stack-pin-bottom-end input { background: transparent; color: var(--color-photobook-ink); }
body:has(.book) .sheet .stack-pin-bottom-end .button-chip, body:has(.book) .sheet .stack-pin-bottom-end .button-chip:not(:disabled):hover {
  background: transparent; color: var(--color-photobook-ink); border: 1px solid color-mix(in srgb, var(--color-photobook-ink) 45%, transparent);
  border-radius: 3px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
}
body:has(.book) .sheet .button[data-state="recording"], body:has(.book) .sheet .button[data-state="recording"]:not(:disabled):hover {
  color: var(--color-photobook-on-dark); background: var(--color-book-mark); border-color: var(--color-book-mark);
}

/* ---------- Ida, on the desk under the book ---------- */
/* A gilt seal with the microphone stamped in it, and her name beside it in the book's italic: the way to ask her
   anything, by voice or in words. It breathes a little light, so it's found. */
.button:has(> .text-ida), .button:has(> .text-ida):not(:disabled):hover {
  display: inline-flex; align-items: center; gap: 12px; padding: 0; color: var(--color-photobook-on-dark);
}
.button:has(> .text-ida) > .icon {
  box-sizing: border-box; width: 46px; height: 46px; padding: 8px; border-radius: 50%; color: color-mix(in srgb, var(--gold) 80%, var(--light));
  border: 1px solid color-mix(in srgb, var(--gold) 80%, transparent);
  background: radial-gradient(circle at 35% 30%, color-mix(in srgb, var(--light) 14%, transparent), transparent 60%), var(--case);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--shadow) 25%, transparent), 0 6px 16px color-mix(in srgb, var(--shadow) 45%, transparent),
    0 0 0 0 color-mix(in srgb, var(--color-book-glow) 0%, transparent);
  animation: ida-breathe 4.8s ease-in-out infinite;
  transition: transform var(--motion-duration-quick) ease;
}
.text-ida {
  font-family: "Bodoni Moda", serif; font-style: italic; font-size: 19px; letter-spacing: 0.01em; text-transform: none;
  color: var(--color-photobook-on-dark);
}
@media (hover: hover) {
  .button:has(> .text-ida):hover > .icon { transform: translateY(-2px) rotate(-6deg); }
  .button:has(> .text-ida):hover .text-ida { color: var(--gold); }
}
@keyframes ida-breathe {
  0%, 100% { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--shadow) 25%, transparent), 0 6px 16px color-mix(in srgb, var(--shadow) 45%, transparent), 0 0 0 0 color-mix(in srgb, var(--color-book-glow) 0%, transparent); }
  50% { box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--shadow) 25%, transparent), 0 6px 16px color-mix(in srgb, var(--shadow) 45%, transparent), 0 0 22px 2px color-mix(in srgb, var(--color-book-glow) 18%, transparent); }
}
@media (max-width: 720px) {
  .button:has(> .text-ida) > .icon { width: 38px; height: 38px; padding: 6px; }
  .text-ida { font-size: 15px; }
}

/* ---------- the desk, alive ---------- */
/* A candle burning off the top left of the desk: its warm light pooled on the wood, never still, never in the way. The
   bookmark's silk stirs in the air now and then. Nothing moves for someone who'd rather it didn't. */
.book::before {
  content: ""; position: absolute; inset: -10%; pointer-events: none;
  background:
    radial-gradient(ellipse 46% 42% at 16% 10%, color-mix(in srgb, var(--color-book-glow) 13%, transparent), transparent 70%),
    radial-gradient(ellipse 30% 26% at 12% 6%, color-mix(in srgb, var(--color-book-glow) 9%, transparent), transparent 70%);
  transform-origin: 14% 8%;
  animation: candle 7s ease-in-out infinite;
}
@keyframes candle {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  17% { opacity: 1; transform: scale(1.015); }
  29% { opacity: 0.82; transform: scale(0.995); }
  46% { opacity: 0.97; transform: scale(1.01) translate(0.2%, 0.1%); }
  63% { opacity: 0.86; transform: scale(1); }
  81% { opacity: 1; transform: scale(1.02) translate(-0.2%, 0); }
}
.book-bookmark-out { animation: silk 9s ease-in-out 2.4s infinite; }
@keyframes silk { 0%, 100% { transform: rotate(7deg); } 50% { transform: rotate(5.8deg); } }
@media (hover: hover) { .book-bookmark-out:hover { animation: none; } }
@media (prefers-reduced-motion: reduce) {
  .book::before, .book-bookmark-out, .button:has(> .text-ida) > .icon { animation: none; }
}

/* A note opened on the letter: its title in the book's display type, what follows quieter under it. */
body:has(.book) .sheet-body > .text:first-child { font-family: "Bodoni Moda", serif; font-size: 28px; line-height: 1.15; color: var(--color-photobook-ink); text-wrap: balance; }
body:has(.book) .sheet-body > .text:first-child::after {
  content: ""; display: block; width: 56px; margin-top: 16px; border-top: 1px solid color-mix(in srgb, var(--color-photobook-gold) 70%, transparent);
}
body:has(.book) .sheet-body > .text:not(:first-child) { font-size: 16px; color: var(--color-photobook-muted); }
