:root {
  --ink: #2a1c14;
  --ink-soft: #5a4536;
  --paper: #f6edd8;
  --gold: #c49a4a;
  --gold-2: #e0b86a;
  --honey: #b56a2c;
  --cream: #fbf6ec;
  --sky: #8ec8ee;
  --sky-2: #c5e6f8;
  --serif: "Cormorant Garamond", Palatino, serif;
  --body: "Source Serif 4", Georgia, serif;
  --caps: "Cormorant Garamond", Palatino, serif;
  --ui: "Fredoka", "Nunito", "Trebuchet MS", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #14100e;
}

body {
  overflow: hidden;
  min-height: 100dvh;
  font-family: var(--body);
}

.stage {
  height: 100dvh;
  display: grid;
  grid-template-rows: 60px minmax(0, 1fr) 36px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(78, 48, 28, 0.92) 0%, transparent 44%),
    radial-gradient(ellipse at 50% 40%, #2a1c18 0%, #120e0c 70%);
}

.topbar,
.bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-family: var(--ui);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--sky);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.topbar-brand img {
  width: 52px;
  height: 52px;
  display: block;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  border: 1px solid var(--sky);
}

.topbar-brand span {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.stage-main {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  min-height: 0;
  padding: 4px 40px;
  position: relative;
}

.nav-btn {
  appearance: none;
  border: 1px solid var(--sky);
  background: rgba(20, 14, 12, 0.55);
  color: var(--sky-2);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  font-family: var(--ui);
  flex-shrink: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
}
#prev { left: 16px; }
#next { right: 16px; }

.nav-btn:hover { background: #3a7aa8; color: #f4fbff; border-color: #3a7aa8; }
.nav-btn:disabled { opacity: 0.22; pointer-events: none; }

.book-wrap {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.book-glow {
  position: absolute;
  inset: 6% -4%;
  background: radial-gradient(ellipse at 50% 55%, rgba(196, 140, 64, 0.28), transparent 68%);
  pointer-events: none;
  z-index: 0;
}

.book-thickness {
  position: absolute;
  top: 0;
  right: -10px;
  width: 11px;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  border-radius: 0 3px 3px 0;
  background: repeating-linear-gradient(
    90deg,
    #efe3c4 0 1px,
    #c4ae7a 1px 2px,
    #8d7350 2px 3px
  );
  box-shadow: 3px 10px 18px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.book-wrap.is-spread .book-thickness,
.book-wrap.is-cover .book-thickness { opacity: 1; }
.book-wrap.is-cover .book-thickness { right: 0; }
.book-wrap.is-back .book-thickness {
  opacity: 1;
  right: auto;
  left: -10px;
  border-radius: 3px 0 0 3px;
}
.book-wrap.is-flipping .book-thickness,
.book-wrap.is-portrait .book-thickness { opacity: 0; }

#book { width: 100%; height: 100%; }
#book:not(.stf__parent) { opacity: 0; }

.page {
  height: 100%;
  overflow: hidden;
  position: relative;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("img/paper.jpg");
  background-size: 280px;
  user-select: none;
  -webkit-user-select: none;
}

.page a { user-select: auto; -webkit-user-select: auto; }

.page--paper::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(176, 122, 46, 0.25);
  pointer-events: none;
  z-index: 2;
}

.page.page--dark,
.stf__item:has(.page--dark) {
  color: var(--cream);
  background-color: #1a120e;
  background-image: radial-gradient(ellipse at 50% 42%, #2c1c16 0%, #120e0c 72%);
}

.page--photo {
  background-color: #1a100c;
  background-image: none;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.page--photo[data-shot="portret"] { background-image: url("img/portret.jpg"); }
.page--photo[data-shot="okladka"] { background-image: url("img/okladka.jpg"); }
.page--photo[data-shot="tyl"] { background-image: url("img/tyl.jpg"); }
.page--photo[data-shot="wstep"] { background-image: url("img/wstep.jpg"); }
.page--photo[data-shot="kosmos"] { background-image: url("img/kosmos.jpg"); }
.page--photo[data-shot="kosmos-2"] { background-image: url("img/kosmos-2.jpg"); }
.page--photo[data-shot="didzejka"] { background-image: url("img/didzejka.jpg"); }
.page--photo[data-shot="didzejka-2"] { background-image: url("img/didzejka-2.jpg"); }
.page--photo[data-shot="wyscigi"] { background-image: url("img/wyscigi.jpg"); }
.page--photo[data-shot="wyscigi-2"] { background-image: url("img/wyscigi-2.jpg"); }
.page--photo[data-shot="planeta"] { background-image: url("img/planeta.jpg"); }
.page--photo[data-shot="planeta-2"] { background-image: url("img/planeta-2.jpg"); }
.page--photo[data-shot="myszka"] { background-image: url("img/myszka.jpg"); }
.page--photo[data-shot="myszka-2"] { background-image: url("img/myszka-2.jpg"); }
.page--photo[data-shot="zakochana"] { background-image: url("img/zakochana.jpg"); }
.page--photo[data-shot="zakochana-2"] { background-image: url("img/zakochana-2.jpg"); }
.page--photo[data-shot="przyjaciele"] { background-image: url("img/przyjaciele.jpg"); }
.page--photo[data-shot="przyjaciele-2"] { background-image: url("img/przyjaciele-2.jpg"); }
.page--photo[data-shot="swiat"] { background-image: url("img/swiat.jpeg"); }
.page--photo[data-shot="swiat-2"] { background-image: url("img/swiat-2.jpg"); }
.page--photo[data-shot="pustynia"] { background-image: url("img/pustynia.jpg"); }
.page--photo[data-shot="pustynia-2"] { background-image: url("img/pustynia-2.jpg"); }

.inner {
  height: 100%;
  padding: 34px 38px 36px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

.photo-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.photo-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.shot-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 56px 28px 24px;
  background: linear-gradient(
    to top,
    rgba(8, 4, 2, 0.72) 0%,
    rgba(8, 4, 2, 0.22) 55%,
    transparent 100%
  );
  color: #fbf6ec;
  pointer-events: none;
}

.shot-name span { display: none; }

.shot-name strong {
  display: block;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 40px;
  line-height: 0.92;
}

.cover-over {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 90px 28px 30px;
  background: linear-gradient(
    to top,
    rgba(12, 6, 4, 0.9) 0%,
    rgba(12, 6, 4, 0.4) 55%,
    transparent 100%
  );
  text-align: center;
  color: #fbf6ec;
  pointer-events: none;
}

.cover-over .kicker {
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--gold-2);
}

.cover-over h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  font-size: 46px;
  line-height: 0.92;
  margin: 8px 0 4px;
  color: #fbf6ec;
}

.cover-over .sub {
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: #f3e6c8;
}

.quote-over {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 36px 32px 44px;
  background: linear-gradient(
    to top,
    rgba(8, 3, 5, 0.88) 0%,
    rgba(8, 3, 5, 0.35) 42%,
    rgba(8, 3, 5, 0.08) 70%,
    transparent 100%
  );
  color: var(--cream);
}

.quote-over blockquote {
  font-family: var(--serif);
  font-style: italic;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 500;
  max-width: 14ch;
  color: #fbf6ec;
}

.quote-over .whisper {
  margin-top: 10px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--gold-2);
}

.quote-over .after {
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.45;
  color: rgba(251, 246, 236, 0.86);
  max-width: 32ch;
}

.spine-cap {
  display: none;
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  font-family: var(--ui);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-2);
  white-space: nowrap;
  z-index: 2;
  text-shadow: 0 1px 6px #000;
}

.running {
  display: flex;
  justify-content: space-between;
  font-family: var(--caps);
  font-size: 11px;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold);
  flex-shrink: 0;
}

h2.display {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  line-height: 0.96;
  margin: 12px 0 8px;
  flex-shrink: 0;
}

h2.display em { font-style: italic; color: var(--honey); }

.byline {
  font-family: var(--ui);
  font-size: 14px;
  font-weight: 500;
  color: var(--honey);
  margin: 0 0 2px;
  flex-shrink: 0;
}

.gold-rule {
  width: 42px;
  height: 1px;
  background: var(--gold);
  border: 0;
  margin: 8px 0 12px;
  flex-shrink: 0;
}

.story {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-soft);
  flex: 1;
  min-height: 0;
  overflow: hidden;
  hyphens: auto;
  -webkit-hyphens: auto;
}

.story p { margin-bottom: 0.62em; }
.story p:last-child { margin-bottom: 0; }

.story--cont { margin-top: 6px; }

.story--tight {
  font-size: 14.4px;
  line-height: 1.42;
}

.lede {
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.lede + .lede { margin-top: 10px; }

.note {
  margin-top: auto;
  padding-top: 12px;
  font-size: 12px;
  line-height: 1.4;
  font-style: italic;
  color: var(--honey);
}

.index {
  list-style: none;
  flex: 1;
  margin-top: 4px;
}

.index li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid rgba(176, 122, 46, 0.3);
}

.index a {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: baseline;
  width: 100%;
  text-decoration: none;
  color: inherit;
  grid-column: 1 / -1;
}

.index .nm {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 500;
}

.index a:hover .nm { color: var(--honey); }

.index .dots {
  border-bottom: 1px dotted rgba(181, 106, 44, 0.4);
  height: 0.7em;
}

.index .pg {
  font-family: var(--caps);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--honey);
}

.foot {
  margin-top: auto;
  padding-top: 10px;
  font-family: var(--caps);
  font-size: 10px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  flex-shrink: 0;
}

.ornament {
  width: 120px;
  height: 16px;
  margin: 8px auto;
}

.back {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 40px;
  position: relative;
  z-index: 1;
}

.back img {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 18%;
  margin-bottom: 16px;
  border: 1px solid var(--gold);
}

.back h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  font-size: 28px;
  color: #fbf6ec;
}

.back .it {
  font-family: var(--serif);
  font-style: italic;
  color: var(--gold-2);
  margin: 6px 0 16px;
  font-size: 16px;
}

.back p {
  font-size: 14px;
  line-height: 1.55;
  color: rgba(251, 246, 236, 0.84);
}

.back .buon {
  margin-top: 22px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 20px;
  color: var(--gold-2);
  max-width: 22ch;
}

.back-over {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  padding: 72px 28px 32px;
  background: linear-gradient(
    to top,
    rgba(12, 6, 4, 0.88) 0%,
    rgba(12, 6, 4, 0.35) 55%,
    transparent 100%
  );
  text-align: center;
  color: #fbf6ec;
  pointer-events: none;
}

.back-over .kicker {
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  color: var(--gold-2);
}

.back-over h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  font-size: 26px;
  margin: 6px 0 4px;
  color: #fbf6ec;
}

.back-over .buon {
  margin-top: 10px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--gold-2);
  max-width: 24ch;
  margin-left: auto;
  margin-right: auto;
}

.stf__item { background-color: var(--paper); }

.stf__parent {
  margin: 0 auto;
  background: transparent;
  overflow: visible;
  z-index: 2;
}

.stf__parent::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow:
    0 0 0 1px rgba(196, 154, 74, 0.18),
    0 28px 60px rgba(0, 0, 0, 0.55),
    0 10px 22px rgba(0, 0, 0, 0.38);
  pointer-events: none;
  z-index: -1;
}

.book-wrap.is-cover .stf__parent::after { left: 50%; }

.book-wrap.is-back .stf__parent::after {
  right: 50%;
  left: 0;
  width: 50%;
}

.book-wrap.is-spread:not(.is-flipping) .stf__parent::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 40px;
  transform: translateX(-50%);
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.18) 40%,
    rgba(0, 0, 0, 0.42) 50%,
    rgba(0, 0, 0, 0.18) 60%,
    rgba(0, 0, 0, 0) 100%
  );
  pointer-events: none;
  z-index: 4;
}

.stf__item.--left .page--paper::after,
.stf__item.--right .page--paper::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.stf__item.--left .page--paper::after {
  background: linear-gradient(90deg, rgba(255, 244, 220, 0.08), transparent 22%, rgba(0, 0, 0, 0.16) 100%);
}

.stf__item.--right .page--paper::after {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.18), transparent 28%, rgba(255, 244, 220, 0.06) 100%);
}

@media (max-width: 1100px) {
  .nav-btn { display: none; }
  .stage-main { padding: 0 12px; }
}

@media (max-width: 820px) {
  .stage { grid-template-rows: 54px minmax(0, 1fr) 34px; }
  .topbar-brand img { width: 42px; height: 42px; }
  .topbar > span:last-child { display: none; }
  .stage-main { padding: 0 8px; }
  .cover-over h1 { font-size: 36px; }
  .shot-name strong { font-size: 32px; }
  h2.display { font-size: 26px; }
  .inner { padding: 28px 26px 28px; }
  .story { font-size: 14.2px; }
  .bottombar {
    font-size: 12px;
    letter-spacing: 0.02em;
    padding: 0 12px;
    justify-content: center;
    gap: 20px;
  }
  .bottombar span:last-child { display: none; }
}
