/* Размер сцены определяется карточками и подписями, поэтому они не обрезаются. */
.home-page { background: #1c1b18; color: #e8ddca; }
.home-page main { width: 100%; padding: 0; }
.home-page footer { display: none; }
.home-intro { position: relative; min-height: calc(100svh - 72px); display: flex; flex-direction: column; align-items: start; padding: 32px 4%; background: url('design/home-background.png') right top / cover no-repeat; }
.home-demo { width: min(100%, 980px); max-width: 76%; outline-offset: 8px; opacity: 1; transition: opacity .45s ease; }
/* Возвращаем сцену к началу только после полного затухания последнего кадра. */
.home-demo.is-resetting { opacity: 0; }
.home-demo.is-rewinding * { transition: none !important; }
.home-demo h1 { display: flex; align-items: center; min-height: 2.5em; margin: 0; max-width: 90%; font-size: clamp(24px, 3vw, 40px); line-height: 1.2; color: #e8ddca; opacity: 1; transition: opacity .3s ease, transform .3s ease; }
.home-demo h1.is-changing { opacity: 0; transform: translateY(5px); }
.demo-scene { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(20px, 6vw, 80px); row-gap: 30px; align-items: center; padding: 24px 8px 12px; }
.demo-threads { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.demo-threads path { fill: none; stroke: #d5c3a6; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-dasharray: 1000; stroke-dashoffset: 1000; transition: stroke-dashoffset .9s ease, opacity .5s ease; }
.demo-node { position: relative; z-index: 1; width: 100%; max-width: 250px; min-width: 0; justify-self: center; transition: opacity .6s ease; }
.demo-root { grid-column: 1; grid-row: 1 / span 2; }
.home-demo[data-step="0"] .demo-root { grid-column: 1 / -1; }
.demo-neighbour { grid-column: 2; opacity: 0; visibility: hidden; transition: opacity .6s ease .2s, visibility .6s; }
.demo-neighbour-1 { grid-row: 1; }
.demo-neighbour-2 { grid-row: 2; }
.demo-card { width: 100%; min-height: 150px; pointer-events: none; }
.demo-card .catalog-book-open > span { font-size: 12px; line-height: 1.15; overflow: hidden; }
/* Во всех разделах значок имеет одну высоту и не растягивается вместе с полосой. */
.demo-card .book-like { height: 46px; cursor: default; background-size: auto 46px; }
.demo-match { display: flex; justify-content: center; align-items: start; gap: 6px; min-height: 2.6em; margin: 10px 0 0; font-size: 13px; line-height: 1.3; text-align: center; overflow-wrap: anywhere; color: #e8ddca; }
.demo-match img { flex: 0 0 18px; width: 18px; height: 18px; object-fit: contain; filter: brightness(0) invert(1); }
.home-demo:not([data-step="0"]) .demo-neighbour { opacity: 1; visibility: visible; }
.home-demo:not([data-step="0"]) path { stroke-dashoffset: 0; }
.home-demo[data-step="2"] .demo-root, .home-demo[data-step="3"] .demo-root,
.home-demo[data-step="2"] .demo-neighbour-1, .home-demo[data-step="3"] .demo-neighbour-1 { opacity: .45; }
.home-demo[data-step="2"] path:first-child, .home-demo[data-step="3"] path:first-child { opacity: .35; }
.demo-counter { margin: 20px 0 24px; font-size: 16px; text-align: center; }
.home-start { position: absolute; top: var(--home-start-top, 480px); transform: translateY(-50%); right: 4%; display: flex; align-items: center; justify-content: center; width: min(260px, 22%); min-height: 60px; margin: 0; padding: 12px 16px; background: url('design/home-start.svg') center / 100% 100% no-repeat; color: #e8ddca; text-align: center; text-decoration: none; font-size: 17px; }
@media (max-width: 700px) {
    .home-intro { min-height: calc(100svh - 112px); padding: 20px 18px; background-position: left top; }
    .home-demo { max-width: 100%; width: 100%; }
    .home-demo h1 { font-size: 24px; max-width: 100%; min-height: 3.6em; }
    .demo-scene { column-gap: 18px; row-gap: 24px; padding-inline: 0; }
    .demo-card { padding: 5px; gap: 4px; }
    .demo-card .catalog-book-open { padding: 8px; }
    .demo-card .catalog-book-open > span { font-size: 11px; }
    .demo-match { font-size: 11px; min-height: 3.9em; }
    .home-start { position: static; transform: none; order: 1; width: min(220px, 100%); min-height: 48px; margin: 0 0 16px; align-self: center; }
}
@media (prefers-reduced-motion: reduce) {
    .home-demo * { transition: none !important; }
}
