/* ============================================================
   Stas Yarcev — portfolio
   Минимальная сетка: 2/3 + 1/3, подписи на кромке кадра.
   ============================================================ */

:root {
  --ink: #111110;
  --muted: #8d8b86;
  --paper: #ffffff;
  --soft: #f2f0ec;
  --pad: clamp(18px, 4.4vw, 72px);
  --gap: clamp(10px, 1.1vw, 16px);
  --row-gap: clamp(9px, 1vw, 14px);
  --maxw: 1320px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0 auto;
  max-width: var(--maxw);
  padding: 0 var(--pad);
  background: var(--paper);
  color: var(--ink);
  font-family: "Helvetica Neue", Helvetica, "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img { display: block; max-width: 100%; }

a { color: inherit; }

::selection { background: #111; color: #fff; }

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 10px 14px;
  background: #111;
  color: #fff;
  font-size: 12px;
  text-decoration: none;
}
.skip:focus { left: 8px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 1.5px solid var(--ink);
  outline-offset: 3px;
}

/* ---------------------------------------------------------- header */
.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding-top: clamp(22px, 3.4vw, 44px);
}

.brand {
  font-size: 12.5px;
  letter-spacing: 0.005em;
  text-decoration: none;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: clamp(13px, 1.8vw, 26px);
}

.nav a {
  font-size: 11px;
  letter-spacing: 0.01em;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2.5px;
  text-decoration-color: rgba(17, 17, 16, 0.38);
  transition: text-decoration-color 0.2s ease;
}
.nav a:hover { text-decoration-color: var(--ink); }

/* ---------------------------------------------------------- intro */
.intro { margin-top: clamp(38px, 4.6vw, 66px); }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--soft);
}

.tagline {
  margin: 17px 0 0;
  font-size: clamp(18px, 2.05vw, 23px);
  font-weight: 400;
  letter-spacing: -0.012em;
  line-height: 1.3;
}

/* ---------------------------------------------------------- works */
.works {
  margin-top: clamp(40px, 5vw, 78px);
  display: flex;
  flex-direction: column;
  gap: var(--row-gap);
}

.row {
  display: grid;
  gap: var(--gap);
  grid-template-columns: 2fr 1fr;
}
.row--b,
.row--d { grid-template-columns: 1fr 2fr; }
.row--e { grid-template-columns: 1fr; }

/* пропорции рядов: подогнаны под исходный сайт */
.row--a { aspect-ratio: 2.32; }
.row--b { aspect-ratio: 2.40; }
.row--c { aspect-ratio: 2.25; }
.row--d { aspect-ratio: 2.78; }
.row--e { aspect-ratio: 3.30; }

.work {
  position: relative;
  margin: 0;
  height: 100%;
  background: var(--soft);
  overflow: visible;
}

.work__link {
  display: block;
  height: 100%;
  position: relative;
  overflow: hidden;
  background: var(--soft);
  cursor: zoom-in;
}

.work img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.9s cubic-bezier(0.22, 0.7, 0.2, 1), opacity 0.4s ease;
  will-change: transform;
}

.work__link:hover img { transform: scale(1.018); }
.work__link:active img { transform: scale(1.004); }

/* подпись на нижней кромке кадра */
.cap {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 2;
  margin: 0;
  padding: 5px 9px 6px;
  background: var(--paper);
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.15;
}

.cap b {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.cap span {
  display: block;
  margin-top: 3px;
  font-size: 9px;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.01em;
}

/* ---------------------------------------------------------- footer */
.foot {
  margin-top: clamp(56px, 6vw, 96px);
  padding-bottom: clamp(40px, 5.4vw, 76px);
  text-align: center;
}

.touch {
  margin: 0 0 clamp(20px, 2.4vw, 28px);
  font-size: clamp(15px, 1.55vw, 20px);
  letter-spacing: -0.01em;
}

.touch a {
  text-decoration: none;
  border-bottom: 1px solid rgba(17, 17, 16, 0.28);
  transition: border-color 0.2s ease;
}
.touch a:hover { border-color: var(--ink); }

.nav--center { justify-content: center; margin-bottom: clamp(16px, 1.8vw, 22px); }

.year {
  margin: 0;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------- lightbox */
.lb {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 56px);
  background: #0b0b0a;
}
.lb[hidden] { display: none; }

.lb__stage {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: min(1500px, 94vw);
}

.lb__img {
  max-width: 100%;
  max-height: calc(100vh - 170px);
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.995);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.22, 0.7, 0.2, 1);
}
.lb.is-ready .lb__img { opacity: 1; transform: none; }

.lb__cap {
  text-align: center;
  color: #f2f0ec;
  line-height: 1.3;
}
.lb__cap b {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.lb__cap span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: rgba(242, 240, 236, 0.55);
}

.lb__count {
  position: absolute;
  bottom: clamp(14px, 2.4vw, 26px);
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: rgba(242, 240, 236, 0.45);
  font-size: 10.5px;
  letter-spacing: 0.08em;
}

.lb__close,
.lb__nav {
  position: absolute;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #f2f0ec;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease, background 0.2s ease;
}
.lb__close:hover,
.lb__nav:hover { opacity: 1; background: rgba(255, 255, 255, 0.08); }

.lb__close { top: clamp(10px, 2vw, 22px); right: clamp(10px, 2vw, 22px); }
.lb__nav--prev { left: clamp(6px, 1.6vw, 20px); top: 50%; transform: translateY(-50%); }
.lb__nav--next { right: clamp(6px, 1.6vw, 20px); top: 50%; transform: translateY(-50%); }

.lb svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.is-locked { overflow: hidden; }

/* ---------------------------------------------------------- reveal */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s ease, transform 0.8s cubic-bezier(0.22, 0.7, 0.2, 1);
}
.reveal.is-in { opacity: 1; transform: none; }

/* ---------------------------------------------------------- responsive */
@media (max-width: 760px) {
  .top { align-items: flex-start; }

  .row,
  .row--a,
  .row--b,
  .row--c,
  .row--d,
  .row--e {
    grid-template-columns: 1fr;
    aspect-ratio: auto;
  }

  .work { aspect-ratio: 1.45; }
  .work--tall { aspect-ratio: 0.82; }
  .work--wide { aspect-ratio: 2.4; }

  .cap { transform: translateX(-50%); }

  .lb__nav { width: 38px; height: 38px; }
  .lb__img { max-height: calc(100vh - 150px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
