/* ==========================================================================
   Портфолио Татьяны Руденко — стили
   Цвета, шрифты и отступы задаются переменными ниже.
   ========================================================================== */

/* Onest хранится локально — сайт работает и без интернета */
@font-face {
  font-family: 'Onest';
  src: url('../fonts/Onest-Variable.ttf') format('truetype');
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #F8F7F5;
  --text: #171717;
  --text-2: #777777;
  --line: #D6D4D1;
  --ph: #E8E7E5;

  /* Версия 2: один гротеск для заголовков и текста */
  --sans: 'Onest', 'Helvetica Neue', 'Arial', sans-serif;

  /* Типографическая шкала — одинаковые по значимости элементы используют один уровень */
  --fs-display: clamp(48px, 6vw, 104px); /* заголовки разделов и страницы проекта */
  --fs-h1: clamp(36px, 3.3vw, 60px);       /* главный заголовок первого экрана */
  --fs-body: 16px;                         /* наборный текст */
  --fs-ui: 15px;                           /* навигация, ссылки, названия карточек */
  --fs-small: 14px;                        /* подписи, категории, фильтры, подвал */
  --fs-label: 13px;                        /* надписи капителью */
  --lh-body: 1.6;
  --ls-display: -0.045em;
  --ls-h1: -0.035em;

  --hero-shift: 7%; /* насколько левая часть первого экрана сдвинута к большому изображению */

  --gutter: clamp(16px, 4.3vw, 72px);   /* поля слева и справа */
  --max: 1680px;                        /* максимальная ширина контента */
  --header-h: clamp(64px, 5.8vw, 96px);
  --section-y: clamp(72px, 9vw, 152px); /* вертикальные отступы разделов */
}

/* ---------- База ---------- */

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, dl, dd, figure { margin: 0; padding: 0; }
ul { list-style: none; }
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

:focus-visible { outline: 1px solid var(--text); outline-offset: 4px; }

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* Плейсхолдер изображения. Чтобы поставить картинку — положите <img> внутрь .ph */
.ph {
  position: relative;
  background: var(--ph);
  overflow: hidden;
}
.ph img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

/* Ссылка со стрелкой и тонкой линией снизу */
.link-arrow {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--text);
  font-size: var(--fs-ui);
  line-height: 1.3;
  white-space: nowrap;
}
.link-arrow:hover { color: var(--text-2); border-color: var(--text-2); }
.arrow { font-family: var(--sans); }

[id] { scroll-margin-top: 8px; }

/* ---------- Шапка ---------- */

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
}

.logo {
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
}

.site-nav ul { display: flex; gap: clamp(20px, 2vw, 34px); }
.site-nav a { font-size: var(--fs-ui); }
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--text-2); }

.menu-toggle {
  display: none;
  padding: 8px 0;
  border: 0;
  background: none;
  font-size: var(--fs-ui);
  cursor: pointer;
}

@media (max-width: 599px) {
  .site-header { position: relative; z-index: 10; }
  .menu-toggle { display: block; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0; right: 0; top: 100%;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .menu-open .site-nav { display: block; }
  .site-nav ul {
    flex-direction: column;
    gap: 0;
    padding: 0 var(--gutter) 12px;
  }
  .site-nav a {
    display: block;
    padding: 14px 0;
    font-size: 28px;
    line-height: 1.2;
    letter-spacing: -0.03em;
    border-top: 1px solid var(--line);
  }
}

/* ---------- Главный экран ---------- */
/* Пропорции взяты из reference-home.png: левая колонка ≈47%, промежуток ≈3%, правая ≈50% */

.hero .container {
  display: grid;
  grid-template-columns: minmax(0, 47fr) minmax(0, 50fr);
  column-gap: 3%;
  padding-bottom: clamp(48px, 4vw, 64px);
}

.hero__left {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(32px, 2.4vw, 48px);
  padding-top: clamp(24px, 3.4vw, 64px);
}

/* Приветствие близко по массе к тексту под ним: чуть крупнее наборного, без «плакатного» размера */
.hero__title {
  font-weight: 400;
  font-size: clamp(22px, 1.8vw, 30px);
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.hero__lead {
  max-width: 30em;
  margin-top: clamp(20px, 2vw, 32px);
  font-size: var(--fs-body);
}
.hero__lead p + p { margin-top: 0.8em; color: var(--text-2); }

/* Нижний ряд: большой и малый плейсхолдеры (53% и 28% ширины колонки) */
.hero__bottom {
  display: grid;
  grid-template-columns: minmax(0, 53.2%) minmax(0, 28.3%);
  column-gap: 2.5%;
  align-items: stretch;
}
.hero__img-a { aspect-ratio: 382 / 444; align-self: start; min-width: 0; }
.hero__aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}
.hero__img-b { aspect-ratio: 203 / 242; }
.hero__aside .link-arrow { align-self: flex-start; }

/* Высота главного изображения — по пропорции, но не меньше высоты левой колонки */
.hero__main { aspect-ratio: 764 / 780; align-self: stretch; width: 100%; min-width: 0; }
.hero__left { min-width: 0; }

/* Левая часть сдвинута вправо, ближе к большому изображению.
   Сдвиг визуальный: размеры и пропорции блоков не меняются. */
@media (min-width: 1200px) {
  .hero__left { position: relative; left: var(--hero-shift); }
  .hero__text { max-width: calc(100% - var(--hero-shift)); }
}

@media (max-width: 899px) {
  .hero__bottom { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
}

@media (max-width: 699px) {
  .hero .container { grid-template-columns: minmax(0, 1fr); row-gap: 40px; }
  .hero__left { display: contents; }
  .hero__text { order: 1; padding-top: 16px; }
  .hero__main { order: 2; aspect-ratio: 4 / 5; }
  .hero__bottom { order: 3; }
}

/* ---------- Разделы ---------- */

.section { padding-block: var(--section-y); }
.section > .container { position: relative; }
.section--lined > .container::before {
  content: '';
  position: absolute;
  top: calc(var(--section-y) * -1);
  left: var(--gutter); right: var(--gutter);
  border-top: 1px solid var(--line);
}

/* Все заголовки разделов (Проекты, Обо мне, Контакты, страница проекта) — один уровень */
.section-title {
  font-weight: 400;
  font-size: var(--fs-display);
  line-height: 0.95;
  letter-spacing: var(--ls-display);
}

/* ---------- Проекты ---------- */


.filters {
  margin-top: clamp(40px, 4.5vw, 72px);
  padding-bottom: clamp(24px, 3vw, 44px);
  border-bottom: 1px solid var(--line);
}
.filters ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 12px;
}
/* На широких экранах — одна строка, длинные подписи переносятся внутри кнопки, как в референсе */
@media (min-width: 1200px) {
  .filters ul { flex-wrap: nowrap; }
  .filters li { flex: 0 1 auto; min-width: 0; }
  .filters li.is-short { flex-shrink: 0; white-space: nowrap; }
}
.filter {
  max-width: 13em;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  font-size: var(--fs-small);
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
}
.filter:hover { color: var(--text-2); }
@media (min-width: 1200px) and (max-width: 1599px) {
  .filter { font-size: 13px; padding-inline: 11px; }
}
.filter[aria-pressed="true"] {
  background: var(--text);
  color: var(--bg);
}

/* На телефоне фильтры прокручиваются горизонтально */
@media (max-width: 599px) {
  .filters ul {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .filters ul::-webkit-scrollbar { display: none; }
  .filters li { flex-shrink: 0; }
  .filter { white-space: nowrap; }
}

@media (max-width: 1199px) {
  .filters ul { justify-content: flex-start; }
  .filter { max-width: none; border-color: var(--line); }
  .filter[aria-pressed="true"] { border-color: var(--text); }
}

.projects__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(40px, 4vw, 64px) clamp(12px, 1.1vw, 18px);
  margin-top: clamp(32px, 3.5vw, 56px);
}
@media (max-width: 1099px) { .projects__grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 559px)  { .projects__grid { grid-template-columns: 1fr; } }

.card { display: block; }
.card .ph { aspect-ratio: 1 / 1; }
.card__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-top: 18px;
}
.card__title { font-size: var(--fs-ui); font-weight: 500; line-height: 1.35; }
.card__cats { margin-top: 4px; font-size: var(--fs-small); line-height: 1.4; color: var(--text-2); }
.card:hover .card__title { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }

.projects__empty { margin-top: 48px; color: var(--text-2); }

/* ---------- Обо мне ---------- */
/* По reference-about.png: отступ ≈6%, портрет ≈29%, промежуток ≈5.5%, текст */

.about__grid {
  display: grid;
  grid-template-columns: 6% 29% 5.5% 1fr;
  align-items: start;
}
.about__media { grid-column: 2; }
.about__portrait { aspect-ratio: 7 / 10; touch-action: pan-y; }

/* Карусель портретов: фото сменяются плавным переходом */
.about__portrait img { opacity: 0; transition: opacity .6s ease; }
.about__portrait img.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .about__portrait img { transition: none; } }
.about__controls {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}
.about__controls[hidden] { display: none; }

/* Смена кадров на первом экране */
.hero-slides img { opacity: 0; transition: opacity .4s ease; }
.hero-slides img.is-active { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .hero-slides img { transition: none; } }
.about__btn {
  width: 40px; height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.about__btn:hover { border-color: var(--text); }
.about__count { font-size: var(--fs-small); color: var(--text-2); min-width: 40px; text-align: center; }
.about__body { grid-column: 4; padding-top: clamp(0px, 1vw, 16px); }

.about__role {
  margin-top: clamp(16px, 2vw, 28px);
  font-size: var(--fs-label);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
/* Текст в две колонки: абзацы перетекают из левой в правую, не разрываясь */
.about__text {
  columns: 2;
  column-gap: clamp(24px, 3.5vw, 56px);
  max-width: 820px;
  margin-top: clamp(28px, 3vw, 48px);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
}
.about__text p { break-inside: avoid; }
.about__text p + p { margin-top: 1em; }

@media (max-width: 899px) {
  .about__grid { grid-template-columns: 40% 1fr; column-gap: 6%; }
  .about__media, .about__body { grid-column: auto; }
  .about__text { columns: 1; }
}
@media (max-width: 599px) {
  .about__grid { grid-template-columns: 1fr; row-gap: 32px; }
  .about__media { width: 72%; }
}

/* ---------- Контакты ---------- */

.contacts__grid {
  display: grid;
  grid-template-columns: 7fr 5fr;
  column-gap: 6%;
  align-items: end;
}
.contacts__text { max-width: 30em; font-size: var(--fs-body); }
.contacts__body .link-arrow { margin-top: 32px; }

.channels {
  margin-top: clamp(40px, 5vw, 72px);
  border-bottom: 1px solid var(--line);
}
.channels div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  font-size: var(--fs-ui);
}
.channels dd { color: var(--text-2); }
.channels dd a { color: var(--text); }
.channels dd a:hover { color: var(--text-2); }

@media (max-width: 899px) {
  .contacts__grid { grid-template-columns: 1fr; row-gap: 40px; }
}

/* ---------- Подвал ---------- */

.site-footer .container {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 28px;
  font-size: var(--fs-small);
  color: var(--text-2);
  position: relative;
}
/* линия подвала — в пределах полей */
.site-footer .container::before {
  content: '';
  position: absolute; top: 0;
  left: var(--gutter); right: var(--gutter);
  border-top: 1px solid var(--line);
}
.site-footer a:hover { color: var(--text); }

/* ---------- Страница проекта ---------- */

.project { padding-top: clamp(16px, 2vw, 32px); padding-bottom: var(--section-y); }

.back-link { font-size: var(--fs-ui); color: var(--text-2); }
.back-link:hover { color: var(--text); }

.project__head {
  display: grid;
  grid-template-columns: 7fr 5fr;
  column-gap: 6%;
  align-items: end;
  margin-top: clamp(40px, 5vw, 80px);
  padding-bottom: clamp(32px, 3.5vw, 56px);
  border-bottom: 1px solid var(--line);
}
.project__cats { margin-top: 20px; font-size: var(--fs-small); color: var(--text-2); }
.project__desc { max-width: 32em; font-size: var(--fs-body); }
.project__desc .note { margin-top: 0.8em; color: var(--text-2); }

.project__gallery {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 1.1vw, 18px);
  margin-top: clamp(32px, 3.5vw, 56px);
}
.project__gallery .ph { grid-column: span 2; }
.project__gallery .ph.is-half { grid-column: span 1; }

.project__nav {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-top: clamp(48px, 6vw, 96px);
  padding-top: 24px;
  border-top: 1px solid var(--line);
  font-size: var(--fs-ui);
}
.project__nav a:hover { color: var(--text-2); }
.project__nav span { display: block; font-size: var(--fs-small); color: var(--text-2); margin-bottom: 4px; }
.project__nav .next { text-align: right; }

@media (max-width: 899px) {
  .project__head { grid-template-columns: 1fr; row-gap: 28px; }
}
@media (max-width: 599px) {
  .project__gallery .ph.is-half { grid-column: span 2; }
}

/* Типографика: без одиноких слов в последней строке абзацев и подписей,
   ровные строки в заголовках. Браузер сам перераспределяет строки под ширину экрана. */
p, li, dd, figcaption { text-wrap: pretty; }
h1, h2, h3, .card__title, .card__cats { text-wrap: balance; }