@font-face {
  font-family: "e-Ukraine";
  font-style: normal;
  font-weight: 200;
  font-display: swap;
  src: url("fonts/e-ukraine-ultralight.woff2") format("woff2");
}

:root {
  --ink: #181711;
  --paper: #f4f0e7;
  --paper-deep: #ece7dc;
  --gold: #b69a5d;
  --book-w: 980px;
  --book-h: 620px;
  --bg: #16142a;
  --cream: #fffbf4;
  --muted: #8d94a6;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; min-height: 100%; overflow: hidden; }

body {
  margin: 0;
  color: var(--cream);
  background: var(--bg);
  font-family: "e-Ukraine", "Manrope", sans-serif;
  font-weight: 200;
}

/* Layout: mobile values follow the 375px Figma frame (104:56) */
.catalog-shell { min-height: 100vh; padding: 32px 12px 24px; }
/* Phones (Figma 156:295): the lettering alone on the left, the language switch on the right, no rule */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 16px;
}
.wordmark {
  display: block;
  width: 110.5px;
  color: var(--cream);
  text-decoration: none;
  transition: opacity .25s ease;
}
.wordmark:hover { opacity: .82; }
.wordmark-svg { display: block; width: 100%; height: auto; }
.wordmark { width: 141.25px; }
.wordmark-svg:not(.wordmark-svg-text) { display: none; }

/* Language switch (Figma 508:156 / 508:117): the current language light and underlined */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font: 200 10px/9px "e-Ukraine", sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
}
.lang-switch a { color: var(--muted); text-decoration: none; transition: color .2s ease; }
.lang-switch a:hover { color: var(--cream); }
.lang-switch a.is-active { color: var(--cream); text-decoration: underline; text-underline-position: from-font; cursor: default; }
.lang-switch a:focus-visible { outline: 1px solid var(--cream); outline-offset: 3px; }
.lang-divider { margin: 0 -8px; }
.lang-globe { flex: none; width: 16px; height: 16px; fill: none; stroke: var(--cream); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

.viewer { position: relative; padding-top: 24px; }

/* Table of contents */
/* Above .book-stage: on the cover turn.js shifts the book's empty half over this column */
.catalog-toc {
  position: relative;
  z-index: 3;
  color: var(--cream);
}
.toc-trigger {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-bottom: 1px solid var(--cream);
  padding: 0;
  color: var(--cream);
  background: transparent;
  font: 200 10px/24px "e-Ukraine", sans-serif;
  letter-spacing: 0;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}
.toc-trigger::after {
  content: "";
  flex: none;
  width: 16px;
  height: 16px;
  background: url("icons/arrow-down.svg") center / contain no-repeat;
  transition: transform .3s cubic-bezier(.22, .61, .36, 1);
}
.catalog-toc.is-open .toc-trigger::after { transform: rotate(180deg); }
.toc-trigger:focus-visible { outline: 1px solid var(--cream); outline-offset: 3px; }
/* Mobile menu opens over the book: the page itself never scrolls */
.toc-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(60vh, 480px);
  padding: 16px 0 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--bg);
  box-shadow: 0 24px 32px rgba(0,0,0,.45);
  scrollbar-width: none;
  /* The phone menu fades and slides in rather than appearing at once */
  visibility: hidden;
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity .25s ease, transform .25s cubic-bezier(.22, .61, .36, 1), visibility 0s linear .25s;
}
.catalog-toc.is-open .toc-list {
  visibility: visible;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: opacity .25s ease, transform .25s cubic-bezier(.22, .61, .36, 1), visibility 0s;
}
.toc-label { display: none; margin: 0; color: var(--cream); font: italic 400 64px/1 "Playfair Display", serif; letter-spacing: 0; }
.toc-collection { min-width: 0; border: 0; }
.toc-collection summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0;
  border-bottom: 1px solid var(--cream);
  cursor: pointer;
  list-style: none;
}
.toc-collection summary::-webkit-details-marker { display: none; }
.toc-collection summary .toc-index { display: none; }
.toc-collection summary b {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--cream);
  font: 200 10px/24px "e-Ukraine", sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
}
.toc-collection summary .toc-toggle {
  flex: none;
  width: 16px;
  height: 16px;
  background: url("icons/arrow-down.svg") center / contain no-repeat;
  transition: transform .3s cubic-bezier(.22, .61, .36, 1);
}
.toc-collection.is-expanded summary .toc-toggle { transform: rotate(180deg); }
.toc-collection summary:focus-visible,
.toc-collection button:focus-visible { outline: 1px solid var(--cream); outline-offset: 3px; }

.toc-collection ol { margin: 0; padding: 0; list-style: none; }
.toc-collection li { margin: 0; }
.toc-collection button {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 12px;
  border: 0;
  padding: 6px 0;
  color: var(--cream);
  background: transparent;
  font: 200 10px/1.4 "e-Ukraine", sans-serif;
  letter-spacing: 0;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
  transition: opacity .2s ease;
}
.toc-collection button .toc-pages { flex: none; min-width: 4.4em; opacity: .6; font-variant-numeric: tabular-nums; }
.toc-collection button:hover { opacity: .7; }

.toc-collection summary { transition: border-color .3s ease; }
.toc-collection.is-expanded summary { border-bottom-color: transparent; }
.toc-collection > ol { margin-top: 6px; }

body.is-auto-flipping .toc-collection button { cursor: wait; }

/* Book (turn.js) — unchanged */
.book-stage {
  position: relative;
  z-index: 2;
  width: var(--book-w);
  height: var(--book-h);
  margin: 24px auto 0;
  perspective: 2600px;
  touch-action: none;
}

body.is-auto-flipping .book-stage { pointer-events: none; }
/* Two-finger zoom (pinch-zoom.js): keep the enlarged book inside its frame */
body.is-pinch-zoomed .book-stage { overflow: hidden; }
body.is-pinch-zoomed .drag-hint,
body.is-pinch-zoomed .page-flow { display: none; }

.page-flow {
  position: absolute;
  z-index: 30;
  inset: 0;
  overflow: hidden;
  visibility: hidden;
  pointer-events: none;
  perspective: 2600px;
  transform-style: preserve-3d;
  transition: opacity .14s ease, visibility 0s linear .14s;
}
.page-flow i {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  opacity: 0;
  backface-visibility: visible;
  background: linear-gradient(90deg, rgba(9,37,35,.2), rgba(255,255,255,.58) 46%, rgba(232,225,209,.38) 72%, rgba(8,28,26,.15));
  border: 1px solid rgba(244,240,231,.2);
  box-shadow: 0 0 16px rgba(0,0,0,.16);
  will-change: transform, opacity;
}
body.is-auto-flipping .page-flow {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}
body.is-auto-flipping.flip-forward .page-flow i {
  left: 50%;
  transform-origin: left center;
  animation: page-flow-forward 500ms cubic-bezier(.42,0,.58,1) infinite;
  animation-delay: calc(var(--flow-index) * -71ms);
}
body.is-auto-flipping.flip-backward .page-flow i {
  left: 0;
  transform-origin: right center;
  animation: page-flow-backward 500ms cubic-bezier(.42,0,.58,1) infinite;
  animation-delay: calc(var(--flow-index) * -71ms);
}

@keyframes page-flow-forward {
  0% { opacity: 0; transform: rotateY(0deg) translateZ(0); }
  10% { opacity: .12; }
  42% { opacity: .36; }
  55% { opacity: .48; transform: rotateY(-102deg) translateZ(18px); }
  88% { opacity: .14; }
  100% { opacity: 0; transform: rotateY(-180deg) translateZ(0); }
}

@keyframes page-flow-backward {
  0% { opacity: 0; transform: rotateY(0deg) translateZ(0); }
  10% { opacity: .12; }
  42% { opacity: .36; }
  55% { opacity: .48; transform: rotateY(102deg) translateZ(18px); }
  88% { opacity: .14; }
  100% { opacity: 0; transform: rotateY(180deg) translateZ(0); }
}

.flipbook { width: var(--book-w); height: var(--book-h); visibility: hidden; user-select: none; -webkit-user-select: none; }
 .flipbook.is-ready { visibility: visible; }
.flipbook.shadow { box-shadow: 0 24px 42px rgba(0,0,0,.33); }
.flipbook .page-wrapper { perspective: 2200px; }
/* Back of a page turning on a phone (script.js): the page mirrored under a light paper veil */
.fold-back { position: relative; }
.fold-back img { transform: scaleX(-1); }
.fold-back::after { content: ""; position: absolute; inset: 0; background: rgba(244, 240, 231, .55); pointer-events: none; }
.flipbook .page {
  width: calc(var(--book-w) / 2);
  height: var(--book-h);
  overflow: hidden;
  color: var(--ink);
  background-color: var(--paper);
  border: 0;
  box-shadow: none;
}
.flipbook .page::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: .25;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.5' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)' opacity='.11'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}
.flipbook .page-content { position: absolute; inset: 0; overflow: hidden; }

.flipbook .cover,
.flipbook .back-cover { color: #fff8df; background: #7cc5c2 !important; border: 1px solid #d9b85d; }
.cover { box-shadow: none; }
.cover .page-content { padding: 0; }
.cover-art { width: 100%; height: 100%; display: block; object-fit: cover; }

.folio { position: absolute; z-index: 31; right: 7%; bottom: 3%; font: 500 6px/1 "Manrope", sans-serif; letter-spacing: .1em; }
.flipbook .even .folio { left: 7%; right: auto; }
.section-no { margin: 0; color: #94763e; font-size: 9px; letter-spacing: .2em; text-transform: uppercase; }

/* "Перегорнути сторінку" hint — shown only in the mobile design */
.drag-hint {
  position: absolute;
  z-index: 80;
  top: calc(100% + 24px);
  right: 44px;
  color: var(--cream);
  font: 200 10px/9px "e-Ukraine", sans-serif;
  letter-spacing: 0;
  pointer-events: none;
  text-transform: uppercase;
  white-space: nowrap;
  transition: opacity .4s ease, visibility 0s linear 0s;
}
.drag-hint > i {
  position: absolute;
  left: calc(100% + 4px);
  bottom: 100%;
  width: 40.3px;
  height: 25.5px;
  background: url("icons/corner-hint.svg") center / contain no-repeat;
}
/* 700–999px wide (a split screen): the book is a spread, but the cover alone sits in its middle,
   so the hint points at the cover's corner, a quarter of the spread in from the right */
@media (min-width: 700px) and (max-width: 999px) {
  body.is-cover-page .drag-hint { right: calc(25% + 44px); }
}
body.is-last-page .drag-hint,
body.has-turned .drag-hint { opacity: 0; visibility: hidden; transition: opacity .4s ease, visibility 0s linear .4s; }

/* Navigation */
.controls {
  width: var(--book-w);
  max-width: 100%;
  margin: 47px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.controls button {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  min-height: 44px;
  border: 0;
  padding: 0;
  color: var(--cream);
  background: transparent;
  font: 200 10px/1 "e-Ukraine", sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
}
.controls button:disabled { cursor: default; }
.controls button:not(:disabled):hover .control-icon { opacity: .72; }
.control-icon {
  display: inline-grid;
  flex: none;
  width: 32px;
  height: 32px;
  place-items: center;
  transition: opacity .2s ease;
}
.control-icon svg { display: block; width: 100%; height: 100%; }
.control-icon-back { transform: scaleX(-1); }
.control-label { display: none; }

.progress {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--cream);
  font: 200 10px/9px "e-Ukraine", sans-serif;
}
.progress i {
  position: relative;
  flex: none;
  width: 96px;
  height: 1px;
  background: currentColor;
}
.progress i::before,
.progress i::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 5.33px;
  height: 5.33px;
  border-radius: 50%;
  background: currentColor;
  transform: translate(-50%, -50%);
}
.progress i::before { left: 0; }
.progress i::after { left: 100%; }
.progress b { display: none; }

.sound-toggle {
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font: 200 10px/10px "e-Ukraine", sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
}
.sound-icon {
  display: block;
  flex: none;
  width: 24px;
  height: 24px;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: url("icons/sound-off.svg") center / 53.125% 53.125% no-repeat;
  background-origin: border-box;
  transition: opacity .2s ease;
}
.sound-toggle.is-muted .sound-icon { background-image: url("icons/sound-on.svg"); background-size: 56.09% 43.75%; }
.sound-toggle:hover .sound-icon { opacity: .72; }
.sound-toggle:focus-visible { outline: 1px solid var(--cream); outline-offset: 4px; }
.sound-toggle-wide { display: none; }
.zoom-toggle {
  display: none;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  font: 200 10px/1 "e-Ukraine", sans-serif;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: pointer;
}
.zoom-icon {
  display: grid;
  flex: none;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  transition: opacity .2s ease;
}
.zoom-icon svg { width: 50%; height: 50%; }
.zoom-toggle .zoom-collapse,
.zoom-toggle[aria-pressed="true"] .zoom-expand { display: none; }
.zoom-toggle[aria-pressed="true"] .zoom-collapse { display: block; }
.zoom-toggle:hover .zoom-icon { opacity: .72; }
.zoom-toggle:focus-visible { outline: 1px solid var(--cream); outline-offset: 4px; }

/* Mobile (Figma 104:56): icon-only, left end of the controls row; the icon shows the current state */
.controls { position: relative; }
.controls .sound-toggle-compact {
  position: absolute;
  top: 50%;
  left: 0;
  display: block;
  width: 32px;
  min-height: 0;
  height: 32px;
  color: var(--muted);
  transform: translateY(-50%);
}
.sound-toggle-compact .sound-icon { width: 32px; height: 32px; }
/* Phone full-screen button: right end of the controls row, mirroring the sound button */
.controls .zoom-toggle-compact {
  position: absolute;
  top: 50%;
  right: 0;
  display: block;
  width: 32px;
  min-height: 0;
  height: 32px;
  color: var(--muted);
  transform: translateY(-50%);
}
.controls .zoom-toggle-compact::before { content: ""; position: absolute; inset: -10px; }
.zoom-toggle-compact .zoom-icon { width: 32px; height: 32px; }
.controls .sound-toggle-compact::before { content: ""; position: absolute; inset: -10px; }
.sound-toggle-compact .sound-icon { background-image: url("icons/sound-on.svg"); background-size: 56.09% 43.75%; }
.sound-toggle-compact.is-muted .sound-icon { background-image: url("icons/sound-off.svg"); background-size: 53.125% 53.125%; }

/* Once the hint is gone the controls take its place (Figma frame 147:118) */
@media (max-width: 999px) {
  /* Full-screen mode: the page fills the screen and two-finger zoom can use all of it */
  body.is-zoomed .masthead,
  body.is-zoomed .catalog-toc,
  body.is-zoomed .drag-hint { display: none; }
  body.is-zoomed .book-stage {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    margin: 0;
    padding: calc(var(--tg-safe-area-inset-top, 0px) + var(--tg-content-safe-area-inset-top, 0px)) 0 calc(96px + env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
  }
  body.is-zoomed .controls {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(24px + env(safe-area-inset-bottom));
    z-index: 5;
    width: auto;
    margin: 0;
  }
  /* A zoomed page runs under the controls: a dark backing keeps the white arrows readable */
  body.is-zoomed .controls::after {
    content: "";
    position: absolute;
    inset: -8px -6px;
    z-index: -1;
    border-radius: 28px;
    background: rgba(22, 20, 42, .78);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    opacity: 0;
    transition: opacity .25s ease;
  }
  body.is-zoomed.is-pinch-zoomed .controls::after { opacity: 1; }

  /* Full width, not the book's: in a short window (Telegram) the book narrows and the sound button would sit on the back arrow */
  .controls { width: 100%; transition: margin-top .4s ease; }
  body.has-turned .controls { margin-top: 14px; }
}

@media (max-width: 340px) {
  .progress i { width: 64px; }
}

@media (max-width: 760px) {
  .page-flow i { width: 100%; }
  body.is-auto-flipping.flip-forward .page-flow i { left: 0; }
}

/* Desktop: everything scales from the 2880×1800 Figma frame (63:32) */
@media (min-width: 1000px) {
  :root { --u: min(calc(100vw / 2880), calc(100vh / 1800)); }

  .catalog-shell {
    width: calc(2880 * var(--u));
    min-height: 0;
    margin: 0 auto;
    padding: calc(128 * var(--u)) calc(128 * var(--u)) 0;
  }
  .masthead {
    position: relative;
    justify-content: center;
    padding-bottom: calc(64 * var(--u));
    border-bottom: max(1px, calc(2 * var(--u))) solid var(--cream);
  }
  .wordmark { width: calc(442.092 * var(--u)); }
  .wordmark-svg:not(.wordmark-svg-text) { display: block; }
  .wordmark-svg-text { display: none; }
  .lang-switch {
    position: absolute;
    top: calc(8 * var(--u));
    right: 0;
    gap: calc(24 * var(--u));
    min-height: calc(64 * var(--u));
    font-size: max(10px, calc(24 * var(--u)));
    line-height: calc(24 * var(--u));
  }
  .lang-divider { margin: 0 calc(-16 * var(--u)); }
  .lang-globe { width: calc(64 * var(--u)); height: calc(64 * var(--u)); stroke-width: 2; }

  .viewer {
    display: grid;
    /* Contents column wider than in Figma 63:32 (397) so long section names stay on one line */
    grid-template-columns: calc(556 * var(--u)) minmax(0, 1fr) calc(398 * var(--u));
    column-gap: 0;
    align-items: start;
    padding-top: calc(128 * var(--u));
  }

  .catalog-toc {
    display: flex;
    flex-direction: column;
    gap: calc(36 * var(--u));
    width: calc(516 * var(--u));
    margin-top: calc(64 * var(--u));
    max-height: calc(var(--book-h) + 64 * var(--u));
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-width: none;
  }
  .catalog-toc::-webkit-scrollbar { display: none; }
  .catalog-toc.has-more {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 96 * var(--u)), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 96 * var(--u)), transparent);
  }
  .toc-trigger { display: none; }
  .toc-list {
    position: static;
    display: flex;
    gap: calc(36 * var(--u));
    visibility: visible;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    transition: none;
    max-height: none;
    padding: 0;
    overflow: visible;
    background: none;
    box-shadow: none;
  }
  .toc-label {
    display: block;
    margin-bottom: calc(92 * var(--u));
    font-size: calc(64 * var(--u));
  }
  .toc-collection summary {
    gap: calc(16 * var(--u));
    border-bottom-width: max(1px, calc(2 * var(--u)));
  }
  .toc-collection.is-expanded summary { border-bottom-color: transparent; }
  /* --toc-fit is set by catalog-loader.js so the longest name fits on one line */
  .toc-collection summary b {
    font-size: var(--toc-fit, max(11px, calc(32 * var(--u))));
    line-height: calc(48 * var(--u));
  }
  .toc-collection summary .toc-toggle {
    width: calc(48 * var(--u));
    height: calc(48 * var(--u));
  }
  .toc-collection > ol {
    display: flex;
    flex-direction: column;
    gap: calc(24 * var(--u));
    margin-top: calc(36 * var(--u));
  }
  .toc-collection button {
    gap: calc(24 * var(--u));
    padding: 0;
    font-size: max(10px, calc(24 * var(--u)));
    line-height: 1;
  }

  .book-stage { margin-top: 0; }
  .drag-hint { display: none; }

  .controls {
    margin-top: calc(64 * var(--u));
    justify-content: space-between;
    gap: 0;
  }
  .controls button {
    gap: calc(24 * var(--u));
    min-height: calc(64 * var(--u));
    font-size: max(10px, calc(24 * var(--u)));
  }
  .control-label { display: inline; }
  .control-icon {
    width: calc(64 * var(--u));
    height: calc(64 * var(--u));
  }
  .progress {
    gap: calc(32 * var(--u));
    color: var(--cream);
    font-size: max(10px, calc(24 * var(--u)));
    line-height: 1;
  }
  .progress i {
    width: calc(256 * var(--u));
    height: max(1px, calc(2 * var(--u)));
  }
  .progress i::before,
  .progress i::after {
    width: calc(10.667 * var(--u));
    height: calc(10.667 * var(--u));
  }
  .controls .sound-toggle-compact,
  .controls .zoom-toggle-compact { display: none; }
  .sound-toggle-wide {
    grid-column: 3;
    justify-self: end;
    align-self: start;
    margin-top: calc(64 * var(--u));
    display: flex;
    align-items: center;
    gap: calc(24 * var(--u));
    font-size: max(10px, calc(24 * var(--u)));
    line-height: 1;
  }
  .sound-toggle-wide .sound-icon {
    width: calc(64 * var(--u));
    height: calc(64 * var(--u));
    border-width: max(1px, calc(2 * var(--u)));
  }

  /* Full-screen reading mode: right under the sound toggle */
  .sound-toggle-wide { grid-row: 1; }
  .zoom-toggle {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: start;
    margin-top: calc(160 * var(--u));
    display: flex;
    align-items: center;
    gap: calc(24 * var(--u));
    font-size: max(10px, calc(24 * var(--u)));
  }
  .zoom-icon {
    width: calc(64 * var(--u));
    height: calc(64 * var(--u));
    border-width: max(1px, calc(2 * var(--u)));
  }

  /* Only the book, the arrows and the page counter stay */
  body.is-zoomed .catalog-shell { width: 100%; padding-top: calc(96 * var(--u)); }
  body.is-zoomed .masthead,
  body.is-zoomed .catalog-toc,
  body.is-zoomed .sound-toggle-wide,
  body.is-zoomed .control-label { display: none; }
  body.is-zoomed .viewer { grid-template-columns: minmax(0, 1fr); padding-top: 0; }
  body.is-zoomed .book-column { grid-column: 1; }
  body.is-zoomed .zoom-toggle {
    position: fixed;
    top: calc(48 * var(--u));
    right: calc(64 * var(--u));
    z-index: 5;
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-flow { display: none; }
}

/* Content editor preview */
/* Same colour as the site background, so sub-pixel page edges and letterboxing don't show as a light line */
.flipbook .figma-page { background-color: var(--bg); }
.figma-page .page-content { width: 100%; height: 100%; overflow: hidden; background: var(--bg); }
.figma-page-image { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; user-select: none; }
.figma-page-image.fits-page { object-fit: cover; }
.catalogue-empty { width: 100%; height: 100%; display: grid; place-content: center; justify-items: center; gap: 28px; padding: 12%; color: #796e5d; background: #eee8dc; text-align: center; font-family: "Cormorant Garamond", serif; font-size: 22px; }
.catalogue-empty img { width: min(260px, 70%); height: auto; opacity: .72; }
.catalogue-empty strong { color: #796e5d; font-family: "Prata", "Cormorant Garamond", serif; font-weight: 400; letter-spacing: .08em; font-size: clamp(24px, 4vw, 46px); }

/* Clickable areas over page images (set up in the admin) */
.page-hotspots { position: absolute; top: 50%; left: 50%; z-index: 2; width: 100%; height: 100%; transform: translate(-50%, -50%); pointer-events: none; container-type: size; }
/* Prices from the admin (font size follows the drawn area, so it scales with the page) */
.page-price { position: absolute; display: flex; align-items: center; justify-content: flex-start; box-sizing: border-box; padding: 0; overflow: hidden; font-family: "e-Ukraine", sans-serif; font-weight: 200; line-height: 1; letter-spacing: 0; text-transform: uppercase; white-space: nowrap; pointer-events: none; }
.page-price-cover { position: absolute; pointer-events: none; }
.page-price-exact { display: block; width: auto; height: auto; padding: 0; overflow: visible; }
.page-hotspot { position: absolute; display: block; padding: 0; border: 0; border-radius: 4px; background: transparent; cursor: pointer; pointer-events: auto; transition: background-color .2s ease, box-shadow .2s ease; -webkit-tap-highlight-color: transparent; }
.page-hotspot:hover { background: rgba(255, 251, 244, .14); box-shadow: 0 0 0 1px rgba(22, 20, 42, .35); }
.page-hotspot:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; }
.page-hotspot:active { background: rgba(22, 20, 42, .12); }

/* "Try on" button on a page, in the look of the button printed on the pages */
.page-hotspot.page-tryon { display: flex; align-items: center; justify-content: center; color: var(--cream); background: var(--bg); font-family: "e-Ukraine", sans-serif; font-weight: 200; line-height: 1; text-transform: uppercase; white-space: nowrap; border-radius: 2px; }
.page-hotspot.page-tryon::before { content: ""; position: absolute; inset: -8px -4px; }
.page-hotspot.page-tryon:hover { color: var(--bg); background: var(--cream); box-shadow: 0 0 0 1px var(--bg); }

/* Virtual try-on (tryon.js) */
.tryon-dialog { width: 100vw; max-width: none; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; color: var(--cream); background: var(--bg); font-family: "e-Ukraine", sans-serif; font-weight: 200; overscroll-behavior: contain; }
.tryon-dialog::backdrop { background: var(--bg); }
.tryon-shell { display: flex; flex-direction: column; gap: 16px; width: min(1100px, 100%); height: 100%; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); }
.tryon-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: none; }
.tryon-title { margin: 0; font: 400 22px/1.2 "Playfair Display", serif; }
.tryon-close { position: relative; flex: none; width: 32px; height: 32px; padding: 0; border: 1px solid var(--cream); border-radius: 50%; background: transparent; cursor: pointer; }
.tryon-close::before, .tryon-close::after { content: ""; position: absolute; top: 50%; left: 50%; width: 14px; height: 1px; background: var(--cream); }
.tryon-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.tryon-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.tryon-step { display: flex; flex: 1; flex-direction: column; gap: 16px; min-height: 0; }
.tryon-step[hidden] { display: none; }
.tryon-pick { align-items: center; justify-content: center; text-align: center; }
.tryon-pick .tryon-btn { width: min(320px, 100%); }
.tryon-lead { max-width: 480px; margin: 0 0 8px; font-size: 13px; line-height: 1.5; }
.tryon-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 16px; border: 1px solid var(--cream); border-radius: 4px; color: var(--cream); background: transparent; font: 200 12px/1.2 "e-Ukraine", sans-serif; letter-spacing: 0; text-align: center; text-transform: uppercase; cursor: pointer; transition: opacity .15s ease; }
.tryon-btn:hover { opacity: .8; }
.tryon-btn-primary { color: var(--bg); background: var(--cream); font-weight: 300; }
.tryon-main { display: flex; flex: 1; align-items: center; justify-content: center; min-height: 0; overflow: hidden; }
.tryon-stage { position: relative; flex: none; overflow: hidden; border-radius: 4px; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.tryon-stage:active { cursor: grabbing; }
.tryon-photo { display: block; width: 100%; height: 100%; pointer-events: none; }
.tryon-ring { position: absolute; display: block; height: auto; pointer-events: none; }
.tryon-tools { display: grid; flex: none; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.tryon-hint { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.tryon-wearers { display: flex; grid-column: 1 / -1; gap: 8px; }
.tryon-wearers[hidden] { display: none; }
.tryon-wearers button { flex: 1; min-height: 36px; border: 1px solid var(--muted); border-radius: 4px; color: var(--cream); background: transparent; font: 200 12px/1 "e-Ukraine", sans-serif; text-transform: uppercase; cursor: pointer; }
.tryon-wearers button[aria-pressed="true"] { border-color: var(--cream); color: var(--bg); background: var(--cream); font-weight: 300; }
.tryon-slider { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 11px; text-transform: uppercase; }
.tryon-slider input { flex: 1; min-width: 0; accent-color: var(--cream); }
.tryon-actions { display: grid; grid-column: 1 / -1; grid-template-columns: 1fr 1fr; gap: 8px; }
.tryon-quote { grid-column: 1 / -1; }
.tryon-final { align-items: center; justify-content: center; text-align: center; }
.tryon-result { flex: 1; min-height: 0; max-width: 100%; object-fit: contain; }
.tryon-error { flex: none; margin: 0; color: var(--cream); font-size: 12px; text-align: center; }
.tryon-error:empty { display: none; }
@media (hover: hover) and (pointer: fine) { .tryon-camera { display: none; } }
@media (min-width: 1000px) {
  .tryon-place { flex-direction: row; }
  .tryon-tools { width: 320px; align-content: center; grid-template-columns: 1fr; }
  .tryon-actions { grid-template-columns: 1fr; }
}

/* Price request form, Figma frame "форма" (308:31) */
@font-face {
  font-family: "e-Ukraine";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("fonts/e-ukraine-light.woff2") format("woff2");
}
.lead-dialog { width: min(375px, calc(100vw - 24px)); max-width: none; max-height: calc(100dvh - 24px); margin: auto; padding: 0; overflow: auto; border: 0; border-radius: 4px; color: var(--bg); background: var(--cream); box-shadow: 0 24px 80px rgba(0, 0, 0, .45); overscroll-behavior: contain; }
.lead-dialog::backdrop { background: rgba(10, 9, 22, .72); backdrop-filter: blur(2px); }
.lead-dialog[open] { animation: lead-in .28s ease; }
@keyframes lead-in { from { opacity: 0; transform: translateY(12px); } }
body.lead-open { overflow: hidden; }
.lead-form { position: relative; margin: 0; padding: 32px 24px; outline: 0; }
.lead-step { display: flex; flex-direction: column; gap: 32px; }
.lead-step[hidden] { display: none; }
.lead-title { margin: 0; color: var(--bg); font: 400 22px/22px "Playfair Display", serif; letter-spacing: 0; text-align: center; }
.lead-fields { display: flex; flex-direction: column; gap: 16px; }
.lead-field { display: flex; flex-direction: column; gap: 4px; }
.lead-label { padding: 0; color: var(--bg); font: 300 10px/normal "e-Ukraine", sans-serif; letter-spacing: 0; text-transform: uppercase; }
.lead-input { box-sizing: border-box; width: 100%; height: 38px; margin: 0; padding: 0 12px 0 10px; border: 1px solid var(--bg); border-radius: 4px; color: var(--bg); background: var(--cream); font: 300 16px/normal "e-Ukraine", sans-serif; outline: 0; appearance: none; }
.lead-input[type="tel"] { letter-spacing: .02em; }
.lead-input::placeholder { color: var(--muted); font: 200 10px/normal "e-Ukraine", sans-serif; text-transform: uppercase; opacity: 1; }
.lead-input:focus { box-shadow: 0 0 0 1px var(--bg); }
.lead-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.lead-messengers { display: flex; flex-direction: column; gap: 12px; min-width: 0; margin: 0; padding: 0; border: 0; }
.lead-messengers legend { float: left; width: 100%; margin: 0; }
.lead-options { display: flex; gap: 12px; }
.lead-option { position: relative; flex: 1 0 0; min-width: 0; }
.lead-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.lead-option span { display: flex; align-items: center; justify-content: center; gap: 10px; height: 40px; border: 1px solid var(--bg); border-radius: 4px; color: var(--bg); background: var(--cream); box-shadow: 0 1px 1px rgba(0, 0, 0, .25); font: 300 13px/normal "e-Ukraine", sans-serif; letter-spacing: -.13px; pointer-events: none; transition: background-color .15s ease, color .15s ease; }
.lead-option input:hover + span { background: #f3eee4; }
.lead-option input:checked + span { color: var(--cream); background: var(--bg); }
.lead-option input:focus-visible + span { outline: 2px solid var(--bg); outline-offset: 2px; }
.lead-icon { display: block; flex: none; background: currentColor; -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat; }
.lead-icon-viber { --icon: url("icons/viber.svg"); width: 13px; height: 15px; }
.lead-icon-telegram { --icon: url("icons/telegram.svg"); width: 14px; height: 11px; }
.lead-submit { display: flex; align-items: center; justify-content: center; width: 100%; margin: 0; padding: 12px; border: 0; border-radius: 4px; color: var(--cream); background: var(--bg); filter: drop-shadow(0 1px .5px rgba(0, 0, 0, .25)); font: 200 13px/normal "e-Ukraine", sans-serif; letter-spacing: -.13px; text-transform: uppercase; cursor: pointer; transition: opacity .15s ease; }
.lead-submit:hover:not(:disabled) { opacity: .88; }
.lead-submit:disabled { opacity: .6; cursor: wait; }
.lead-submit:focus-visible { outline: 2px solid var(--bg); outline-offset: 2px; }
.lead-error { min-height: 0; margin: 0; color: #a3222d; font: 300 10px/1.3 "e-Ukraine", sans-serif; }
.lead-error:empty { display: none; }
.lead-field.is-invalid .lead-input, .lead-messengers.is-invalid .lead-option span { border-color: #a3222d; box-shadow: 0 0 0 1px #a3222d; }
.lead-close { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: pointer; opacity: .55; transition: opacity .15s ease; }
.lead-close::before, .lead-close::after { content: ""; position: absolute; top: 50%; left: 50%; width: 14px; height: 1px; background: var(--bg); }
.lead-close::before { transform: translate(-50%, -50%) rotate(45deg); }
.lead-close::after { transform: translate(-50%, -50%) rotate(-45deg); }
.lead-close:hover { opacity: 1; }
.lead-close:focus-visible { outline: 1px solid var(--bg); opacity: 1; }
.lead-done { align-items: center; gap: 20px; padding: 12px 0 0; }
.lead-text { margin: 0; color: var(--bg); font: 300 12px/1.5 "e-Ukraine", sans-serif; text-align: center; }
.lead-done .lead-submit { margin-top: 12px; }
