/* Секция «Работы»: горизонтальные ролики и рилсы в «телефоне».
   Всё, что относится к #works, живёт здесь, а не в index.html, чтобы правки
   этой секции не толкались с правками других блоков в одном файле.
   Данные роликов и сборка разметки — в works.js. */

/* ---- Подблоки секции ---- */
.works-block + .works-block { margin-top: 72px; padding-top: 56px; border-top: 1px dotted var(--line); }
.works-block__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 28px; margin: 0 0 28px; }
.works-block__title { margin: 0; font: 500 .95rem/1.4 "IBM Plex Mono", ui-monospace, monospace;
                      letter-spacing: .08em; text-transform: uppercase; }
.works-block__note { margin: 0; font-size: .9rem; line-height: 1.6; color: var(--text-muted); max-width: 62ch; }

/* Иконки: контурные, цвет наследуют. Заливка задаётся атрибутом у отдельных
   фигур (треугольник play, точки), он побеждает наследование от svg. */
#works svg, .lightbox svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Горизонтальные ролики: карточка .work из index.html, обложка стала кнопкой ---- */
.works-ads { background: transparent; border: 0; overflow: visible; gap: 20px; }
button.work__thumb { position: relative; display: block; width: 100%; aspect-ratio: 16/9; padding: 0; border: 0;
                     background: #000; color: #fff; cursor: pointer; overflow: hidden; font: inherit; }
.work__thumb img { display: block; width: 100%; height: 100%; object-fit: cover;
                   transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.work__thumb:hover img, .work__thumb:focus-visible img { transform: scale(1.04); }
.work__thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.work__play { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; margin: -30px 0 0 -30px;
              border-radius: 50%; display: grid; place-items: center; color: #fff;
              background: rgba(0,30,62,.7); border: 1px solid rgba(255,255,255,.55);
              transition: transform .3s, background .3s, color .3s, border-color .3s; }
.work__play svg { width: 22px; height: 22px; margin-left: 3px; }
.work__thumb:hover .work__play, .work__thumb:focus-visible .work__play {
  transform: scale(1.08); background: var(--accent); color: var(--ink); border-color: var(--accent); }
.work__dur { position: absolute; right: 12px; bottom: 12px; padding: 3px 9px; border-radius: 999px;
             background: rgba(0,22,46,.78); font-size: .75rem; font-variant-numeric: tabular-nums; }

/* ---- Рилсы: сетка обложек слева, телефон справа ---- */
.reels-stage { --phone-w: 350px; position: relative; display: grid;
               grid-template-columns: minmax(0, 1fr) var(--phone-w); gap: 56px; align-items: center; }
/* Свечение из брендбука: одно размытое пятно за телефоном. */
.reels-stage::before { content: ""; position: absolute; right: -60px; top: 50%; width: 560px; height: 560px;
                       transform: translateY(-50%); border-radius: 50%; pointer-events: none;
                       background: radial-gradient(closest-side, rgba(0,206,242,.16), rgba(0,206,242,0)); }

.reels-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { position: relative; aspect-ratio: 9/16; padding: 0; border: 1px solid var(--line); border-radius: 16px;
        overflow: hidden; background: #000; color: #fff; cursor: pointer; text-align: left; font: inherit;
        outline: 2px solid transparent; outline-offset: 3px; transition: outline-color .25s; }
.tile img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2,.7,.2,1); }
.tile:hover img { transform: scale(1.05); }
.tile::after { content: ""; position: absolute; inset: 0; pointer-events: none;
               background: linear-gradient(to top, rgba(0,0,0,.6), transparent 45%); }
.tile.is-active { outline-color: var(--accent); }
.tile:focus-visible { outline-color: #fff; }
.tile__brand { position: absolute; z-index: 1; top: 10px; left: 10px; font-size: .66rem; letter-spacing: .08em;
               text-transform: uppercase; color: rgba(255,255,255,.85); text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.tile__dur { position: absolute; z-index: 1; left: 10px; bottom: 10px; display: flex; align-items: center; gap: 5px;
             font-size: .72rem; font-variant-numeric: tabular-nums; }
.tile__dur svg { width: 12px; height: 12px; }
.tile__title { position: absolute; z-index: 1; left: 10px; right: 10px; bottom: 30px; font-size: .72rem; color: rgba(255,255,255,.85);
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Телефон ---- */
.phone { position: relative; width: var(--phone-w); justify-self: end; }
.phone__frame { position: relative; padding: 10px; border-radius: 50px; background: #050505;
                box-shadow: 0 0 0 1px rgba(255,255,255,.22), 0 40px 90px -30px rgba(0,0,0,.9),
                            inset 0 0 0 1px rgba(255,255,255,.05); }
/* Внутри экрана — интерфейс Instagram, поэтому системный шрифт, как в приложении.
   Брендовые шрифты остаются снаружи телефона. */
.phone__screen { position: relative; aspect-ratio: 9 / 19.5; border-radius: 40px; overflow: hidden; background: #000;
                 color: #fff; isolation: isolate; -webkit-tap-highlight-color: transparent;
                 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
.phone__island { position: absolute; z-index: 8; top: 10px; left: 50%; width: 92px; height: 26px;
                 transform: translateX(-50%); border-radius: 20px; background: #000; }
.phone__status { position: absolute; z-index: 7; top: 13px; left: 0; right: 0; display: flex; justify-content: space-between;
                 align-items: center; padding: 0 26px; font-size: .8rem; font-weight: 600; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.phone__status-icons { display: flex; gap: 5px; align-items: center; }
.phone__status-icons svg { height: 11px; width: auto; display: block; }

.reels__top { position: absolute; z-index: 6; top: 46px; left: 0; right: 0; display: flex; align-items: center;
              justify-content: space-between; padding: 0 14px; pointer-events: none; }
.reels__top > * { pointer-events: auto; }
.reels__title { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.reels__cam svg { width: 26px; height: 26px; display: block; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.reels__close { display: none; width: 44px; height: 44px; margin-left: -10px; border: 0; padding: 0; background: none;
                color: #fff; cursor: pointer; place-items: center; filter: drop-shadow(0 1px 2px rgba(0,0,0,.6)); }
.reels__close svg { width: 26px; height: 26px; }
.reels__close:focus-visible { outline: 2px solid var(--accent); border-radius: 50%; }

/* Лента: нативная прокрутка с прилипанием по одному слайду. overscroll-behavior
   не даёт колесу над телефоном прокручивать страницу. */
.reels { position: absolute; inset: 0; z-index: 1; overflow-y: auto; scroll-snap-type: y mandatory;
         overscroll-behavior: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; outline: none; }
.reels::-webkit-scrollbar { display: none; }
.reels:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.reel { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; background: #000; overflow: hidden; }
/* 9:16 в экране 9:19.5: видео целиком, без обрезки, полосы сверху и снизу
   уходят под статус-бар и панель вкладок — так же кадр лежит и в приложении. */
.reel__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
/* Постер поверх видео до первого кадра (см. works.js), спиннер — если кадр
   задерживается дольше секунды. */
.reel__poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none;
                background: #000; transition: opacity .25s; }
.reel.is-playing .reel__poster { opacity: 0; }
.reel__spin { position: absolute; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; box-sizing: border-box;
              border-radius: 50%; border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; pointer-events: none;
              opacity: 0; transition: opacity .3s; animation: reel-spin .9s linear infinite; }
.reel.is-loading:not(.is-playing) .reel__spin { opacity: 1; transition-delay: 1s; }
@keyframes reel-spin { to { transform: rotate(360deg); } }
.reel__shade { position: absolute; left: 0; right: 0; bottom: 0; height: 46%; pointer-events: none;
               background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0)); }
.reel__tap { position: absolute; inset: 0; z-index: 2; border: 0; padding: 0; background: transparent; cursor: pointer; }
.reel__tap:focus-visible { outline: 2px solid var(--accent); outline-offset: -4px; }
.reel__glyph { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; pointer-events: none;
               opacity: 0; transition: opacity .2s; }
.reel__glyph span { width: 76px; height: 76px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; }
.reel__glyph svg { width: 34px; height: 34px; margin-left: 4px; }
.reel.is-paused .reel__glyph { opacity: 1; }
.reel__burst { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; pointer-events: none; }
.reel__burst svg { width: 110px; height: 110px; fill: #fff; stroke: none; opacity: 0;
                   filter: drop-shadow(0 4px 12px rgba(0,0,0,.45)); }
.reel.is-burst .reel__burst svg { animation: reel-burst .9s cubic-bezier(.2,.8,.2,1); }
@keyframes reel-burst {
  0%   { transform: scale(.3); opacity: 0; }
  25%  { transform: scale(1.15); opacity: 1; }
  60%  { transform: scale(1); opacity: 1; }
  100% { transform: scale(1.2) translateY(-24px); opacity: 0; }
}

/* Правый рейл: сердце, комментарии, поделиться, ещё, обложка аудио. */
.reel__rail { position: absolute; z-index: 4; right: 8px; bottom: 82px; display: flex; flex-direction: column;
              align-items: center; gap: 14px; }
.rail__btn { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 44px; padding: 4px 0;
             border: 0; background: none; color: #fff; font: 600 .72rem/1 inherit; cursor: pointer;
             filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
.rail__btn svg { width: 28px; height: 28px; transition: transform .2s; }
.rail__btn:active svg { transform: scale(.85); }
.rail__btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
/* Красное сердце — единственный цвет вне палитры, и он внутри экрана телефона:
   это цитата интерфейса Instagram, а не элемент сайта. */
.rail__btn--like.is-liked svg { fill: #ff3040; stroke: #ff3040; animation: rail-pop .4s cubic-bezier(.2,.8,.2,1); }
@keyframes rail-pop { 0% { transform: scale(.6); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }
.rail__disc { width: 30px; height: 30px; margin-top: 4px; border-radius: 8px; border: 2px solid #fff;
              background: var(--ink) url(assets/logo/symbol-white.svg) center / 60% no-repeat; }

.reel__meta { position: absolute; z-index: 4; left: 12px; right: 54px; bottom: 74px; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
.reel__user { display: flex; align-items: center; gap: 7px; margin-bottom: 9px; }
.reel__avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid #fff;
                background: var(--ink) url(assets/logo/symbol-white.svg) center / 55% no-repeat; }
.reel__name { font-size: .8rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reel__follow { flex: none; border: 1px solid rgba(255,255,255,.85); border-radius: 8px; background: transparent; color: #fff;
                font: 600 .66rem/1 inherit; padding: 6px 7px; cursor: pointer; transition: background .25s, color .25s; }
.reel__follow.is-on { background: #fff; color: #000; }
.reel__follow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.reel__caption { margin: 0 0 9px; font-size: .8rem; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2;
                 -webkit-box-orient: vertical; overflow: hidden; }
.reel__caption b { font-weight: 600; }
.reel__tags { color: rgba(255,255,255,.75); }
.reel__audio { display: flex; align-items: center; gap: 6px; font-size: .74rem; }
.reel__audio svg { flex: none; width: 14px; height: 14px; }
.reel__audio-track { flex: 1; overflow: hidden; -webkit-mask: linear-gradient(90deg, #000 85%, transparent);
                     mask: linear-gradient(90deg, #000 85%, transparent); }
.reel__audio-track > span { display: inline-block; white-space: nowrap; animation: reel-marquee 9s linear infinite; }
.reel__audio-track > span > span { padding-right: 32px; }
@keyframes reel-marquee { to { transform: translateX(-50%); } }
.reel__progress { position: absolute; z-index: 4; left: 0; right: 0; bottom: 60px; height: 2px; background: rgba(255,255,255,.28); }
.reel__progress i { display: block; height: 100%; width: 100%; background: #fff; transform-origin: left; transform: scaleX(0); }

.phone__tabs { position: absolute; z-index: 6; left: 0; right: 0; bottom: 0; height: 60px; padding: 8px 8px 14px; box-sizing: border-box;
               display: flex; justify-content: space-around; align-items: center; background: #000; }
.phone__tabs svg { width: 25px; height: 25px; display: block; }
.phone__tabs .is-on svg { stroke-width: 2.6; }
.phone__tabs .tab-avatar { width: 25px; height: 25px; border-radius: 50%; border: 1.5px solid #fff;
                           background: var(--ink) url(assets/logo/symbol-white.svg) center / 55% no-repeat; }
.phone__home { position: absolute; z-index: 7; left: 50%; bottom: 6px; width: 120px; height: 4px; margin-left: -60px;
               border-radius: 2px; background: #fff; opacity: .9; }

/* Подсказка о свайпе: рука над первым слайдом, гаснет после первой прокрутки. */
.reels__hint { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; pointer-events: none;
               background: rgba(0,0,0,.4); opacity: 0; transition: opacity .35s; }
.phone.is-hinting .reels__hint { opacity: 1; }
.reels__hint-box { display: grid; justify-items: center; gap: 10px; max-width: 72%; text-align: center; font-size: .85rem;
                   font-weight: 600; line-height: 1.3; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
.reels__hint-hand { width: 54px; height: 54px; stroke-width: 1.8; animation: reels-swipe 1.6s cubic-bezier(.4,0,.2,1) infinite; }
.reels__hint-chev { width: 22px; height: 22px; stroke-width: 2.5; animation: reels-chev 1.6s ease-in-out infinite; }
@keyframes reels-swipe {
  0%   { transform: translateY(26px); opacity: 0; }
  20%  { opacity: 1; }
  70%  { transform: translateY(-22px); opacity: 1; }
  100% { transform: translateY(-30px); opacity: 0; }
}
@keyframes reels-chev { 0%, 100% { transform: translateY(0); opacity: .5; } 50% { transform: translateY(-6px); opacity: 1; } }
.reels__hint-text--fine { display: none; }
@media (hover: hover) and (pointer: fine) {
  .reels__hint-text--coarse { display: none; }
  .reels__hint-text--fine { display: block; }
}

/* Стрелки под телефоном: для мыши и клавиатуры. */
.phone__nav { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 18px; }
.phone__nav button { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: transparent;
                     color: #fff; cursor: pointer; display: grid; place-items: center;
                     transition: border-color .25s, color .25s; }
.phone__nav button svg { width: 20px; height: 20px; }
.phone__nav button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.phone__nav button:disabled { opacity: .35; cursor: default; }
.phone__nav button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.phone__counter { min-width: 52px; text-align: center; font-size: .78rem; color: var(--text-muted);
                  font-variant-numeric: tabular-nums; }

/* Шторка (комментарии, «ещё») и тост внутри экрана. */
.phone__sheet { position: absolute; z-index: 9; inset: 0; display: none; }
.phone__sheet.is-open { display: block; }
.phone__sheet-back { position: absolute; inset: 0; width: 100%; border: 0; padding: 0; background: rgba(0,0,0,.5); cursor: pointer; }
.phone__sheet-body { position: absolute; left: 0; right: 0; bottom: 0; background: #262626; border-radius: 18px 18px 0 0;
                     padding: 10px 16px 24px; animation: sheet-up .3s cubic-bezier(.2,.8,.2,1); }
.phone__sheet-body::before { content: ""; display: block; width: 36px; height: 4px; border-radius: 2px; background: #555; margin: 0 auto 14px; }
@keyframes sheet-up { from { transform: translateY(100%); } }
.phone__sheet-title { margin: 0 0 16px; text-align: center; font-weight: 600; font-size: .95rem; }
.phone__sheet-empty { text-align: center; padding: 22px 0 26px; color: #a8a8a8; font-size: .85rem; line-height: 1.5; }
.phone__sheet-empty b { display: block; color: #fff; font-size: 1.1rem; margin-bottom: 6px; }
.phone__sheet-input { display: flex; gap: 10px; align-items: center; padding-top: 12px; border-top: 1px solid #3a3a3a; }
.phone__sheet-input span:last-child { flex: 1; border: 1px solid #3a3a3a; border-radius: 22px; padding: 10px 14px; color: #8e8e8e; font-size: .85rem; }
.phone__sheet-action { display: block; width: 100%; text-align: left; padding: 14px 4px; border: 0; border-bottom: 1px solid #3a3a3a;
                       background: none; color: #fff; font: 500 .9rem/1.2 inherit; cursor: pointer; text-decoration: none; box-sizing: border-box; }
.phone__sheet-action:last-child { border-bottom: 0; }
.phone__sheet-action:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; border-radius: 6px; }
.phone__toast { position: absolute; z-index: 10; left: 50%; bottom: 80px; max-width: 86%; padding: 10px 16px; border-radius: 10px;
                background: #262626; color: #fff; font-size: .8rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
                transform: translate(-50%, 10px); opacity: 0; transition: opacity .25s, transform .25s; pointer-events: none; }
.phone__toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---- Лайтбокс для горизонтальных роликов ---- */
.lightbox { border: 0; padding: 0; margin: auto; width: min(1100px, 94vw); max-width: none; max-height: none;
            background: transparent; color: #fff; overflow: visible; }
.lightbox::backdrop { background: rgba(0,22,46,.94); }
.lightbox__body { position: relative; }
.lightbox video { display: block; width: 100%; aspect-ratio: 16/9; border-radius: 22px; background: #000; outline: 1px solid var(--line); }
.lightbox__foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.lightbox__meta { padding: 14px 4px 0; font-size: .85rem; line-height: 1.6; }
.lightbox__copy { margin: 14px 4px 0; padding: 0; border: 0; background: none; color: var(--text-muted); font: inherit; font-size: .85rem;
                  line-height: 1.6; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.lightbox__copy:hover { color: var(--accent); }
.lightbox__copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.lightbox__meta b { display: block; font-weight: 500; }
.lightbox__meta span { color: var(--text-muted); }
.lightbox__close { position: absolute; top: -54px; right: 0; width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
                   background: transparent; color: #fff; cursor: pointer; display: grid; place-items: center;
                   transition: border-color .25s, color .25s; }
.lightbox__close svg { width: 20px; height: 20px; }
.lightbox__close:hover { border-color: var(--accent); color: var(--accent); }
.lightbox__close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Узкие экраны: сетка 3×, телефон — оверлей на весь экран ---- */
@media (max-width: 900px) {
  .reels-stage { display: block; }
  .reels-stage::before { display: none; }
  .reels-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .tile { border-radius: 12px; }
  .tile__title { display: none; }
  .phone { display: none; width: auto; }
  /* justify-self: end из десктопной раскладки действует и на fixed-элемент:
     без сброса телефон схлопывается в нулевую ширину у правого края. */
  .phone.is-open { display: block; position: fixed; inset: 0; width: 100%; height: 100%; justify-self: auto; z-index: 10000; }
  .phone__frame { height: 100%; padding: 0; border-radius: 0; box-shadow: none; }
  .phone__screen { height: 100%; aspect-ratio: auto; border-radius: 0; }
  .phone__island, .phone__status, .phone__home, .phone__nav { display: none; }
  .reels__top { top: calc(env(safe-area-inset-top, 0px) + 12px); }
  .reels__close { display: grid; }
  .phone__tabs { height: calc(60px + env(safe-area-inset-bottom, 0px)); padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
  .reel__rail { bottom: calc(82px + env(safe-area-inset-bottom, 0px)); }
  .reel__meta { bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  .reel__progress { bottom: calc(60px + env(safe-area-inset-bottom, 0px)); }
  .works-ads { gap: 14px; }
  .lightbox video { border-radius: 14px; }
}
html.is-reels-open, html.is-reels-open body { overflow: hidden; }
/* Шапка движка живёт в корневом контексте наложения выше .page и легла бы
   поверх оверлея — пока лента открыта, шапку прячем. */
html.is-reels-open .sw-topbar { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
  .reels__hint-hand, .reels__hint-chev, .reel__audio-track > span, .rail__btn--like.is-liked svg { animation: none; }
  .reel__spin { animation: none; border-top-color: rgba(255,255,255,.25); border-color: #fff; }
  .reel.is-burst .reel__burst svg { animation-duration: .01s; }
  .phone__sheet-body { animation: none; }
  .tile img, .work__thumb img { transition: none; }
}
