/* ═══════════════════════════════════════════════════════════════════════
   Lectio — feuille de style
   Langage visuel : le manuscrit glosé. Papier chaud, encre, et une seule
   couleur « rubrique » (l'encre rouge des copistes) réservée à ce qui
   compte : la traduction et l'action principale.
   Newsreader (lecture, titres) · Karla (interface) · DM Mono (chiffres).
   Voir docs/handoff-technique.md, « Refonte de l'interface ».
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── 1. Jetons ─────────────────────────────────────────────────────── */
:root {
  color-scheme: light;

  /* Encre (couleur d'accent) : teinte + chroma choisies par l'utilisateur,
     la clarté dépend du thème pour garder le contraste AA partout. */
  --ink-h: 340;
  --ink-c: 0.15;
  --ink-l: 40%;
  --accent: oklch(var(--ink-l) var(--ink-c) var(--ink-h));
  --accent-strong: oklch(calc(var(--ink-l) - 6%) var(--ink-c) var(--ink-h));
  --on-accent: oklch(99% 0.005 85);
  --accent-wash: color-mix(in oklch, var(--accent) 9%, var(--surface));
  --accent-tint: color-mix(in oklch, var(--accent) 16%, var(--surface));
  --lit: color-mix(in oklch, var(--accent) 24%, transparent);

  --desk: oklch(95.5% 0.014 85);
  --surface: oklch(98.6% 0.008 85);
  --page: #ffffff;
  --text: oklch(24% 0.018 340);
  --text-muted: oklch(46% 0.018 340);
  --rule: oklch(87% 0.016 82);
  --rule-strong: oklch(60% 0.02 340);
  --danger: oklch(48% 0.16 30);
  --shadow-color: 30 20% 20%;

  --shadow-1: 0 1px 2px hsl(var(--shadow-color) / 0.08), 0 2px 8px -2px hsl(var(--shadow-color) / 0.1);
  --shadow-2: 0 1px 1px hsl(var(--shadow-color) / 0.06), 0 8px 20px -8px hsl(var(--shadow-color) / 0.22),
    0 24px 48px -24px hsl(var(--shadow-color) / 0.22);
  --shadow-page: 0 1px 1px hsl(var(--shadow-color) / 0.08), 0 14px 30px -18px hsl(var(--shadow-color) / 0.3),
    0 40px 70px -50px hsl(var(--shadow-color) / 0.35);

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Karla", ui-sans-serif, system-ui, sans-serif;
  --mono: "DM Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --topbar-h: 56px;
  --gloss-scale: 1; /* taille de la bulle de traduction, réglable */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

:root[data-theme="sepia"] {
  --desk: oklch(90% 0.04 78);
  --surface: oklch(94.5% 0.034 80);
  --page: oklch(96% 0.03 82);
  --text: oklch(28% 0.04 55);
  --text-muted: oklch(44% 0.04 60);
  --rule: oklch(80% 0.045 75);
  --rule-strong: oklch(55% 0.05 60);
  --shadow-color: 30 40% 18%;
}

:root[data-theme="night"] {
  color-scheme: dark;
  --ink-l: 76%;
  --on-accent: oklch(18% 0.02 340);
  --accent-strong: oklch(84% calc(var(--ink-c) * 0.8) var(--ink-h));
  --desk: oklch(17.5% 0.012 320);
  --surface: oklch(22.5% 0.014 320);
  --page: oklch(26% 0.012 320);
  --text: oklch(92% 0.012 85);
  --text-muted: oklch(72% 0.014 85);
  --rule: oklch(32% 0.014 320);
  --rule-strong: oklch(58% 0.016 320);
  --danger: oklch(72% 0.15 30);
  --shadow-color: 320 30% 3%;
}

:root[data-ink="indigo"] { --ink-h: 268; --ink-c: 0.15; }
:root[data-ink="foret"] { --ink-h: 158; --ink-c: 0.09; }
:root[data-ink="terre"] { --ink-h: 48; --ink-c: 0.12; }
:root[data-ink="ardoise"] { --ink-h: 245; --ink-c: 0.035; --ink-l: 34%; }
:root[data-theme="night"][data-ink="ardoise"] { --ink-l: 82%; }

/* ─── 2. Base ───────────────────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--desk);
  /* Grain de papier : presque invisible, mais il évite l'aplat « écran ». */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .25 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 0.3s ease, color 0.3s ease;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

::selection {
  background: color-mix(in oklch, var(--accent) 30%, transparent);
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--on-accent);
  border-radius: var(--radius-s);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus {
  transform: none;
}

/* ─── 3. Boutons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s, transform 0.15s var(--ease-out);
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: inset 0 -2px 0 hsl(0 0% 0% / 0.18), var(--shadow-1);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-strong);
}

.btn-large {
  min-height: 52px;
  padding: 0 24px;
  font-size: 16.5px;
  border-radius: 14px;
}
.btn-large .icon {
  width: 22px;
  height: 22px;
}

.btn-outline {
  border-color: var(--rule-strong);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) {
  background: var(--accent-wash);
  border-color: var(--accent);
}

.btn-small {
  min-height: 32px;
  padding: 0 11px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-quiet,
.btn-icon {
  color: var(--text-muted);
}
.btn-icon {
  width: 36px;
  padding: 0;
}
.btn-quiet:hover:not(:disabled),
.btn-icon:hover:not(:disabled) {
  background: var(--accent-wash);
  color: var(--text);
}
.btn[aria-pressed="true"] {
  background: var(--accent-tint);
  color: var(--accent-strong);
}
.btn-quiet[aria-pressed="true"] {
  border-color: color-mix(in oklch, var(--accent) 45%, transparent);
}

.btn-danger {
  background: var(--danger);
  color: var(--on-accent);
}
.btn-danger-quiet {
  color: var(--danger);
  border-color: color-mix(in oklch, var(--danger) 45%, transparent);
}
.btn-danger-quiet:hover:not(:disabled) {
  background: color-mix(in oklch, var(--danger) 10%, transparent);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 3px;
}
.link-btn:hover {
  color: var(--accent-strong);
}
.link-btn .icon {
  width: 16px;
  height: 16px;
}

/* ─── 4. Barre du haut ──────────────────────────────────────────────── */
.update-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13.5px;
  font-weight: 600;
}
.update-banner button {
  padding: 3px 12px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: transparent;
  color: inherit;
  font-weight: 700;
  font-size: 13px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--topbar-h);
  padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  background: color-mix(in oklch, var(--desk) 86%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s;
}
body[data-view="reader"] .topbar,
body.is-scrolled .topbar {
  border-bottom-color: var(--rule);
}

/* Le logotype : une lettrine rubriquée suivie du mot, comme une initiale
   de manuscrit. */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 4px 6px 4px 2px;
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  font-family: var(--serif);
  line-height: 1;
  flex-shrink: 0;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  margin-right: 3px;
  border-radius: 7px 7px 7px 2px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 22px;
  font-weight: 600;
  font-style: italic;
  transition: transform 0.3s var(--ease-out);
}
.brand:hover .brand-mark {
  transform: rotate(-6deg);
}
.brand-name {
  font-size: 22px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.01em;
  transform: translateY(3px);
}

.doc-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}
.doc-heading-rule {
  width: 1px;
  height: 22px;
  background: var(--rule-strong);
  opacity: 0.5;
  flex-shrink: 0;
}
.doc-title {
  overflow: hidden;
  font-family: var(--serif);
  font-size: 16.5px;
  font-style: italic;
  color: var(--text-muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
body[data-view="home"] .reader-only {
  display: none;
}
body[data-view="reader"] .brand-name {
  display: none;
}
.topbar-sep {
  width: 1px;
  height: 20px;
  margin: 0 6px;
  background: var(--rule);
}

.lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  background: var(--surface);
  font-size: 13.5px;
  font-weight: 600;
  transition: border-color 0.15s, background-color 0.15s;
}
.lang-chip:hover,
.lang-chip[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--accent-wash);
}
.lang-chip .icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
}
.lang-chip-target {
  color: var(--accent-strong);
}
.lang-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 1.5px solid var(--rule-strong);
}
.lang-chip-dot.is-ready {
  border-color: transparent;
  background: oklch(62% 0.14 150);
}
.lang-chip-dot.is-loading {
  border-color: var(--accent);
  border-right-color: transparent;
  animation: spin 0.8s linear infinite;
}

.read-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  pointer-events: none;
}
#read-progress-bar {
  width: 100%;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s var(--ease-out);
}

/* ─── 5. Popover des langues ────────────────────────────────────────── */
.popover {
  position: fixed;
  z-index: 45;
  width: min(380px, calc(100vw - 24px));
  padding: 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.lang-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 8px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
select {
  width: 100%;
  min-height: 38px;
  padding: 0 30px 0 11px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-m);
  background: var(--page)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23777' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='m1.5 1.5 4.5 4.5 4.5-4.5'/%3E%3C/svg%3E")
    no-repeat right 10px center;
  font-weight: 600;
  appearance: none;
}
.swap-btn {
  margin-bottom: 1px;
  transition: transform 0.35s var(--ease-out), background-color 0.15s;
}
.swap-btn:active {
  transform: rotate(180deg) !important;
}
.engine-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}
.engine-state {
  font-size: 13px;
  line-height: 1.45;
  color: var(--text-muted);
}
.engine-state strong {
  color: var(--text);
}

/* ─── 6. Le pupitre (accueil) ───────────────────────────────────────── */
main {
  outline: none;
}

.home {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: clamp(28px, 6vw, 72px) clamp(18px, 4vw, 40px) 48px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
}

.kicker {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.kicker span {
  color: var(--accent);
}

.home-title {
  margin-top: 18px;
  font-family: var(--serif);
  font-size: clamp(38px, 5.6vw, 68px);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.025em;
  text-wrap: balance;
}
.home-title em {
  font-weight: 400;
}
.home-title .rubric {
  color: var(--accent);
  white-space: nowrap;
  text-decoration: underline;
  text-decoration-thickness: 0.045em;
  text-underline-offset: 0.16em;
  text-decoration-color: color-mix(in oklch, var(--accent) 45%, transparent);
}

.home-lede {
  max-width: 34em;
  margin-top: 22px;
  font-family: var(--serif);
  font-size: clamp(17px, 1.5vw, 19.5px);
  line-height: 1.55;
  color: var(--text-muted);
}

.home-cta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 30px;
}
.home-sample {
  font-size: 13.5px;
}
/* Mode économe : bouton de lecture d'une page scannée, posé sur la page. */
.ocr-offer {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  gap: 4px;
  width: min(280px, 80%);
  padding: 16px 18px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  color: var(--text);
  font-size: 14px;
  text-align: center;
  transform: translate(-50%, -50%);
}
.ocr-offer strong {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 500;
}
.ocr-offer span {
  color: var(--text-muted);
}
.incident-note {
  padding: 8px 10px;
  border-radius: var(--radius-s);
  background: color-mix(in oklch, var(--danger) 10%, transparent);
}
.home-cta-hint {
  font-size: 13.5px;
  color: var(--text-muted);
}

/* Le spécimen : une feuille posée de travers sur le pupitre. */
.specimen {
  position: relative;
  margin: 0;
  justify-self: center;
  width: min(430px, 100%);
}
.specimen-sheet {
  position: relative;
  padding: 34px 34px 22px;
  border-radius: 3px;
  background: var(--page);
  box-shadow: var(--shadow-page);
  transform: rotate(1.6deg);
  transition: transform 0.5s var(--ease-out);
}
.specimen:hover .specimen-sheet,
.specimen:focus-within .specimen-sheet {
  transform: rotate(0.4deg) translateY(-3px);
}
.specimen-sheet::before {
  /* Marge tracée à la mine, comme sur un feuillet réglé. */
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 20px;
  width: 1px;
  background: color-mix(in oklch, var(--accent) 28%, transparent);
}
.specimen-folio {
  position: absolute;
  top: 12px;
  right: 16px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}
.specimen-text {
  font-family: var(--serif);
  font-size: clamp(21px, 2.1vw, 25px);
  /* Interligne large : la place de la glose interlinéaire. */
  line-height: 2.15;
  color: var(--text);
}
.lettrine {
  float: left;
  margin: 0.2em 0.1em 0 0;
  font-size: 3.5em;
  font-weight: 500;
  line-height: 0.74;
  color: var(--accent);
}
.sw {
  position: relative;
  display: inline-block;
  line-height: 1.2;
  border-radius: 3px;
  cursor: help;
  white-space: nowrap;
  transition: background-color 0.15s;
}
.sw::after {
  content: attr(data-gloss);
  position: absolute;
  left: 50%;
  bottom: 100%;
  font-size: 0.6em;
  font-style: italic;
  line-height: 1;
  color: var(--accent-strong);
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 5px);
  transition: opacity 0.18s, transform 0.3s var(--ease-out);
  pointer-events: none;
}
.sw.is-lit,
.sw:focus-visible {
  background: var(--lit);
  outline: none;
}
.sw.is-lit::after,
.sw:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, -2px);
}
.specimen-margin {
  position: relative;
  margin-top: 14px;
  padding: 12px 0 0 22px;
  border-top: 1px solid var(--rule);
  font-family: var(--serif);
  font-size: 15.5px;
  font-style: italic;
  line-height: 1.45;
  color: var(--accent-strong);
}
.specimen-margin-mark {
  position: absolute;
  left: 0;
  top: 11px;
  font-style: normal;
  opacity: 0.6;
}
.specimen-source {
  margin-top: 14px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  text-align: right;
}
.specimen-hint {
  margin: 18px 0 0 28px;
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--text-muted);
}
.specimen-hint-arrow {
  display: inline-block;
  margin-right: 4px;
  font-style: normal;
  color: var(--accent);
  animation: nudge 2.4s ease-in-out infinite;
}

/* L'étagère */
.shelf-section {
  margin-top: clamp(48px, 7vw, 84px);
}
.section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule-strong);
}
.section-title {
  font-family: var(--serif);
  font-size: 24px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.01em;
}
.section-count {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}

.shelf {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 30px 22px;
  margin: 0;
  padding: 26px 0 0;
  list-style: none;
}
.book {
  position: relative;
  min-width: 0;
}
.book-open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
}
.book-cover {
  position: relative;
  display: block;
  aspect-ratio: 0.72;
  overflow: hidden;
  border-radius: 2px 5px 5px 2px;
  background: var(--page);
  box-shadow: var(--shadow-page);
  transform-origin: bottom left;
  transition: transform 0.4s var(--ease-out), box-shadow 0.3s;
}
.book-cover::before {
  /* La charnière du livre. */
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 1;
  width: 9px;
  background: linear-gradient(90deg, hsl(0 0% 0% / 0.16), hsl(0 0% 0% / 0.02) 60%, hsl(0 0% 100% / 0.12));
}
.book-open:hover .book-cover,
.book-open:focus-visible .book-cover {
  transform: translateY(-6px) rotate(-1.4deg);
}
.book-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
:root[data-theme="night"] .book-cover img {
  filter: brightness(0.82);
}
.book-cover-type {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: 100%;
  padding: 16px 14px 14px 20px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--serif);
}
.book-cover-type b {
  font-size: 54px;
  font-weight: 400;
  font-style: italic;
  line-height: 0.8;
}
.book-cover-type span {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13.5px;
  line-height: 1.25;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
/* Le signet : sa longueur dit où tu en es dans le livre. */
.book-ribbon {
  position: absolute;
  top: 0;
  right: 16px;
  z-index: 2;
  width: 13px;
  height: calc(16px + var(--progress, 0) * 0.5 * 100%);
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 6px), 0 100%);
  box-shadow: 0 1px 2px hsl(0 0% 0% / 0.3);
}
.book-cover-type + .book-ribbon {
  background: var(--on-accent);
}
.book-title {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 12px;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.book-meta {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
}
.book-delete {
  position: absolute;
  top: 6px;
  left: 14px;
  z-index: 3;
  width: 30px;
  min-height: 30px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--danger);
  box-shadow: var(--shadow-1);
  opacity: 0;
  transition: opacity 0.15s;
}
.book-delete .icon {
  width: 16px;
  height: 16px;
}
.book:hover .book-delete,
.book-delete:focus-visible {
  opacity: 1;
}
@media (hover: none) {
  .book-delete {
    opacity: 1;
  }
  /* Pas de glisser-déposer ni de survol sur un écran tactile. */
  .home-cta-hint {
    display: none;
  }
}

/* Les trois principes, numérotés comme des notes de marge */
.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 4vw, 48px);
  margin-top: clamp(48px, 7vw, 84px);
  padding-top: 26px;
  border-top: 1px solid var(--rule-strong);
}
.principle {
  position: relative;
  padding-left: 34px;
}
.principle-num {
  position: absolute;
  left: 0;
  top: -3px;
  font-family: var(--serif);
  font-size: 21px;
  font-style: italic;
  color: var(--accent);
}
.principle h3 {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  line-height: 1.25;
}
.principle p {
  margin-top: 7px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text-muted);
}

.home-foot {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 56px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  font-size: 13px;
  color: var(--text-muted);
}
.home-foot-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
}
.home-foot-credit {
  line-height: 1.6;
}
.home-foot-credit a,
.legal a {
  color: var(--accent-strong);
  text-underline-offset: 3px;
}
.home-foot-credit strong {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 500;
  font-style: italic;
  color: var(--text);
}

.legal {
  max-height: min(60dvh, 520px);
  margin-top: 6px;
  padding-right: 6px;
  overflow-y: auto;
}
.legal h3 {
  margin-top: 18px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.legal p,
.legal li {
  margin-top: 7px;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--text);
}
.legal ul {
  margin: 0;
  padding-left: 18px;
}
.settings-credit {
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--text-muted);
}

/* ─── 7. Le lecteur ─────────────────────────────────────────────────── */
.viewer {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 24px clamp(8px, 2.4vw, 28px) 140px;
}

.thumbnail-rail {
  position: sticky;
  top: calc(var(--topbar-h) + 20px);
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 124px;
  max-height: calc(100dvh - var(--topbar-h) - 40px);
  padding: 4px 10px 12px 4px;
  overflow-y: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
}
.thumb-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 5px;
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  transition: background-color 0.15s;
}
.thumb-item:hover {
  background: var(--accent-wash);
}
.thumb-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 0.72;
  border-radius: 2px;
  background: var(--page);
  box-shadow: var(--shadow-1);
  outline: 2px solid transparent;
  outline-offset: 2px;
  transition: outline-color 0.15s;
}
.thumb-item span {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
}
.thumb-item.thumb-active .thumb-canvas {
  outline-color: var(--accent);
}
.thumb-item.thumb-active span {
  color: var(--accent-strong);
  font-weight: 500;
}

.pages-scroll {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-x: auto;
  /* Laisse respirer l'ombre des pages malgré overflow-x. */
  padding: 4px 4px 40px;
  margin: -4px -4px -40px;
}

.page-wrapper {
  position: relative;
  flex-shrink: 0;
  margin-inline: auto;
  border-radius: 2px;
  background: var(--page);
  box-shadow: var(--shadow-page);
  scroll-margin-top: calc(var(--topbar-h) + 16px);
}
.page-ink {
  position: relative;
  width: 100%;
  height: 100%;
}
.pdf-canvas {
  display: block;
  border-radius: 2px;
}

/* « Teinter les pages » : le PDF épouse le thème au lieu d'éblouir. */
:root[data-theme="sepia"][data-tint="on"] .page-ink,
:root[data-theme="sepia"][data-tint="on"] .thumb-canvas {
  filter: sepia(0.42) brightness(0.97);
}
:root[data-theme="night"][data-tint="on"] .page-ink,
:root[data-theme="night"][data-tint="on"] .thumb-canvas {
  filter: invert(0.88) hue-rotate(180deg);
}

/* Page en attente : quelques lignes fantômes plutôt qu'un sablier. */
.page-skeleton {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 2.6%;
  padding: 12% 11%;
  overflow: hidden;
}
.page-skeleton i {
  display: block;
  height: 1.4%;
  min-height: 5px;
  border-radius: 99px;
  background: color-mix(in oklch, var(--text) 9%, transparent);
  animation: breathe 1.6s ease-in-out infinite;
}
.page-skeleton i:nth-child(1) { width: 46%; height: 2.6%; margin-bottom: 4%; }
.page-skeleton i:nth-child(4n) { width: 72%; }
.page-skeleton i:nth-child(5n) { width: 88%; margin-bottom: 3%; }
.page-skeleton i:nth-child(odd) { animation-delay: 0.2s; }
.page-skeleton-num {
  position: absolute;
  right: 5%;
  bottom: 3.5%;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text-muted);
}
.page-error {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--danger);
  font-size: 14px;
  text-align: center;
}

/* Couche de traduction complète (sur-couche non destructive) */
.overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.overlay-line {
  position: absolute;
  overflow: hidden;
  transition: opacity 0.18s var(--ease-out);
}
/* Appui long sur un paragraphe (ou Alt maintenue) : l'original reparaît. */
.overlay-line.is-peeking,
.peek-all .overlay-line {
  opacity: 0;
}
/* Le cache apparaît d'un coup (jamais d'ancien et de nouveau texte mêlés) ;
   seule la traduction s'écrit de gauche à droite. */
.overlay-line > span {
  position: absolute;
  white-space: nowrap;
  transform-origin: left center;
  animation: ink-in 0.45s var(--ease-out) backwards;
  animation-delay: inherit;
}
/* En attente de traduction : un reflet passe sur le texte d'origine. */
.overlay-line.is-pending {
  background: linear-gradient(100deg, transparent 20%, var(--lit) 50%, transparent 80%) 0 0 / 220% 100%;
  animation: sweep 1.3s linear infinite;
}

/* Couche de mots : invisibles, alignés sur le rendu, ils portent
   le survol, le tap, le clavier et la sélection. */
.text-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  line-height: 1;
}
.text-block {
  position: absolute;
  color: transparent;
  white-space: pre;
  cursor: pointer;
  border-radius: 2px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.text-block::selection {
  background: color-mix(in oklch, var(--accent) 32%, transparent);
  color: transparent;
}
.text-layer:not(.selection-mode) .text-block:hover,
.text-block.is-lit {
  background: var(--lit);
}
/* Comble l'espace entre deux mots d'un même passage surligné. */
.text-block.is-lit::after {
  content: "";
  position: absolute;
  top: 0;
  left: 100%;
  width: var(--gap, 0px);
  height: 100%;
  background: var(--lit);
}
.text-block:focus-visible {
  background: var(--lit);
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.text-layer.selection-mode .text-block {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  touch-action: auto;
}
.text-block-uncertain {
  border-bottom: 2px dotted var(--accent);
}
.word-correction-input {
  position: absolute;
  z-index: 3;
  padding: 0 2px;
  border: 1.5px solid var(--accent);
  border-radius: 3px;
  background: var(--surface);
  color: var(--text);
  font-family: var(--sans);
  box-shadow: var(--shadow-1);
}

/* ─── 8. La réglette (dock) ─────────────────────────────────────────── */
.dock {
  position: fixed;
  /* Centré sans transform : les animations (Motion) pilotent transform. */
  left: 0;
  right: 0;
  width: max-content;
  margin-inline: auto;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 16px);
  padding: 6px;
  border: 1px solid var(--rule);
  border-radius: 18px;
  background: color-mix(in oklch, var(--surface) 92%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(1.5);
  backdrop-filter: blur(16px) saturate(1.5);
  box-shadow: var(--shadow-2);
}
.dock-group {
  display: flex;
  align-items: center;
  gap: 2px;
}
.dock-group + .dock-group,
.dock-modes + .dock-group,
.dock-group + .dock-modes {
  margin-left: 4px;
}
.dock-zoom,
.dock-view {
  padding-left: 8px;
  border-left: 1px solid var(--rule);
}

.page-field {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 0 4px;
  font-family: var(--mono);
  font-size: 13px;
}
#page-input {
  width: 4.2ch;
  min-height: 30px;
  padding: 0 2px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: color-mix(in oklch, var(--text) 6%, transparent);
  font-weight: 500;
  text-align: center;
  box-sizing: content-box;
}
#page-input:hover,
#page-input:focus {
  border-color: var(--accent);
  background: var(--page);
  outline: none;
}
.page-total {
  color: var(--text-muted);
}

.zoom-value {
  min-width: 52px;
  min-height: 30px;
  padding: 0 4px;
  border: 0;
  border-radius: 7px;
  background: none;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--text-muted);
}
.zoom-value:hover {
  background: var(--accent-wash);
  color: var(--text);
}

/* Sélecteur segmenté (modes, thème…) : un curseur glisse sous le choix. */
.segmented {
  position: relative;
  display: flex;
  min-width: 0;
  margin: 0;
  padding: 3px;
  border: 0;
  border-radius: 12px;
  background: color-mix(in oklch, var(--text) 7%, transparent);
}
.segmented label {
  position: relative;
  z-index: 1;
  flex: 1;
  cursor: pointer;
}
.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.segmented label > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.2s;
}
.segmented input:checked + span {
  color: var(--accent-strong);
}
.segmented label:hover > span {
  color: var(--text);
}
.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.seg-thumb {
  position: absolute;
  top: 3px;
  left: 0;
  height: calc(100% - 6px);
  width: 0;
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.seg-thumb.is-placed {
  transition: transform 0.38s cubic-bezier(0.3, 1.35, 0.5, 1), width 0.3s var(--ease-out);
}
:root[data-theme="night"] .seg-thumb {
  background: color-mix(in oklch, var(--text) 14%, var(--surface));
}
.seg-short {
  display: none;
}

/* ─── 9. Pastille d'état ────────────────────────────────────────────── */
.status-pill {
  position: fixed;
  left: 0;
  right: 0;
  margin-inline: auto;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 62px);
  z-index: 26;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 24px);
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--text);
  color: var(--desk);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-2);
}
body[data-view="home"] .status-pill {
  bottom: max(20px, env(safe-area-inset-bottom));
}
.status-track {
  width: 64px;
  height: 4px;
  overflow: hidden;
  border-radius: 99px;
  background: color-mix(in oklch, var(--desk) 25%, transparent);
  flex-shrink: 0;
}
#engine-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--desk);
  transition: width 0.25s ease;
}
.status-pill.status-error {
  background: var(--danger);
  color: var(--on-accent);
  border-radius: var(--radius-l);
}
.status-pill.status-error .status-track {
  display: none;
}
.status-pill.status-error #engine-status-text::before {
  content: "⚠ ";
}
.status-close {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: -6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  flex-shrink: 0;
}
.status-close .icon {
  width: 14px;
  height: 14px;
}

/* ─── 10. La glose (bulle de traduction) ────────────────────────────── */
.gloss {
  position: fixed;
  z-index: 35;
  width: max-content;
  min-width: 150px;
  max-width: min(calc(360px * var(--gloss-scale)), calc(100vw - 24px));
  padding: 12px 14px 10px 17px;
  border: 1px solid var(--rule);
  border-radius: 4px 12px 12px 4px;
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.gloss::before {
  /* Le filet rubriqué : la signature de toute traduction dans Lectio. */
  content: "";
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: -1px;
  width: 4px;
  border-radius: 4px 0 0 4px;
  background: var(--accent);
}
.gloss-caret {
  position: absolute;
  left: var(--caret-x, 24px);
  width: 12px;
  height: 12px;
  border: 1px solid var(--rule);
  background: var(--surface);
  transform: translateX(-50%) rotate(45deg);
}
.gloss[data-side="below"] .gloss-caret {
  top: -7px;
  border-right: 0;
  border-bottom: 0;
}
.gloss[data-side="above"] .gloss-caret {
  bottom: -7px;
  border-left: 0;
  border-top: 0;
}
.gloss-meta {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.gloss-source {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 5px;
  font-family: var(--serif);
  font-size: calc(14px * var(--gloss-scale));
  font-style: italic;
  line-height: 1.35;
  color: var(--text-muted);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.gloss-text {
  max-height: min(40vh, 320px);
  margin-top: 4px;
  overflow-y: auto;
  font-family: var(--serif);
  font-size: calc(18.5px * var(--gloss-scale));
  line-height: 1.38;
  color: var(--text);
  overflow-wrap: anywhere;
}
.gloss-context {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px dashed var(--rule);
  font-family: var(--serif);
  font-size: calc(14.5px * var(--gloss-scale));
  line-height: 1.4;
  color: var(--text-muted);
}
.gloss-context mark {
  padding: 0 2px;
  border-radius: 3px;
  background: var(--lit);
  color: var(--text);
  font-weight: 500;
}
.gloss.is-loading .gloss-text {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--text-muted);
}
.gloss.is-loading .gloss-text::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  margin-left: 2px;
  text-align: left;
  animation: dots 1.2s steps(4, end) infinite;
}
.gloss.bubble-error::before {
  background: var(--danger);
}
.gloss.bubble-error .gloss-text {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--danger);
}
.gloss-actions {
  display: flex;
  gap: 2px;
  margin: 10px -6px 0;
  padding-top: 7px;
  border-top: 1px dashed var(--rule);
}
.gloss-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
}
.gloss-btn .icon {
  width: 16px;
  height: 16px;
}
.gloss-btn:hover:not(:disabled) {
  background: var(--accent-wash);
  color: var(--accent-strong);
}
.gloss-size-btn {
  margin-left: auto;
}
.gloss-size-glyph {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1;
}
.gloss-size-glyph small {
  font-size: 12px;
}
.gloss-grip {
  display: none;
}
.gloss-btn.is-done {
  color: var(--accent-strong);
}
.gloss-btn:disabled {
  cursor: default;
}

.selection-btn {
  position: fixed;
  z-index: 35;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px 0 10px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: var(--shadow-2);
}
.selection-btn .icon {
  width: 18px;
  height: 18px;
}

/* ─── 11. Tiroir latéral ────────────────────────────────────────────── */
.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: hsl(var(--shadow-color) / 0.38);
  -webkit-backdrop-filter: blur(1.5px);
  backdrop-filter: blur(1.5px);
}
.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  display: flex;
  flex-direction: column;
  width: min(400px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--rule);
  box-shadow: var(--shadow-2);
}
.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 16px 14px 22px;
  border-bottom: 1px solid var(--rule);
}
.side-panel-header h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  font-style: italic;
  letter-spacing: -0.01em;
}
.side-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 22px max(24px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
}

.panel-empty {
  margin: 28px 0;
  padding: 0 10px;
  font-family: var(--serif);
  font-size: 16.5px;
  font-style: italic;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
}
.panel-empty::before {
  content: "❦";
  display: block;
  margin-bottom: 10px;
  font-size: 26px;
  font-style: normal;
  color: var(--accent);
}

.panel-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

/* Bibliothèque (version liste, dans le tiroir) */
.library-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: var(--radius-m);
  transition: background-color 0.15s;
}
.library-item:hover {
  background: var(--accent-wash);
}
.library-item.is-current {
  background: var(--accent-tint);
}
.library-item-open {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 12px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  text-align: left;
}
.library-thumb {
  width: 46px;
  aspect-ratio: 0.72;
  overflow: hidden;
  border-radius: 2px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-1);
  font-family: var(--serif);
  font-size: 24px;
  font-style: italic;
  display: grid;
  place-items: center;
}
.library-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
.library-item-info {
  min-width: 0;
}
.library-item-title {
  display: -webkit-box;
  overflow: hidden;
  font-family: var(--serif);
  font-size: 15.5px;
  font-weight: 500;
  line-height: 1.25;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.library-item-meta {
  display: block;
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Carnet de gloses */
.highlight-item {
  position: relative;
  padding: 12px 12px 10px 16px;
  border: 1px solid var(--rule);
  border-radius: 3px 10px 10px 3px;
  background: var(--page);
}
.highlight-item::before {
  content: "";
  position: absolute;
  top: -1px;
  bottom: -1px;
  left: -1px;
  width: 3px;
  border-radius: 3px 0 0 3px;
  background: var(--accent);
}
.highlight-source {
  font-family: var(--serif);
  font-size: 14.5px;
  font-style: italic;
  line-height: 1.4;
  color: var(--text-muted);
}
.highlight-translated {
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.38;
}
.highlight-note {
  display: block;
  width: 100%;
  min-height: 34px;
  margin-top: 9px;
  padding: 7px 9px;
  border: 1px dashed var(--rule-strong);
  border-radius: 7px;
  background: transparent;
  font-size: 13.5px;
  line-height: 1.4;
  resize: vertical;
  field-sizing: content;
}
.highlight-note::placeholder {
  color: var(--text-muted);
  opacity: 0.8;
}
.highlight-note:focus {
  border-style: solid;
  border-color: var(--accent);
  outline: none;
}
.highlight-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}
.highlight-page {
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.mini-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--text-muted);
}
.mini-btn .icon {
  width: 16px;
  height: 16px;
}
.mini-btn:hover {
  background: color-mix(in oklch, var(--danger) 12%, transparent);
  color: var(--danger);
}

/* Recherche et sommaire */
.search-form {
  position: sticky;
  top: -18px;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: -18px -22px 0;
  padding: 14px 22px 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  color: var(--text-muted);
}
.search-form input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-m);
  background: var(--page);
  font-size: 16px; /* 16 px : pas de zoom automatique sur iPhone */
}
.search-form input:focus {
  border-color: var(--accent);
  outline: none;
}
.search-status {
  font-size: 13px;
  color: var(--text-muted);
}
.search-results {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.search-hit {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 10px;
  padding: 9px 8px;
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  text-align: left;
}
.search-hit:hover,
.search-hit:focus-visible {
  background: var(--accent-wash);
}
.search-hit-page {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent-strong);
}
.search-hit-text {
  font-family: var(--serif);
  font-size: 14.5px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.search-hit-text mark {
  padding: 0 1px;
  border-radius: 2px;
  background: var(--lit);
  color: inherit;
  font-weight: 600;
}
.outline {
  margin: 0;
  padding: 0;
  list-style: none;
}
.outline-item {
  display: block;
  width: 100%;
  padding: 8px 8px 8px calc(8px + var(--depth, 0) * 16px);
  border: 0;
  border-radius: var(--radius-s);
  background: none;
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.35;
  text-align: left;
}
.outline-item:hover,
.outline-item:focus-visible {
  background: var(--accent-wash);
}
.text-block.is-found {
  background: color-mix(in oklch, var(--accent) 38%, transparent);
  animation: found-pulse 0.9s ease-in-out 2;
}
@keyframes found-pulse {
  50% { box-shadow: 0 0 0 4px color-mix(in oklch, var(--accent) 25%, transparent); }
}

/* Réglages */
.settings-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--rule);
}
.settings-section:last-child {
  border-bottom: 0;
}
.settings-heading {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.settings-label {
  font-size: 14.5px;
  font-weight: 600;
}
.settings-hint {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.settings-row > div {
  min-width: 0;
}

.ink-swatches {
  display: flex;
  gap: 10px;
}
.ink-swatch {
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 -3px 0 hsl(0 0% 0% / 0.18);
  transition: transform 0.2s var(--ease-out);
}
.ink-swatch:hover {
  transform: scale(1.1);
}
.ink-swatch[aria-checked="true"]::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid var(--swatch);
  border-radius: 50%;
}
.ink-swatch[data-ink="bordeaux"] { --swatch: oklch(42% 0.15 340); }
.ink-swatch[data-ink="indigo"] { --swatch: oklch(42% 0.15 268); }
.ink-swatch[data-ink="foret"] { --swatch: oklch(42% 0.09 158); }
.ink-swatch[data-ink="terre"] { --swatch: oklch(46% 0.12 48); }
.ink-swatch[data-ink="ardoise"] { --swatch: oklch(36% 0.035 245); }

/* Interrupteur */
.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.switch input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 99px;
  background: var(--rule-strong);
  transition: background-color 0.2s;
  pointer-events: none;
}
.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform 0.3s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.switch input:checked + span {
  background: var(--accent);
}
.switch input:checked + span::after {
  transform: translateX(18px);
}
.switch input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}
.range-value {
  min-width: 3ch;
  font-family: var(--mono);
  font-size: 13px;
  text-align: right;
  color: var(--accent-strong);
}
input[type="color"] {
  width: 40px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}

/* ─── 12. Dépôt de fichier, toasts, dialogues ───────────────────────── */
.drop-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in oklch, var(--desk) 88%, transparent);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.drop-frame {
  display: grid;
  place-items: center;
  gap: 18px;
  width: min(520px, 100%);
  aspect-ratio: 1.5;
  border: 2px dashed var(--accent);
  border-radius: 24px;
  background: var(--accent-wash);
  font-family: var(--serif);
  font-size: 26px;
  font-style: italic;
  color: var(--accent-strong);
  align-content: center;
}
.drop-mark {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 14px 14px 14px 4px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 46px;
  animation: bob 1.4s ease-in-out infinite;
}

.toasts {
  position: fixed;
  left: 0;
  right: 0;
  margin-inline: auto;
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 62px);
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}
body[data-view="home"] .toasts {
  bottom: max(20px, env(safe-area-inset-bottom));
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--text);
  color: var(--desk);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-2);
  pointer-events: auto;
}
.toast.toast-error {
  background: var(--danger);
  color: var(--on-accent);
}
.toast button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.dialog {
  width: min(420px, calc(100vw - 32px));
  padding: 24px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-2);
}
.dialog-wide {
  width: min(520px, calc(100vw - 32px));
}
.dialog::backdrop {
  background: hsl(var(--shadow-color) / 0.45);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.dialog[open] {
  animation: pop-in 0.28s var(--ease-out);
}
.dialog h2 {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 500;
  line-height: 1.2;
}
.dialog p {
  margin-top: 10px;
  color: var(--text-muted);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* ─── Export : choix de la mise en page, puis PDF prêt ─────────────── */
.export-dialog {
  width: min(460px, calc(100vw - 24px));
}
.choice-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}
.choice-list legend {
  margin-bottom: 8px;
  padding: 0;
}
.choice {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-m);
  background: var(--page);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.choice-compact {
  padding: 9px 14px;
}
.choice > input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.choice:has(> input:checked) {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}
.choice:has(> input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.choice-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.choice-text strong {
  font-size: 14px;
}
.choice-text small {
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.35;
}
.choice-range {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.choice-range input {
  width: 64px;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-s, 6px);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: center;
}
/* Petites pages dessinées : une seule, ou une paire original / traduction. */
.choice-art {
  display: flex;
  flex: none;
  gap: 3px;
  width: 44px;
  justify-content: center;
}
.choice-art i {
  width: 20px;
  height: 27px;
  border: 1px solid var(--rule-strong);
  border-radius: 2px;
  background:
    repeating-linear-gradient(to bottom, transparent 0 4px, var(--rule-strong) 4px 5px) 4px 5px / 12px 17px no-repeat,
    var(--surface);
}
.choice-art-pair i:last-child,
.choice-art-single i {
  background:
    repeating-linear-gradient(to bottom, transparent 0 4px, var(--accent) 4px 5px) 4px 5px / 12px 17px no-repeat,
    var(--surface);
}
.export-note {
  font-size: 12.5px;
}
.export-ready-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}
.export-ready-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}
.export-ready-actions .btn {
  justify-content: center;
  min-height: 44px;
}
@media (max-width: 480px) {
  .export-dialog[open] {
    margin: auto 0 0;
    width: 100vw;
    max-width: 100vw;
    border-radius: var(--radius-l) var(--radius-l) 0 0;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
  }
}

/* Formule recopiée de la page d'origine dans une ligne traduite : posée
   sur la ligne de base sans agrandir la ligne. */
.overlay-chip {
  position: relative;
  display: inline-block;
  height: 0;
  vertical-align: baseline;
}
.overlay-chip img {
  position: absolute;
  left: 0;
  max-width: none;
  pointer-events: none;
}

/* ─── Glossaire ─────────────────────────────────────────────────────── */
.text-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-m);
  background: var(--page);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* pas de zoom automatique sur iPhone */
}
.text-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.glossary-field {
  margin-top: 16px;
}
.glossary-list {
  display: flex;
  flex-direction: column;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}
.glossary-item {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
}
.glossary-edit {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
  padding: 9px 2px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.glossary-src {
  font-weight: 600;
}
.glossary-arrow {
  color: var(--text-muted);
}
.glossary-tgt {
  color: var(--accent);
  font-family: var(--serif);
  font-style: italic;
}
.glossary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.shortcuts {
  display: flex;
  flex-direction: column;
  margin: 16px 0 0;
}
.shortcuts > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--rule);
}
.shortcuts dt {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.shortcuts dd {
  margin: 0;
  font-size: 14px;
  text-align: right;
}
kbd {
  display: inline-block;
  min-width: 24px;
  padding: 2px 6px;
  border: 1px solid var(--rule-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--page);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
  color: var(--text);
}

/* Carte d'installation */
.install-card {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 38;
  width: min(380px, calc(100vw - 24px));
  padding: 20px 20px 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-l);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}
.install-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.install-head h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 500;
  font-style: italic;
}
.install-close {
  position: absolute;
  top: 10px;
  right: 10px;
}
.install-card > p {
  margin-top: 10px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-muted);
}
.install-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.install-steps li {
  position: relative;
  padding-left: 32px;
  font-size: 14.5px;
  line-height: 1.45;
  counter-increment: step;
}
.install-steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-strong);
  font-family: var(--mono);
  font-size: 12px;
}
.install-steps .install-note {
  padding-left: 0;
  font-size: 13px;
  color: var(--text-muted);
  counter-increment: none;
}
.install-steps .install-note::before {
  content: none;
}
.install-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
body[data-view="reader"] .install-card {
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + 70px);
}

/* ─── 13. Animations ────────────────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes breathe {
  50% { opacity: 0.45; }
}
@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}
@keyframes nudge {
  0%, 100% { transform: none; }
  50% { transform: translate(-3px, -3px); }
}
@keyframes bob {
  50% { transform: translateY(-6px) rotate(-4deg); }
}
@keyframes ink-in {
  from { opacity: 0; clip-path: inset(-20% 100% -20% 0); }
  to { opacity: 1; clip-path: inset(-20% 0 -20% 0); }
}
@keyframes sweep {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}
@keyframes pop-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
}

/* ─── 14. Écrans étroits ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .home-hero {
    grid-template-columns: 1fr;
  }
  .specimen {
    justify-self: start;
    margin-top: 6px;
  }
  .principles {
    grid-template-columns: 1fr;
  }
  .btn-label {
    display: none;
  }
  #translate-doc-btn {
    width: 36px;
    padding: 0;
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-h: 52px;
  }
  .topbar {
    gap: 8px;
  }
  .topbar-sep,
  .doc-heading-rule {
    display: none;
  }
  .doc-title {
    font-size: 15px;
  }
  .lang-chip {
    padding: 0 10px;
    font-size: 13px;
  }
  /* Sur téléphone, la pastille de langues se réduit aux codes (EN → FR). */
  .lang-chip [data-short]::before {
    content: attr(data-short);
  }
  .lang-chip [data-short] {
    font-size: 0;
  }
  .lang-chip [data-short]::before {
    font-size: 13px;
  }
  #open-btn {
    display: none;
  }
  .install-card {
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
  }

  .viewer {
    flex-direction: column;
    gap: 12px;
    padding: 12px 6px 150px;
  }
  .thumbnail-rail {
    position: static;
    flex-direction: row;
    width: 100%;
    max-height: none;
    padding: 4px 4px 8px;
    overflow-x: auto;
    overflow-y: hidden;
  }
  .thumb-item {
    width: 64px;
    flex-shrink: 0;
  }
  .pages-scroll {
    width: 100%;
    gap: 12px;
  }

  .dock {
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    justify-content: space-between;
    width: auto;
    max-width: none;
  }
  .dock-zoom,
  .dock-view {
    display: none;
  }
  .dock-modes {
    flex: 1;
  }
  .segmented label > span {
    padding: 0 8px;
    min-height: 34px;
  }
  .dock .seg-long {
    display: none;
  }
  .dock .seg-short {
    display: inline;
  }
  .dock .btn-icon {
    width: 34px;
  }

  /* La glose devient une feuille posée au-dessus de la réglette. */
  .gloss {
    left: 8px !important;
    right: 8px;
    top: auto !important;
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 60px);
    width: auto;
    max-width: none;
    border-radius: 4px 14px 14px 4px;
  }
  .gloss-caret {
    display: none;
  }
  /* Poignée : la feuille se ferme en la tirant vers le bas. */
  .gloss-grip {
    display: block;
    width: 36px;
    height: 4px;
    margin: -4px auto 8px;
    border-radius: 99px;
    background: var(--rule-strong);
    opacity: 0.45;
  }
  .gloss {
    max-height: 62dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .gloss-text {
    max-height: none;
  }
  /* En lecture, la barre du haut s'efface quand on descend et revient dès
     qu'on remonte : plus de place pour la page. */
  .topbar {
    transition: transform 0.28s var(--ease-out), border-color 0.2s;
  }
  body.topbar-away[data-view="reader"] .topbar {
    transform: translateY(-102%);
  }
  .gloss-btn {
    min-height: 38px;
    padding: 0 10px;
    font-size: 13.5px;
  }
  .status-pill,
  .toasts {
    bottom: calc(max(8px, env(safe-area-inset-bottom)) + 62px);
  }

  .side-panel {
    top: auto;
    left: 0;
    width: 100%;
    max-height: 86dvh;
    border-left: 0;
    border-top: 1px solid var(--rule);
    border-radius: 20px 20px 0 0;
  }
  .side-panel-header {
    position: relative;
    padding-top: 22px;
  }
  .side-panel-header::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    width: 40px;
    height: 4px;
    border-radius: 99px;
    background: var(--rule-strong);
    opacity: 0.5;
    transform: translateX(-50%);
  }
  .shelf {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 24px 16px;
  }
}

/* Réglette des tout petits téléphones (≤ 380 px) : les quatre modes doivent
   rester visibles, « Sélection » compris. */
.dock .seg-mid-short {
  display: none;
}
/* « Phrase » reste en toutes lettres tant qu'il y a la place. */
.dock .seg-long.seg-mid {
  display: inline;
}
@media (max-width: 380px) {
  .dock {
    gap: 2px;
    padding: 5px;
  }
  .dock .btn-icon {
    width: 30px;
  }
  .page-field {
    gap: 3px;
    padding: 0 2px;
  }
  #page-input {
    width: 3ch;
  }
  .dock .segmented label > span {
    padding: 0 6px;
  }
  .dock .seg-long.seg-mid {
    display: none;
  }
  .dock .seg-mid-short {
    display: inline;
  }
}

/* Barre du haut des téléphones en lecture : la bibliothèque reste à un
   geste (le logo ramène au pupitre), le titre cède la place aux outils. */
@media (max-width: 720px) {
  body[data-view="reader"] #library-btn {
    display: none;
  }
}
@media (max-width: 480px) {
  .doc-heading {
    display: none;
  }
  .topbar {
    gap: 4px;
    padding-inline: 8px;
  }
  .topbar-actions {
    gap: 0;
  }
  .topbar .btn-icon,
  #translate-doc-btn {
    width: 38px;
    min-height: 40px;
  }
  .lang-chip {
    gap: 4px;
    padding: 0 9px;
  }
}

/* Appareils modestes (voir src/device.js) : aucun flou d'arrière-plan ni
   filtre sur les pages. Chacun oblige le navigateur à garder une copie
   cachée, à pleine résolution, de ce qu'il recouvre — sur iPhone, c'est de la
   mémoire graphique comptée dans la limite de l'onglet. La teinte des pages
   (sépia, nuit) est alors appliquée directement sur l'image de la page. */
:root[data-lite="on"] .topbar,
:root[data-lite="on"] .dock,
:root[data-lite="on"] .scrim,
:root[data-lite="on"] .drop-overlay,
:root[data-lite="on"] .dialog::backdrop {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
:root[data-lite="on"] .topbar {
  background: var(--desk);
}
:root[data-lite="on"] .dock {
  background: var(--surface);
}
:root[data-lite="on"] .page-ink,
:root[data-lite="on"] .thumb-canvas {
  filter: none !important;
}
/* Ombres floutées et éléments inclinés : mesurés dans le moteur de Safari,
   ils coûtent à eux seuls environ 160 Mo sur l'accueil (le navigateur
   dessine chaque ombre floue dans une image à part, à la densité de l'écran,
   et une page de PDF en porte une). Sur appareil modeste : ombres fines. */
:root[data-lite="on"] {
  --shadow-1: 0 1px 2px hsl(var(--shadow-color) / 0.14);
  --shadow-2: 0 1px 3px hsl(var(--shadow-color) / 0.2), 0 0 0 1px hsl(var(--shadow-color) / 0.06);
  --shadow-page: 0 1px 2px hsl(var(--shadow-color) / 0.22), 0 0 0 1px hsl(var(--shadow-color) / 0.05);
}
:root[data-lite="on"] .specimen-sheet,
:root[data-lite="on"] .specimen:hover .specimen-sheet,
:root[data-lite="on"] .specimen:focus-within .specimen-sheet,
:root[data-lite="on"] .book-open:hover .book-cover,
:root[data-lite="on"] .book-open:focus-visible .book-cover {
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  .topbar,
  .dock,
  .gloss,
  .status-pill,
  .thumbnail-rail {
    display: none !important;
  }
}
