/* Портфолио. Токены — здесь, акцент каждого проекта приходит из projects.json (--accent). */
:root {
  --bg: #0b0c0f;
  --bg-2: #13151a;
  --ink: #f2efe8;
  --muted: #9a9ca3;
  --line: rgba(242, 239, 232, .12);
  --accent: #ff6a1a;
  --head: "Unbounded", "Arial Black", sans-serif;
  --body: "Manrope", system-ui, sans-serif;
  --pad: clamp(16px, 5vw, 72px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--body); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, p { margin: 0; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 6px; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 50; background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 8px; }
.skip:focus { top: 12px; }

/* Фоновая картинка первого экрана: уезжает вместе со страницей (лёгкий параллакс из main.js)
   и плавно растворяется в --bg. Слева чуть темнее — там текст. Пятна .glow идут поверх. */
.backdrop { position: absolute; top: 0; left: 0; width: 100%; height: max(100svh, 620px); z-index: -2; pointer-events: none; overflow: hidden; }
.backdrop::before { content: ""; position: absolute; inset: 0; background: url("../img/backdrop.webp") 70% 30% / cover no-repeat; transform: translate3d(0, var(--by, 0px), 0); will-change: transform; }
.backdrop::after { content: ""; position: absolute; inset: -1px; background:
  linear-gradient(90deg, rgba(11, 12, 15, .55) 0%, rgba(11, 12, 15, .25) 40%, rgba(11, 12, 15, 0) 65%),
  linear-gradient(180deg, rgba(11, 12, 15, .35) 0%, rgba(11, 12, 15, .1) 25%, rgba(11, 12, 15, .15) 50%, rgba(11, 12, 15, .55) 70%, rgba(11, 12, 15, .85) 85%, var(--bg) 100%); }
@media (max-width: 700px) {
  .backdrop::before { background-position: 78% 40%; opacity: .8; }
}

/* Медленно плывущие пятна света на фоне */
.glow { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.glow span { position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%; filter: blur(90px); opacity: .22; animation: drift 26s ease-in-out infinite alternate; }
.glow span:nth-child(1) { background: #ff6a1a; left: -20vmax; top: -25vmax; }
.glow span:nth-child(2) { background: #3fc4d6; right: -25vmax; top: 20vh; animation-duration: 32s; animation-delay: -8s; opacity: .14; }
.glow span:nth-child(3) { background: #d7ed5a; left: 20vw; bottom: -40vmax; animation-duration: 38s; animation-delay: -15s; opacity: .1; }
@keyframes drift { to { transform: translate(8vmax, 6vmax) scale(1.15); } }

.top { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 18px var(--pad); background: rgba(11, 12, 15, .72); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.logo { font: 700 15px/1 var(--head); letter-spacing: .02em; text-decoration: none; }
.top nav { display: flex; gap: 22px; font-weight: 600; font-size: 14px; }
.top nav a { text-decoration: none; padding: 10px 0; opacity: .8; }
.top nav a:hover { opacity: 1; }

.hero { min-height: calc(100svh - 70px); display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 40px var(--pad) 60px; max-width: 1400px; }
.kicker { display: flex; align-items: center; gap: 10px; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #5be37d; box-shadow: 0 0 0 0 rgba(91, 227, 125, .6); animation: pulse 2.2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(91, 227, 125, 0); } 100% { box-shadow: 0 0 0 0 rgba(91, 227, 125, 0); } }
h1 { font: 700 clamp(28px, 8.4vw, 112px)/1.04 var(--head); overflow-wrap: anywhere; letter-spacing: -.035em; max-width: 13ch; }
h1 em { font-style: normal; background: linear-gradient(90deg, #ff6a1a, #e3b062, #d7ed5a, #3fc4d6, #ff6a1a); background-size: 300% 100%; -webkit-background-clip: text; background-clip: text; color: transparent; animation: shine 10s linear infinite; }
@keyframes shine { to { background-position: 300% 0; } }
.lead { font-size: clamp(17px, 1.6vw, 21px); color: #c9c8c3; max-width: 46ch; }
.scroll-cue { display: inline-flex; align-items: center; gap: 14px; width: max-content; text-decoration: none; font-weight: 600; padding: 12px 0; }
.scroll-cue i { display: grid; place-items: center; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; font-style: normal; animation: bob 2.4s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(6px); } }

/* Проекты */
.work { display: grid; gap: clamp(80px, 12vw, 160px); padding: 40px var(--pad) 120px; max-width: 1400px; margin: 0 auto; }
.project { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(28px, 4vw, 64px); align-items: center; }
.project:nth-child(even) .shot { order: 2; }
.shot { display: block; text-decoration: none; perspective: 1200px; position: relative; }
.shot::before { content: ""; position: absolute; inset: 10% 6% -6%; background: var(--accent); filter: blur(70px); opacity: .28; border-radius: 40px; transition: opacity .4s; }
.shot:hover::before { opacity: .45; }
.frame { position: relative; border-radius: 14px; overflow: hidden; background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0, 0, 0, .55);
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg)); transition: transform .5s cubic-bezier(.2, .7, .2, 1); will-change: transform; }
.bar { display: flex; align-items: center; gap: 6px; padding: 10px 14px; background: #1b1d23; border-bottom: 1px solid var(--line); }
.bar i { width: 10px; height: 10px; border-radius: 50%; background: #3a3d45; }
.bar i:first-child { background: var(--accent); }
.url { margin-left: 10px; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pic { aspect-ratio: 16 / 10; overflow: hidden; background: linear-gradient(135deg, var(--bg-2), #1d2027); }
.pic img { width: 100%; height: 100%; object-fit: cover; object-position: top; transform: scale(1.06) translateY(var(--py, 0px)); transition: transform .2s linear; }
.pic.empty { display: grid; place-items: center; font: 700 clamp(24px, 4vw, 48px) var(--head); color: var(--accent); }

.num { font: 500 13px/1 var(--head); color: var(--accent); letter-spacing: .1em; margin-bottom: 16px; }
.title { font: 700 clamp(30px, 3.6vw, 52px)/1.05 var(--head); letter-spacing: -.03em; }
.meta { margin-top: 12px; color: var(--muted); font-weight: 600; font-size: 15px; }
.meta b { color: var(--ink); font-weight: 600; padding: 3px 10px; border-radius: 99px; border: 1px solid color-mix(in srgb, var(--accent) 60%, transparent); margin-left: 6px; font-size: 13px; white-space: nowrap; }
.summary { margin-top: 20px; color: #cfcdc7; font-size: 17px; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 0; padding: 0; }
.tags li { font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 99px; background: rgba(242, 239, 232, .06); border: 1px solid var(--line); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 30px; }
.btn { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 24px; border-radius: 99px; background: var(--accent); color: #0b0c0f; font-weight: 700; text-decoration: none; transition: transform .25s, box-shadow .25s; }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 45%, transparent); }
.btn::after { content: "↗"; }
.links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.links a { font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 10px 0; border-bottom: 1px solid transparent; }
.links a:hover { color: var(--ink); border-color: var(--accent); }

.outro { padding: 60px var(--pad) 120px; max-width: 1400px; margin: 0 auto; display: grid; gap: 18px; justify-items: start; }
.outro h2 { font: 700 clamp(30px, 5vw, 72px)/1.05 var(--head); letter-spacing: -.03em; }
.outro p { color: var(--muted); font-size: 18px; max-width: 40ch; }
.outro .btn { --accent: var(--ink); }
.top nav button { font: inherit; color: inherit; background: none; border: 0; padding: 10px 0; cursor: pointer; opacity: .8; }
.top nav button:hover { opacity: 1; }
/* Переключатель языков (в шапке и в подвале). translate="no" в HTML — чтобы автопереводчик не переименовал кнопки */
.top { padding-block: 12px; }
.top nav { align-items: center; }
.langs { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 99px; }
.langs a, .top nav .langs a { display: grid; place-items: center; min-width: 44px; min-height: 40px; padding: 0 8px; border-radius: 99px;
  font: 600 12px/1 var(--body); letter-spacing: .1em; color: var(--muted); text-decoration: none; opacity: 1; transition: color .2s, background .2s; }
.langs a:hover, .top nav .langs a:hover { color: var(--ink); background: rgba(242, 239, 232, .08); }
.langs a[aria-current], .top nav .langs a[aria-current] { background: var(--ink); color: var(--bg); }
button.btn { border: 0; font: 700 16px var(--body); cursor: pointer; }

/* Окно «Написать» */
dialog { width: min(520px, calc(100% - 32px)); max-height: 92dvh; overflow: auto; padding: 28px; border: 1px solid var(--line); border-radius: 18px; background: var(--bg-2); color: var(--ink); }
dialog::backdrop { background: rgba(5, 6, 8, .7); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
dialog[open] { animation: pop .35s cubic-bezier(.2, .7, .2, 1); }
@keyframes pop { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.dlg-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.dlg-top h2 { font: 700 24px/1.1 var(--head); letter-spacing: -.02em; }
.close { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--ink); font-size: 26px; line-height: 1; cursor: pointer; }
.contact-form label { display: grid; gap: 6px; margin-bottom: 14px; font-size: 14px; font-weight: 600; color: var(--muted); }
.contact-form input, .contact-form textarea { width: 100%; font: 16px/1.5 var(--body); color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.contact-form .send { width: 100%; justify-content: center; margin-top: 6px; }
.contact-form .send::after { content: "→"; }
.contact-form .send:disabled { opacity: .6; cursor: wait; }
.honey { position: absolute; left: -9999px; width: 1px; height: 1px; }
.form-note { min-height: 1.5em; margin-top: 14px; font-size: 15px; }
.form-note.ok { color: #7be495; }
.form-note.err { color: #ff9b7a; }
.form-note a { color: var(--ink); }

/* Галерея под карточкой (поле gallery в projects.json) и окно просмотра */
.gallery { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-wrap: wrap; gap: 10px; }
.gallery li { flex: 1 1 0; min-width: 64px; max-width: 128px; }
.gallery button { display: block; width: 100%; aspect-ratio: 16 / 10; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg-2); cursor: zoom-in; transition: transform .25s, border-color .25s, box-shadow .25s; }
.gallery button:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 30%, transparent); }
.gallery img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
#lightbox { --accent: var(--ink); width: min(1280px, calc(100% - 24px)); max-width: none; max-height: none; padding: 0; overflow: visible; background: none; border: 0; }
#lightbox figure { margin: 0; }
#lightbox img { width: 100%; max-height: calc(100dvh - 110px); object-fit: contain; border-radius: 12px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); cursor: zoom-out; }
#lightbox figcaption { margin-top: 12px; text-align: center; color: var(--ink); font-weight: 600; }
#lightbox .close { position: absolute; top: -8px; right: -8px; background: var(--bg-2); }
#lightbox .nav { position: absolute; top: calc(50% - 40px); width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: rgba(19, 21, 26, .85); color: var(--ink); font-size: 30px; line-height: 1; cursor: pointer; }
#lightbox .prev { left: 12px; }
#lightbox .next { right: 12px; }
#lightbox img.swap { animation: pop .3s cubic-bezier(.2, .7, .2, 1); }

/* Листалка слайдов в рамке (поле slides в projects.json). Скриншоты заполняют рамку (cover),
   целиком — в окне просмотра по клику. */
.shot.has-slides { min-width: 0; } /* иначе ширина ленты слайдов распирает колонку сетки */
.slider { position: relative; touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.slider:focus-visible { outline: 2px solid var(--ink); outline-offset: -3px; }
.slider .track { display: flex; height: 100%; transform: translate3d(calc(var(--k, 0) * -100% + var(--dx, 0px)), 0, 0); transition: transform .65s cubic-bezier(.2, .7, .2, 1); }
.slider .track.drag { transition: none; }
.slide { flex: 0 0 100%; height: 100%; overflow: hidden; cursor: zoom-in; background: linear-gradient(135deg, #0d1c24, #13151a); }
.slider img { object-position: center; -webkit-user-drag: none; }
.sl-nav { position: absolute; top: 50%; margin-top: -22px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(242, 239, 232, .22);
  background: rgba(11, 12, 15, .55); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); color: var(--ink); font-size: 28px; line-height: 1; cursor: pointer;
  opacity: 0; transition: opacity .3s, background .25s, border-color .25s, transform .25s; }
.sl-nav:hover { background: rgba(11, 12, 15, .8); border-color: var(--accent); }
.sl-prev { left: 12px; }
.sl-next { right: 12px; }
.slider:hover .sl-nav, .slider:focus-within .sl-nav { opacity: 1; }
.sl-prev:active { transform: translateX(-3px); }
.sl-next:active { transform: translateX(3px); }
.sl-foot { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 32px 14px 10px; background: linear-gradient(transparent, rgba(5, 6, 8, .6)); pointer-events: none; }
.sl-dots { display: flex; flex-wrap: wrap; pointer-events: auto; }
.sl-dots button { display: grid; place-items: center; width: 16px; height: 22px; padding: 0; border: 0; background: none; cursor: pointer; }
.sl-dots button::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: rgba(242, 239, 232, .45); transition: width .35s, background .35s; }
.sl-dots button:hover::before { background: var(--ink); }
.sl-dots button[aria-current] { width: 26px; }
.sl-dots button[aria-current]::before { width: 18px; background: var(--accent); }
.sl-count { margin-left: auto; padding: 5px 10px; border-radius: 99px; background: rgba(11, 12, 15, .6); font: 600 12px/1 var(--body); letter-spacing: .08em; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (hover: none) {
  .sl-nav { opacity: 1; width: 40px; height: 40px; margin-top: -20px; font-size: 24px; }
  .sl-prev { left: 8px; }
  .sl-next { right: 8px; }
}
@media (max-width: 560px) {
  .sl-dots { display: none; }
}

.foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; padding: 28px var(--pad); border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.noscript { color: var(--muted); }

/* Появление при прокрутке. Сознательно не отключаем при «уменьшить движение» в системе:
   сдвиги небольшие и плавные, а у владельца эта настройка включена. */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1); }
.reveal.in { opacity: 1; transform: none; }
.project .shot.reveal { transform: translateY(60px) scale(.96); }
.project .shot.reveal.in { transform: none; }
.project .info.reveal { transition-delay: .12s; }
/* Первый экран появляется сразу при загрузке, не дожидаясь скрипта */
.hero .reveal { animation: rise 1s cubic-bezier(.2, .7, .2, 1) both; }
.hero .reveal:nth-child(2) { animation-delay: .1s; }
.hero .reveal:nth-child(3) { animation-delay: .25s; }
.hero .reveal:nth-child(4) { animation-delay: .4s; }
@keyframes rise { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }

@media (max-width: 900px) {
  .project { grid-template-columns: 1fr; }
  .project:nth-child(even) .shot { order: 0; }
  .top nav { gap: 16px; }
}
@media (max-width: 640px) {
  .top nav .nav-work { display: none; }
}
@media (max-width: 400px) {
  .top { gap: 10px; }
  .top nav { gap: 10px; }
  .logo { font-size: 13px; }
}
@media (max-width: 480px) {
  .bar { padding: 8px 10px; }
  .bar i { width: 8px; height: 8px; }
  .summary { font-size: 16px; }
  .btn { width: 100%; justify-content: center; }
  #lightbox .nav { top: auto; bottom: -4px; width: 44px; height: 44px; }
  #lightbox figcaption { padding: 0 56px; }
}
