/* Скролл-шоу главной «превращение картины в кованый знак» (стилистика
   утверждена владельцем 2026-08-21, эталон design-probes/20-shpakovgrad.html).
   Файл подключается ТОЛЬКО на index.html после shpakovgrad.css и переопределяет
   его правила для главной; остальные страницы не затронуты.
   Темп шоу задаёт «Панель темпа» в админке (data/design-tempo.json). */

::selection { background: var(--clan-gold); color: var(--clan-black); }
:focus-visible { outline: 2px solid var(--clan-gold); outline-offset: 2px; }

/* ── Шапка: прозрачная над картиной, плотная после погружения ── */
#site-header { position: fixed; inset: 0 0 auto; }
#site-header .site-header { border-bottom-color: transparent; background: transparent; backdrop-filter: none;
  transition: background .4s ease, border-color .4s ease, backdrop-filter .4s ease; }
#site-header .site-header.solid { border-bottom-color: var(--line);
  background: color-mix(in srgb, var(--clan-black) 88%, transparent); backdrop-filter: blur(16px); }
/* Выпадающая мобильная навигация должна остаться читаемой и над картиной. */
#site-header .main-nav.open { background: var(--clan-charcoal); }

/* ── Нить глав ── */
.thread { position: fixed; right: 26px; top: 50%; transform: translateY(-50%); z-index: 40; height: 44vh;
  display: flex; flex-direction: column; align-items: center; }
.thread .track { position: relative; flex: 1; width: 1px; background: color-mix(in srgb, var(--clan-bronze) 40%, transparent); }
.thread .fill { position: absolute; inset: 0; background: linear-gradient(var(--clan-gold), var(--clan-bronze));
  transform-origin: 50% 0; transform: scaleY(0); }
.thread .tick { position: absolute; left: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; }
.thread .tick i { width: 5px; height: 5px; border-radius: 50%; background: var(--clan-bronze); display: block;
  transition: background .3s, box-shadow .3s; }
.thread .tick span { position: absolute; right: 14px; color: var(--muted); font-size: 10px; letter-spacing: .14em;
  text-transform: uppercase; white-space: nowrap; opacity: 0; transition: opacity .3s; pointer-events: none; }
.thread .tick.on i { background: var(--clan-gold); box-shadow: 0 0 8px color-mix(in srgb, var(--clan-gold) 60%, transparent); }
.thread .tick.on span { opacity: 1; color: var(--clan-gold); }

/* ── Мир: река золота течёт под всей страницей ── */
.world { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.world canvas { width: 100%; height: 100%; display: block; }
.world::after { content: ""; position: absolute; inset: 0;
  background: radial-gradient(130% 100% at 50% 42%, transparent 45%, rgba(13, 13, 15, .72) 100%); }
body > main { position: relative; z-index: 1; }
.site-footer { position: relative; z-index: 2; }

/* Номер главы — гигантская цифра летописи в глубине листа */
.chapnum { position: absolute; right: 2%; top: 50%; z-index: 0; pointer-events: none;
  font-family: "Yeseva One", Georgia, serif; font-size: min(58vh, 660px); line-height: 1;
  color: rgba(212, 175, 55, .06); -webkit-text-stroke: 1.5px rgba(212, 175, 55, .2);
  transform: translateY(-50%); will-change: transform; }
/* Тёплое дыхание света в глубине каждого листа */
.sw:not(#s-hero) .st::before { content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(58% 52% at 30% 44%, rgba(212, 175, 55, .085), rgba(212, 175, 55, .02) 55%, transparent 74%);
  animation: home-ambient 12s ease-in-out infinite alternate; }
@keyframes home-ambient { from { opacity: .65; transform: translateY(1.5%); } to { opacity: 1; transform: translateY(-1.5%); } }
.scene-in { position: relative; z-index: 1; }

/* ── Сцены ── */
.sw { position: relative; }
.sw .st { position: sticky; top: 0; height: 100svh; overflow: hidden; }
/* Пин снимается автоматом (home-show.js), когда контент главы выше экрана:
   глава скроллится обычным потоком, превращения играют по её проходу. */
.sw.no-pin .st { position: static; height: auto; overflow: visible; }
/* В no-pin-режиме (мобайл) экраны глав перестают клипать, и слои шоу (печать,
   номер главы, шахта) давали документу лишние ~4px вбок. clip не создаёт
   скролл-контейнер — вертикальная прокрутка и sticky не задеты. */
html { overflow-x: clip; }
.sw.no-pin .scene-in { height: auto; padding-bottom: 56px; }

/* Главы I–II: кабинет → кованый знак */
#s-hero .st { border-bottom: 1px solid var(--line); }
.camera { position: absolute; inset: 0; transform-origin: 62% 58%; will-change: transform; }
.camera .art { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: center; }
#pcanvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.paintfx { position: absolute; inset: 0; pointer-events: none; }
.flame { position: absolute; width: 26vmax; height: 26vmax; border-radius: 50%; pointer-events: none;
  mix-blend-mode: screen; filter: blur(6px);
  background: radial-gradient(circle, rgba(255, 186, 92, .34) 0%, rgba(255, 150, 50, .10) 38%, transparent 68%); }
.flame.f1 { left: 31%; top: 40%; translate: -50% -50%; animation: home-flick 3.7s ease-in-out infinite; }
.flame.f2 { left: 67%; top: 48%; translate: -50% -50%; width: 20vmax; height: 20vmax; animation: home-flick 2.9s ease-in-out .6s infinite; }
.flame.f3 { left: 46%; top: 6%; translate: -50% -50%; width: 16vmax; height: 16vmax; opacity: .7; animation: home-flick 4.6s ease-in-out 1.2s infinite; }
@keyframes home-flick {
  0%, 100% { opacity: .55; transform: scale(1); }
  23% { opacity: .85; transform: scale(1.06) translate(4px, -3px); }
  41% { opacity: .62; transform: scale(.97); }
  67% { opacity: .9; transform: scale(1.09) translate(-3px, 2px); }
  82% { opacity: .7; transform: scale(1.02); }
}
.shaft { position: absolute; right: -12%; top: -18%; width: 70%; height: 130%; pointer-events: none;
  mix-blend-mode: screen; opacity: .5; transform: rotate(14deg); transform-origin: 100% 0;
  background: linear-gradient(100deg, transparent 30%, rgba(233, 196, 120, .12) 52%, rgba(233, 196, 120, .03) 66%, transparent 78%);
  animation: home-shaft 9s ease-in-out infinite; }
@keyframes home-shaft { 0%, 100% { opacity: .38; } 50% { opacity: .6; } }
.dust { position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; }
.veil { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(13, 13, 15, .42) 0%, rgba(13, 13, 15, .05) 26%, rgba(13, 13, 15, .02) 55%, rgba(13, 13, 15, .72) 88%, var(--clan-black) 100%); }
.signglow { position: absolute; left: 50%; top: 44%; width: min(92vw, 1440px); height: 56svh;
  transform: translate(-50%, -50%); pointer-events: none; opacity: 0;
  background: radial-gradient(50% 50% at 50% 50%, rgba(212, 175, 55, .15), rgba(212, 175, 55, .045) 55%, transparent 76%); }
.dots { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background-image: radial-gradient(circle, rgba(194, 181, 155, .4) 1px, transparent 1.4px);
  background-size: 54px 54px; animation: home-dotdrift 90s linear infinite; }
@keyframes home-dotdrift { to { background-position: 540px 324px; } }

/* HUD сцены */
.hud { position: absolute; right: 24px; top: 86px; z-index: 5; max-width: 220px; text-align: right;
  color: var(--muted); font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; line-height: 1.8; pointer-events: none; }
.hud b { color: var(--clan-gold); font-weight: 600; }

/* Выноски фрагментов картины */
.ann { position: absolute; z-index: 5; pointer-events: none; opacity: 0; }
.ann .dot { position: absolute; left: 0; top: 50%; width: 5px; height: 5px; border-radius: 50%; background: var(--clan-gold);
  transform: translate(-50%, -50%); }
.ann .ln { position: absolute; left: 0; top: 50%; height: 1px; background: linear-gradient(90deg, var(--clan-gold), rgba(212, 175, 55, .25));
  transform-origin: 0 50%; width: 110px; }
.ann .lb { position: absolute; left: 118px; top: 50%; transform: translate(0, -50%); white-space: nowrap;
  color: var(--clan-gold); font-size: 10.5px; letter-spacing: .13em; text-transform: uppercase;
  text-shadow: 0 1px 8px rgba(0, 0, 0, .9); will-change: transform, opacity; }
.ann.flip .ln { transform-origin: 100% 50%; left: auto; right: 0; }
.ann.flip .dot { left: auto; right: 0; transform: translate(50%, -50%); }
.ann.flip .lb { left: auto; right: 118px; }

/* Контент героя: прижат к низу сцены, уходит вверх при погружении */
#s-hero .hero-content { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  width: min(1180px, 100%); margin: 0 auto; padding: 0 24px 11svh; will-change: transform, opacity; }
#s-hero .hero-content h1 { max-width: 900px; margin: 0; font-family: "Yeseva One", Georgia, serif;
  font-size: clamp(48px, 9vw, 116px); line-height: .94; text-transform: uppercase;
  color: var(--clan-sand); text-shadow: 0 3px 18px var(--clan-black); }
#s-hero .motto { margin: 14px 0 30px; color: var(--clan-gold); font-size: clamp(17px, 2vw, 24px); }
.hero-search .control { min-height: 52px; background: color-mix(in srgb, var(--clan-black) 82%, transparent); backdrop-filter: blur(6px); }
.hero-links .button { background: color-mix(in srgb, var(--clan-charcoal) 72%, transparent); backdrop-filter: blur(6px); }
.scroll-hint { position: absolute; left: 50%; bottom: 3.5svh; translate: -50%; z-index: 6; color: var(--muted);
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase; display: flex; flex-direction: column;
  align-items: center; gap: 7px; }
.scroll-hint::after { content: ""; width: 1px; height: 26px;
  background: linear-gradient(var(--clan-gold), transparent); animation: home-drop 2.2s ease-in-out infinite; }
@keyframes home-drop { 0% { transform: scaleY(0); transform-origin: top; } 45% { transform: scaleY(1); transform-origin: top; }
  55% { transform: scaleY(1); transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

/* Главы III–IV: общий лист сцены (плотный — глава делит экран между блоками) */
.scene-in { width: min(1320px, 100%); margin: 0 auto; padding: clamp(84px, 10vh, 140px) 24px 40px; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-start; }
.sh { margin: 0 0 5px; color: var(--clan-gold); font-size: 12px; letter-spacing: .14em; text-transform: uppercase; }
.scene-in h2 { margin: 0 0 7px; font-family: "Yeseva One", Georgia, serif; font-size: clamp(24px, 2.6vw, 34px);
  color: color-mix(in srgb, var(--clan-sand) 94%, white); }
.scene-in .sub { margin: 0; color: var(--muted); max-width: 56ch; }

/* Летопись — горизонтальная лента чисел: глава делит экран с рецептами */
.ledger { margin-top: 28px; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0 34px; border-top: 1px solid var(--line); }
.led { padding: 16px 0 0; will-change: transform, opacity; }
.led b { display: block; font-family: "Yeseva One", Georgia, serif; font-size: clamp(36px, 4.2vw, 60px);
  line-height: 1; color: var(--clan-gold); font-variant-numeric: tabular-nums; }
.led span { display: block; margin-top: 6px; color: var(--muted); font-size: clamp(12.5px, 1.05vw, 14.5px);
  line-height: 1.4; max-width: 30ch; }
.led .ledline { display: block; height: 1px; margin-top: 12px; background: var(--clan-gold);
  transform-origin: 0 50%; transform: scaleX(0); }

/* Внутренний заголовок блока внутри главы (рецепты, «О проекте») */
.sh2 { margin: 0 0 4px; color: var(--clan-gold); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.latest-head { margin: 30px 0 0; will-change: transform, opacity; }
.latest-head h3 { margin: 0; font-family: "Yeseva One", Georgia, serif; font-size: clamp(20px, 2vw, 27px);
  color: color-mix(in srgb, var(--clan-sand) 94%, white); }

/* Рецепты: карточки движка на выделке эталона — формула круглыми медальонами.
   Компактнее каталога: глава делит экран с летописью, ряд из четырёх карточек. */
#latest-recipes { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); margin-top: 14px; }
#latest-recipes .recipe-card h3 { margin: 10px 0 4px; font-size: 16px; }
#latest-recipes .recipe-card .effect { display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 2; overflow: hidden; min-height: 0; margin-bottom: 10px; }
#latest-recipes .recipe-card-actions .button { min-height: 33px; }
#latest-recipes .recipe-card { position: relative; will-change: transform, opacity;
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); }
#latest-recipes .recipe-card::after { content: ""; position: absolute; inset: 0; border-radius: 8px; pointer-events: none;
  opacity: 0; transition: opacity .3s; mix-blend-mode: screen;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(233, 196, 120, .14), transparent 65%); }
#latest-recipes .recipe-card:hover::after { opacity: 1; }
#latest-recipes .recipe-card:hover { border-color: color-mix(in srgb, var(--clan-gold) 55%, var(--line)); }
#latest-recipes .recipe-formula { overflow: visible; flex-wrap: wrap; gap: 6px; padding: 6px 0; }
#latest-recipes .formula-item { flex: 0 0 auto; width: 54px; min-width: 54px; height: 54px; border-radius: 50%;
  border-color: color-mix(in srgb, var(--clan-bronze) 80%, transparent);
  background: radial-gradient(120% 120% at 30% 22%, #3a3325 0%, #241f16 52%, #15120c 100%);
  box-shadow: inset 0 1px rgba(233, 196, 120, .28), inset 0 -6px 12px rgba(0, 0, 0, .55), 0 4px 10px rgba(0, 0, 0, .5);
  will-change: transform, opacity; }
#latest-recipes .formula-item img { width: 40px; height: 40px; filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .6)); }
#latest-recipes .formula-item.result { border-color: var(--clan-gold); }
#latest-recipes .formula-op { will-change: opacity; }
#latest-recipes .grade-badge { left: -3px; bottom: -5px; }
#latest-recipes .stars-badge { top: -6px; right: -6px; }
#s-chronicle .load-more { padding: 0; margin-top: 18px; will-change: opacity, transform; }

/* Союз */
#home-alliance { margin: 38px 0 0; position: relative; overflow: hidden; }
#home-alliance::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: var(--gl, 0);
  background: radial-gradient(52% 90% at 26% 50%, color-mix(in srgb, var(--clan-gold) 12%, transparent), transparent 70%); }
#home-alliance .alliance-logos img { filter: grayscale(1) brightness(.45) drop-shadow(0 6px 14px rgba(0, 0, 0, .45));
  will-change: filter, transform; }
#home-alliance .alliance-text .l { will-change: opacity, transform; }

/* Финал главы IV: манифест и печать по центру, река стягивается кольцом */
.union-final { margin-top: 42px; text-align: center; }
.about { max-width: 640px; margin: 6px auto 0; color: var(--muted); line-height: 1.65; font-size: 16px; will-change: opacity, transform; }
.about b { color: var(--clan-sand); }
.stamp { width: 176px; margin: 24px auto 0; display: block; will-change: transform, opacity;
  filter: grayscale(1) sepia(1) saturate(2.6) hue-rotate(-12deg) brightness(1.5)
    drop-shadow(0 10px 26px rgba(0, 0, 0, .6)); }

@media (max-width: 900px) {
  .thread { display: none; }
  .hud { display: none; }
  .ann { display: none; }
  .scene-in { padding: 84px 16px 30px; }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
  .led { padding: 16px 0 0; }
  .flame { filter: blur(4px); }
}
@media (max-width: 640px) {
  .hero-search { grid-template-columns: 1fr; }
  .hero-search .button { min-height: 48px; }
}

/* reduced motion: страница — обычный статичный сайт, всё в финальном состоянии */
@media (prefers-reduced-motion: reduce) {
  .sw { height: auto !important; }
  .led .ledline { transform: none; }
  .sw .st { position: static; height: auto; min-height: 60vh; }
  #s-hero .st { min-height: 100svh; }
  .flame, .shaft, .scroll-hint::after, .dots, .sw:not(#s-hero) .st::before { animation: none; }
  .dust, #pcanvas, .ann, .signglow, .world canvas { display: none; }
  .camera .art { opacity: 1 !important; }
  #site-header { position: sticky; }
  #site-header .site-header { border-bottom-color: var(--line);
    background: color-mix(in srgb, var(--clan-black) 95%, transparent); backdrop-filter: blur(16px); }
}
