/* ==========================================================
   Стили сайта. Обычно трогать не нужно.
   Цвета и размеры шрифтов собраны в блоке :root ниже.
   ========================================================== */

:root {
  --bg: #1b1c1e;
  --surface: #26272a;
  --line: #3a3b3f;
  --text: #ecebe8;
  --muted: #9a9b9f;
  --accent: #a9c3da;

  --gutter: clamp(20px, 4vw, 56px);
  --max: 1440px;
  --font: "Archivo", "Helvetica Neue", Arial, system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

a { color: inherit; }

button { font: inherit; color: inherit; }

h1, h2, h3, p, ul { margin: 0; padding: 0; }
ul { list-style: none; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.wrap {
  width: min(var(--max), 100% - var(--gutter) * 2);
  margin-inline: auto;
}

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

.site-header { padding: 22px 0; }

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

.brand {
  text-decoration: none;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.01em;
}

#nav { display: flex; gap: 28px; }

#nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}

#nav a:hover { color: var(--text); border-bottom-color: var(--line); }

/* ---------- Первый экран ---------- */

.hero { margin-top: 12px; }

.reel {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  overflow: hidden;
}

.reel img,
.reel iframe,
.reel video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.reel img { object-fit: cover; }
.reel video { background: #000; }

.reel-btn {
  position: absolute;
  inset: 0;
  width: 100%;
  border: 0;
  padding: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0) 45%);
  cursor: pointer;
  text-align: left;
}

.reel-label {
  position: absolute;
  left: clamp(16px, 2.5vw, 32px);
  bottom: clamp(14px, 2.2vw, 28px);
  font-size: clamp(1rem, 1.6vw, 1.4rem);
  font-weight: 600;
  font-stretch: 112%;
}

.play-mark {
  position: absolute;
  right: clamp(16px, 2.5vw, 32px);
  bottom: clamp(14px, 2.2vw, 28px);
  width: clamp(56px, 6vw, 84px);
  aspect-ratio: 1;
  border: 1.5px solid var(--text);
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.play-mark::before {
  content: "";
  margin-left: 6%;
  border-style: solid;
  border-width: 0.55em 0 0.55em 0.9em;
  border-color: transparent transparent transparent var(--text);
  font-size: clamp(14px, 1.6vw, 20px);
}

.reel-btn:hover .play-mark { background: var(--text); }
.reel-btn:hover .play-mark::before { border-left-color: var(--bg); }

.hero-text {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 32px var(--gutter);
  margin-top: clamp(28px, 4vw, 48px);
  align-items: end;
}

h1 {
  font-size: clamp(2.1rem, 5.2vw, 4.75rem);
  font-weight: 600;
  font-stretch: 125%;
  line-height: 1.03;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero-side p { max-width: 38ch; color: var(--muted); }
.hero-side .where { margin-top: 12px; color: var(--text); }

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

.work, .contact { margin-top: clamp(80px, 11vw, 150px); }

.section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px 32px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  margin-bottom: clamp(28px, 4vw, 48px);
}

h2 {
  font-size: clamp(1.4rem, 2.2vw, 1.9rem);
  font-weight: 600;
  font-stretch: 118%;
}

.filters { display: flex; flex-wrap: wrap; gap: 4px 28px; }

.filters button {
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.filters button:hover { color: var(--text); }

.filters button[aria-pressed="true"] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ---------- Сетка проектов ---------- */

.grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-flow: dense;
  gap: 44px 24px;
}

@media (min-width: 640px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
  .item.featured { grid-column: span 2; }
}

@media (min-width: 1000px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}

.item {
  align-self: start;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--surface);
}

.thumb img { width: 100%; height: 100%; object-fit: cover; }

.thumb .ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-stretch: 112%;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.18s;
}

.thumb .play-mark {
  z-index: 1;
  right: auto;
  bottom: auto;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  width: 60px;
  opacity: 0;
  transition: opacity 0.18s;
}

.item:hover .thumb::after,
.item:focus-visible .thumb::after,
.item:hover .thumb .play-mark,
.item:focus-visible .thumb .play-mark { opacity: 1; }

.item-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.item-title { font-size: 1.1rem; font-weight: 600; line-height: 1.3; }
.item-year { color: var(--muted); font-variant-numeric: tabular-nums; }

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.92rem;
}

.empty { color: var(--muted); grid-column: 1 / -1; }

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

.contact-body { display: grid; gap: 22px; }

.email {
  justify-self: start;
  font-size: clamp(1.5rem, 4.2vw, 3.4rem);
  font-weight: 500;
  font-stretch: 112%;
  line-height: 1.15;
  text-decoration: none;
  border-bottom: 2px solid var(--line);
  overflow-wrap: anywhere;
}

.email:hover { border-bottom-color: var(--accent); }

.contact-note { color: var(--muted); max-width: 52ch; }

.links { display: flex; flex-wrap: wrap; gap: 8px 32px; }

.links a { text-decoration: none; border-bottom: 1px solid var(--line); }
.links a:hover { border-bottom-color: var(--accent); }

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

.site-footer {
  margin-top: clamp(80px, 10vw, 140px);
  padding: 28px 0 40px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---------- Окно проекта ---------- */

.modal {
  width: min(1120px, 94vw);
  max-height: 94vh;
  padding: 0;
  border: 0;
  background: var(--surface);
  color: var(--text);
  overflow: auto;
}

.modal::backdrop { background: rgba(0, 0, 0, 0.84); }

.modal[open] { animation: fade 0.16s ease-out; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
}

.modal-bar h3 { font-size: 1.05rem; font-weight: 600; font-stretch: 112%; }

.text-btn {
  background: none;
  border: 0;
  padding: 6px 2px;
  cursor: pointer;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}

.text-btn:hover { color: var(--text); border-bottom-color: var(--accent); }

.player {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
}

.player iframe,
.player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.modal-body { padding: 22px 20px 28px; display: grid; gap: 14px; }

.modal-meta { display: flex; flex-wrap: wrap; gap: 4px 24px; color: var(--muted); }

.modal-desc { max-width: 68ch; white-space: pre-line; }

.modal-credits { color: var(--muted); max-width: 68ch; white-space: pre-line; font-size: 0.95rem; }

.modal-body a { justify-self: start; border-bottom: 1px solid var(--accent); text-decoration: none; }

/* ---------- Мобильные ---------- */

@media (max-width: 760px) {
  .hero-text { grid-template-columns: 1fr; }
  #nav { gap: 20px; }
  .modal { width: 100vw; max-height: 100vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .modal[open] { animation: none; }
  .thumb::after, .thumb .play-mark { transition: none; }
}
