/* Айдар Хуснутдинов — вторая версия.
   Первый экран как в основной версии, виден сразу. Дальше текст и лучшая песня
   рядом: пока читаешь, DIRT перед глазами. Потом «комната прослушивания» — сетка 3×3,
   за которой дышит живой градиент из цветов обложки. Тот же градиент светится сквозь
   мазки имени.
   Крупные надписи пишет кисть Shygyrt, остальное — Rubik. */

:root{
  --ink:#16151A; --paper:#EEECE6; --dim:#64625E; --line:#D2CEC4;
  --red:#E8331F; --blue:#1F3BE8; --yellow:#F2C21B;
  --f-text:'Rubik', system-ui, -apple-system, sans-serif;
  --f-mono:'JetBrains Mono', ui-monospace, monospace;
  --gut:clamp(18px,4vw,48px);
  --barH:80px; --navW:340px;   /* место под меню вместе с переключателем языка */
  --wide:1240px;
  --ease:cubic-bezier(.2,.8,.2,1);
}

*,*::before,*::after{ box-sizing:border-box }
html{ -webkit-text-size-adjust:100%; scroll-behavior:smooth; scroll-padding-top:64px }
body{
  margin:0; background:var(--paper); color:var(--ink);
  font:400 20px/1.6 var(--f-text);
  overflow-x:hidden;
}
img{ max-width:100%; display:block }
a{ color:inherit }
button{ font:inherit; color:inherit }
::selection{ background:var(--yellow); color:var(--ink) }
:focus-visible{ outline:3px solid var(--blue); outline-offset:2px }

/* ---------- Надписи кистью ---------- */
/* Картинка держит место, пока кисть не начала писать на холсте. */
[data-brush]{ margin:0 }
[data-brush] canvas{ display:block; height:auto }
.js [data-brush]:not(.is-img) > img{ visibility:hidden }

/* ---------- 1. Имя ---------- */
/* h1 держит место под шапку; имя в шапке рисует JS ровно поверх него */
.name{ margin:0; height:var(--barH); padding:0 var(--gut); display:flex; align-items:center }
.name img, .name canvas{ display:block; height:auto; width:min(calc(var(--barH) * .5 * var(--nameAR, 1791 / 186)), calc(100vw - 2 * var(--gut) - var(--navW))) }

/* ---------- 2. Фото и кисть ---------- */
.hero{ margin:0; position:relative; overflow:hidden }
.hero img{ width:100%; height:min(70vh,43.48vw); object-fit:cover; object-position:center 30% }   /* как в основной версии */
/* Контур: бумага сайта, видна только сквозь маску-линию. Маска кадрируется так же, как фото (cover, center 30%). */
.hero__line{ position:absolute; inset:0; width:100%; height:100%; pointer-events:none; background:var(--paper);
  -webkit-mask:url(img/outline.png?v=5) center 30% / cover no-repeat; mask:url(img/outline.png?v=5) center 30% / cover no-repeat }

/* ---------- 3. Что я делаю: слова тушью на полях штриховки ---------- */
/* Под словами три размытые объёмные кляксы своих цветов (тушь, жёлтый, красный),
   наползают друг на друга; текут под музыку и застывают в тишине (JS). */
.skills{
  list-style:none; display:flex; flex-wrap:wrap; gap:0; padding:0;
  /* слова под фото, полоса красок над ними заходит на низ снимка */
  margin:calc(-.5 * clamp(24px,2.6vw,38px) + 14px) 0 0;
  text-align:center; position:relative; z-index:2; isolation:isolate;
}
.skills li{ flex:1 1 0; min-width:0; position:relative; z-index:1; display:flex; justify-content:center; padding:clamp(8px,1vw,14px) clamp(8px,1.2vw,16px) }
.skills li.skills__bg{ position:absolute; inset:-48px 0; z-index:0; padding:0; flex:none }   /* холст с запасом: мягкий край капель не обрезается */
.skills__bg canvas{ display:block; width:100%; height:100% }
.word{ display:block; position:relative; padding:.5em 1.6em; margin:-.5em -1.6em }
/* Под словом — расчищенная клякса: несколько мягких комков разного размера и брызги
   вокруг. Комки (::before) и брызги (::after) дышат с разным периодом, поэтому
   форма всё время чуть перетекает. Только transform — работает видеокарта.
   У каждого слова клякса своя: развёрнута и растянута по-другому. */
.word::before, .word::after{ content:""; position:absolute; z-index:-1; pointer-events:none }
.word::before{
  inset:-1.4em -2em;   /* с запасом: комки затухают внутри, срезов нет */
  background:
    radial-gradient(ellipse 30% 46% at 32% 54%, rgba(238,236,230,.62) 0%, rgba(238,236,230,.42) 35%, rgba(238,236,230,.16) 65%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 28% 52% at 48% 46%, rgba(238,236,230,.62) 0%, rgba(238,236,230,.42) 35%, rgba(238,236,230,.16) 65%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 26% 44% at 63% 57%, rgba(238,236,230,.62) 0%, rgba(238,236,230,.42) 35%, rgba(238,236,230,.16) 65%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 18% 36% at 74% 45%, rgba(238,236,230,.62) 0%, rgba(238,236,230,.42) 35%, rgba(238,236,230,.16) 65%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 10% 22% at 22% 41%, rgba(238,236,230,.62) 0%, rgba(238,236,230,.42) 35%, rgba(238,236,230,.16) 65%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 9% 18% at 53% 72%, rgba(238,236,230,.62) 0%, rgba(238,236,230,.42) 35%, rgba(238,236,230,.16) 65%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 8% 16% at 38% 30%, rgba(238,236,230,.62) 0%, rgba(238,236,230,.42) 35%, rgba(238,236,230,.16) 65%, rgba(238,236,230,0) 100%);
  animation:breathe 6s ease-in-out infinite alternate;
}
.word::after{
  inset:-.9em -1.1em;
  /* брызги — неровные овалы с мягким краем, не идеальные кружки */
  background:
    radial-gradient(ellipse 5px 3px at 5% 70%, rgba(238,236,230,.6), rgba(238,236,230,.25) 55%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 4px 6px at 95% 24%, rgba(238,236,230,.6), rgba(238,236,230,.25) 55%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 3px 2px at 89% 84%, rgba(238,236,230,.6), rgba(238,236,230,.25) 55%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 6px 3.5px at 29% 8%, rgba(238,236,230,.6), rgba(238,236,230,.25) 55%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 3px 4.5px at 71% 94%, rgba(238,236,230,.6), rgba(238,236,230,.25) 55%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 8px 5px at 97% 58%, rgba(238,236,230,.6), rgba(238,236,230,.25) 55%, rgba(238,236,230,0) 100%),
    radial-gradient(ellipse 4px 2.5px at 8% 30%, rgba(238,236,230,.6), rgba(238,236,230,.25) 55%, rgba(238,236,230,0) 100%);
  animation:drift 11s ease-in-out infinite alternate;
}
.skills li:nth-child(1) .word::before, .skills li:nth-child(1) .word::after{ --flip:1; --tilt:-2deg }
.skills li:nth-child(2) .word::before, .skills li:nth-child(2) .word::after{ --flip:-1; --tilt:3deg }
.skills li:nth-child(3) .word::before, .skills li:nth-child(3) .word::after{ --flip:1; --tilt:6deg }
.skills li:nth-child(2) .word::before{ animation-duration:7.3s; animation-delay:-3s }
.skills li:nth-child(3) .word::before{ animation-duration:8.6s; animation-delay:-6s }
.skills li:nth-child(2) .word::after{ animation-duration:13s; animation-delay:-5s }
.skills li:nth-child(3) .word::after{ animation-duration:15s; animation-delay:-9s }
@keyframes breathe{
  0%  { transform:scale(calc(var(--flip,1) * .92),.86) rotate(calc(var(--tilt,0deg) - 3deg)) }
  50% { transform:scale(calc(var(--flip,1) * 1.03),1.12) rotate(calc(var(--tilt,0deg) + 1deg)) }
  100%{ transform:scale(calc(var(--flip,1) * 1.12),.98) rotate(calc(var(--tilt,0deg) + 3deg)) }
}
@keyframes drift{
  0%  { transform:scale(calc(var(--flip,1) * .94),.9) rotate(var(--tilt,0deg)) translateX(-2%) }
  100%{ transform:scale(calc(var(--flip,1) * 1.08),1.1) rotate(calc(var(--tilt,0deg) - 4deg)) translateX(2%) }
}
.word img{ height:clamp(24px,2.6vw,38px); width:auto; max-width:100% }
/* Слова проявляются мягко, по очереди. */
.js .word img{ animation:wordIn 1.6s var(--ease) both }
.skills li:nth-child(2) .word img{ animation-delay:.35s }
.skills li:nth-child(3) .word img{ animation-delay:.7s }
@keyframes wordIn{ from{ opacity:0; filter:blur(4px) } to{ opacity:1; filter:none } }


/* ---------- Шапка: имя слева, меню справа — сразу, без анимации ---------- */
.bar{
  position:fixed; inset:0 0 auto; z-index:90; height:var(--barH);
  display:flex; align-items:center; justify-content:flex-end; padding:0 var(--gut);
  background:var(--paper); transition:box-shadow .4s;
}
.bar.is-small{ box-shadow:0 1px 0 #16151A14, 0 8px 20px -14px #16151A55 }
/* Имя в шапке ставит JS ровно на место h1. */
.bar__name{ position:absolute; left:0; top:0; transform-origin:0 0; will-change:transform }
.bar__name img{ display:block; width:100%; height:auto }
.bar__name.is-letters img{ display:none }
.bar__name canvas{ position:absolute; display:block }
.js .name img{ visibility:hidden }
.bar__nav{ display:flex; gap:clamp(14px,2.4vw,32px); font-size:16px; font-weight:500; position:relative }
/* Меню проявляется справа, когда буквы дошли до угла. */
/* Слово проступает из размытия, буквы съезжаются к своему месту. */
.bar.menu .bar__nav a{ opacity:1; filter:none; letter-spacing:0; pointer-events:auto;
  transition:opacity 1.1s ease, filter 1.3s var(--ease), letter-spacing 1.4s var(--ease), background-size .3s var(--ease) }
.bar.menu .bar__nav a:nth-child(2){ transition-delay:.25s }
.bar.menu .bar__nav a:nth-child(3){ transition-delay:.5s }
.bar.menu .bar__nav a:nth-child(4){ transition-delay:.75s }
/* Переключатель языка — тише меню и чуть в стороне. */
.bar__lang{ color:var(--dim); margin-left:clamp(0px,1vw,12px) }
.bar__nav a{ text-decoration:none; padding:6px 0; background:linear-gradient(var(--red),var(--red)) 0 100% / 0 2px no-repeat; transition:background-size .3s var(--ease) }
.bar__nav a:hover{ background-size:100% 2px }

/* ---------- 4. Текст и лучшая песня рядом ---------- */
.story{
  max-width:var(--wide); margin:0 auto;
  padding:clamp(14px,1.5vw,22px) var(--gut) clamp(60px,8vw,110px);
  display:grid; grid-template-columns:minmax(0,1.15fr) minmax(0,1fr); gap:clamp(30px,6vw,90px);
  align-items:end;
}
.story__aside{ margin:0 0 1.4em; color:var(--dim); font-size:clamp(19px,1.7vw,22px); line-height:1.45 }
.story__lead{ margin:0 0 .2em; font-size:clamp(19px,1.7vw,22px) }
.story__h{ margin:0 0 .8em }
.story__h img, .story__h canvas{ width:min(100%,520px); height:auto }
.story__p{ margin:0 0 1.4em; font-size:clamp(20px,1.75vw,24px); line-height:1.55 }
.story__to{ margin:0; font-size:clamp(20px,1.75vw,24px); font-weight:500 }
.story__best{ position:sticky; bottom:clamp(20px,4vh,40px); align-self:end; isolation:isolate }
.best__list{ list-style:none; margin:0; padding:0 }
/* Стрелка кистью от конца фразы к песне. Левый край, ширину и высоту ставит скрипт. */
.story__arrow{ position:absolute; left:0; top:0; width:0; pointer-events:none; z-index:1 }
.story__arrow img, .story__arrow canvas{ display:block; width:100%; height:auto }
/* Когда играет DIRT, оживает вся полоса экрана: живой градиент во всю ширину окна,
   сверху и снизу растворяется в бумаге. */
.story{ position:relative; isolation:isolate }
.story__glow{
  position:absolute; top:0; bottom:0; left:50%; width:100vw; height:100%; margin-left:-50vw; z-index:-1;
  pointer-events:none;
  -webkit-mask-image:linear-gradient(transparent, #000 14%, #000 86%, transparent);
          mask-image:linear-gradient(transparent, #000 14%, #000 86%, transparent);
}

/* ---------- Карточка песни: обложка + полоска-плеер + подписи ---------- */
.card{ display:block; position:relative; isolation:isolate }
/* Свечение играющей обложки — её же цвета, размытые. Не пульсирует: музыку и так видно по фону. */
.card::before{
  content:""; position:absolute; left:0; right:0; top:0; aspect-ratio:1; z-index:-1;
  background:var(--cov) center / cover no-repeat; filter:blur(48px) saturate(1.7);
  opacity:0; transform:scale(.9); transition:opacity .8s, transform .8s var(--ease);
  pointer-events:none;
}
.card.is-play::before{ opacity:.75; transform:scale(1.08) }
.card__cover{ display:block; position:relative; aspect-ratio:1; border:2px solid var(--ink); background:#E3E0D7; overflow:hidden }

.card__cover img{ width:100%; height:100%; object-fit:cover; transition:transform .5s var(--ease) }
.card:hover .card__cover img{ transform:scale(1.03) }
.strip{
  display:flex; align-items:center; gap:10px; margin-bottom:12px;
  border:2px solid var(--ink); border-top:0; padding:6px 8px; background:var(--paper);
}
.strip__play{
  width:36px; height:36px; flex:0 0 auto; padding:0;
  border:2px solid var(--ink); background:var(--yellow); color:var(--ink);
  font:14px/1 var(--f-text); cursor:pointer;
}
.strip__play:hover, .is-play .strip__play{ background:var(--red); color:var(--paper) }
.strip__wave{ flex:1; height:24px; cursor:pointer; min-width:0 }
.strip__wave rect{ fill:var(--ink) }
.strip__wave .base rect{ opacity:.22 }
.strip__wave .played rect{ fill:var(--red) }
.strip__time{ font:400 12px/1 var(--f-mono); color:var(--dim); min-width:34px; text-align:right; font-variant-numeric:tabular-nums }
.card__name{ display:block; font-size:clamp(17px,1.4vw,19px); font-weight:500; line-height:1.3 }
.card__role{ display:block; margin-top:4px; font-size:16px; line-height:1.4; color:var(--dim) }
.card--best .card__name{ font-size:clamp(19px,1.7vw,23px) }
.card--best .card__role{ font-size:17px }
.card--best .strip__play{ width:42px; height:42px; font-size:16px }

/* ---------- 5. Комната прослушивания ---------- */
.room{ position:relative; background:var(--ink); color:var(--paper); overflow:hidden }
.room__glow{ position:absolute; inset:0; width:100%; height:100%; pointer-events:none }
.room__in{
  position:relative; max-width:var(--wide); margin:0 auto;
  padding:clamp(14px,1.5vw,22px) var(--gut) clamp(60px,8vw,110px);
}
.room__lead{ margin:0 0 .1em; font-size:clamp(20px,1.9vw,26px) }
.room__h{ margin:0 0 clamp(26px,3.4vw,46px) }
.room__h img, .room__h canvas{ width:clamp(180px,24vw,330px); height:auto }
.grid{
  list-style:none; margin:0; padding:0;
  display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:clamp(26px,3vw,44px) clamp(18px,2.4vw,34px);
}
.room .card__cover{ border-color:var(--paper) }
.room .strip{ background:var(--ink); border-color:var(--paper) }
.room .strip__play{ border-color:var(--paper) }
.room .strip__wave rect{ fill:var(--paper) }
.room .strip__wave .played rect{ fill:var(--yellow) }
.room .strip__time, .room .card__role{ color:#EEECE6a6 }

/* ---------- 6. Письмо ---------- */
.write{ position:relative; isolation:isolate; background:var(--red); color:var(--paper); padding:clamp(50px,7vw,96px) var(--gut) clamp(50px,7vw,90px) }
.write > *{ max-width:900px; margin-left:auto; margin-right:auto }
.write > .write__glow{ position:absolute; inset:0; width:100%; height:100%; max-width:none; z-index:-1; pointer-events:none }
.write__lead{ margin-top:0; margin-bottom:clamp(16px,2.4vw,28px); font-size:clamp(20px,1.9vw,26px); line-height:1.45 }
.write__lead{ margin-bottom:.15em }
.write__h{ margin-bottom:clamp(26px,3.4vw,46px) }
.write__h img, .write__h canvas{ width:min(100%,640px); height:auto }
.form{ display:grid; grid-template-columns:1fr 1fr; gap:clamp(18px,2.4vw,28px) clamp(20px,3vw,40px) }
.f{ display:block }
.f--wide{ grid-column:1 / -1 }
.f__l{ display:block; font-size:16px; margin-bottom:6px }
.f__l i{ font-style:normal; opacity:.7 }
.f__i{
  width:100%; border:0; border-bottom:2px solid #EEECE6aa; background:transparent; color:var(--paper);
  font:400 clamp(19px,1.8vw,22px)/1.3 var(--f-text); padding:6px 0 10px; border-radius:0;
}
.f__i:focus{ outline:none; border-bottom-color:var(--paper) }
.f__i.is-bad{ border-bottom-color:var(--yellow) }
.f__t{ resize:vertical; min-height:3.2em }
.hp{ position:absolute; left:-9999px }
.form__end{ grid-column:1 / -1; display:flex; align-items:center; gap:22px; flex-wrap:wrap; margin-top:6px }
.btn{
  border:2px solid var(--ink); cursor:pointer; background:var(--ink); color:var(--paper);
  font:500 20px/1 var(--f-text); padding:.85em 1.6em; transition:background .2s, color .2s;
}
.btn:hover{ background:var(--yellow); color:var(--ink) }
.btn:disabled{ opacity:.6 }
.form__note{ font-size:16px }
.form__note.is-err{ color:var(--yellow) }
.write__fallback{ margin-top:clamp(30px,3.6vw,50px); margin-bottom:0; font-size:16px; opacity:.9 }

/* ---------- Подвал ---------- */
.foot{ background:var(--ink); color:var(--paper); padding:clamp(40px,5vw,70px) var(--gut) 22px }
.foot__name{ margin:0 }
.foot__name img, .foot__name canvas{ width:100%; height:auto }
.foot__row{ margin:20px 0 0; text-align:right; font-size:14px; opacity:.6 }

/* ---------- Мини-плеер ---------- */
.mini{
  position:fixed; right:var(--gut); bottom:var(--gut); z-index:85;
  display:grid; grid-template-columns:44px minmax(0,1fr) 70px 40px; align-items:center; gap:0 12px;
  background:var(--paper); color:var(--ink); padding:8px 8px 12px; max-width:min(380px, calc(100vw - 2 * var(--gut)));
  box-shadow:0 20px 40px -10px #0008, 0 0 0 1px #16151A22;
  transform:translateY(calc(100% + var(--gut) + 30px)); transition:transform .5s var(--ease);
}
.mini.on{ transform:none }
.mini__cover{ width:44px; height:44px; object-fit:cover }
.mini__t{ font-size:14px; font-weight:500; white-space:nowrap; overflow:hidden; text-overflow:ellipsis }
.mini__eq{ width:70px; height:30px }
.mini__btn{ width:40px; height:40px; border:0; border-radius:50%; background:var(--ink); color:var(--paper); cursor:pointer; font-size:13px }
.mini__bar{ position:absolute; left:0; right:0; bottom:0; height:14px; cursor:pointer; touch-action:none;   /* видно 3 px, ловит палец 14 */
  background:linear-gradient(#16151A22,#16151A22) bottom / 100% 3px no-repeat; transition:background-size .2s }
.mini__bar span{ position:absolute; left:0; bottom:0; height:3px; width:0; background:var(--red); transition:height .2s }
.mini__bar:hover{ background-size:100% 6px }
.mini__bar:hover span{ height:6px }
.strip__wave{ touch-action:none }

/* ---------- Планшет и телефон ---------- */
@media (max-width:900px){
  .story{ grid-template-columns:1fr; align-items:start }
  .story__best{ position:relative; max-width:480px }
  .story__arrow{ display:none }
  .grid{ grid-template-columns:repeat(2,minmax(0,1fr)) }
}
@media (max-width:640px){
  body{ font-size:18px }
  .hero img{ height:auto }
  .hero__line{ -webkit-mask-image:url(img/outline-mob.png?v=5); mask-image:url(img/outline-mob.png?v=5) }
  .skills li{ flex:1 1 100% }
  .word img{ height:24px }
  :root{ --barH:60px; --navW:235px }
  .bar__nav{ font-size:14px; gap:12px }
  .form{ grid-template-columns:1fr }
  .card__role{ font-size:15px }
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{ animation:none !important; transition-duration:.01ms !important }
}
