/* Le livre (D-205, docs/09 § 44) : papier clair, une personne par page, prune douce pour ce qui s'écoute. Un seul monde
   visuel, quel que soit le thème de l'appareil : c'est un objet, pas une page du site. Fraunces et Inter viennent de
   ulalu.css ; Cormorant Garamond et Mrs Saint Delafield ne servent qu'ici (wwwroot/fonts/LICENCES.md). */
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 300 700; font-display: swap; src: url(../fonts/cormorant-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215; }
@font-face { font-family: "Cormorant Garamond"; font-style: normal; font-weight: 300 700; font-display: swap; src: url(../fonts/cormorant-latinext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 300 700; font-display: swap; src: url(../fonts/cormorant-italic-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215; }
@font-face { font-family: "Cormorant Garamond"; font-style: italic; font-weight: 300 700; font-display: swap; src: url(../fonts/cormorant-italic-latinext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Mrs Saint Delafield"; font-display: swap; src: url(../fonts/mrs-saint-delafield-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F; }
@font-face { font-family: "Mrs Saint Delafield"; font-display: swap; src: url(../fonts/mrs-saint-delafield-latinext.woff2) format("woff2"); unicode-range: U+0100-02BA, U+1E00-1EFF; }

/* Disposition : un en-tête fin, le livre au centre (double page ou page seule), une ligne de commandes. */
.livre {
  --bg: #f6f1ea; --page: #fcfaf7; --page-edge: #ece4dc; --ink: #2a2230; --ink-2: #574c55; --muted: #8b7e87;
  --plum: #6e3d55; --plum-ink: #5a2f44; --rose: #f1e5ea; --rose-2: #e6d3db; --line: #e4dad8; --focus: #6e3d55;
  --display: "Cormorant Garamond", "Georgia", serif; --script: "Mrs Saint Delafield", "Snell Roundhand", cursive; --ui: "Inter", system-ui, sans-serif;
  position: fixed; inset: 0; display: grid; grid-template-rows: auto 1fr auto; background: var(--bg); color: var(--ink);
  font-family: var(--ui); overflow: hidden; color-scheme: light;
}
.livre *, .livre *::before, .livre *::after { box-sizing: border-box; }
.livre button { font: inherit; color: inherit; }
.livre :focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

.livre__head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 12px clamp(16px, 3vw, 40px); padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); background: var(--bg); }
.livre__brand { display: flex; align-items: center; gap: 14px; min-width: 0; font: 500 15px/1 var(--ui); color: var(--ink-2); text-decoration: none; }
.livre__brand b { font: 700 22px/1 "Fraunces", var(--display); letter-spacing: -.01em; color: var(--ink); }
.livre__brand span { padding-left: 14px; border-left: 1px solid var(--line); }
.livre__title { margin: 0; text-align: center; font: 500 clamp(18px, 2.2vw, 24px)/1.2 var(--display); text-wrap: balance; }
.livre__tools { display: flex; justify-content: flex-end; gap: 8px; }
.tool { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: 500 14px/1 var(--ui); cursor: pointer; }
.tool:hover { border-color: var(--plum); }
.tool .ico { width: 18px; height: 18px; }

.livre__stage { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; grid-template-rows: auto minmax(0, 1fr); align-items: center; gap: 8px; padding: clamp(10px, 2vh, 24px) clamp(8px, 2vw, 24px); min-height: 0; perspective: 3000px; }
.livre__intro { grid-column: 1 / -1; text-align: center; margin: 0 0 clamp(6px, 1.5vh, 14px); }
.livre__eyebrow { margin: 0; max-width: none; font: 600 11px/1.4 var(--ui); letter-spacing: .28em; text-transform: uppercase; color: var(--ink-2); }
.livre__eyebrow::before { content: none; }
.livre__intro h1 { margin: 2px 0 4px; max-width: none; font: 400 clamp(30px, 4.6vw, 54px)/1.05 var(--display); letter-spacing: -.01em; text-wrap: balance; }
.livre__lead { margin: 0 auto; max-width: 60ch; font: 400 clamp(16px, 1.6vw, 20px)/1.4 var(--display); color: var(--ink-2); text-align: center; }
.arrow { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--plum); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 16px -6px rgba(110,61,85,.6); }
.arrow:disabled { opacity: .25; cursor: default; box-shadow: none; }
.arrow .ico { width: 20px; height: 20px; }

.book { position: relative; justify-self: center; transform-style: preserve-3d; }
.is-spread .book { --ph: min(calc(100svh - 300px), 620px); --pw: min(calc(var(--ph) * 1.18), calc((100vw - 200px) / 2)); width: calc(var(--pw) * 2); height: calc(var(--pw) / 1.18); }
.is-single .book { width: 100%; height: 100%; min-height: 0; align-self: stretch; }
.book::before { content: ""; position: absolute; inset: 0; border-radius: 6px; box-shadow: 0 30px 60px -24px rgba(60,35,45,.35), 0 2px 6px rgba(60,35,45,.08); background: var(--page-edge); }
.is-spread .book::after { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-1px); background: linear-gradient(180deg, transparent, rgba(0,0,0,.08) 20%, rgba(0,0,0,.08) 80%, transparent); z-index: 3; pointer-events: none; }

.leaf { position: absolute; top: 0; height: 100%; transform-style: preserve-3d; }
.is-spread .leaf { left: 50%; width: 50%; transform-origin: left center; }
.is-single .leaf { left: 0; width: 100%; transform-origin: left center; }
.leaf.is-turned { transform: rotateY(-180deg); }
.is-single .leaf.is-turned { visibility: hidden; }
.face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; background: var(--page); }
.face--back { transform: rotateY(180deg); }
.is-spread .face--front { border-radius: 0 6px 6px 0; box-shadow: inset 12px 0 24px -18px rgba(0,0,0,.25); }
.is-spread .face--back { border-radius: 6px 0 0 6px; box-shadow: inset -12px 0 24px -18px rgba(0,0,0,.25); }
.is-single .face { border-radius: 6px; }
.face .shade { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: linear-gradient(90deg, rgba(40,20,30,.45), rgba(40,20,30,.05) 50%, rgba(255,255,255,.12)); }
.face--back .shade { background: linear-gradient(270deg, rgba(40,20,30,.45), rgba(40,20,30,.05) 50%, rgba(255,255,255,.12)); }

/* La page d'une personne */
.pg { position: absolute; inset: 0; display: flex; flex-direction: column; gap: clamp(10px, 2.2cqh, 22px); padding: clamp(18px, 5.5cqw, 44px) clamp(18px, 6cqw, 52px); container-type: size; }
.face { container-type: size; }
.pg--blank { background: var(--page); }
/* A verso left blank so that a photo lands on a left page: a small fleuron says it is meant. */
.pg--blank:not(.pg--end)::after { content: "❦"; position: absolute; inset: 0; display: grid; place-items: center; font: 400 28px/1 var(--display); color: var(--plum); opacity: .18; }
.pg--end { display: grid; place-items: center; align-content: center; font: italic 400 22px/1.4 var(--display); color: var(--muted); }
.pg--end p { margin: 0; }
/* « Fait avec Ulalu » sous « Fin du livre » (D-228) : une signature, pas un bouton — mais assez haute pour un doigt. */
.pg__made { font: 500 12px/1.4 var(--ui); letter-spacing: .06em; }
.pg__made a { display: inline-block; padding: 14px 12px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.pg__kind { display: flex; align-items: center; gap: 12px; margin: 0; font: 600 11px/1 var(--ui); letter-spacing: .26em; text-transform: uppercase; color: var(--ink-2); }
.pg__rule { flex: 0 0 clamp(40px, 12cqw, 90px); height: 1px; background: var(--line); }
.pg__body { display: grid; grid-template-columns: minmax(0, 36%) minmax(0, 1fr); gap: clamp(14px, 4cqw, 40px); align-items: start; flex: 1 1 auto; min-height: 0; }
.pg__photo { position: relative; margin: 0; width: 100%; aspect-ratio: var(--ar, .8); max-height: 100%; border-radius: 10px; overflow: hidden; background: var(--rose); }
.pg__photo img, .pg__photo video { display: block; width: 100%; height: 100%; object-fit: cover; }
.pg__photo--none { display: grid; place-items: center; font: 400 64px/1 var(--display); color: var(--plum); }
.pg__vplay { position: absolute; inset: auto 12px 12px auto; width: 52px; height: 52px; border-radius: 50%; border: 0; background: var(--plum); color: #fff; display: grid; place-items: center; cursor: pointer; }
.pg__vplay .ico { width: 22px; height: 22px; }
.pg__text { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.pg__name { margin: 0; font: 400 clamp(28px, 9cqw, 46px)/1.05 var(--display); letter-spacing: -.01em; overflow-wrap: anywhere; }
.pg__role { margin: 4px 0 0; font: 400 clamp(15px, 3.6cqw, 19px)/1.3 var(--display); font-variant-numeric: lining-nums; color: var(--muted); }
.pg__quote { position: relative; margin: clamp(10px, 3cqh, 22px) 0 0; padding-left: clamp(22px, 6cqw, 34px); font-family: var(--display); font-style: italic; font-weight: 400; color: var(--ink); text-wrap: pretty; hyphens: auto; }
.pg__quote--l { font-size: clamp(19px, 4.6cqw, 27px); line-height: 1.32; }
.pg__quote--m { font-size: clamp(17px, 4cqw, 23px); line-height: 1.34; }
.pg__quote--s { font-size: clamp(15px, 3.4cqw, 20px); line-height: 1.36; }
.pg__quote--xs { font-size: clamp(13.5px, 3cqw, 17px); line-height: 1.38; }
.q { font-style: normal; font-weight: 600; color: var(--plum); opacity: .75; line-height: 0; }
.q--open { position: absolute; left: 0; top: .55em; font-size: 2.2em; }
.q--close { display: inline-block; margin-left: .15em; font-size: 2.2em; vertical-align: -.35em; }
.pg__sig { margin: clamp(8px, 2cqh, 18px) 0 0; font: 400 clamp(30px, 8cqw, 44px)/1 var(--script); color: var(--ink); transform: rotate(-5deg); transform-origin: left; white-space: nowrap; overflow: hidden; text-overflow: clip; }
.pg--word-only .pg__text { justify-content: center; }
/* A photo wider than tall (a group, a landscape) sits on top, whole, the words beneath it. */
/* Whole, never cut into a band: with words, the photo keeps a wider left column and its own proportions; without
   words, it spans the top. Its width follows its height (fit() lowers --photo-h last). */
.pg--wide .pg__body { grid-template-columns: minmax(0, 46%) minmax(0, 1fr); align-items: start; }
.pg--wide .pg__photo { width: min(100%, calc(var(--photo-h, 60cqh) * var(--ar, 1.4))); height: auto; max-height: none; margin-inline: auto; }
.pg--wide.pg--voice-only .pg__body { grid-template-columns: 1fr; }
.pg--wide.pg--voice-only .pg__photo { --photo-h: 56cqh; }
.pg--wide .pg__text { align-items: flex-start; }
.pg--wide .pg__quote { margin-top: clamp(6px, 1.6cqh, 14px); }
.pg--voice-only .pg__body { grid-template-columns: minmax(0, 44%) minmax(0, 1fr); align-items: stretch; }
.pg--voice-only .pg__photo { aspect-ratio: auto; height: 100%; max-height: none; }
.pg--voice-only .pg__text { justify-content: center; gap: 0; }
.pg--voice-only .pg__sig { margin-top: clamp(6px, 1.5cqh, 12px); }
.pg--voice-only .pg__sig { margin-top: clamp(14px, 4cqh, 30px); }

.player { flex: 0 0 auto; padding: clamp(10px, 2cqh, 14px) clamp(14px, 4cqw, 22px); border-radius: 12px; background: var(--rose); }
.player__label { margin: 0 0 6px; font: 400 clamp(13px, 3.2cqw, 16px)/1.3 var(--display); color: var(--ink-2); }
.player__row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: clamp(8px, 2.5cqw, 16px); }
.player__btn { position: relative; width: clamp(44px, 12cqw, 60px); height: clamp(44px, 12cqw, 60px); border-radius: 50%; border: 0; background: var(--plum); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 14px -6px rgba(110,61,85,.55); }
.player__btn .ico { width: 44%; height: 44%; }
.player__btn .ico--pause, .is-playing .player__btn .ico--play { display: none; }
.is-playing .player__btn .ico--pause { display: block; }
.wave { width: 100%; height: clamp(26px, 7cqw, 40px); display: block; }
.wave__base { fill: #d9c6ce; }
.wave__done { fill: var(--plum-ink); }
.player__time { font: 500 clamp(12px, 3cqw, 15px)/1 var(--ui); font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.player__mute { width: 40px; height: 40px; border: 0; background: transparent; color: var(--plum); border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.player__mute .ico { width: 22px; height: 22px; fill: currentColor; }
.is-muted .player__mute { opacity: .45; }
.pg__num { position: absolute; bottom: clamp(10px, 2.5cqh, 16px); font: 500 12px/1 var(--ui); color: var(--muted); letter-spacing: .06em; }
.face--front .pg__num, .is-single .pg__num { right: clamp(14px, 4cqw, 24px); }
.face--back .pg__num { left: clamp(14px, 4cqw, 24px); }

/* A double page for long words (docs/09 § 44): the photo alone on the left page, the words facing it. */
.pg--photo .pg__body { grid-template-columns: 1fr; place-items: center; }
.pg--photo .pg__photo { width: min(100%, calc(var(--photo-h, 78cqh) * var(--ar, .8))); height: auto; max-height: none; aspect-ratio: var(--ar, .8); border-radius: 10px; box-shadow: 0 18px 40px -22px rgba(60,35,45,.45); }
.pg--words .pg__body { grid-template-columns: 1fr; }
.pg--words .pg__text { justify-content: center; }
.pg--words .pg__quote { font-size: clamp(17px, 4.3cqw, 26px); line-height: 1.42; max-width: 34em; }
.pg--words .pg__name { font-size: clamp(30px, 9cqw, 48px); }

/* Commandes */
/* Left: « Feuilleter les souvenirs »; middle: where we are; right: download and full screen. */
.livre__foot { display: flex; align-items: center; gap: 12px; padding: 10px clamp(16px, 3vw, 40px); padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--bg); }
.linkbtn { display: inline-flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 6px; border: 0; background: none; font: 500 14px/1 var(--ui); color: var(--ink); text-decoration: none; cursor: pointer; border-radius: 8px; }
.livre a.linkbtn, .livre a.linkbtn:hover { font: 500 14px/1 var(--ui); color: var(--ink); text-decoration: none; }
.linkbtn .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.is-auto [data-listen] { color: var(--plum); font-weight: 600; }
.progress { display: grid; justify-items: center; gap: 6px; min-width: 160px; }
.progress__where { font: 500 15px/1 var(--display); letter-spacing: .08em; font-variant-numeric: tabular-nums lining-nums; }
.progress__bar { width: min(270px, 40vw); height: 4px; border-radius: 4px; background: var(--rose-2); overflow: hidden; }
.progress__fill { height: 100%; width: 0; background: var(--plum); border-radius: 4px; transition: width .5s; }
.livre__foot .progress { margin-inline: auto; }

/* Les participants */
.guests { position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 92vw); padding: 18px; overflow: auto; background: #fff; border-left: 1px solid var(--line); box-shadow: -20px 0 40px -30px rgba(0,0,0,.25); transform: translateX(105%); transition: transform .35s; z-index: 20; }
.has-guests .guests { transform: none; }
.guests__title { margin: 0 0 12px; font: 400 24px/1.1 var(--display); }
.guests__list { display: grid; gap: 4px; }
.guests__item { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 6px 8px; border: 0; border-radius: 10px; background: none; text-align: left; cursor: pointer; }
.guests__item:hover, .guests__item.is-current { background: var(--rose); }
.guests__item img, .guests__ini { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; display: grid; place-items: center; background: var(--rose-2); font: 400 20px/1 var(--display); color: var(--plum); }
.guests__name { font: 500 17px/1.2 var(--display); }
.guests__kind { font-size: 13px; color: var(--plum); }
.guests__close { position: absolute; top: 12px; right: 12px; }

.livre__notice { margin: 0; padding: 6px 16px; max-width: none; text-align: center; font: 400 12px/1.4 var(--ui); color: var(--muted); }

@media (max-width: 759px) {
  .livre__head { grid-template-columns: 1fr auto; }
  .pg--voice-only .pg__body { grid-template-columns: 1fr; }
  .pg--wide .pg__body { grid-template-columns: 1fr; }
  .pg--voice-only .pg__photo, .pg--wide .pg__photo { aspect-ratio: var(--ar, 1.33); height: auto; max-height: none; width: min(100%, calc(var(--photo-h, 48cqh) * var(--ar, 1.33))); margin-inline: auto; }
  .pg--wide:not(.pg--voice-only) .pg__photo { --photo-h: 30cqh; }
  .pg--photo .pg__photo { --photo-h: 66cqh; }
  .pg--words .pg__quote { font-size: 17px; }
  .pg--voice-only .pg__text { justify-content: flex-start; gap: 6px; }
  .pg--voice-only .pg__name { margin-top: 6px; }
  .livre__title { display: none; }
  .livre__intro h1 { font-size: 26px; }
  .livre__intro .lead { font-size: 15px; }
  .livre__stage { grid-template-columns: 1fr; padding: 8px 20px 6px; }
  .livre__intro { margin-bottom: 4px; }
  .livre__lead { font-size: 14px; line-height: 1.3; }
  .livre__notice { font-size: 11px; line-height: 1.3; padding: 4px 12px; }
  .arrow { display: none; }
  .pg { gap: 12px; padding: 18px 18px 40px; }
  .pg__body { grid-template-columns: 1fr; gap: 12px; }
  .pg__photo { aspect-ratio: 4 / 3; max-height: 34cqh; }
  .pg__name { font-size: 30px; }
  .pg__sig { font-size: 32px; }
  .livre__foot { gap: 6px; padding-inline: 12px; }
  .linkbtn span { display: none; }
  .progress { min-width: 0; }
  .progress__bar { width: 34vw; }
}
@media (prefers-reduced-motion: reduce) { .progress__fill, .guests { transition: none; } }

/* Sans script : le livre à plat. */
.livre__flat { padding: 20px; overflow: auto; max-height: 100%; font: 400 16px/1.5 var(--ui); }
.livre__flat ol { padding-left: 20px; display: grid; gap: 14px; }
.livre__flat blockquote { margin: 4px 0; font: italic 400 18px/1.4 var(--display); }
.livre__notice span + span::before { content: " · "; }
