@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/onest-cyrillic.woff2") format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Onest";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("assets/fonts/onest-latin.woff2") format("woff2");
  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 {
  --paper: #f6f6f1;
  --ink: #242720;
  --muted: #73776c;
  --line: #dddfd4;
  --accent: #ddeb9e;
  --content-width: 1160px;
  scrollbar-gutter: stable;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Onest", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body.viewer-open {
  overflow: hidden;
}

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

h1,
h2,
h3,
p {
  margin: 0;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

.intro,
.projects {
  width: min(var(--content-width), calc(100% - 80px));
  margin-inline: auto;
}

/* Первый экран. */
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: center;
  gap: 64px;
  padding-block: 88px 100px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.intro .eyebrow {
  margin-bottom: 24px;
}

h1 {
  font-size: clamp(44px, 6.6vw, 82px);
  font-weight: 550;
  letter-spacing: -0.065em;
  line-height: 1.03;
}

h1 span {
  color: #859747;
}

.intro__heading {
  margin-top: 28px;
  font-size: clamp(18px, 1.8vw, 23px);
  font-weight: 450;
  line-height: 1.45;
  letter-spacing: -0.025em;
}

.intro__experience {
  margin-top: 24px;
  color: var(--muted);
  font-size: 14px;
}

.contact-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--ink);
  background: var(--accent);
  border: 1px solid #cfdd8c;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  text-decoration: none;
  transition: background-color 180ms ease, transform 180ms ease;
}

.intro .contact-link {
  margin-top: 28px;
}

.contact-link:hover {
  background: #d4e58e;
  transform: translateY(-1px);
}

.contact-link:focus-visible {
  outline: 3px solid rgba(133, 151, 71, 0.4);
  outline-offset: 3px;
}

.contact-link__icon {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.portrait-frame {
  padding: 10px;
  background: #e5e8db;
  border: 1px solid #dce1ce;
  border-radius: 18px;
  box-shadow: 12px 12px 0 #e9ecdf;
  transform: rotate(3deg);
}

.portrait {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 10px;
  object-fit: cover;
}

/* Кейсы и превью интерфейсов. */
.projects__intro {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.projects__intro > p:last-child {
  color: var(--muted);
  font-size: 13px;
}

.project {
  padding-block: 48px 72px;
}

.project + .project {
  border-top: 1px solid var(--line);
}

.project__heading {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 28px;
}

h2 {
  font-size: clamp(28px, 3.5vw, 42px);
  font-weight: 550;
  letter-spacing: -0.05em;
  line-height: 1.2;
}

.project__heading > p {
  color: var(--muted);
  font-size: 13px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: 196px;
  gap: 14px;
  margin-bottom: 36px;
}

.gallery a {
  --gallery-frame: #eae9e1;

  position: relative;
  display: block;
  grid-column: span 2;
  overflow: hidden;
  padding: 14px;
  background: var(--gallery-frame);
  border-radius: 14px;
  cursor: zoom-in;
}

.gallery a:first-child {
  grid-column: span 4;
  grid-row: span 2;
}

.gallery a:nth-child(n+4) {
  grid-column: span 3;
}

.project--xsolla .gallery a {
  --gallery-frame: #e9e6f0;
}

.project--asv .gallery a {
  --gallery-frame: #e2e9ed;
}

.gallery a::after {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: block;
  width: 28px;
  height: 28px;
  color: #343830;
  background:
    linear-gradient(currentColor, currentColor) center / 10px 2px no-repeat,
    linear-gradient(currentColor, currentColor) center / 2px 10px no-repeat,
    #ffffff;
  border: 3px solid var(--gallery-frame);
  border-radius: 50%;
  content: "";
}

.gallery__media {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  border-radius: 8px;
}

.gallery img {
  display: block;
  width: 100%;
  height: auto;
  transform-origin: top center;
  transition: transform 180ms ease;
}

.gallery a:hover img,
.gallery a:focus-visible img {
  transform: scale(1.02);
}

.project__description {
  max-width: 800px;
  padding-left: 24px;
  border-left: 2px solid var(--accent);
}

.project__description > p:first-child {
  max-width: 700px;
  font-size: 19px;
  font-weight: 450;
  line-height: 1.5;
  letter-spacing: -0.025em;
}

h3 {
  margin-top: 24px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

ul {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}

li::marker {
  color: #929d71;
}

.project__description > p:last-child {
  font-size: 13px;
}

/* Завершение страницы. */
.page-contact {
  width: min(var(--content-width), calc(100% - 80px));
  margin-inline: auto;
  padding-block: 56px 40px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.page-end {
  display: flex;
  width: min(var(--content-width), calc(100% - 80px));
  align-items: center;
  justify-content: flex-start;
  gap: 20px;
  margin-inline: auto;
  padding-block: 8px 40px;
  color: var(--muted);
  font-size: 12px;
}

.page-end::after {
  flex: 1;
  height: 1px;
  background: var(--line);
  content: "";
}

/* Просмотр скриншотов. */
.lightbox {
  position: fixed;
  inset: 0;
  width: 100vw;
  max-width: 100vw;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 24px 32px;
  overflow: hidden;
  color: #f7f7f2;
  background: #20221f;
  border: 0;
}

.lightbox[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 20px;
}

.lightbox::backdrop {
  background: #20221f;
}

.lightbox__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.lightbox__caption {
  color: #c9ccc2;
  font-size: 14px;
}

.lightbox button {
  flex-shrink: 0;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.lightbox__close {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 44px;
  padding: 4px 0 4px 12px;
  font-size: 13px;
}

.lightbox__close span {
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}

.lightbox__stage {
  display: grid;
  min-height: 0;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 20px;
  touch-action: pan-y pinch-zoom;
}

.lightbox__image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.lightbox__stage button {
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  font-family: Arial, sans-serif;
  font-size: 25px;
  line-height: 1;
}

.lightbox__stage button:hover,
.lightbox__stage button:focus-visible {
  color: #20221f;
  background: var(--accent);
}

.lightbox__counter {
  color: #b1b6a6;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

@media (min-width: 768px) {
  .intro {
    grid-template-columns: minmax(0, 1fr) 280px;
  }

  .portrait-frame {
    transform: translateY(-28px) rotate(3deg);
  }
}

@media (max-width: 767px) {
  .intro,
  .projects,
  .page-contact,
  .page-end {
    width: calc(100% - 40px);
  }

  .intro {
    grid-template-columns: minmax(0, 1fr) 160px;
    gap: 24px;
    padding-block: 64px 72px;
  }

  h1 {
    font-size: clamp(37px, 6.8vw, 58px);
  }

  .portrait-frame {
    padding: 6px;
    border-radius: 12px;
    box-shadow: 8px 8px 0 #e9ecdf;
  }

  .gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 196px;
    grid-template-rows: 308px;
    gap: 10px;
  }

  .gallery a,
  .gallery a:nth-child(n+4) {
    grid-column: auto;
  }

  .gallery a:first-child {
    grid-column: 1 / -1;
    grid-row: auto;
    min-height: 308px;
  }

  .lightbox {
    padding: 12px;
  }

  .lightbox__toolbar {
    gap: 12px;
  }

  .lightbox__caption {
    font-size: 12px;
  }

  .lightbox__stage {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .lightbox__image {
    grid-column: 1;
    grid-row: 1;
    padding-bottom: 60px;
  }

  .lightbox__stage button {
    position: absolute;
    bottom: 0;
    width: 44px;
    height: 44px;
  }

  .lightbox__previous {
    left: calc(50% - 54px);
  }

  .lightbox__next {
    right: calc(50% - 54px);
  }

}

@media (max-width: 559px) {
  .intro {
    position: relative;
    display: block;
    padding-block: 44px 56px;
  }

  .intro .eyebrow {
    margin-bottom: 88px;
  }

  h1 {
    font-size: clamp(35px, 9vw, 50px);
  }

  .intro__heading {
    font-size: 18px;
  }

  .intro__experience {
    font-size: 12px;
  }

  .portrait-frame {
    position: absolute;
    top: 34px;
    right: 8px;
    width: 90px;
  }

  .project {
    padding-block: 32px 48px;
  }

  .project__heading {
    margin-bottom: 20px;
  }

  .gallery {
    grid-auto-rows: 150px;
    grid-template-rows: 250px;
  }

  .gallery a {
    padding: 10px;
    border-radius: 9px;
  }

  .gallery a:first-child {
    min-height: 250px;
  }

  .gallery a::after {
    right: 10px;
    bottom: 10px;
    width: 24px;
    height: 24px;
    font-size: 16px;
  }

  .project__description {
    padding-left: 16px;
  }

  .project__description > p:first-child {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery img,
  .contact-link {
    transition: none;
  }

}
