* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: #f4efe6;
  color: #161616;
  font-family: "Iowan Old Style", Palatino, Georgia, serif;
}

.scroll { height: 280vh; }

.stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #f4efe6;
}

.head {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  z-index: 12;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  padding: 0 20px;
  pointer-events: none;
}

@font-face {
  font-family: "Manrope";
  src: url("fonts/manrope-bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Cormorant";
  src: url("fonts/cormorant-garamond.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Cormorant Italic";
  src: url("fonts/cormorant-garamond-italic.ttf") format("truetype");
  font-weight: 500;
  font-style: italic;
  font-display: block;
}

@font-face {
  font-family: "Manrope Medium";
  src: url("fonts/manrope-medium.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "PT Serif";
  src: url("fonts/pt-serif.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Prata";
  src: url("fonts/prata.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Montserrat Black";
  src: url("fonts/montserrat-black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Playfair";
  src: url("fonts/playfair-black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Montserrat Black Italic";
  src: url("fonts/montserrat-black-italic.ttf") format("truetype");
  font-weight: 900;
  font-style: italic;
  font-display: block;
}

@font-face {
  font-family: "Comfortaa";
  src: url("fonts/comfortaa-bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Oswald";
  src: url("fonts/oswald-bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Noto Serif Display";
  src: url("fonts/noto-serif-display-black.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Manrope Light";
  src: url("fonts/manrope-light.ttf") format("truetype");
  font-weight: 300;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Lemon Milk Pro";
  src: url("fonts/lemon-milk-pro-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: block;
}

.skyall {
  position: relative;
  display: block;
  width: calc(100% + 40px);
  margin-left: -20px;
  margin-right: -20px;
  overflow: hidden;
  text-align: center;
}

.skyall::before {
  content: "";
  position: absolute;
  z-index: 0;
  left: -40px;
  right: -40px;
  top: -36px;
  height: 62%;
  background: url("sky.png?v=2") center / cover no-repeat;
  filter: blur(16px);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 46%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, #000 46%, transparent 100%);
}

.skyall::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(176, 214, 238, 0) 0%,
    rgba(168, 208, 234, 0.22) 28%,
    rgba(150, 198, 228, 0.2) 46%,
    rgba(244, 239, 230, 0.72) 78%,
    #f4efe6 100%
  );
}

.skyline,
.skyfade {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  margin: 0;
  overflow: visible;
  background: none;
  -webkit-mask-image: none;
  mask-image: none;
}

.skyline {
  padding: 0.7em 6% 0.55em;
}

.skyfade {
  padding: 8px 20px 26px;
}

.skyline::before,
.skyfade::before,
.skyfade::after {
  content: none;
}

.skyfade .sell,
.skyfade .quote {
  position: relative;
  z-index: 1;
}

.mark {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin: 0;
  white-space: nowrap;
  text-align: center;
  font-family: "Lemon Milk Pro", "Montserrat Black", sans-serif;
  font-weight: 700;
  font-style: normal;
  font-size: clamp(32px, 4.2vw, 54px);
  letter-spacing: 0;
  line-height: 1;
  color: #4eb6ea;
  background: none;
  -webkit-text-fill-color: #4eb6ea;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  filter: none;
  text-shadow: 0.035em 0.035em 0.09em rgba(0, 0, 0, 0.55);
}

.sell {
  margin: 2px auto 0;
  max-width: 920px;
  font-family: "Lemon Milk Pro", "Montserrat Black", sans-serif;
  font-size: clamp(17px, 2.05vw, 24px);
  font-weight: 700;
  letter-spacing: 0.07em;
  line-height: 1.25;
  text-transform: uppercase;
  color: #2f93cf;
  -webkit-text-fill-color: #2f93cf;
  -webkit-text-stroke: 1px #163044;
  paint-order: stroke fill;
  text-shadow:
    0 0 1px rgba(255, 255, 255, 0.95),
    0 1px 0 rgba(255, 255, 255, 0.85);
}

.quote {
  margin: 10px auto 0;
  width: min(460px, calc(100% - 32px));
  padding: 7px 14px 6px;
  background-color: #f7f1e6;
  background-image: repeating-linear-gradient(
    180deg,
    transparent,
    transparent 15px,
    rgba(110, 82, 54, 0.13) 16px
  );
  border: 1px solid rgba(78, 54, 34, 0.18);
  box-shadow: 0 4px 12px rgba(62, 42, 24, 0.05);
  text-align: center;
}

.quote p,
.quote cite {
  font-family: "Manrope Light", "Manrope Medium", sans-serif;
  font-weight: 300;
  color: #145a86;
  text-shadow: none;
}

.quote p {
  margin: 0;
  font-size: 13px;
  line-height: 16px;
}

.quote cite {
  display: block;
  margin-top: 2px;
  font-style: normal;
  font-size: 11px;
  letter-spacing: 0.02em;
  line-height: 16px;
}

.crowd {
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: 4;
  transform-origin: center top;
}

.person {
  position: absolute;
  bottom: var(--b);
  left: var(--x);
  height: var(--h);
  width: calc(var(--h) * 0.58);
  z-index: var(--z);
  margin: 0;
  transform: translateX(-50%);
  isolation: isolate;
}

.spin {
  width: 100%;
  height: 100%;
  position: relative;
}

.face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  transform-origin: center center;
}

.hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 16px;
  margin: 0;
  text-align: center;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: #5e5b56;
  z-index: 20;
  transition: opacity 0.4s ease;
}

.hint.gone { opacity: 0; }

.bible {
  position: absolute;
  z-index: 22;
  display: block;
  width: 290px;
  text-decoration: none;
  color: #3a2714;
  cursor: pointer;
  filter: drop-shadow(0 10px 8px rgba(42, 24, 10, 0.18));
}

.bible img {
  display: block;
  width: 100%;
  height: auto;
}

.bible-words {
  position: absolute;
  z-index: 3;
  inset: 0;
  pointer-events: none;
  font-family: "Cormorant Italic", Georgia, serif;
  font-style: italic;
  font-size: 1.2em;
  font-weight: 700;
  font-synthesis: weight;
  line-height: 1;
  color: #2a1c10;
  -webkit-text-stroke: 1.15px #2a1c10;
  paint-order: stroke fill;
}

.bible-words span {
  position: absolute;
  top: 47%;
  transform: translate(-50%, -50%);
  text-align: center;
  white-space: nowrap;
  text-shadow:
    0 0 8px #f3e6d0,
    0 0 4px #f3e6d0,
    0 0 2px #f3e6d0;
}

.bible-words span:first-child {
  left: 29%;
}

.bible-words span:last-child {
  left: 61%;
}

.bible:hover .bible-words {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.04em;
}

.bible:hover .bible-words span {
  position: relative;
  left: auto;
  top: auto;
  z-index: 4;
  transform: none;
  font-size: 2em;
  color: #2a1c10;
  -webkit-text-fill-color: #2a1c10;
  -webkit-text-stroke: 2.3px #2a1c10;
  background: none;
  animation: verse-glow 1.1s ease-in-out infinite;
}

.bible:hover .bible-words span::before,
.bible:hover .bible-words span::after {
  position: absolute;
  font-style: normal;
  font-size: 0.22em;
  line-height: 1;
  color: #d4af37;
  -webkit-text-fill-color: #d4af37;
  -webkit-text-stroke: 0.7px #1a120c;
  paint-order: stroke fill;
  text-shadow:
    0 0 5px #d4af37,
    0 0 10px #b8860b;
  animation: verse-spark 0.7s ease-in-out infinite;
  pointer-events: none;
}

.bible:hover .bible-words span::before {
  content: "✦";
  left: -0.05em;
  top: -0.72em;
}

.bible:hover .bible-words span::after {
  content: "✦";
  right: -0.15em;
  bottom: -0.62em;
  animation-delay: 0.32s;
}

@keyframes verse-glow {
  0%, 100% {
    text-shadow:
      0 0 8px #f3e6d0,
      0 0 12px rgba(255, 214, 120, 0.35);
  }
  50% {
    text-shadow:
      0 0 8px #fff,
      0 0 16px #ffe08a,
      0 0 28px #ffb703;
  }
}

@keyframes verse-spark {
  0%, 100% { opacity: 0.15; transform: scale(0.6); }
  50% { opacity: 1; transform: scale(1.15); }
}

.bible-tap {
  position: absolute;
  left: 50%;
  top: calc(100% + 4px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  color: #3a2714;
  font-family: "Manrope", "Segoe UI", sans-serif;
  font-weight: 700;
  font-size: 22px;
  font-style: normal;
  line-height: 1;
  letter-spacing: 0.14em;
  pointer-events: none;
}

.bible-tap-arrow {
  display: block;
  width: 36px;
  height: 26px;
  overflow: visible;
}

.bible-tap-arrow path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bible:hover {
  transform: translateY(-4px);
}

.bible:focus-visible {
  outline: 2px solid #4eb6ea;
  outline-offset: 4px;
}

.side-actions {
  position: absolute;
  z-index: 24;
  left: 18px;
  top: 52%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(188px, 28vw);
  pointer-events: auto;
}

.side-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 10px 14px;
  text-align: center;
  text-decoration: none;
  font-family: "Lemon Milk Pro", "Montserrat Black", sans-serif;
  font-size: clamp(15px, 1.55vw, 18px);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: #4eb6ea;
  background: #f7f1e6;
  border: 1px solid rgba(78, 54, 34, 0.2);
  box-shadow:
    0 4px 12px rgba(62, 42, 24, 0.08),
    0.035em 0.035em 0.09em rgba(0, 0, 0, 0.12);
  text-shadow: 0.035em 0.035em 0.09em rgba(0, 0, 0, 0.28);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.side-btn-soft {
  color: #3a2714;
  text-shadow: none;
  font-family: "Manrope", "Manrope Medium", sans-serif;
  letter-spacing: 0.02em;
}

.side-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(62, 42, 24, 0.12);
}

.side-btn:focus-visible {
  outline: 2px solid #4eb6ea;
  outline-offset: 3px;
}

/* Планшет */
@media (max-width: 1100px) and (min-width: 760px) {
  .head { padding: 0 16px; top: 8px; }
  .skyfade { padding: 6px 16px 18px; }
  .quote { width: min(420px, calc(100% - 28px)); }
  .quote p { font-size: 14px; line-height: 18px; }
  .side-actions {
    left: 14px;
    width: min(168px, 24vw);
  }
  .bible-tap { font-size: 18px; }
  .hint { bottom: 12px; font-size: 13px; }
}

/* Телефон */
@media (max-width: 759px) {
  /* Важно: НЕ ставить overflow на html/body — ломает position:sticky и поворот */

  /* Выше страница — есть куда листать, фигуры успевают повернуться */
  .scroll { height: 320vh; }

  .stage {
    overflow: hidden;
    touch-action: pan-y;
  }

  .head {
    top: 4px;
    padding: 0 10px;
  }

  .skyline {
    padding: 0.4em 4% 0.28em;
  }

  .skyfade {
    padding: 2px 10px 6px;
  }

  .mark {
    white-space: normal;
    font-size: clamp(26px, 8.2vw, 38px);
    line-height: 1.05;
  }

  .sell {
    font-size: clamp(12px, 3.4vw, 16px);
    letter-spacing: 0.04em;
    line-height: 1.25;
  }

  /* Цитату на телефоне прячем — отдаём высоту фигурам */
  .quote {
    display: none;
  }

  .crowd {
    /* Не обрезать фигуры внутри сцены — масштаб считает JS под ширину */
    max-width: none;
  }

  .side-actions {
    left: 10px;
    right: auto;
    top: auto;
    bottom: max(52px, env(safe-area-inset-bottom, 0px) + 44px);
    transform: none;
    width: min(138px, 40vw);
    gap: 7px;
    z-index: 24;
  }

  .side-btn {
    min-height: 44px;
    padding: 9px 10px;
    font-size: 13px;
  }

  .hint {
    left: 10px;
    right: auto;
    bottom: max(10px, env(safe-area-inset-bottom, 0px) + 6px);
    font-size: 12px;
    padding: 0;
    max-width: 42%;
    text-align: left;
    z-index: 23;
  }

  .bible-tap {
    font-size: 14px;
    letter-spacing: 0.08em;
  }

  .bible-tap-arrow {
    width: 24px;
    height: 16px;
  }

  #bible {
    z-index: 22;
  }

  /* На телефоне hover-эффекты Библии не нужны — мешают тапу */
  .bible:hover {
    transform: none;
  }
}

/* Узкий телефон */
@media (max-width: 400px) {
  .side-actions {
    width: min(128px, 46vw);
    bottom: max(50px, env(safe-area-inset-bottom, 0px) + 42px);
  }

  .side-btn {
    min-height: 42px;
    font-size: 12px;
    padding: 8px 8px;
  }

  .sell {
    font-size: 12px;
  }
}

/* Телефон лёжа */
@media (max-height: 480px) and (orientation: landscape) {
  .scroll { height: 260vh; }
  .skyfade { padding: 2px 12px 8px; }
  .quote { display: none; }
  .side-actions {
    top: 50%;
    bottom: auto;
    transform: translateY(-50%);
  }
  .hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .spin { transition: none; }
  .mark { animation: none; }
  .bible:hover .bible-words span,
  .bible:hover .bible-words span::before,
  .bible:hover .bible-words span::after { animation: none; }
}
