/*
  Макет нарисован под 1920px. --u — это «1px макета»: на 1920 и шире равен 1px,
  на меньших экранах всё пропорционально ужимается. Ниже 760px — отдельная мобильная раскладка.
*/
:root {
  --cream: #f9dbb8;
  --wine: #4e1212;
  --dark: #262626;
  --u: calc(min(100vw, 1920px) / 1920);
  --font: 'Unbounded', system-ui, sans-serif;
}

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

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--dark);
  color: var(--cream);
  font-family: var(--font);
  line-height: normal;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: inherit;
}

p,
h1,
h2 {
  margin: 0;
  font-weight: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:focus-visible {
  outline: 3px solid var(--cream);
  outline-offset: 4px;
}

/* ---------- Первый экран ---------- */
.hero {
  position: relative;
  height: calc(1080 * var(--u));
  overflow: hidden;
  background: #1a1420 url('/img/hero.webp') center / cover no-repeat;
}

.site-header {
  position: absolute;
  top: calc(63 * var(--u));
  left: calc(261 * var(--u));
  display: flex;
  align-items: flex-start;
  gap: calc(41 * var(--u));
}

.site-header .logo {
  width: calc(281 * var(--u));
  height: calc(45 * var(--u));
}

.site-header .logo img {
  width: 100%;
  height: 100%;
}

.site-header nav {
  padding-top: calc(3 * var(--u));
}

.site-header nav a {
  font-size: calc(32 * var(--u));
  font-weight: 400;
  text-decoration: none;
  text-underline-offset: 0.2em;
}

.site-header nav a:hover {
  text-decoration: underline;
}

.hero h1 {
  position: absolute;
  left: calc(257 * var(--u));
  top: calc(661 * var(--u));
  width: calc(804 * var(--u));
  font-size: calc(64 * var(--u));
  font-weight: 500;
  text-transform: uppercase;
}

/* ---------- Обо мне ---------- */
.about {
  position: relative;
  height: calc(1080 * var(--u));
  background: var(--wine);
}

.about h2 {
  position: absolute;
  top: calc(176 * var(--u));
  left: 0;
  right: 0;
  text-align: center;
  font-size: calc(64 * var(--u));
  font-weight: 600;
}

.about-card {
  position: absolute;
  top: calc(316 * var(--u));
  left: 50%;
  width: calc(1192 * var(--u));
  height: calc(470 * var(--u));
  transform: translateX(-50%);
}

.about-frame {
  position: absolute;
  left: calc(146 * var(--u));
  top: calc(27 * var(--u));
  width: calc(1046 * var(--u));
  height: calc(376 * var(--u));
  border: calc(11 * var(--u)) solid var(--cream);
  border-radius: calc(100 * var(--u));
  font-weight: 300;
}

.about-meta {
  position: absolute;
  left: calc(296 * var(--u));
  top: calc(79.5 * var(--u));
  width: calc(600 * var(--u));
  height: calc(76 * var(--u));
  font-size: calc(48 * var(--u));
}

.about-meta > span {
  position: absolute;
  top: calc(8.5 * var(--u));
  white-space: nowrap;
}

.about-meta .name { left: 0; }
.about-meta .age { left: calc(302 * var(--u)); }
.about-meta .type { left: calc(453 * var(--u)); }

.about-meta .separators {
  position: absolute;
  left: calc(244.5 * var(--u));
  top: 0;
  width: calc(174 * var(--u));
  height: calc(76 * var(--u));
}

.about-meta .sep {
  display: none;
}

.about-desc {
  position: absolute;
  left: calc(296 * var(--u));
  top: calc(177 * var(--u));
  font-size: calc(40 * var(--u));
  white-space: nowrap;
}

/* Аватар со звёздочками и сердечками — позиции из макета, относительно .about-card */
.avatar {
  position: absolute;
  inset: 0 auto auto 0;
  width: calc(470 * var(--u));
  height: calc(470 * var(--u));
}

.avatar > * {
  position: absolute;
}

.avatar .ring {
  left: calc(15 * var(--u));
  top: calc(26 * var(--u));
  width: calc(390 * var(--u));
  height: calc(390 * var(--u));
}

.avatar .photo {
  left: calc(27 * var(--u));
  top: calc(38 * var(--u));
  width: calc(366 * var(--u));
  height: calc(366 * var(--u));
  border-radius: 50%;
  overflow: hidden;
}

.avatar .photo img {
  position: absolute;
  left: calc(-41.374 * var(--u));
  top: calc(-12.199 * var(--u));
  width: calc(484.226 * var(--u));
  height: calc(390.356 * var(--u));
  max-width: none;
}

.avatar .star-1 {
  left: calc(9.39 * var(--u));
  top: calc(19.49 * var(--u));
  width: calc(127.021 * var(--u));
  height: calc(127.021 * var(--u));
  rotate: -16.87deg;
}

.avatar .heart-2 {
  left: calc(128.9 * var(--u));
  top: calc(4.3 * var(--u));
  width: calc(78 * var(--u));
  height: calc(69.01 * var(--u));
  rotate: -15.56deg;
}

.avatar .heart-1 {
  left: calc(259.56 * var(--u));
  top: calc(333.75 * var(--u));
  width: calc(136.687 * var(--u));
  height: calc(121.906 * var(--u));
  rotate: 15deg;
}

.avatar .star-2 {
  left: calc(177.04 * var(--u));
  top: calc(364.54 * var(--u));
  width: calc(100.329 * var(--u));
  height: calc(100.329 * var(--u));
  rotate: 4.09deg;
}

/* ---------- Подвал ---------- */
.site-footer {
  height: calc(454 * var(--u));
  padding-top: calc(123 * var(--u));
  background: var(--dark);
}

.socials {
  display: flex;
  justify-content: center;
  gap: calc(99 * var(--u));
  margin: 0;
  padding: 0;
  list-style: none;
}

.socials a {
  display: block;
  transition: opacity 0.2s, transform 0.2s;
}

.socials a:hover {
  opacity: 0.8;
  transform: translateY(-3px);
}

.socials .tg img {
  width: calc(102 * var(--u));
  height: calc(104 * var(--u));
}

.socials .da img {
  width: calc(65 * var(--u));
  height: calc(104 * var(--u));
}

/* ---------- Галерея ---------- */
.gallery-page {
  width: calc(1405 * var(--u));
  margin: 0 auto;
  padding: calc(164 * var(--u)) 0 calc(126 * var(--u));
}

.gallery-head h1 {
  width: calc(804 * var(--u));
  font-size: calc(64 * var(--u));
  font-weight: 500;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(98 * var(--u));
  padding: 0 calc(27 * var(--u));
  border: calc(5 * var(--u)) solid var(--cream);
  border-radius: calc(32 * var(--u));
  font-size: calc(32 * var(--u));
  font-weight: 400;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

.btn:hover {
  background: var(--cream);
  color: var(--dark);
}

.gallery-head .btn {
  margin-top: calc(45 * var(--u));
}

/*
  Ровные ряды: JS раскладывает картинки по рядам высотой около --row-h,
  внутри ряда ширина пропорциональна соотношению сторон → высота у всех одинаковая,
  а ряд точно заполняет ширину. Неполный последний ряд не растягивается.
*/
.gallery-grid {
  --row-h: calc(440 * var(--u));
  --gap: calc(40 * var(--u));
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  margin-top: calc(90 * var(--u));
}

.gallery-row {
  display: flex;
  gap: var(--gap);
}

.gallery-row.is-last .gallery-item {
  flex: 0 1 calc(var(--ar) * var(--row-h));
}

.gallery-item {
  flex: var(--ar) 1 0;
  min-width: 0;
  aspect-ratio: var(--ar);
  padding: 0;
  border: 0;
  background: #1d1d1d;
  cursor: zoom-in;
  overflow: hidden;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-item:hover img {
  transform: scale(1.02);
}

.gallery-status {
  text-align: center;
  font-size: calc(32 * var(--u));
  font-weight: 300;
  opacity: 0.7;
}

.gallery-foot {
  display: flex;
  justify-content: center;
  margin-top: calc(113 * var(--u));
}

/* Лайтбокс */
.lightbox {
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgb(0 0 0 / 0.92);
  color: var(--cream);
}

.lightbox::backdrop {
  background: transparent;
}

.lightbox[open] {
  display: grid;
  place-items: center;
}

.lightbox img {
  max-width: calc(100vw - 160px);
  max-height: calc(100dvh - 48px);
  object-fit: contain;
}

.lightbox button {
  position: absolute;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 2px solid var(--cream);
  border-radius: 50%;
  background: rgb(38 38 38 / 0.6);
  color: var(--cream);
  font: 400 24px/1 var(--font);
  cursor: pointer;
}

.lightbox .lb-close { top: 16px; right: 16px; }
.lightbox .lb-prev { left: 16px; top: 50%; translate: 0 -50%; }
.lightbox .lb-next { right: 16px; top: 50%; translate: 0 -50%; }

/* ---------- Мобильная раскладка ---------- */
@media (max-width: 760px) {
  :root {
    /* под мобилку «пиксель макета» крупнее, чтобы текст не становился мелким */
    --u: calc(100vw / 1100);
  }

  .hero {
    height: min(100svh, 720px);
    background-position: 62% center;
  }

  .hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 40%, rgb(0 0 0 / 0.55));
  }

  .site-header {
    top: 24px;
    left: 16px;
    right: 16px;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
  }

  .site-header .logo {
    width: 140px;
    height: 22px;
  }

  .site-header nav a {
    font-size: 15px;
  }

  .hero h1 {
    z-index: 1;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 48px;
    width: auto;
    font-size: clamp(28px, 8.5vw, 40px);
  }

  .about {
    height: auto;
    padding: 56px 16px 72px;
  }

  .about h2 {
    position: static;
    font-size: 32px;
  }

  .about-card {
    position: relative;
    top: 0;
    left: 0;
    width: auto;
    height: auto;
    margin-top: 32px;
    transform: none;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .avatar {
    --u: calc(min(100vw - 32px, 360px) / 470);
    position: relative;
    inset: auto;
    flex: none;
    order: -1;
    z-index: 1;
  }

  .about-frame {
    position: relative;
    left: 0;
    top: 0;
    width: 100%;
    max-width: 420px;
    height: auto;
    margin-top: -40px;
    padding: 56px 24px 28px;
    border-width: 5px;
    border-radius: 40px;
    text-align: center;
  }

  .about-meta {
    position: static;
    width: auto;
    height: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    font-size: 24px;
  }

  .about-meta > span {
    position: static;
  }

  .about-meta .separators {
    display: none;
  }

  .about-meta .sep {
    display: block;
    width: 4px;
    height: 32px;
    border-radius: 2px;
    background: var(--cream);
  }

  .about-desc {
    position: static;
    margin-top: 16px;
    font-size: 17px;
    white-space: normal;
  }

  .site-footer {
    height: auto;
    padding: 48px 16px;
  }

  .socials {
    gap: 56px;
  }

  .socials .tg img { width: 56px; height: 57px; }
  .socials .da img { width: 36px; height: 57px; }

  /* Галерея */
  .gallery-page {
    width: auto;
    padding: 40px 16px 56px;
  }

  .gallery-head h1 {
    width: auto;
    font-size: clamp(26px, 8vw, 36px);
  }

  .btn {
    height: 52px;
    padding: 0 22px;
    border-width: 3px;
    border-radius: 18px;
    font-size: 16px;
  }

  .gallery-head .btn {
    margin-top: 20px;
  }

  .gallery-grid {
    --row-h: 150px;
    --gap: 8px;
    margin-top: 32px;
  }

  .gallery-status {
    font-size: 16px;
  }

  .gallery-foot {
    margin-top: 40px;
  }

  .lightbox img {
    max-width: 100vw;
    max-height: calc(100dvh - 140px);
  }

  .lightbox .lb-prev,
  .lightbox .lb-next {
    top: auto;
    bottom: 16px;
    translate: none;
  }

  .lightbox .lb-prev { left: calc(50% - 72px); }
  .lightbox .lb-next { right: calc(50% - 72px); }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
