/* «Мир Маргариты» — раздел общей страницы. Стили из прототипа страницы без шапки, подвала и базовых правил
   (их задаёт стиль портала); совпадавшие классы переименованы: .sec-head → .w-head, .btn → .w-btn. */

/* ---------- живой фон ---------- */
.ambient { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
/* мягкие тени, словно свет проходит через предметы за краем экрана */
.shade { position: absolute; border-radius: 46% 54% 60% 40% / 50% 42% 58% 50%; filter: blur(70px); opacity: .5; will-change: transform; }
.s1 { width: 46vw; height: 40vw; top: -12vw; inset-inline-end: -10vw; background: radial-gradient(circle at 40% 40%, rgba(255, 194, 75, .55), rgba(255, 194, 75, 0) 70%); animation: drift1 46s ease-in-out infinite alternate; }
.s2 { width: 40vw; height: 36vw; top: 38vh; inset-inline-start: -14vw; background: radial-gradient(circle at 50% 50%, rgba(20, 184, 166, .30), rgba(20, 184, 166, 0) 70%); animation: drift2 58s ease-in-out infinite alternate; }
.s3 { width: 34vw; height: 30vw; bottom: -10vw; inset-inline-end: 12vw; background: radial-gradient(circle at 50% 50%, rgba(91, 46, 85, .18), rgba(91, 46, 85, 0) 70%); animation: drift3 64s ease-in-out infinite alternate; }
@keyframes drift1 { to { transform: translate(-8vw, 10vh) rotate(18deg) scale(1.08); } }
@keyframes drift2 { to { transform: translate(10vw, -8vh) rotate(-14deg) scale(1.12); } }
@keyframes drift3 { to { transform: translate(-12vw, -12vh) rotate(10deg); } }
/* редкие полупрозрачные кубики, пиксели и звёздочки */
.floaters { position: absolute; inset: 0; will-change: transform; }
.fl { position: absolute; width: 34px; height: 34px; fill: currentColor; opacity: .16; animation: bob 16s ease-in-out infinite; }
.f1 { top: 22%; left: 2%; color: var(--coral); width: 46px; animation-duration: 19s; }
.f2 { top: 34%; left: 95%; color: var(--teal); width: 20px; animation-duration: 14s; animation-delay: -4s; }
.f3 { top: 62%; left: 2.5%; color: var(--sun); width: 26px; opacity: .3; animation-duration: 22s; animation-delay: -9s; }
.f4 { top: 80%; left: 94%; color: var(--plum); width: 16px; animation-duration: 17s; animation-delay: -2s; }
.f5 { top: 96%; left: 3%; color: var(--teal); width: 40px; animation-duration: 24s; animation-delay: -12s; }
.f6 { top: 50%; left: 96.5%; color: var(--coral); width: 14px; opacity: .2; animation-duration: 15s; }
.f7 { top: 12%; left: 92%; color: var(--plum); width: 18px; opacity: .2; animation-duration: 20s; animation-delay: -6s; }
.f8 { top: 128%; left: 2%; color: var(--sun); width: 22px; opacity: .28; animation-duration: 18s; animation-delay: -3s; }
@keyframes bob { 0%, 100% { transform: translate(0, 0) rotate(-6deg); } 50% { transform: translate(14px, -22px) rotate(8deg); } }
html.is-hidden .shade, html.is-hidden .fl { animation-play-state: paused; }


/* ---------- появление разделов ---------- */
.js .reveal { opacity: 0; transform: translateY(26px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- 1. знакомство ---------- */
.intro { padding-block: clamp(24px, 4.2vw, 58px) clamp(14px, 2.8vw, 40px); }
.intro-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.title { margin: 0; font: 800 clamp(44px, 7vw, 88px)/.98 var(--font); letter-spacing: -.03em; color: var(--plum); }
.title em { font-style: normal; display: inline-block; background: linear-gradient(120deg, #5b2e55 0%, #ff6b5a 55%, #ffb347 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hello { margin: 22px 0 0; font: 700 clamp(22px, 2.4vw, 28px)/1.2 var(--font); color: var(--ink); }
.intro-lead { margin: 10px 0 0; max-width: 30em; color: var(--ink-2); font-size: clamp(17px, 1.5vw, 19px); }
.scroll-cue { display: inline-flex; align-items: center; gap: 8px; margin-top: 26px; padding: 10px 18px; border-radius: 999px; background: var(--surface); box-shadow: var(--sh-1); text-decoration: none; font-weight: 600; color: var(--plum); transition: transform .25s, box-shadow .25s; }
.scroll-cue svg { width: 18px; height: 18px; animation: nudge 2.6s ease-in-out infinite; }
.scroll-cue:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(3px); } }

.intro-art { position: relative; aspect-ratio: 1 / 1; max-width: 480px; width: 100%; justify-self: center; }
.halo { position: absolute; inset: 6%; border-radius: 50%; background: radial-gradient(circle, #fff 0%, #fff4e4 55%, rgba(255, 244, 228, 0) 72%); }
.portrait { position: absolute; inset: 18%; margin: 0; border-radius: 34% 38% 36% 40%; overflow: hidden; box-shadow: var(--sh-2); border: 6px solid #fff; }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.polaroid { position: absolute; width: 30%; margin: 0; padding: 6px 6px 18px; border-radius: 10px; background: #fff; box-shadow: var(--sh-1); transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s; }
.polaroid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.polaroid:hover { transform: rotate(0deg) translateY(-8px) scale(1.06) !important; box-shadow: var(--sh-2); z-index: 3; }
.p1 { top: 0; inset-inline-start: 2%; transform: rotate(-8deg); animation: sway 9s ease-in-out infinite; }
.p2 { top: 8%; inset-inline-end: 0; transform: rotate(7deg); animation: sway 11s ease-in-out infinite reverse; }
.p3 { bottom: 2%; inset-inline-start: 30%; transform: rotate(-3deg); animation: sway 10s ease-in-out infinite; animation-delay: -3s; }
@keyframes sway { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.brick { position: absolute; width: 46px; height: 28px; border-radius: 6px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12), 0 6px 14px rgba(58, 43, 66, .14); }
.brick::before, .brick::after { content: ""; position: absolute; top: -7px; width: 12px; height: 8px; border-radius: 4px 4px 2px 2px; background: inherit; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12); }
.brick::before { left: 8px; }
.brick::after { right: 8px; }
.b1 { background: var(--coral); bottom: 14%; inset-inline-end: 8%; transform: rotate(12deg); animation: sway 7s ease-in-out infinite; }
.b2 { background: var(--teal); top: 44%; inset-inline-start: -2%; width: 36px; height: 22px; transform: rotate(-16deg); animation: sway 8.5s ease-in-out infinite reverse; }
.b3 { background: var(--sun); top: -2%; inset-inline-end: 34%; width: 30px; height: 18px; transform: rotate(8deg); animation: sway 9.5s ease-in-out infinite; }

/* ---------- заголовки разделов ---------- */
.eyebrow { display: inline-block; padding: 4px 12px; border-radius: 999px; background: #f1e3ef; color: var(--plum); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; }
html[dir="rtl"] .eyebrow { letter-spacing: 0; }
.w-head h2, .ideas-text h2 { margin: 12px 0 0; font: 800 clamp(30px, 4vw, 48px)/1.05 var(--font); letter-spacing: -.02em; color: var(--plum); }
.w-head p { margin: 12px 0 0; max-width: 40em; color: var(--ink-2); }

/* ---------- 2. LEGO: горизонтальная галерея ---------- */
.lego { padding-block: clamp(26px, 4.2vw, 56px) clamp(16px, 2.6vw, 34px); }
.gallery { margin-top: clamp(14px, 2vw, 22px); }
.gallery-track { display: flex; gap: clamp(14px, 2vw, 22px); overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; padding: 10px max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter))) 18px; scroll-padding-inline: max(var(--gutter), calc((100vw - var(--wrap)) / 2 + var(--gutter))); scrollbar-width: none; }
.gallery-track::-webkit-scrollbar { display: none; }
.shot { position: relative; flex: none; width: clamp(240px, 30vw, 360px); margin: 0; scroll-snap-align: start; border-radius: 22px; background: #fff; padding: 8px; box-shadow: var(--sh-1); transition: transform .4s cubic-bezier(.2, .8, .2, 1), box-shadow .4s; }
.shot:hover { transform: translateY(-8px) rotate(-.6deg); box-shadow: var(--sh-2); }
.shot img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 16px; background: var(--bg-2); }
.shot figcaption { padding: 10px 8px 4px; font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
.shot.is-current { box-shadow: 0 0 0 3px rgba(20, 184, 166, .35), var(--sh-2); }
.gallery-bar { display: flex; align-items: center; gap: 10px; }
.round { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: #fff; color: var(--plum); box-shadow: var(--sh-1); cursor: pointer; transition: transform .2s, box-shadow .2s; }
.round svg { width: 20px; height: 20px; }
.round:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
html[dir="rtl"] [data-prev] svg, html[dir="rtl"] [data-next] svg { transform: scaleX(-1); }
.gallery-count { margin-inline-start: 6px; color: var(--ink-2); font-weight: 600; font-size: 14px; }

/* ---------- 3. идеи → игры: пиксели собираются в обложку ---------- */
.ideas { padding-block: clamp(34px, 5vw, 66px) clamp(28px, 4.2vw, 56px); }
.ideas-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(28px, 5vw, 72px); align-items: center; }
.ideas-text .big { margin: 16px 0 0; font: 600 clamp(19px, 1.8vw, 22px)/1.45 var(--font); color: var(--ink); }
.ideas-text p { margin: 12px 0 0; color: var(--ink-2); max-width: 34em; }
/* «Идеи начинаются с фантазии»: небольшая карточка со значком-лампочкой */
.spark { display: flex; align-items: flex-start; gap: 16px; margin-top: 22px; padding: 18px 20px; border-radius: 22px; background: linear-gradient(135deg, #fff 0%, #fff6ea 100%); box-shadow: var(--sh-1); }
.spark-ic { position: relative; flex: none; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; background: #fdf0d8; }
.spark-ic > svg:first-child { width: 36px; height: 36px; }
.spark-ic .bulb { fill: #ffc24b; }
.spark-ic .base { fill: #c08a2e; }
.spark-ic .glint { stroke: #fff; }
.spark-star { position: absolute; top: -6px; inset-inline-end: -6px; width: 20px; height: 20px; fill: var(--coral); animation: twinkle 4.8s ease-in-out infinite; }
@keyframes twinkle { 0%, 70%, 100% { transform: scale(1) rotate(0deg); opacity: .9; } 80% { transform: scale(1.25) rotate(14deg); opacity: 1; } 90% { transform: scale(.9) rotate(-6deg); opacity: .8; } }
.spark h3 { margin: 2px 0 0; font: 700 clamp(18px, 1.7vw, 20px)/1.25 var(--font); color: var(--plum); }
.spark p { margin: 6px 0 0; color: var(--ink-2); font-size: 16px; line-height: 1.55; }
.ideas-art { position: relative; border-radius: 26px; background: #fff; box-shadow: var(--sh-2); padding: 12px; }
.sc-stage { position: relative; aspect-ratio: 3 / 2; border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, #fff6ea, #f4ecfa); }
.mosaic { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(16, 1fr); grid-template-rows: repeat(10, 1fr); gap: 3px; padding: 3px; }
.px { border-radius: 4px; background: var(--c, #f1e4d2); transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--r, 0)) scale(var(--s, 1)); opacity: var(--o, 1); transition: transform 1.2s cubic-bezier(.2, .8, .2, 1), opacity .9s ease, background-color .9s ease; transition-delay: var(--d, 0s); }
.sc-cover, .sc-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .9s ease; }
.sc-cover.is-on, .sc-video.is-on { opacity: 1; }
/* медленное «дыхание» обложки: лёгкое приближение со сдвигом */
.sc-cover { transform: scale(1); transform-origin: 50% 50%; transition: opacity .9s ease, transform 6.5s cubic-bezier(.25, .1, .25, 1); }
.sc-cover.is-zoom { transform: scale(1.08) translate(-1.2%, -1%); }
.sc-live { position: absolute; top: 12px; inset-inline-start: 12px; display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, .92); color: var(--plum); font-size: 12.5px; font-weight: 700; box-shadow: var(--sh-1); opacity: 0; transform: translateY(-4px); transition: opacity .5s ease, transform .5s ease; }
.sc-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 0 3px rgba(255, 107, 90, .25); }
.sc-live.is-on { opacity: 1; transform: none; }
.sc-foot { display: flex; align-items: center; gap: 12px; padding: 12px 6px 2px; }
.sc-cap { flex: 1; min-width: 0; margin: 0; font-weight: 700; font-size: 16px; color: var(--plum); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .4s ease; }
.sc-cap.is-fade { opacity: 0; }
.sc-dots { display: flex; gap: 2px; }
.sc-dots button { width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; background: none; cursor: pointer; }
.sc-dots button::before { content: ""; width: 7px; height: 7px; border-radius: 4px; background: #e6d6c3; transition: width .3s ease, background .3s ease; }
.sc-dots button[aria-current="true"]::before { width: 18px; background: var(--teal); }
.sc-all { display: inline-flex; align-items: center; gap: 4px; padding: 6px 4px; color: var(--ink-2); font-size: 14px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.sc-all svg { width: 15px; height: 15px; }
.sc-all:hover { color: var(--plum); }
html[dir="rtl"] .sc-all svg { transform: scaleX(-1); }

/* ---------- 4. завершение ---------- */
.outro { padding-block: clamp(18px, 3.4vw, 44px) clamp(36px, 4.6vw, 60px); }
.outro-card { max-width: 760px; margin: 0 auto; padding: clamp(26px, 4vw, 44px); border-radius: 30px; background: linear-gradient(140deg, #fff 0%, #fff4e6 100%); box-shadow: var(--sh-1); text-align: center; }
.outro-card p { margin: 0; font: 600 clamp(19px, 2vw, 24px)/1.45 var(--font); color: var(--ink); }
.w-btn { display: inline-flex; align-items: center; gap: 8px; margin-top: 22px; min-height: 48px; padding: 0 22px; border-radius: 999px; background: var(--lime); color: var(--lime-ink); font-weight: 700; text-decoration: none; box-shadow: 0 2px 0 #7fb81c, 0 10px 24px rgba(163, 230, 53, .35); transition: transform .2s, box-shadow .2s; }
.w-btn svg { width: 18px; height: 18px; }
html[dir="rtl"] .w-btn svg { transform: scaleX(-1); }
.w-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 0 #7fb81c, 0 16px 30px rgba(163, 230, 53, .45); }


/* ---------- адаптив ---------- */
@media (max-width: 900px) {
  .intro-grid, .ideas-grid { grid-template-columns: minmax(0, 1fr); }
  .intro-art { max-width: 400px; }
}
@media (max-width: 680px) {
  .intro { padding-block: 18px 14px; }
  .intro-grid { gap: 14px; }
  .intro-art { max-width: 330px; }
  .hello { margin-top: 14px; }
  .scroll-cue { margin-top: 16px; }
  .lego { padding-block: 32px 14px; }
  .gallery { margin-top: 12px; }
  .ideas { padding-block: 34px 26px; }
  .ideas-grid { gap: 18px; }
  .outro { padding-block: 22px 36px; }
  .shot { width: 74vw; }
  .mosaic { grid-template-columns: repeat(12, 1fr); grid-template-rows: repeat(8, 1fr); gap: 2px; padding: 2px; }
  .sc-foot { gap: 8px; }
  .sc-all { display: none; }   /* на телефоне в подписи остаются название и точки; «Игры» есть в меню */
  .sc-cap { font-size: 15px; }
  .fl { display: none; }
  .fl.f1, .fl.f3, .fl.f5 { display: block; }
}

/* ---------- уменьшение движения: фон замирает, параллакс и автосмена отключаются ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .shade, .fl, .polaroid, .brick, .scroll-cue svg, .spark-star { animation: none !important; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .px, .sc-cover, .sc-video, .sc-cap, .sc-live, .shot, .polaroid, .round, .w-btn { transition: none; }
  .sc-cover.is-zoom { transform: none; }
  .gallery-track { scroll-behavior: auto; }
}
