@font-face {
  font-family: 'HelveticaNeueCyr';
  src: url('../fonts/HelveticaNeueCyr-Roman.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'HelveticaNeueCyr';
  src: url('../fonts/HelveticaNeueCyr-Medium.ttf') format('truetype');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --black: #000000;
  --white: #ffffff;
  --gray-mid: #8a8a8a;
  --gray-line: #e2e2e2;
  --accent: #44ccff;
  --accent-light: #99eeff;
  --container: 1600px;
  --gap: 24px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; overflow-x: clip; }

body {
  margin: 0;
  overflow-x: clip;
  background: var(--white);
  color: var(--black);
  font-family: 'HelveticaNeueCyr', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; text-decoration: none; }

.wrap {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
}

.site-header__inner {
  position: relative;
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 40px;
}

.logo { display: block; line-height: 0; }
.logo img { height: 13px; width: auto; display: block; }

.main-nav {
  display: flex;
  gap: 32px;
  position: relative;
  top: 1px;
}

.main-nav a {
  position: relative;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--black);
  opacity: 0.55;
  transition: opacity 0.2s ease;
}
.main-nav a::after {
  content: "";
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: -4px;
  right: -4px;
}
.main-nav a:hover { opacity: 1; }
.main-nav a.active {
  opacity: 1;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.header-mark {
  display: block;
  line-height: 0;
  background: none;
  border: none;
  padding: 8px;
  margin: -8px -8px -8px auto;
  cursor: pointer;
}
.header-mark img { height: 14px; width: auto; display: block; pointer-events: none; }

.header-align {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 24px;
  right: 24px;
  display: grid;
  grid-template-columns: 45fr 55fr;
  column-gap: 96px;
  align-items: center;
  pointer-events: none;
}

.lang-switch {
  grid-column: 2;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
  position: relative;
  top: 1px;
}
.lang-switch button {
  font-family: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.lang-switch button:first-child { font-weight: 500; color: var(--black); }
.lang-switch button:last-child { font-weight: 400; color: var(--gray-mid); }
.lang-switch span {
  display: block;
  width: 1px;
  height: 9px;
  background: var(--black);
}

@media (max-width: 720px) {
  .header-align {
    position: static;
    display: contents;
  }
}

/* ---------- Mobile nav ---------- */

@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .site-header__inner { padding: 14px 16px; gap: 16px; }

  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: #ffffff;
    border-bottom: 1px solid var(--gray-line);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .main-nav.is-open { max-height: 240px; }
  .main-nav a {
    padding: 16px;
    border-top: 1px solid var(--gray-line);
    opacity: 1;
  }
  .main-nav a:first-child { border-top: none; }
}

/* ---------- Hero ---------- */

.hero {
  padding: 56px 0 0;
}

.hero h1 {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
  text-transform: uppercase;
}

.hero__row {
  display: grid;
  grid-template-columns: 45fr 55fr;
  gap: 32px 96px;
  align-items: center;
  margin-top: 22px;
}

.hero__tags {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-mid);
}

.hero__contact {
  display: flex;
  gap: 18px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--black);
}
.hero__contact a { border-bottom: 1px solid var(--gray-line); }
.hero__contact a:hover { border-color: var(--black); }

.hero__grid {
  display: grid;
  grid-template-columns: 45fr 55fr;
  gap: 32px 96px;
  align-items: center;
  margin-top: 24px;
  min-height: 141px;
}

.hero__avatar {
  width: 141px;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #ffffff;
}
.hero__avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hero__links {
  display: flex;
  justify-content: space-between;
  gap: 28px;
}
.hero__links a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-mid);
  transition: color 0.15s ease;
}
.hero__links a::after {
  content: "";
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: -4px;
  right: -4px;
}
.hero__links a:hover { color: var(--black); }
.hero__links img { width: 10px; height: 10px; }

.hero__bio {
  font-size: 13px;
  line-height: 1.4;
  color: var(--black);
  max-width: 640px;
  margin: 0;
}
.hero__bio--statement {
  font-size: clamp(20px, 2.6vw, 32px);
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: -0.01em;
  max-width: 580px;
}

@media (max-width: 720px) {
  .hero h1 { line-height: 0.95; margin-bottom: 0; }
  .hero__row { grid-template-columns: 1fr; gap: 24px; margin-top: 32px; }
  .hero__grid { grid-template-columns: 1fr; margin-top: 32px; }
  .hero__links { flex-wrap: wrap; justify-content: flex-start; gap: 0 24px; }
}

.section-tabs {
  display: flex;
  gap: 48px;
  margin-top: 56px;
}

.section-tab {
  position: relative;
  font-family: inherit;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: none;
  border: none;
  padding: 0;
  color: var(--gray-mid);
  cursor: pointer;
}
.section-tab::after {
  content: "";
  position: absolute;
  top: -8px;
  bottom: -8px;
  left: -4px;
  right: -4px;
}

.section-tab.active {
  color: var(--black);
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 720px) {
  .section-tabs { margin-top: 32px; gap: 28px; }
}

/* ---------- Home project grid ---------- */

/*
 * TWO-TRACK PROJECT GRID — the reusable template for this site.
 *
 * Desktop = exactly two container types, side by side:
 *   left track  (narrower, ~45%) and right track (~55% wide).
 * Every project sits in one cell. Cells are placed in normal reading
 * order (left, right, left, right, ...) so row 1 = [project A | project B],
 * row 2 = [project C | project D], etc.
 *
 * The height-matching rule ("left and right in the same row must be
 * EXACTLY the same height") is enforced by CSS Grid itself, not by
 * copying pixel numbers: a grid row's height is always the tallest
 * cell in that row, and align-items:stretch (the Grid default) forces
 * the shorter cell to match it. So you never hand-tune heights —
 * just add a new .proj-block in the right spot in the DOM and the
 * grid keeps both columns level automatically.
 *
 * Inside a cell: .proj-tiles is a small sub-grid (1-4 images) that
 * always fills 100% of the cell's stretched height via object-fit:
 * cover — one hero image is just a 1-tile version of the same thing.
 * That's the only pattern to learn to add a new project.
 */

.home-grid {
  display: grid;
  grid-template-columns: 45fr 55fr;
  gap: 80px 96px;
  align-items: stretch;
  margin-top: 32px;
  padding-bottom: 32px;
}

.proj-block {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.proj-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
}
.proj-tiles.tiles-1 { grid-template-columns: 1fr; }
.proj-tiles .tile { display: block; min-height: 0; }
.proj-tiles .tile > img,
.proj-tiles .tile > .tile-stack {
  width: 100%;
  height: 100%;
}
.proj-tiles img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #f2f2f2;
}
.proj-tiles .span-2 { grid-column: span 2; }
.proj-tiles .span-2-rows { grid-row: span 2; }
.tile-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tile-stack img { flex: 1 1 0; min-height: 0; object-fit: cover; }

/* .composite — for the handful of blocks pulled 1:1 from a specific
   Figma frame (exact left/top/width/height % + a background photo
   bleeding through the gaps), instead of the generic .proj-tiles grid.
   Children are positioned with inline style percentages copied
   straight from Figma's node coordinates — see README.md. */
.composite {
  position: relative;
  overflow: hidden;
  flex: 1 1 auto;
  min-height: 0;
}
.composite img,
.composite .cbox {
  position: absolute;
  display: block;
}
.composite > img { object-fit: cover; }
.composite .cbox { overflow: hidden; }
.composite .cbox img { max-width: none; }

.proj-block__cap {
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
  padding-top: 4px;
  margin-top: 6px;
}
.proj-block__cap span:last-child { color: var(--gray-mid); font-weight: 400; }

.home-more {
  margin: 0;
  text-align: center;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-bottom: 32px;
}
.home-more a:hover { opacity: 0.6; }

@media (max-width: 720px) {
  .home-grid { grid-template-columns: 1fr; }
  .proj-block { grid-column: 1 !important; }
}

/* ---------- About page ---------- */

.page-title {
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  padding-top: 56px;
  margin: 0 0 14px;
}

/* .page-hero's height is set by JS (assets/js/main.js) to this page's own
   real content height + a fixed 20px — the same 20px as .home-grid's own
   margin-top below the line (see there), so the divider sits symmetrically:
   exactly 20px under whatever content precedes it, exactly 20px above the
   first project row, on every page and at any viewport width. A plain CSS
   px/vw guess can't track real text-wrapping (which varies by browser/
   font), so this is measured directly instead of estimated. The height
   below is just a pre-JS fallback (divider sits right after content). */
.page-hero {
  position: relative;
}
.page-hero .page-divider {
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: 0;
  width: 100vw;
  margin-left: -50vw;
  border-bottom: 1px solid var(--black);
}

.about-body {
  display: grid;
  gap: 24px;
  max-width: 480px;
  margin-top: 32px;
  padding-bottom: 32px;
}
.about-body p {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  margin: 0;
}

.cv-tag {
  position: fixed;
  pointer-events: none;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(0,0,0,0.35);
  background: transparent;
  transform: translate(-50%, -50%);
  z-index: 60;
  opacity: 0;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}
.cv-tag.show { opacity: 1; }

/* ---------- Contact page ---------- */

.contact-list {
  list-style: none;
  margin: 32px 0 32px;
  padding: 0;
}
.contact-list li { border-top: 1px solid var(--gray-line); }
.contact-list li:last-child { border-bottom: 1px solid var(--gray-line); }
.contact-list a,
.contact-list span {
  display: block;
  padding: 22px 0;
  font-size: clamp(32px, 7vw, 72px);
  font-weight: 400;
  letter-spacing: -0.02em;
}
.contact-list span { color: var(--gray-mid); cursor: default; }
.contact-list a { transition: opacity 0.15s ease; }
.contact-list a:hover { opacity: 0.55; }

/* ---------- Projects page ---------- */

.case {
  position: relative;
  padding: 56px 0;
}
.case::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  right: 50%;
  width: 100vw;
  margin-left: -50vw;
  border-top: 1px solid var(--black);
}
.case:first-of-type { padding-top: 32px; }
.case:first-of-type::before { content: none; }
.case:last-of-type { padding-bottom: 32px; }

.case__meta {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  align-items: start;
  gap: 16px;
  margin-bottom: 22px;
}

.case__lang {
  display: flex;
  gap: 10px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
}
.case__lang button {
  background: none;
  border: none;
  font: inherit;
  color: var(--gray-mid);
  cursor: pointer;
  padding: 0;
}
.case__lang button.active { color: var(--black); text-decoration: underline; text-underline-offset: 3px; }

.case__title {
  font-size: 22px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.case__info {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 400;
}
.case__info a { border-bottom: 1px solid var(--gray-line); }
.case__info a:hover { border-color: var(--black); }

.case__desc {
  display: grid;
  grid-template-columns: 90px 1fr 1fr;
  gap: 16px;
  margin-bottom: 30px;
}
.case__desc p {
  grid-column: 2 / span 2;
  font-size: 12px;
  font-weight: 400;
  text-transform: uppercase;
  line-height: 1.6;
  margin: 0 0 14px;
  max-width: 640px;
}

/* Horizontal filmstrip — matches the source design: every case's
   material scrolls sideways at one fixed height, instead of wrapping
   into a grid. Add a new project's images in a row of <img> tags and
   it just works — no layout math needed. */
.case__gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 10px;
  scroll-snap-type: x proximity;
}
.case__gallery img {
  height: 300px;
  width: auto;
  max-width: none;
  flex: 0 0 auto;
  object-fit: cover;
  scroll-snap-align: start;
  background: #f2f2f2;
  cursor: zoom-in;
}
.case__gallery::-webkit-scrollbar { height: 5px; }
.case__gallery::-webkit-scrollbar-track { background: transparent; }
.case__gallery::-webkit-scrollbar-thumb { background: var(--gray-line); border-radius: 3px; }

.case__empty {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-mid);
  padding: 20px 0 0;
}

@media (max-width: 760px) {
  .case__meta, .case__desc { grid-template-columns: 1fr; }
  .case__desc p { grid-column: 1; }
  .case__gallery img { height: 220px; }
}

/* ---------- Lightbox (click a gallery image to zoom) ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  background: rgba(10, 10, 10, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  cursor: zoom-out;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform: scale(0.92);
  transition: transform 0.3s ease;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.lightbox.is-open img {
  transform: scale(1);
}

/* ---------- Footer ---------- */

.footer-divider {
  position: relative;
}
.footer-divider::after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: 0;
  width: 100vw;
  margin-left: -50vw;
  border-bottom: 1px solid var(--black);
}

.site-footer {
  background: var(--white);
  color: var(--black);
}
.site-footer__inner {
  position: relative;
  padding-top: 32px;
  padding-bottom: 32px;
  display: grid;
  grid-template-columns: 45fr 55fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "portrait right"
    "credit   right";
  gap: 32px 96px;
}
.site-footer__portrait {
  grid-area: portrait;
  width: clamp(200px, 24vw, 345px);
  aspect-ratio: 345 / 181;
}
.site-footer__portrait img { width: 100%; height: 100%; object-fit: contain; display: block; }
.site-footer__credit {
  grid-area: credit;
  align-self: end;
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--gray-mid);
}
.site-footer__right {
  grid-area: right;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.site-footer__nav,
.site-footer__social,
.site-footer__contact {
  display: flex;
  flex-direction: column;
  gap: 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.site-footer__nav a,
.site-footer__social a,
.site-footer__contact a {
  position: relative;
}
.site-footer__nav a::after,
.site-footer__social a::after,
.site-footer__contact a::after {
  content: "";
  position: absolute;
  top: -6px;
  bottom: -6px;
  left: -4px;
  right: -4px;
}
.site-footer__nav a { color: var(--black); }
.site-footer__nav a:hover { opacity: 0.6; }
.site-footer__social a,
.site-footer__social span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--gray-mid);
}
.site-footer__social a:hover { color: var(--black); }
.site-footer__social img { width: 10px; height: 10px; }
.site-footer__contact { text-transform: none; }
.site-footer__contact a { color: var(--black); }
.site-footer__contact a:hover { opacity: 0.6; }

@media (max-width: 720px) {
  .site-footer__inner {
    grid-template-columns: 1fr;
    grid-template-areas:
      "portrait"
      "right"
      "credit";
  }
}
@media (max-width: 640px) {
  .site-footer__inner { gap: 32px; }
}
