/* Корабль дураков — лист инкунабулы */
:root {
  --paper: #efe5cc;
  --paper-hi: #f6eedb;
  --paper-lo: #dfd2b2;
  --ink: #1e1a15;
  --ink-soft: #4a4035;
  --ink-faint: #8a7a63;
  --rubric: #9c2b1b;
  --rubric-deep: #7a1f12;
  --night: #15110e;
  --night-2: #221a14;
  --gold: #b9975b;
  --serif: 'Cormorant Garamond', 'EB Garamond', Georgia, 'Times New Roman', serif;
  --sc: 'Cormorant SC', 'Cormorant Garamond', Georgia, serif;
  --antiqua: 'EB Garamond', 'Cormorant Garamond', Georgia, serif;
  --fraktur: 'UnifrakturMaguntia', 'EB Garamond', serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--night);
  background-image:
    radial-gradient(ellipse 120% 80% at 50% 0%, #2b2018 0%, rgba(43, 32, 24, 0) 60%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .9 0 0 0 0 .75 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.45;
  font-feature-settings: 'liga', 'kern';
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
::selection { background: var(--rubric); color: var(--paper-hi); }

/* ---------- бумага ---------- */
.paper {
  position: relative;
  background-color: var(--paper);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='p'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.035 .6' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .1 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23p)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='3' seed='3'/%3E%3CfeColorMatrix values='0 0 0 0 .3 0 0 0 0 .22 0 0 0 0 .1 0 0 0 .13 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 50% 40%, var(--paper-hi) 0%, var(--paper) 55%, var(--paper-lo) 100%);
}
.paper::after { /* потемневшие края */
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(92, 62, 22, .28), inset 0 0 14px rgba(60, 40, 15, .25);
}

/* ---------- верхняя планка ---------- */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 12px;
  padding: 10px 22px;
  color: #cdbd9c;
  background: linear-gradient(rgba(21, 17, 14, .96), rgba(21, 17, 14, .82));
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(185, 151, 91, .22);
  font-family: var(--sc);
  font-size: 15px;
  letter-spacing: .12em;
}
.bar a { text-decoration: none; transition: color .2s; }
.bar a:hover { color: #f3e6c8; }
.bar .home { justify-self: center; font-size: 17px; letter-spacing: .22em; white-space: nowrap; }
.bar .home i { font-style: normal; color: var(--rubric); filter: brightness(1.6); margin: 0 .5em; }
.bar .left { display: flex; gap: 18px; align-items: center; }
.bar .right { display: flex; gap: 14px; align-items: center; justify-content: flex-end; }
.switch { display: inline-flex; border: 1px solid rgba(185, 151, 91, .4); border-radius: 2px; overflow: hidden; }
.switch button {
  all: unset; cursor: pointer; padding: 3px 11px;
  font-family: var(--sc); font-size: 14px; letter-spacing: .1em; color: #a8987a;
  transition: background .2s, color .2s;
}
.switch button:hover { color: #f3e6c8; }
.switch button[aria-pressed='true'] { background: #cdbd9c; color: var(--night); }
.switch button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
html:not([data-lang='de']) .only-orig { display: none; }

/* ---------- разворот ---------- */
.spread {
  display: grid; grid-template-columns: 1fr 1fr;
  max-width: 1320px;
  margin: 34px auto 60px;
  padding: 0 28px;
  filter: drop-shadow(0 30px 40px rgba(0, 0, 0, .55));
  animation: rise .7s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .spread, .hero .title-leaf { animation: none !important; } }

.page { padding: 46px 62px 56px; min-height: calc(100vh - 130px); }
.verso { border-radius: 3px 0 0 3px; }
.recto { border-radius: 0 3px 3px 0; }
.verso::before, .recto::before { /* корешок */
  content: ''; position: absolute; top: 0; bottom: 0; width: 70px; pointer-events: none; z-index: 1;
}
.verso::before { right: 0; background: linear-gradient(to right, rgba(60, 38, 12, 0), rgba(60, 38, 12, .1) 60%, rgba(40, 24, 8, .34)); }
.recto::before { left: 0; background: linear-gradient(to left, rgba(60, 38, 12, 0), rgba(60, 38, 12, .08) 60%, rgba(40, 24, 8, .3)); }

.runhead {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--sc); font-size: 14px; letter-spacing: .24em; color: var(--ink-faint);
  padding-bottom: 8px; margin-bottom: 30px;
  border-bottom: 1px solid rgba(74, 64, 53, .28);
}
.runhead .num { color: var(--rubric); letter-spacing: .1em; font-size: 16px; }

.verso-in { position: sticky; top: 76px; mix-blend-mode: multiply; }

/* девиз */
.motto {
  margin: 0 auto 22px; width: fit-content; max-width: 100%;
  font-size: 23px; line-height: 1.34; font-style: italic; font-weight: 500;
  color: var(--ink);
}
.motto span { display: block; }
.motto span:first-child::first-letter { color: var(--rubric); font-style: normal; font-weight: 700; font-size: 1.25em; }
.motto.de { font-style: normal; }

/* гравюра */
.cut { margin: 0 auto; max-width: 440px; }
.cut img { width: auto; height: auto; max-width: 100%; max-height: clamp(280px, calc(100vh - 440px), 640px); margin: 0 auto; mix-blend-mode: multiply; filter: contrast(1.06); }
.title-leaf .cut img { max-height: none; }
.cut.wide { max-width: 100%; }
.cut .none {
  aspect-ratio: 3 / 4; display: grid; place-items: center;
  border: 3px double rgba(74, 64, 53, .45); color: var(--ink-faint);
  font-family: var(--sc); letter-spacing: .2em; font-size: 14px;
}

/* заглавие-рубрика */
.rubric { text-align: center; margin: 26px 0 0; }
.rubric h1 {
  margin: 0; font-family: var(--sc); font-weight: 600;
  font-size: clamp(26px, 2.6vw, 36px); line-height: 1.12; letter-spacing: .05em;
  color: var(--rubric);
  text-wrap: balance;
}
.rubric .orig {
  display: block; margin-top: 8px;
  font-family: var(--fraktur); font-size: 23px; color: var(--ink-soft); line-height: 1.2;
}
html[data-lang='de'] .rubric h1 { font-size: 20px; color: var(--ink-faint); letter-spacing: .12em; order: 2; margin-top: 10px; }
html[data-lang='de'] .rubric { display: flex; flex-direction: column; }
html[data-lang='de'] .rubric .orig { font-size: clamp(30px, 3vw, 42px); color: var(--rubric); margin: 0; }
.fleuron { text-align: center; color: var(--rubric); font-size: 22px; margin-top: 18px; opacity: .85; }

/* стихи */
.text { position: relative; margin: 0 auto; width: fit-content; max-width: 100%; }
@media (min-width: 700px) { .text .v.first, .text .v.second { white-space: nowrap; } .text { left: -1.2em; } }
.text .v { position: relative; white-space: pre-wrap; padding-left: 1.6em; text-indent: -1.6em; margin-left: 1.6em; }
.text .gap { height: .8em; }
.text .v[data-n]::before {
  content: attr(data-n);
  position: absolute; left: -4.2em; top: .2em; width: 2em; text-align: right; text-indent: 0;
  font-family: var(--antiqua); font-size: 13px; font-style: normal; color: var(--ink-faint);
}
.text.ru { font-size: 22px; line-height: 1.42; font-weight: 500; }
.text.de { font-family: var(--antiqua); font-size: 19.5px; line-height: 1.5; }
html[data-script='fraktur'] .text.de, html[data-script='fraktur'] .motto.de, html[data-script='fraktur'] .prose.de {
  font-family: var(--fraktur); font-size: 23px; line-height: 1.36; letter-spacing: .01em;
}
html[data-script='fraktur'] .motto.de { font-size: 25px; }
.cap {
  float: left; text-indent: 0;
  font-family: var(--fraktur); font-weight: 400; color: var(--rubric);
  font-size: 3.5em; line-height: .82; padding: .06em .1em 0 0; margin-left: -.02em;
}
.text.ru .cap { font-family: var(--sc); font-weight: 700; font-size: 3.3em; line-height: .78; padding-top: .08em; }
.cap { height: .84em; }
html[data-script='fraktur'] .text.de .cap { height: .76em; }
.text .v.first { text-indent: 0; padding-left: 0; }
.text .v.second { text-indent: 0; padding-left: 0; }

.prose { max-width: 30em; margin: 0 auto 26px; text-align: justify; hyphens: auto; font-size: 21px; }
.prose.de { font-family: var(--antiqua); font-size: 19px; }
.note {
  max-width: 27em; margin: 0 auto 26px; padding: 10px 16px;
  border-top: 1px solid rgba(156, 43, 27, .4); border-bottom: 1px solid rgba(156, 43, 27, .4);
  font-size: 17px; font-style: italic; color: var(--ink-soft); text-align: center;
}

/* язык */
.L { display: none; }
html[data-lang='ru'] .L.ru, html[data-lang='de'] .L.de, html[data-lang='en'] .L.en, html[data-lang='wh'] .L.wh, .L.keep { display: block; }
html[data-lang='ru'] .only-de .text.de, html[data-lang='ru'] .only-de .prose.de { display: block; }

/* английские версии: Barclay 1509, Whitcomb 1899 */
.text.en, .text.wh { font-family: var(--antiqua); font-size: 19.5px; line-height: 1.5; }
.text.en .v { white-space: normal; }
.motto.en, .motto.wh { font-family: var(--antiqua); font-size: 19px; line-height: 1.36; }
.rubric .entitle {
  font-family: var(--antiqua); font-style: italic; font-size: clamp(22px, 2.1vw, 29px); line-height: 1.16;
  color: var(--rubric); margin-bottom: 12px; text-wrap: balance;
}
html[data-lang='en'] .rubric h1, html[data-lang='wh'] .rubric h1 { font-size: 18px; color: var(--ink-faint); letter-spacing: .12em; }
html[data-lang='en'] .rubric .orig, html[data-lang='wh'] .rubric .orig { font-size: 18px; margin-top: 4px; }
.envoy {
  margin: 1.2em 0 .7em; text-align: center; font-family: var(--sc); font-weight: 600; font-size: 17px;
  letter-spacing: .14em; color: var(--rubric); text-wrap: balance;
}
.envoy::before { content: '❦'; display: block; font-size: 18px; margin-bottom: 6px; opacity: .8; }
.credit {
  max-width: 28em; margin: 30px auto 0; padding-top: 12px; border-top: 1px solid rgba(74, 64, 53, .28);
  font-size: 16px; color: var(--ink-soft); text-align: center; text-wrap: pretty;
}
sup { font-size: .68em; line-height: 0; }
.ov { position: relative; display: inline-block; text-indent: 0; line-height: 1; }
.switch button { white-space: nowrap; }
@media (max-width: 1400px) { .switch .yr { display: none; } }
.ov i { position: absolute; left: 0; right: 0; top: -.1em; text-align: center; font-style: normal; font-size: .5em; line-height: 1; }
html[data-script='fraktur'] .ov i { top: -.04em; }

.folio { text-align: center; margin-top: 40px; font-family: var(--sc); letter-spacing: .3em; font-size: 14px; color: var(--ink-faint); }

/* листание */
.turn {
  position: fixed; top: 50%; z-index: 10; transform: translateY(-50%);
  width: 46px; height: 120px; display: grid; place-items: center;
  color: #a8987a; text-decoration: none; font-size: 34px; font-family: var(--serif);
  opacity: .55; transition: opacity .2s, color .2s, transform .2s;
}
.turn:hover { opacity: 1; color: #f3e6c8; }
.turn.prev { left: 0; } .turn.prev:hover { transform: translate(-3px, -50%); }
.turn.next { right: 0; } .turn.next:hover { transform: translate(3px, -50%); }
.pager {
  max-width: 1320px; margin: -26px auto 70px; padding: 0 28px;
  display: flex; justify-content: space-between; gap: 20px;
  font-family: var(--sc); letter-spacing: .1em; font-size: 16px; color: #a8987a;
}
.pager a { text-decoration: none; max-width: 46%; }
.pager a:hover { color: #f3e6c8; }
.pager small { display: block; font-size: 12px; letter-spacing: .3em; color: #77684f; }
.pager .n { text-align: right; margin-left: auto; }

/* ---------- титул ---------- */
.hero { position: relative; overflow: hidden; min-height: min(100vh, 1200px); display: grid; place-items: center; padding: 50px 20px 70px; }
.hero .title-leaf { position: relative; z-index: 1; }
/* стена гравюр за титулом: два слоя, параллакс по прокрутке (--sy из app.js) и медленный дрейф */
.wall { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.wall i {
  position: absolute; left: 0; top: -25%; height: 150%; width: calc(100% + var(--tw));
  background-repeat: repeat; background-size: var(--tw) auto; mix-blend-mode: screen; will-change: transform, translate;
  animation: drift linear infinite;
}
.wall .w1 { --tw: 1308px; background-image: url(bg1.jpg); opacity: .2; translate: 0 calc(var(--sy, 0) * .45px); animation-duration: 300s; }
.wall .w2 { --tw: 1648px; background-image: url(bg2.jpg); background-position: 300px 120px; opacity: .42; translate: 0 calc(var(--sy, 0) * .2px); animation-duration: 190s; animation-direction: reverse; }
.wall::after {
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 62% 58% at 50% 46%, rgba(21, 17, 14, .85) 0%, rgba(21, 17, 14, .3) 60%, rgba(21, 17, 14, 0) 100%),
    linear-gradient(to bottom, rgba(21, 17, 14, .5) 0%, rgba(21, 17, 14, 0) 18%, rgba(21, 17, 14, 0) 72%, var(--night) 100%);
}
@keyframes drift { to { transform: translateX(calc(-1 * var(--tw))); } }
@media (max-width: 760px) { .wall .w1 { --tw: 760px; opacity: .24; } .wall .w2 { --tw: 1000px; opacity: .5; } }
@media (max-width: 760px) {
  .wall::after { background: linear-gradient(to bottom, rgba(21, 17, 14, .35) 0%, rgba(21, 17, 14, 0) 14%, rgba(21, 17, 14, 0) 80%, var(--night) 100%); }
  .hero { padding: 64px 14px 96px; }
}
@media (prefers-reduced-motion: reduce) { .wall i { animation: none; translate: none; } }
.title-leaf {
  width: min(680px, 100%); padding: 58px 54px 46px; text-align: center; border-radius: 3px;
  box-shadow: 0 40px 70px rgba(0, 0, 0, .6);
  animation: rise .9s cubic-bezier(.2, .7, .2, 1) both;
}
.title-leaf .author { font-family: var(--sc); letter-spacing: .34em; font-size: 17px; color: var(--ink-soft); }
.title-leaf h1 {
  margin: 14px 0 2px; font-family: var(--sc); font-weight: 700;
  font-size: clamp(44px, 8.4vw, 84px); line-height: .96; letter-spacing: .02em; color: var(--rubric);
}
.title-leaf h1 span span { display: block; font-size: .5em; letter-spacing: .34em; color: var(--ink); font-weight: 600; margin-top: .3em; }
.title-leaf .fr { font-family: var(--fraktur); font-size: clamp(26px, 4.4vw, 40px); color: var(--ink); margin: 14px 0 22px; }
.title-leaf .cut { max-width: 100%; }
.title-leaf .imprint { margin-top: 22px; font-family: var(--sc); letter-spacing: .26em; font-size: 15px; color: var(--ink-soft); }
.title-leaf .imprint b { color: var(--rubric); font-weight: 600; }
.title-leaf .go {
  display: inline-block; margin-top: 26px; padding: 9px 26px; text-decoration: none;
  font-family: var(--sc); letter-spacing: .2em; font-size: 16px; color: var(--paper-hi); background: var(--rubric);
  border-radius: 2px; transition: background .2s;
}
.title-leaf .go:hover { background: var(--rubric-deep); }

.about { max-width: 760px; margin: 0 auto 80px; padding: 0 24px; color: #d6c8a8; font-size: 23px; line-height: 1.5; text-align: center; text-wrap: pretty; }
.about p { margin: 0 0 .9em; }
.about p:first-child::first-letter { font-family: var(--sc); font-weight: 700; color: #d9694f; font-size: 1.5em; }

.reg-head { text-align: center; color: #cdbd9c; margin: 0 20px 34px; }
.reg-head h2 { font-family: var(--sc); font-weight: 600; letter-spacing: .3em; font-size: 30px; margin: 0; }
.reg-head .fr { font-family: var(--fraktur); font-size: 22px; color: #8f7f62; }
.reg-head input {
  margin-top: 20px; width: min(420px, 100%); padding: 9px 16px;
  font-family: var(--serif); font-size: 19px; font-style: italic; text-align: center;
  color: #f3e6c8; background: rgba(255, 240, 200, .05);
  border: 1px solid rgba(185, 151, 91, .35); border-radius: 2px; outline: none;
}
.reg-head input:focus { border-color: var(--gold); }
.reg-head input::placeholder { color: #77684f; }

.register {
  max-width: 1360px; margin: 0 auto 90px; padding: 0 28px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(218px, 1fr)); gap: 26px 22px;
}
.card {
  display: flex; flex-direction: column; padding: 16px 16px 18px; text-decoration: none; text-align: center;
  border-radius: 2px; box-shadow: 0 12px 22px rgba(0, 0, 0, .45);
  transition: transform .25s cubic-bezier(.2, .7, .2, 1), box-shadow .25s;
}
.card::after { box-shadow: inset 0 0 40px rgba(92, 62, 22, .25); }
.card:hover { transform: translateY(-5px) rotate(-.4deg); box-shadow: 0 22px 34px rgba(0, 0, 0, .6); }
.card:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.card .n { font-family: var(--sc); font-size: 14px; letter-spacing: .2em; color: var(--rubric); margin-bottom: 8px; }
.card .th { aspect-ratio: 3 / 4; display: grid; place-items: center; overflow: hidden; }
.card .th img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.card .th.none { border: 3px double rgba(74, 64, 53, .35); font-family: var(--fraktur); font-size: 54px; color: rgba(156, 43, 27, .7); }
.card .t { margin-top: 12px; font-family: var(--sc); font-weight: 600; font-size: 18px; line-height: 1.12; letter-spacing: .03em; color: var(--ink); text-wrap: balance; }
.card .o { margin-top: 5px; font-family: var(--fraktur); font-size: 16px; color: var(--ink-faint); line-height: 1.15; }
.card[hidden] { display: none; }

.foot { text-align: center; color: #77684f; font-size: 16px; padding: 0 24px 60px; max-width: 760px; margin: 0 auto; }
.foot a { color: #a8987a; }

/* ---------- язык интерфейса ---------- */
html[data-ui='en'] .u-ru, html:not([data-ui='en']) .u-en { display: none !important; }
html[data-lang='ru'] .rubric h1 .u-ru { display: inline !important; }
html[data-lang='ru'] .rubric h1 .u-en { display: none !important; }
.sh { display: none; }
.uisw { position: absolute; top: 14px; right: 16px; z-index: 2; background: rgba(21, 17, 14, .6); }

/* ---------- плавание: волна под планкой и кораблик — место листа в книге ---------- */
.bar { border-bottom: 0; }
.voyage {
  position: absolute; left: 0; right: 0; top: 100%; height: 22px; pointer-events: none; overflow-x: clip;
  background: linear-gradient(rgba(21, 17, 14, .82), rgba(21, 17, 14, .55) 70%, rgba(21, 17, 14, 0));
}
.voyage::after {
  content: ''; position: absolute; left: 0; right: -44px; bottom: 2px; height: 6px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='6'%3E%3Cpath d='M0 3Q11 -.5 22 3T44 3' fill='none' stroke='%23b9975b' stroke-opacity='.6'/%3E%3C/svg%3E") repeat-x;
  animation: swell 7s linear infinite;
}
@keyframes swell { to { transform: translateX(-44px); } }
.ship {
  position: absolute; bottom: 5px; left: calc(10px + var(--p) * (100% - 50px)); width: 29px; height: 22px;
  color: #dcc491; transition: left 1.7s cubic-bezier(.45, .05, .25, 1);
}
.ship svg { display: block; width: 100%; height: 100%; fill: currentColor; transform-origin: 50% 92%; animation: bob 4.6s ease-in-out infinite; }
.ship.back svg { animation: none; transform: scaleX(-1); }
@keyframes bob { 0%, 100% { transform: rotate(-4deg) translateY(0); } 50% { transform: rotate(4deg) translateY(1px); } }

/* ---------- шутовской колпак в конце листа ---------- */
.cap-orn { margin: 46px auto 0; width: 62px; color: var(--rubric); opacity: .9; }
.cap-orn svg { display: block; width: 100%; fill: currentColor; transform-origin: 50% 100%; }
.cap-orn.seen svg, .cap-orn.in svg { animation: jingle 1.8s cubic-bezier(.3, .6, .3, 1) .25s 1; }
.cap-orn:hover svg { animation: jingle2 1.2s ease-in-out 1; }
.cap-orn + .folio { margin-top: 12px; }
@keyframes jingle { 0% { transform: rotate(0); } 15% { transform: rotate(-11deg); } 35% { transform: rotate(8deg); } 55% { transform: rotate(-5deg); } 75% { transform: rotate(2.5deg); } 100% { transform: rotate(0); } }
@keyframes jingle2 { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 60% { transform: rotate(6deg); } 85% { transform: rotate(-2deg); } }

/* ---------- перелистывание ---------- */
html[data-out] body { pointer-events: none; }
html[data-in='next'] .spread { animation: in-next .8s cubic-bezier(.2, .7, .2, 1) both; }
html[data-in='prev'] .spread { animation: in-prev .8s cubic-bezier(.2, .7, .2, 1) both; }
html[data-in='board'] .spread { animation: in-board 1s cubic-bezier(.2, .7, .2, 1) both; }
html[data-out='next'] .spread { animation: out-next .3s cubic-bezier(.5, 0, .9, .5) forwards; }
html[data-out='prev'] .spread { animation: out-prev .3s cubic-bezier(.5, 0, .9, .5) forwards; }
html[data-out='open'] .spread, html[data-out='open'] .hero .title-leaf { animation: out-open .3s ease-in forwards; }
html[data-out='board'] .hero .title-leaf { transform-origin: 0 50%; animation: out-board .56s cubic-bezier(.55, 0, .85, .45) forwards; }
html[data-out] .pager, html[data-out] .about, html[data-out] #register, html[data-out] .foot, html[data-out] .wall { opacity: 0; transition: opacity .3s ease-in; }
@keyframes in-next { from { opacity: 0; transform: perspective(2400px) translateX(7%) rotateY(-10deg); } to { opacity: 1; transform: none; } }
@keyframes in-prev { from { opacity: 0; transform: perspective(2400px) translateX(-7%) rotateY(10deg); } to { opacity: 1; transform: none; } }
@keyframes in-board { from { opacity: 0; transform: translateY(30px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes out-next { to { opacity: 0; transform: perspective(2400px) translateX(-7%) rotateY(10deg); } }
@keyframes out-prev { to { opacity: 0; transform: perspective(2400px) translateX(7%) rotateY(-10deg); } }
@keyframes out-open { to { opacity: 0; transform: translateY(-12px) scale(.985); } }
@keyframes out-board { 40% { opacity: 1; } to { opacity: 0; transform: perspective(1700px) rotateY(-78deg); } }

/* ---------- прокрутка по листам и проявление ---------- */
html:has(.hero) { scroll-snap-type: y proximity; }
.hero, .about, #register { scroll-snap-align: start; }
.foot { scroll-snap-align: end; }
.about { scroll-margin-top: 90px; } #register { scroll-margin-top: 40px; }
.rv { opacity: 0; transform: translateY(24px); pointer-events: auto; transition: opacity .9s ease var(--d, 0s), transform .9s cubic-bezier(.2, .7, .2, 1) var(--d, 0s); }
.rv.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .ship, .ship svg, .voyage::after, .cap-orn svg { animation: none !important; transition: none !important; }
  html { scroll-snap-type: none; }
}

/* ---------- узкие экраны ---------- */
@media (max-width: 980px) {
  .spread { grid-template-columns: 1fr; margin-top: 18px; padding: 0 12px; }
  .page { min-height: 0; padding: 34px 26px 40px; }
  .verso { border-radius: 3px 3px 0 0; padding-bottom: 26px; }
  .recto { border-radius: 0 0 3px 3px; padding-top: 14px; }
  .verso::before, .recto::before { display: none; }
  .recto .runhead { display: none; }
  .verso-in { position: static; }
  .cut img { max-height: none; }
  .turn { display: none; }
  .text .v[data-n]::before { left: -3.4em; }
  .pager { padding: 0 16px; }
}
@media (max-width: 760px) {
  .bar { display: flex; flex-wrap: nowrap; justify-content: space-between; gap: 8px; padding: 8px 10px 6px; }
  .bar .home { display: none; }
  .bar .left { white-space: nowrap; font-size: 14px; }
  .bar .right { flex: 0 1 auto; flex-wrap: nowrap; gap: 6px; min-width: 0; }
  .switch button { padding: 4px 7px; font-size: 12.5px; letter-spacing: .04em; }
  .switch .yr, .lg { display: none; }
  .sh { display: inline; }
  html:not([data-lang='de']) .bar .idx .lg { display: inline; }
  .voyage { height: 18px; }
  .ship { width: 23px; height: 18px; }
}
@media (max-width: 560px) {
  body { font-size: 18px; }
  .page { padding: 28px 18px 36px; }
  .text.ru { font-size: 19px; } .text.de { font-size: 17.5px; }
  html[data-script='fraktur'] .text.de { font-size: 20px; }
  .text .v { margin-left: 1.3em; }
  .text .v[data-n]::before { left: -3.2em; font-size: 11px; }
  .motto { font-size: 20px; }
  .title-leaf { padding: 40px 22px 34px; }
  .register { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; padding: 0 12px; }
  .card { padding: 10px 10px 14px; } .card .t { font-size: 15.5px; } .card .o { font-size: 14px; }
  .about { font-size: 20px; }
}
