/* ───────── Шрифты (лежат на своём домене, без сторонних запросов) ───────── */
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 400 900; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-cyrillic-wght-italic.woff2") format("woff2");
  font-weight: 400 900; font-style: italic; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Playfair Display";
  src: url("../fonts/playfair-display-latin-wght-italic.woff2") format("woff2");
  font-weight: 400 900; font-style: italic; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-cyrillic-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Montserrat";
  src: url("../fonts/montserrat-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ───────── Основа ───────── */
:root {
  --bg: #0a0a0a;
  --ink: #f4f1ea;            /* мраморный белый */
  --ink-2: #d2cec5;
  --mute: #96928a;
  --line: rgba(244, 241, 234, .2);
  --serif: "Playfair Display", "Times New Roman", Georgia, serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --pad: clamp(20px, 5.5vw, 96px);
  --d: min(30vw, 52vh);      /* диаметр портрета на сцене */
  --ease: cubic-bezier(.66, 0, .18, 1);
  --morph: 1.2s;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink-2);
  font: 500 1rem/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* свет прожектора и зерно — как на проекторе */
body::before,
body::after { content: ""; position: fixed; inset: 0; pointer-events: none; }
body::before {
  z-index: -2;
  background:
    radial-gradient(70vmax 55vmax at 24% 38%, rgba(255, 255, 255, .10), transparent 68%),
    radial-gradient(60vmax 45vmax at 92% 108%, rgba(255, 255, 255, .05), transparent 70%),
    var(--bg);
}
body::after { z-index: -1; background: url("../img/grain.svg"); opacity: .07; }

.framed body { display: none; }

h1, h2, h3, p, dl, dd, ol, ul, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
img, svg { display: block; }
a { color: inherit; }

::selection { background: var(--ink); color: var(--bg); }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: 2px; }

.sprite { position: absolute; }

.skip {
  position: fixed; left: 16px; top: -80px; z-index: 50;
  padding: 10px 16px; background: var(--ink); color: var(--bg);
  font-weight: 700; text-decoration: none; border-radius: 4px;
}
.skip:focus { top: 16px; }

/* ───────── Типографика ───────── */
h1, h2, h3, .mark, .figure { font-family: var(--serif); color: var(--ink); font-weight: 700; }

h1, h2 {
  font-size: clamp(2.7rem, 6vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: -.012em;
  text-wrap: balance;
}
h2 { font-size: clamp(2.4rem, 5.2vw, 4.6rem); }
h2.title-sm { font-size: clamp(1.7rem, 2.7vw, 2.5rem); line-height: 1.15; letter-spacing: 0; }

.eyebrow {
  font-size: .72rem; font-weight: 600; letter-spacing: .26em;
  text-transform: uppercase; color: var(--mute);
}

.lede { font-size: clamp(1rem, 1.18vw, 1.12rem); max-width: 34em; }

.figure {
  font-size: clamp(2rem, 3.3vw, 3.1rem); line-height: 1.1;
  font-variant-numeric: lining-nums;
}
.figure span { font-weight: 500; font-style: italic; color: var(--ink-2); }

/* ───────── Шапка и навигация по слайдам ───────── */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 20px var(--pad) 30px;
  background: linear-gradient(rgba(10, 10, 10, .97) 0, rgba(10, 10, 10, .9) 55%, rgba(10, 10, 10, 0));
}
.mark { font-size: 1.15rem; text-decoration: none; letter-spacing: .01em; }
.mark span { color: var(--mute); }

.menu { display: flex; gap: clamp(14px, 2.2vw, 34px); }
.menu a {
  font-size: .74rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  text-decoration: none; color: var(--mute); padding: 6px 0;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat;
  transition: color .3s, background-size .4s var(--ease);
}
.menu a:hover, .menu a[aria-current] { color: var(--ink); background-size: 100% 1px; }

.pager { display: none; }

/* ───────── Слайды ───────── */
.scene {
  position: relative;
  padding: 104px var(--pad) 64px;
}
.copy { position: relative; z-index: 1; display: grid; gap: 22px; justify-items: start; }
.copy > p { max-width: 36em; }

.scene--hero { min-height: 100vh; min-height: 100svh; display: grid; align-content: center; gap: 44px; }

.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.btn {
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 26px;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: .8rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  text-decoration: none; color: var(--ink);
  transition: background-color .3s, color .3s, border-color .3s;
}
.btn:hover { border-color: var(--ink); }
.btn--solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--solid:hover { background: transparent; color: var(--ink); }

/* портрет в потоке — для телефона и для режима без JS */
.portrait {
  position: relative; width: min(64vw, 300px); aspect-ratio: 1; margin: 0 auto;
}
.portrait::before {
  content: ""; position: absolute; inset: -8%;
  border: 4px solid var(--ink); border-radius: 50%;
}
.portrait img, .bust img {
  position: relative; width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
  filter: grayscale(1) contrast(1.1) brightness(1.08);
}

.next { display: none; }

/* факты и стек — как музейные таблички */
.facts, .stack { display: grid; width: 100%; max-width: 36em; border-top: 1px solid var(--line); }
.facts > div, .stack > div {
  display: grid; grid-template-columns: 9.5em 1fr; gap: 16px; align-items: baseline;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
dt { font-size: .7rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--mute); }
dd { color: var(--ink); font-size: .93rem; }

/* факты: крупная цифра или слово + подпись */
.trivia { display: grid; gap: 0 clamp(24px, 4vw, 56px); width: 100%; margin-top: 6px; }
.trivia li {
  display: grid; grid-template-columns: 5.4rem 1fr; gap: 14px; align-items: baseline;
  padding: 16px 0 18px; border-top: 1px solid var(--line);
}
.trivia b {
  font-family: var(--serif); font-weight: 700; font-size: clamp(1.9rem, 3vw, 3rem); line-height: 1;
  color: var(--ink); font-variant-numeric: lining-nums;
}
.trivia p { font-size: .93rem; max-width: 30em; }

/* направления */
.domains { display: grid; gap: 28px; width: 100%; margin-top: 12px; }
.domain { display: grid; gap: 8px; justify-items: start; }
.domain h3 { font-size: 1.3rem; line-height: 1.2; }
.domain p { font-size: .93rem; max-width: 26em; }
.domain-icon { width: 34px; height: 34px; color: var(--ink); margin-bottom: 4px; }

/* проекты */
.works { display: grid; gap: 0 clamp(28px, 5vw, 80px); width: 100%; margin-top: 10px; }
.work { display: grid; gap: 8px; align-content: start; padding: 22px 0 24px; border-top: 1px solid var(--line); }
.work h3 { font-size: clamp(1.35rem, 1.9vw, 1.7rem); line-height: 1.15; }
.work p { font-size: .93rem; max-width: 34em; }
.work-no, .work-tech { font-size: .7rem !important; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--mute); }
.work-tech { letter-spacing: .08em; color: var(--ink-2); margin-top: 2px; }
.note { font-size: .88rem; color: var(--mute); padding-top: 20px; border-top: 1px solid var(--line); width: 100%; max-width: none !important; }

/* контакты */
.links { display: grid; width: 100%; max-width: 36em; border-top: 1px solid var(--line); }
.links li {
  display: grid; grid-template-columns: 9.5em 1fr; gap: 16px; align-items: baseline;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.links li[hidden] { display: none; }
.links span { font-size: .7rem; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--mute); }
.links a, .links b {
  font-family: var(--serif); font-weight: 700; font-size: clamp(1.25rem, 2vw, 1.7rem); color: var(--ink);
  text-decoration: none; overflow-wrap: anywhere; justify-self: start;
}
.links a { background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat; transition: background-size .4s var(--ease); }
.links a:hover { background-size: 0 1px; background-position: 100% 100%; }
.colophon { font-size: .75rem; color: var(--mute); letter-spacing: .08em; margin-top: 18px; }

.stage { display: none; }

@media (max-width: 959px) {
  .menu a:not(:last-child) { display: none; }
  .scene--about .title-sm { font-size: clamp(2.4rem, 9vw, 3.4rem); line-height: 1.02; }
  .scene--domains .title-sm { font-size: clamp(1.9rem, 7vw, 2.6rem); }
}
@media (min-width: 620px) and (max-width: 959px) {
  .domains, .works { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 620px) {
  .trivia { grid-template-columns: 1fr 1fr; }
  .trivia li { grid-template-columns: 1fr; gap: 8px; align-content: start; }
}
@media (max-width: 420px) {
  .facts > div, .stack > div, .links li { grid-template-columns: 1fr; gap: 2px; }
}

/* ───────── Десктоп: презентация со сценой ───────── */
@media (min-width: 960px) {
  .scene {
    min-height: 100vh; min-height: 100svh;
    padding: 112px calc(var(--pad) + 28px) 72px var(--pad);
    display: grid; align-content: center;
  }
  .copy { gap: 24px; }

  .scene--hero { grid-template-columns: 1fr 1fr; gap: 0; align-items: center; }
  .scene--hero .copy, .scene--stack .copy, .scene--contact .copy { width: min(100%, 46vw); }
  .scene--hero .copy { width: auto; padding-right: 3vw; }
  .portrait { width: var(--d); margin: 0; justify-self: center; }

  .scene--about .copy { width: min(100%, 39vw); justify-self: end; justify-items: end; text-align: right; }
  .scene--about .facts > div { grid-template-columns: 1fr 9.5em; }
  .scene--about .facts dt { order: 2; text-align: right; }

  .scene--stack .copy { width: min(100%, 47vw); }
  .stack dd { font-size: .88rem; }

  .scene--facts .copy { width: min(100%, 50vw); justify-self: end; }
  .trivia p { font-size: .88rem; }

  .scene--domains { align-content: stretch; }
  .scene--domains .copy { align-content: start; justify-items: center; height: 100%; grid-template-rows: auto 1fr; }
  .scene--domains .title-sm { text-align: center; }
  .domains {
    grid-template-columns: 1fr calc(var(--d) * 1.08) 1fr; grid-template-rows: auto auto;
    gap: clamp(28px, 7vh, 72px) clamp(24px, 4vw, 64px);
    align-content: center; margin: 0; padding-top: 2vh;
  }
  .domain--tl { grid-area: 1 / 1; }
  .domain--bl { grid-area: 2 / 1; }
  .domain--tr { grid-area: 1 / 3; }
  .domain--br { grid-area: 2 / 3; }
  .domain--tl, .domain--bl { justify-items: end; text-align: right; }
  .domain h3 { font-size: clamp(1.15rem, 1.55vw, 1.5rem); }
  .domain p { font-size: .86rem; max-width: 24em; }

  .scene--projects { align-content: start; padding-top: 128px; padding-bottom: 96px; }
  .works { grid-template-columns: 1fr 1fr; }

  .next {
    display: block; position: absolute; left: var(--pad); bottom: 34px; z-index: 2;
    width: 26px; height: 44px; border: 1px solid var(--line); border-radius: 14px;
  }
  .next span {
    position: absolute; left: 50%; top: 9px; width: 4px; height: 8px; margin-left: -2px;
    border-radius: 2px; background: var(--ink); animation: nudge 2.2s var(--ease) infinite;
  }

  /* точки-слайды справа */
  .js .pager {
    display: grid; gap: 4px; position: fixed; right: calc(var(--pad) / 2 - 12px); top: 50%; z-index: 20;
    transform: translateY(-50%);
  }
  .pager a { position: relative; display: block; width: 24px; height: 24px; }
  .pager a::before {
    content: ""; position: absolute; inset: 9px; border-radius: 50%;
    border: 1px solid var(--mute); transition: background-color .3s, border-color .3s, transform .4s var(--ease);
  }
  .pager a:hover::before { border-color: var(--ink); }
  .pager a[aria-current]::before { background: var(--ink); border-color: var(--ink); transform: scale(1.5); }
  .pager span {
    position: absolute; right: 30px; top: 50%; transform: translateY(-50%);
    font-size: .66rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap;
    color: var(--ink); opacity: 0; transition: opacity .25s; pointer-events: none;
  }
  .pager a:hover span, .pager a:focus-visible span { opacity: 1; }
}

/* сцена включается только с JS: без него остаётся обычная страница с портретом в потоке */
@media (min-width: 960px) {
  /* «Прилипание» к слайдам (scroll-snap) намеренно не используется: в Chromium оно блокировало прокрутку колесом. */
  .js .portrait { visibility: hidden; }

  .js .stage { display: block; position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
  .stage > * {
    position: absolute; left: 50%; top: 50%;
    width: var(--d); height: var(--d); margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2);
    border-radius: 50%;
    transform: translate(var(--x, 0), var(--y, 0)) scale(var(--s, 1));
    opacity: var(--o, 1);
    transition: transform var(--morph) var(--ease), opacity calc(var(--morph) * .7) ease;
    will-change: transform, opacity;
  }
  .ring { border: max(4px, .36vw) solid var(--ink); }
  .glow { background: radial-gradient(closest-side, rgba(255, 255, 255, .13), transparent); }
  .bust { box-shadow: 0 30px 90px rgba(0, 0, 0, .7); }
  .wheel {
    background: radial-gradient(circle at 34% 28%, #f6f4ef, #cfccc5 55%, #a9a6a0);
    color: #17171a;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), 0 30px 90px rgba(0, 0, 0, .7);
  }
  .wheel svg { width: 100%; height: 100%; }
  .wheel-cross { fill: none; stroke: rgba(23, 23, 26, .32); stroke-width: .7; }

  /* Кольцо везде соосно портрету: фото всегда целиком внутри рамки. */

  /* 01 — портрет справа в кольце */
  [data-scene="hero"] .bust  { --x: 22vw; --y: 1vh; --s: 1; }
  [data-scene="hero"] .ring  { --x: 22vw; --y: 1vh; --s: 1.17; }
  [data-scene="hero"] .glow  { --x: 22vw; --y: 2vh; --s: 2.6; }
  [data-scene="hero"] .wheel { --x: 22vw; --y: 1vh; --s: .5; --o: 0; }

  /* 02 — крупный план слева, кольцо расширяется и бледнеет */
  [data-scene="about"] .bust  { --x: -23vw; --y: 3vh; --s: 1.34; }
  [data-scene="about"] .ring  { --x: -23vw; --y: 3vh; --s: 1.6; --o: .3; }
  [data-scene="about"] .glow  { --x: -20vw; --y: 0vh; --s: 3.1; }
  [data-scene="about"] .wheel { --x: -23vw; --y: 3vh; --s: .6; --o: 0; }

  /* 03 — возвращается направо */
  [data-scene="stack"] .bust  { --x: 24vw; --y: 6vh; --s: 1.08; }
  [data-scene="stack"] .ring  { --x: 24vw; --y: 6vh; --s: 1.27; }
  [data-scene="stack"] .glow  { --x: 24vw; --y: 6vh; --s: 2.8; }
  [data-scene="stack"] .wheel { --x: 24vw; --y: 6vh; --s: .5; --o: 0; }

  /* 04 — факты: портрет уходит налево, текст справа */
  [data-scene="facts"] .bust  { --x: -28vw; --y: 2vh; --s: .9; }
  [data-scene="facts"] .ring  { --x: -28vw; --y: 2vh; --s: 1.06; }
  [data-scene="facts"] .glow  { --x: -28vw; --y: 2vh; --s: 2.7; }
  [data-scene="facts"] .wheel { --x: -28vw; --y: 2vh; --s: .5; --o: 0; }

  /* 05 — колесо направлений, портрет в центре */
  [data-scene="domains"] .bust  { --x: 0vw; --y: 7vh; --s: .34; }
  [data-scene="domains"] .ring  { --x: 0vw; --y: 7vh; --s: 1.14; --o: .5; }
  [data-scene="domains"] .glow  { --x: 0vw; --y: 7vh; --s: 3; }
  [data-scene="domains"] .wheel { --x: 0vw; --y: 7vh; --s: 1; --o: 1; }

  /* 05 — сцена пустеет, кольцо остаётся фоном */
  [data-scene="projects"] .bust  { --x: 42vw; --y: -38vh; --s: .3; --o: 0; }
  [data-scene="projects"] .ring  { --x: 34vw; --y: -6vh; --s: 3; --o: .07; }
  [data-scene="projects"] .glow  { --x: 30vw; --y: -20vh; --s: 3.4; --o: .6; }
  [data-scene="projects"] .wheel { --x: 0vw; --y: -30vh; --s: .4; --o: 0; }

  /* 06 — финал */
  [data-scene="contact"] .bust  { --x: 23vw; --y: 2vh; --s: .96; }
  [data-scene="contact"] .ring  { --x: 23vw; --y: 2vh; --s: 1.2; }
  [data-scene="contact"] .glow  { --x: 23vw; --y: 2vh; --s: 2.7; }
  [data-scene="contact"] .wheel { --x: 23vw; --y: 2vh; --s: .5; --o: 0; }

  /* текст слайда появляется следом за Morph */
  .js .copy > * { opacity: 0; transform: translateY(22px); transition: opacity .8s ease, transform 1s var(--ease); }
  .js .is-in .copy > * { opacity: 1; transform: none; }
  .js .is-in .copy > :nth-child(2) { transition-delay: .08s; }
  .js .is-in .copy > :nth-child(3) { transition-delay: .16s; }
  .js .is-in .copy > :nth-child(4) { transition-delay: .24s; }
  .js .is-in .copy > :nth-child(5) { transition-delay: .32s; }
  .js .is-in .copy > :nth-child(6) { transition-delay: .4s; }

  .domain-icon { display: none; }
}

/* низкие экраны: слайды не обязаны влезать в один экран */
@media (min-width: 960px) and (max-height: 720px) {
  h1, h2 { font-size: clamp(2.4rem, 4.6vw, 3.6rem); }
  .scene { padding-top: 96px; padding-bottom: 48px; }
  .copy { gap: 16px; }
}

@keyframes nudge {
  0%, 100% { transform: translateY(0); opacity: 1; }
  60% { transform: translateY(14px); opacity: 0; }
  61% { transform: translateY(0); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  :root { --morph: .01s; }
  .js .copy > * { transition: none; }
  .next span { animation: none; }
}

/* ───────── Печать / сохранение в PDF ───────── */
@media print {
  :root { --ink: #111; --ink-2: #222; --mute: #555; --line: #bbb; --bg: #fff; }
  html, body { background: #fff; }
  body::before, body::after, .stage, .bar, .pager, .next, .actions, .skip { display: none !important; }
  .scene { min-height: 0 !important; padding: 0 0 18pt !important; display: block !important; break-inside: avoid; }
  .scene--projects { break-inside: auto; }
  .copy, .scene--about .copy { width: auto !important; text-align: left !important; justify-items: start !important; gap: 8pt; }
  .js .copy > * { opacity: 1 !important; transform: none !important; }
  .portrait, .js .portrait { visibility: visible !important; width: 90pt; float: right; margin: 0 0 8pt 12pt; }
  .portrait::before { display: none; }
  h1, h2 { font-size: 26pt; }
  h2.title-sm { font-size: 16pt; }
  .figure { font-size: 16pt; }
  body { font-size: 10pt; }
  .domains, .works, .trivia { grid-template-columns: 1fr 1fr !important; gap: 0 18pt; }
  .trivia li { padding: 6pt 0; }
  .trivia b { font-size: 16pt; }
  .domain { justify-items: start !important; text-align: left !important; padding: 6pt 0; grid-area: auto !important; }
  .domain-icon { display: none; }
  .work { padding: 8pt 0; break-inside: avoid; }
  .links a { background: none; }
}
