/* Главная: навигатор разделов, hero со сборкой, услуги-бенто, флик-галерея, маршрут этапов, веер форматов, загрузка */

/* Левый навигатор разделов */
.rail { position: fixed; left: 10px; top: 50%; translate: 0 -50%; z-index: 90; display: flex; flex-direction: column; gap: .35rem; mix-blend-mode: difference; color: #fff; font-size: 11px; }
.rail a { position: relative; padding: .2rem .7rem; opacity: .4; transition: opacity .3s; }
.rail a::before, .rail a::after { content: ""; position: absolute; top: 50%; width: 6px; height: 1px; background: #fff; scale: 0 1; transition: scale .35s var(--ease); }
.rail a::before { left: 0; } .rail a::after { right: 0; }
.rail a:hover, .rail a[aria-current="true"] { opacity: 1; }
.rail a[aria-current="true"]::before, .rail a[aria-current="true"]::after { scale: 1 1; }
@media (max-width: 899px) { .rail { display: none; } }

/* Hero */
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: center; overflow: hidden; padding-block: 7rem 4rem; }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-copy { position: relative; z-index: 2; max-width: 44rem; pointer-events: none; transition: opacity .6s, filter .6s; }
.hero-copy a { pointer-events: auto; }
.display { font-size: clamp(2.8rem, 6.2vw, 7rem); font-weight: 600; letter-spacing: -.04em; line-height: .95; }
.hero-foot { position: absolute; z-index: 2; left: var(--gutter); right: var(--gutter); bottom: 1.2rem; display: flex; justify-content: space-between; align-items: center; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; }
.hero-foot > span { opacity: .55; }
.hero-word { position: absolute; left: 50%; bottom: -.2em; translate: -50% 0; z-index: 1; margin: 0; font-size: 26vw; font-weight: 700; letter-spacing: -.07em; line-height: 1; white-space: nowrap; color: transparent; -webkit-text-stroke: 1px rgb(242 242 237 / .1); pointer-events: none; user-select: none; }

/* Сборка: частицы собираются в слово, пока зажата мышь, пробел или кнопка «Зажмите» */
.hero.is-holding .hero-copy { opacity: .12; filter: blur(3px); }
.hero.is-built:not(.is-holding) .hero-copy { transition-delay: 1.2s; }
.hold-words { position: absolute; left: 50%; top: 40%; z-index: 2; translate: -50% -50%; margin: 0; font-size: clamp(2.4rem, 7vw, 6.5rem); font-weight: 600; letter-spacing: -.045em; line-height: 1; white-space: nowrap; pointer-events: none; }
.hold-words .ch { display: inline-block; white-space: pre; opacity: 0; translate: 0 .35em; animation: letter-in .55s var(--ease) forwards; animation-delay: calc(var(--i) * 30ms); }
.hold-words .accent { color: var(--accent); }
.hold-words.is-leaving { opacity: 0; transition: opacity .35s; }
@keyframes letter-in { to { opacity: 1; translate: 0 0; } }
.hold-btn { display: none; align-items: center; gap: .7rem; padding: .5rem .8rem; border: 0; border-radius: 999px; background: rgb(12 12 11 / .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); color: inherit; font: inherit; letter-spacing: .14em; text-transform: uppercase; cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.js .hold-btn { display: inline-flex; }
.js .scroll-hint { display: none; }
.hold-ring { width: 26px; height: 26px; border-radius: 50%; background: conic-gradient(var(--accent) calc(var(--hold, 0) * 360deg), rgb(242 242 237 / .25) 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px)); }
.cursor.is-hint .cursor-label:not(:empty) { opacity: 1; translate: 20px 0; }
.cursor-ring::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; background: conic-gradient(#fff calc(var(--hold, 0) * 360deg), transparent 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px)); }
.cursor.is-holding .cursor-ring { transform: scale(.75); }
@media (prefers-reduced-motion: reduce) {
  .js .hold-btn, .hold-words { display: none; }
  .js .scroll-hint { display: inline; }
}

/* Первый экран на широких и невысоких экранах: слово-контур занимает нижнюю полосу, текст и кнопки стоят над ним */
@media (min-width: 761px) {
  .hero { --word: min(26vw, 44svh); padding-block: 6.5rem calc(var(--word) * .72 + 2.5rem); }
  .hero-word { font-size: var(--word); }
  .hero-copy { max-width: min(62rem, 100%); }
  .display { font-size: clamp(2.6rem, min(6.2vw, 10.5svh), 7rem); }
}
/* Телефон: текст сразу под шапкой, слово-контур над кнопкой, чтобы сборку было видно целиком */
@media (max-width: 760px) {
  .hero { justify-content: flex-start; padding-top: 6rem; padding-bottom: calc(25vw + 5.5rem); }
  .hero-word { bottom: 3.6rem; font-size: 25vw; }
}

/* Услуги: бенто и слово-подложка */
.services { padding-block: clamp(6rem, 12vw, 10rem); overflow: hidden; }
.ghost-word { position: absolute; top: clamp(1rem, 3vw, 2.5rem); left: 50%; translate: -50% 0; margin: 0; font-size: 21vw; font-weight: 700; letter-spacing: -.06em; line-height: .8; white-space: nowrap; background: linear-gradient(to bottom, rgb(12 12 11 / .17) 25%, rgb(12 12 11 / .04) 90%); -webkit-background-clip: text; background-clip: text; color: transparent; pointer-events: none; user-select: none; }
.bento { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(15rem, auto); gap: 12px; }
.tile-wide { grid-column: span 2; }
.tile-tall { grid-row: span 2; }
.tile-ink { background: var(--ink); color: var(--paper); }
.tile-ink:hover { background: var(--accent); color: var(--ink); }
.tile-accent { background: var(--accent); border-color: transparent; }
.flow { position: absolute; top: 4.5rem; left: 1.6rem; right: 1.6rem; display: flex; justify-content: space-between; align-items: center; }
.flow::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px dashed currentColor; opacity: .35; }
.flow i { position: relative; font-style: normal; font-size: .75rem; padding: .35rem .7rem; border: 1px solid currentColor; border-radius: 999px; background: var(--ink); }
.tile-ink:hover .flow i { background: var(--accent); }
@media (max-width: 900px) { .bento { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .bento { grid-template-columns: 1fr; grid-auto-rows: minmax(12rem, auto); } .tile-wide { grid-column: auto; } .tile-tall { grid-row: auto; min-height: 16rem; } }
@media (hover: none) {
  .tile-ink:hover { background: var(--ink); color: var(--paper); }
  .tile-accent:hover { background: var(--accent); color: var(--ink); }
}

/* Работы: флик-галерея. Фон секции берёт тон проекта (пипетка) */
.work { padding-block: clamp(6rem, 12vw, 10rem); transition: background-color .8s ease; }
.flick { display: flex; gap: 6px; height: min(82svh, 46rem); }
.flick-item { position: relative; flex: 1 1 0; min-width: 0; overflow: hidden; border-radius: 14px; background: var(--ink-2); transition: flex-grow .9s var(--ease); }
.flick-item.is-active { flex-grow: 5; }
.flick-item > img, .flick-item .art { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); transform: scale(1.1); transition: filter .8s, transform 1.2s var(--ease); }
.flick-item.is-active > img, .flick-item.is-active .art { filter: none; transform: scale(1); }
.flick-item::before { content: ""; position: absolute; inset: 0; z-index: 2; background: linear-gradient(to top, rgb(8 8 8 / .94) 0%, rgb(8 8 8 / .7) 30%, rgb(8 8 8 / 0) 70%); pointer-events: none; }
.flick-item::after { content: ""; position: absolute; inset: 0; z-index: 2; backdrop-filter: blur(8px); background: rgb(12 12 11 / .35); transition: opacity .6s; pointer-events: none; }
.flick-item.is-active::after { opacity: 0; }
.flick-hit { position: absolute; inset: 0; z-index: 3; width: 100%; border: 0; padding: 0; background: none; color: var(--paper); font: inherit; cursor: pointer; text-align: left; }
.is-active .flick-hit { z-index: 1; cursor: default; }
.flick-hit:focus-visible { outline-offset: -4px; }
.flick-tab { position: absolute; left: 50%; top: 1.2rem; translate: -50% 0; writing-mode: vertical-rl; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; transition: opacity .4s; }
.flick-tab b { font-weight: 400; opacity: .6; }
.is-active .flick-tab { opacity: 0; }
.flick-body { position: absolute; left: 0; bottom: 0; z-index: 4; max-width: 30rem; padding: clamp(1.2rem, 3vw, 2.2rem); color: var(--paper); opacity: 0; translate: 0 1rem; pointer-events: none; transition: opacity .5s, translate .7s var(--ease); }
.is-active .flick-body { opacity: 1; translate: 0 0; pointer-events: auto; transition-delay: .35s; }
.flick-body h3 { font-size: clamp(1.6rem, 3vw, 2.6rem); letter-spacing: -.04em; margin-bottom: .6rem; }
.flick-body p:not(.eyebrow) { opacity: .75; margin-bottom: 1rem; }
/* Без JS все карточки раскрыты одинаково: тексты и ссылки доступны */
html:not(.js) .flick-item { flex-grow: 1; }
html:not(.js) .flick-item::after, html:not(.js) .flick-tab { opacity: 0; }
html:not(.js) .flick-body { opacity: 1; translate: none; pointer-events: auto; }
html:not(.js) .flick-item > img, html:not(.js) .flick-item .art { filter: none; transform: none; }
@media (max-width: 760px) {
  .flick { flex-direction: column; height: auto; gap: 12px; }
  .flick-item, .flick-item.is-active { flex: none; height: auto; aspect-ratio: 4 / 5; }
  .flick-item::after { opacity: 0; }
  .flick-item > img, .flick-item .art { filter: none; transform: none; }
  .flick-hit { display: none; }
  .flick-body { opacity: 1; translate: none; pointer-events: auto; }
}

/* Туманный переход тёмное → светлое */
.mist { height: 45vh; background: linear-gradient(to bottom, var(--ink) 0%, #262624 25%, #6f6f6b 55%, #c9c9c3 80%, var(--paper) 100%); margin-block: -1px; }

/* Этапы: маршрут с точкой и эхом */
main > .process { height: 280svh; padding: 0; }
.process-sticky { position: sticky; top: 0; min-height: 100svh; display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 2rem; align-items: center; padding: 6rem var(--gutter) 3rem max(var(--gutter), 4.5rem); }
.coords { display: flex; justify-content: space-between; gap: 1rem; max-width: 26rem; margin-top: 2.5rem; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; opacity: .65; }
.process .head-more { margin-top: 2rem; }
.route { position: relative; height: min(80svh, 48rem); }
.route-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.route-svg path { fill: none; vector-effect: non-scaling-stroke; }
.route-base { stroke: rgb(12 12 11 / .16); stroke-width: 1.5; stroke-dasharray: 2 5; }
.route-flown { stroke: var(--ink); stroke-width: 2; }
.route-dot { position: absolute; left: 50%; top: 0; z-index: 2; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 4px var(--accent); display: none; }
.js .route-dot { display: block; }
.route-dot i { position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; translate: -50% -50%; border: 1px solid var(--ink); border-radius: 50%; opacity: 0; animation: echo 2.2s infinite; }
.route-dot i:nth-child(2) { animation-delay: .25s; } .route-dot i:nth-child(3) { animation-delay: .5s; }
@keyframes echo { 0% { opacity: .8; width: 100%; height: 100%; } 60% { opacity: 0; width: 520%; height: 520%; } 100% { opacity: 0; } }
.stations li { position: absolute; top: calc(var(--at) * 100%); left: 56%; width: 44%; translate: 0 -50%; transition: opacity .5s, translate .7s var(--ease); }
.stations li:nth-child(even) { left: auto; right: 56%; text-align: right; }
.js .stations li { opacity: .3; }
.js .stations li.is-on { opacity: 1; }
.stations .num { display: inline-block; font-size: .75rem; padding: .2rem .55rem; border: 1px solid currentColor; border-radius: 999px; margin-bottom: .6rem; transition: background-color .4s; }
.stations li.is-on .num { background: var(--accent); border-color: var(--accent); }
.stations p { font-size: .92rem; opacity: .7; margin-top: .4rem; }
@media (max-width: 860px), (prefers-reduced-motion: reduce) {
  main > .process { height: auto; }
  .process-sticky { position: static; grid-template-columns: 1fr; padding-block: 6rem; }
  .route { height: auto; }
  .route-svg, .js .route-dot { display: none; }
  .stations { border-left: 1px solid rgb(12 12 11 / .2); }
  .stations li, .stations li:nth-child(even) { position: relative; top: auto; left: auto; right: auto; width: auto; translate: none; text-align: left; padding: 0 0 2.2rem 1.6rem; }
  .js .stations li { opacity: 1; }
  .stations li::before { content: ""; position: absolute; left: -5px; top: .55rem; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); }
}
/* Этапы на телефоне: вертикальная линия заполняется при прокрутке, точка с эхом едет по ней */
@media (max-width: 860px) and (prefers-reduced-motion: no-preference) {
  .stations { position: relative; }
  .js .stations::after { content: ""; position: absolute; left: -1px; top: 0; width: 2px; height: 100%; background: var(--ink); transform-origin: top; transform: scaleY(var(--fill, 0)); }
  .js .route-dot { display: block; left: 0; top: 0; }
  .js .stations li { opacity: 1; }
  .js .stations li.is-on { opacity: 1; }
  .stations li.is-on::before { background: var(--accent); box-shadow: 0 0 0 2px var(--ink); }
}
/* Без JS на широком экране — простой вертикальный список вместо маршрута */
@media (min-width: 861px) {
  html:not(.js) main > .process { height: auto; }
  html:not(.js) .process-sticky { position: static; }
  html:not(.js) .route { height: auto; }
  html:not(.js) .route-svg { display: none; }
  html:not(.js) .stations li, html:not(.js) .stations li:nth-child(even) { position: relative; top: auto; left: auto; right: auto; width: auto; translate: none; text-align: left; padding-bottom: 2rem; }
}

/* Форматы: карточки веером */
.fan { --fan: 1; display: flex; justify-content: center; align-items: flex-end; padding-block: 2rem 3rem; }
.card { position: relative; width: min(22rem, 100%); min-height: 25rem; display: flex; flex-direction: column; padding: 2rem; border-radius: 6px; box-shadow: 0 40px 60px -35px rgb(0 0 0 / .45); transform: translateY(calc((1 - var(--fan)) * 70%)) rotate(calc(var(--r) * (1 + (1 - var(--fan)) * 2.2))); transform-origin: 50% 100%; }
.card:nth-child(1) { margin-right: -1.2rem; }
.card:nth-child(2) { z-index: 2; margin-bottom: 2.5rem; }
.card:nth-child(3) { margin-left: -1.2rem; }
.card h3 { font-size: 1.9rem; letter-spacing: -.04em; margin-bottom: 1.2rem; }
.card ul { margin: 0 0 2rem; }
.card li { padding: .6rem 0; border-bottom: 1px dashed color-mix(in srgb, currentColor 25%, transparent); font-size: .95rem; }
.card .pill { margin-top: auto; align-self: flex-start; }
.card-paper { background: #faf9f4; color: var(--ink); }
.card-accent { background: var(--accent); color: var(--ink); }
.card-ink { background: var(--ink); color: var(--paper); }
.fan + .note { text-align: center; }
@media (max-width: 860px) {
  .fan { flex-direction: column; align-items: center; }
  .card, .card:nth-child(n) { margin: 0 0 1rem; transform: rotate(calc(var(--r) / 4)); }
}
@media (prefers-reduced-motion: reduce) { .fan { --fan: 1 !important; } }

/* Загрузка: колонки сетки закрывают экран, логотип рисуется, счётчик 000→100, затем колонки уезжают вверх */
.loader { display: none; }
.js.is-loading .loader, .js .loader.is-leaving { display: block; }
/* Если JS не отработал — через 7 секунд страница всё равно откроется */
html.is-loading { overflow: hidden; animation: loader-unlock 0s 7s forwards; }
.js.is-loading .loader { animation: loader-failsafe 0s 7s forwards; }
@keyframes loader-unlock { to { overflow: visible; } }
@keyframes loader-failsafe { to { visibility: hidden; } }
.loader { position: fixed; inset: 0; z-index: 10001; color: var(--paper); }
.loader.is-leaving { pointer-events: none; }
.loader-cols { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(6, 1fr); }
.loader-cols i { background: var(--ink); border-left: 1px solid rgb(242 242 237 / .06); transform-origin: top; transition: transform .45s var(--ease) calc(var(--n) * 35ms); }
.loader-cols i:nth-child(1) { --n: 0; } .loader-cols i:nth-child(2) { --n: 1; } .loader-cols i:nth-child(3) { --n: 2; }
.loader-cols i:nth-child(4) { --n: 3; } .loader-cols i:nth-child(5) { --n: 4; } .loader-cols i:nth-child(6) { --n: 5; }
.loader.is-leaving .loader-cols i { transform: scaleY(0); }
.loader-mark { position: absolute; left: 50%; top: 50%; translate: -50% -50%; display: flex; align-items: center; gap: 14px; }
.loader-symbol { width: clamp(44px, 6vw, 64px); height: auto; overflow: visible; }
.loader-square { fill: var(--ink); stroke: var(--accent); stroke-width: 3; stroke-dasharray: 1; stroke-dashoffset: 1; animation: loader-draw 1s var(--ease) forwards; }
.loader-square-front { animation-delay: .15s; }
@keyframes loader-draw { to { stroke-dashoffset: 0; } }
.loader-word { font-size: clamp(40px, 7vw, 72px); font-weight: 650; letter-spacing: -.065em; line-height: 1.1; padding-right: .08em; clip-path: inset(0 100% 0 0); animation: loader-word .6s .1s var(--ease) forwards; }
.loader-word b { font-weight: inherit; transition: color .35s; }
.loader.is-done .loader-word b { color: var(--accent); }
@keyframes loader-word { to { clip-path: inset(0 0 0 0); } }
.loader-bar { position: absolute; left: 50%; top: calc(50% + clamp(48px, 6vw, 72px)); translate: -50% 0; width: 180px; height: 2px; background: rgb(242 242 237 / .14); overflow: hidden; }
.loader-bar i { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(var(--p, 0)); }
.loader-count { position: absolute; left: var(--gutter); bottom: .6rem; margin: 0; display: flex; align-items: flex-start; font-size: clamp(4rem, 12vw, 10rem); font-weight: 600; letter-spacing: -.05em; line-height: 1; }
.loader-count small { font-size: .22em; margin: .35em 0 0 .25em; opacity: .5; letter-spacing: 0; }
.loader-digits { display: flex; }
.loader-digit { display: block; width: .6em; height: 1em; overflow: hidden; text-align: center; }
.loader-reel { display: block; transition: transform .5s var(--ease); }
.loader-reel span { display: block; height: 1em; }
.loader-label { position: absolute; right: var(--gutter); bottom: 1.6rem; margin: 0; font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; opacity: .6; }
.loader.is-leaving :is(.loader-mark, .loader-bar, .loader-count, .loader-label) { opacity: 0; transform: translateY(-2rem); transition: opacity .4s, transform .7s var(--ease); }
@media (max-width: 600px) { .loader-label { bottom: auto; top: 1.4rem; } }
