/*
  Размеры сняты с макета Figma.
  Десктоп: 1 единица --u = 1px макета 1440 (масштабируется под ширину экрана).
  Мобилка: 1 единица --m = 1px макета 390.
*/

@font-face { font-family: "Instrument Serif"; src: url("instrument-serif-400.woff2") format("woff2"); font-weight: 200; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url("plex-mono-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("inter-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }

:root {
  --bg: #0f0f0f;
  --fg: #ffffff;
  --dim: #3f3f3f;
  --cap: #474747;
  --line: rgba(63, 63, 63, .45);
  --serif: "Instrument Serif", "Times New Roman", serif;
  --mono: "IBM Plex Mono", "Plex Mono", ui-monospace, Menlo, monospace;
  --sans: -apple-system, "SF Pro Display", "SF UI Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  --u: calc(min(100vw, 1920px) / 1440);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
p, h1, h2, ul { margin: 0; padding: 0; font-weight: inherit; }
ul { list-style: none; }
:focus-visible { outline: 1px solid var(--fg); outline-offset: 4px; }
.mono { font-family: var(--mono); }
.dim { color: var(--dim); }

/* ---------- header ---------- */
.top {
  position: absolute; left: 0; right: 0; top: env(safe-area-inset-top, 0px);
  height: calc(90 * var(--u));
  z-index: 5;
  font-size: calc(16 * var(--u));
  line-height: 1;
  letter-spacing: -0.06em;
}
.top > * { position: absolute; top: calc(32 * var(--u)); }
.logo { left: calc(12 * var(--u)); top: calc(29 * var(--u)); }
.logo img { height: calc(32 * var(--u)); width: auto; }
.nav-sketches { left: 25.45%; transform: translateX(-50%); }
.nav-works { left: 74.58%; transform: translateX(-50%); }
.avatar { left: 50%; transform: translateX(-50%); }
.avatar img { width: calc(56 * var(--u)); height: calc(56 * var(--u)); border-radius: 50%; object-fit: cover; }
.nav-cv { right: calc(16 * var(--u)); padding-bottom: calc(5 * var(--u)); border-bottom: 1px solid rgba(255,255,255,.45); }

/* ---------- hero ---------- */
.hero { position: relative; height: calc(760 * var(--u)); }
.hero-text {
  position: absolute; left: calc(60 * var(--u)); top: calc(196 * var(--u));
  width: calc(613 * var(--u));
  font-family: var(--serif); font-weight: 200;
  font-size: calc(72 * var(--u)); line-height: 1; letter-spacing: -0.06em;
  text-align: center;
}
.hero-circle {
  position: absolute; left: calc(828 * var(--u)); top: calc(166 * var(--u));
  width: calc(492 * var(--u)); aspect-ratio: 1;
  display: grid; place-items: center;
}
.dots { position: absolute; inset: 0; width: 100%; height: 100%; color: var(--dim); }
.hero-circle { will-change: transform; }
.hand { width: 40.7%; position: relative; }

.corner { position: absolute; top: calc(706 * var(--u)); display: flex; gap: calc(8 * var(--u)); font-size: calc(16 * var(--u)); line-height: 1; letter-spacing: -0.06em; }
.corner-mark { font-family: var(--serif); font-weight: 200; padding-top: 1px; }
.corner-lines { display: flex; flex-direction: column; }
.corner-lines > * { display: block; }
.corner-lines > :nth-child(2) { margin-top: calc(4 * var(--u)); }
.corner-lines > :nth-child(3) { margin-top: calc(2 * var(--u)); }
.corner .indent { padding-left: calc(41 * var(--u)); }
.corner-lines > * { white-space: nowrap; }
.corner .right { text-align: right; }
.corner-a { left: calc(16 * var(--u)); }
.corner-c { left: calc(1249 * var(--u)); width: calc(175 * var(--u)); }
.corner-c .corner-lines { flex: 1; }

/* ---------- sketches grid ---------- */
.sketches { padding: calc(80 * var(--u)) calc(16 * var(--u)) 0; }
.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: calc(8 * var(--u));
  row-gap: calc(88 * var(--u));
}
.tile-media { display: block; width: 100%; padding: 0; border: 0; border-radius: 0; aspect-ratio: 1; overflow: hidden; background: #1a1a1a; cursor: zoom-in; }
.tile-media img, .tile-media video { width: 100%; height: 100%; object-fit: cover; }
.tile-media.inset { display: grid; place-items: center; background: #141414; }
.tile-media.inset video, .tile-media.inset img { width: 86%; height: auto; object-fit: contain; }
.tile-media.missing { display: grid; place-items: center; color: #333; font-family: var(--mono); font-size: 12px; }
.tile-caption {
  margin-top: calc(32 * var(--u));
  min-height: 2em;
  font-family: var(--mono);
  font-size: calc(16 * var(--u)); line-height: 1; letter-spacing: -0.06em;
  color: var(--cap);
  transition: color .3s ease;
}
.grid li:hover .tile-caption, .grid li:focus-within .tile-caption { color: var(--fg); }

/* ---------- works ---------- */
.works { position: relative; padding: calc(128 * var(--u)) calc(16 * var(--u)) 0; }
.works-title {
  font-family: var(--serif); font-weight: 200;
  font-size: calc(72 * var(--u)); line-height: 1; letter-spacing: -0.06em;
  text-align: center;
  margin-bottom: calc(60 * var(--u));
}
.work {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: calc(8 * var(--u));
  align-items: start;
  padding: calc(48 * var(--u)) 0 calc(56 * var(--u));
  border-top: 1px solid var(--line);
}
.works-list li:first-child .work { padding-top: 0; border-top: 0; }
.works-list li:last-child .work { padding-bottom: 0; }
.work-name {
  grid-column: 1;
  max-width: calc(253 * var(--u));
  font-family: var(--serif); font-weight: 200;
  font-size: calc(40 * var(--u)); line-height: 1; letter-spacing: -0.04em;
}
.work-text, .work-label { font-family: var(--mono); font-size: calc(16 * var(--u)); line-height: 1; letter-spacing: -0.06em; color: var(--cap); }
.work-text { grid-column: 2; color: #3f3f3f; transition: color .3s ease; }
.work:hover .work-text, .work:focus-visible .work-text { color: #545454; }
.name-roll { position: relative; display: block; overflow: hidden; margin-bottom: -.32em; }
.name-roll > span { display: block; padding-bottom: .32em; transition: transform .55s cubic-bezier(.7,0,.2,1); }
.name-roll > .nr-b { position: absolute; left: 0; top: 100%; width: 100%; }
@media (hover: hover) {
  .work:hover .name-roll > span { transform: translateY(-100%); }
}
.work:focus-visible .name-roll > span { transform: translateY(-100%); }
.work-label { grid-column: 4; justify-self: end; position: relative; text-align: right; }
.work-label .action { position: absolute; right: 0; top: 0; color: var(--fg); opacity: 0; white-space: nowrap; }
.work-label .status { transition: opacity .2s; white-space: nowrap; }
.work:hover .status, .work:focus-visible .status { opacity: 0; }
.work:hover .action, .work:focus-visible .action { opacity: 1; }
.work-image { display: none; }

.works-preview {
  position: absolute; left: calc(824 * var(--u)); top: 0;
  width: calc(390 * var(--u));
  pointer-events: none; opacity: 0;
  transform: translateY(-50%) rotate(-4.75deg);
  transition: opacity .25s ease;
  z-index: 3;
}
.works-preview.on { opacity: 1; animation: rise .6s cubic-bezier(.2,.7,.2,1) both; }
@keyframes rise {
  from { opacity: .35; transform: translateY(calc(-50% + 48px)) rotate(-4.75deg); }
  to   { opacity: 1;   transform: translateY(-50%) rotate(-4.75deg); }
}
.works-preview img { width: 100%; height: auto; }

/* desktop-only line breaks from the layout */
.br-d { display: inline; }

/* ---------- footer ---------- */
.footer { text-align: center; padding: calc(96 * var(--u)) 16px calc(32 * var(--u)); }
.footer-title { font-family: var(--serif); font-weight: 200; font-size: 24px; line-height: 1; letter-spacing: -0.04em; }
.footer-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 22px; margin-top: 12px; }
.footer-cell { display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 1; letter-spacing: -0.06em; white-space: nowrap; }
.footer-row > .footer-cell:first-child { justify-self: end; align-items: center; }
.footer-row > .footer-cell:last-child { justify-self: start; align-items: center; }
.footer-label { color: var(--dim); text-transform: uppercase; }
.globe { width: 76px; height: 50px; }
.footer-domain { display: inline-block; margin-top: 12px; font-family: var(--mono); font-size: 12px; line-height: 1; letter-spacing: -0.06em; color: var(--cap); text-transform: uppercase; }

/* ---------- link roll ---------- */
.roll { display: inline-block; overflow: hidden; vertical-align: top; line-height: 1.2; height: 1.2em; margin: -0.1em 0; }
.roll-in { display: flex; flex-direction: column; transition: transform .5s cubic-bezier(.7,0,.2,1); }
.roll-in > span { display: block; white-space: nowrap; }
a:hover .roll-in, a:focus-visible .roll-in { transform: translateY(-50%); }

/* ---------- custom cursor on grid ---------- */
.cursor, .cursor-plus {
  position: fixed; left: 0; top: 0; z-index: 20;
  width: 42px; height: 42px; margin: -21px 0 0 -21px;
  border-radius: 50%;
  pointer-events: none; transform: scale(0); transition: transform .3s cubic-bezier(.2,.7,.2,1);
}
.cursor { background: #fff; mix-blend-mode: difference; }
.cursor-plus { z-index: 21; }
.cursor.on, .cursor-plus.on { transform: scale(1); }
.cursor-plus span { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; }
.cursor-plus span::before, .cursor-plus span::after { content: ""; position: absolute; background: #fff; }
.cursor-plus span::before { left: 6.5px; top: 0; width: 1px; height: 14px; }
.cursor-plus span::after { top: 6.5px; left: 0; height: 1px; width: 14px; }
.cursor.on { transform: scale(1); }
.has-cursor .tile-media { cursor: none; }

/* ---------- Instrument Serif есть только в Regular: обводкой цвета фона делаем его тоньше, ближе к Ultralight ---------- */
.hero-text, .works-title, .work-name, .footer-title, .corner-mark { -webkit-text-stroke: 0.016em var(--bg); }
.footer-title { -webkit-text-stroke-width: 0.005em; }
.corner-mark { -webkit-text-stroke-width: 0; }

/* ---------- лайтбокс ---------- */
.lb-lock, .lb-lock body { overflow: hidden; }
.lb { position: fixed; inset: 0; z-index: 50; visibility: hidden; pointer-events: none; }
.lb.open { visibility: visible; pointer-events: auto; }
.lb-bg {
  position: absolute; inset: 0;
  background: rgba(15, 15, 15, .55);
  -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
  opacity: 0; transition: opacity .45s ease;
}
.lb.open .lb-bg { opacity: 1; }
.lb-stage { position: absolute; inset: 0; pointer-events: none; }
.lb-media { position: fixed; object-fit: cover; transform-origin: 0 0; pointer-events: auto; transition: opacity .3s; }
.lb-btn {
  position: absolute; z-index: 2;
  width: 52px; height: 52px; border-radius: 50%; border: 0; padding: 0;
  background: rgba(255, 255, 255, .2); color: #fff;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: grid; place-items: center; cursor: pointer;
  opacity: 0; transform: scale(.8);
  transition: opacity .3s ease, transform .3s ease, background .2s;
}
.lb.open .lb-btn { opacity: 1; transform: scale(1); transition-delay: .25s, .25s, 0s; }
.lb-btn:hover { background: rgba(255, 255, 255, .32); }
.lb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.lb-close { top: 24px; right: 24px; }
.lb-prev { left: 24px; top: 50%; margin-top: -26px; }
.lb-next { right: 24px; top: 50%; margin-top: -26px; }
.lb-btn:focus-visible { outline: 1px solid #fff; outline-offset: 3px; }

/* ---------- mobile (макет 390) ---------- */
@media (max-width: 760px) {
  :root { --m: calc(100vw / 390); }

  .top { height: calc(90 * var(--m)); font-size: 16px; }
  .top > * { top: calc(32 * var(--m)); }
  .logo { left: calc(4 * var(--m)); top: calc(32 * var(--m)); }
  .logo img { height: calc(28 * var(--m)); }
  .nav-sketches, .nav-works { display: none; }
  .avatar img { width: calc(56 * var(--m)); height: calc(56 * var(--m)); }
  .nav-cv { right: calc(8 * var(--m)); padding-bottom: 5px; }

  .hero { height: auto; padding: calc(144 * var(--m)) calc(8 * var(--m)) 0; }
  .hero-text, .corner { position: static; }
  .hero-circle { position: relative; left: auto; top: auto; }
  .hero-text { width: 100%; font-size: calc(48 * var(--m)); }
  .hero-circle { width: 100%; margin-top: calc(24 * var(--m)); }
  .hand { width: 50.6%; }

  .hero { display: grid; grid-template-columns: 1fr 1fr; column-gap: calc(8 * var(--m)); }
  .hero-text, .hero-circle { grid-column: 1 / -1; }
  .corner { margin-top: calc(42 * var(--m)); flex-direction: column; gap: calc(10 * var(--m)); width: auto; font-size: 16px; }
  .corner-c { width: auto; }
  .corner .indent { padding-left: calc(92 * var(--m)); }
  .corner-lines > :nth-child(2) { margin-top: 4px; }
  .corner-lines > :nth-child(3) { margin-top: 2px; }
  .corner-a .mono { font-family: var(--sans); }

  .sketches { padding: calc(80 * var(--m)) calc(8 * var(--m)) 0; }
  .grid { grid-template-columns: repeat(2, 1fr); column-gap: calc(8 * var(--m)); row-gap: calc(40 * var(--m)); }
  .br-d { display: none; }
  .grid li { order: var(--mo, 99); }
  .grid li.no-mobile { display: none; }
  .tile-caption { margin-top: calc(16 * var(--m)); font-size: 14px; line-height: 1.1; min-height: 0; }

  .works { padding: calc(80 * var(--m)) calc(8 * var(--m)) 0; }
  .works-title { font-size: calc(48 * var(--m)); margin-bottom: calc(48 * var(--m)); }
  .works-preview { display: none; }
  .work { grid-template-columns: 1fr 1fr; column-gap: calc(8 * var(--m)); row-gap: calc(24 * var(--m)); padding: 0 0 calc(80 * var(--m)); border-top: 0; }
  .works-list li:last-child .work { padding-bottom: 0; }
  .work-name { grid-column: 1 / -1; max-width: none; justify-self: center; text-align: center; font-size: 28px; letter-spacing: -0.02em; -webkit-text-stroke-width: 0.008em; }
  .footer-title { -webkit-text-stroke-width: 0; }
  .work-label { grid-column: 1; grid-row: 2; justify-self: start; text-align: left; font-size: 14px; line-height: 1.1; }
  .work-text { grid-column: 2; grid-row: 2; font-size: 14px; line-height: 1.1; }
  .work-label .action { display: none; }
  .work:hover .status { opacity: 1; }
  .work-image { display: block; grid-column: 1 / -1; width: 100%; }

  .footer { padding: calc(80 * var(--m)) 16px calc(32 * var(--m)); }

  .lb-btn { width: 44px; height: 44px; }
  .lb-close { top: 12px; right: 12px; }
  .lb-prev, .lb-next { top: auto; bottom: 20px; margin-top: 0; }
  .lb-prev { left: calc(50% - 52px); }
  .lb-next { right: calc(50% - 52px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .works-preview, .roll-in, .name-roll > span, .lb-bg, .lb-btn { transition: none; }
  .works-preview.on { animation: none; }
  .cursor, .cursor-plus { display: none; }
  .has-cursor .tile-media { cursor: auto; }
}
