/* ============================================================
   KIRILL KLEPALOV — portfolio
   Jost (variable, self-hosted), white / black / crimson accent
   ============================================================ */

/* ---------- fonts ---------- */
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/jost-var-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Jost';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/jost-var-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: 'Jost';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/jost-italic-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0152-0153, U+2000-206F, U+20AC;
}
@font-face {
  font-family: 'Jost';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url('../fonts/jost-italic-cyrillic.woff2') format('woff2');
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

/* ---------- tokens ---------- */
:root {
  --bg: #ffffff;
  --text: #111111;
  --muted: #8b8b8b;
  --accent: #f00000; /* как у референса: красный на ховерах и в оверлее */
  --line: #e8e8e8;
  --overlay: rgba(240, 0, 0, 0.6);
  --tile-bg-1: #17181a;
  --tile-bg-2: #2b2d31;
  --gap: 16px;
  --wrap-pad: clamp(16px, 4vw, 48px);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Jost', 'Helvetica Neue', Arial, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  letter-spacing: 0.04em;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; transition: color 0.25s var(--ease); }
a:hover { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.wrap { width: 100%; max-width: 1680px; margin: 0 auto; padding-inline: var(--wrap-pad); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.site-main {
  flex: 1;
  padding-block: clamp(20px, 4vw, 48px) clamp(48px, 6vw, 96px);
}
.spa-ready .site-main {
  transition: opacity 0.32s var(--ease), transform 0.32s var(--ease);
}
.page-loading .site-main {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

/* ---------- header ---------- */
.site-header { padding-block: clamp(20px, 3.5vw, 40px); }
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6em; min-width: 0; }
.brand:hover { color: var(--text); }
.brand-name {
  font-weight: 600;
  font-size: clamp(15px, 2vw, 20px);
  letter-spacing: 0.32em;
  white-space: nowrap;
}
.brand-role {
  font-weight: 400;
  font-size: clamp(14px, 1.6vw, 17px);
  letter-spacing: 0.2em;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover .brand-name { color: var(--accent); }

.site-nav ul {
  display: flex;
  gap: clamp(16px, 2.2vw, 36px);
  margin: 0; padding: 0;
  list-style: none;
}
.site-nav a {
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: lowercase;
  position: relative;
  padding-bottom: 4px;
  white-space: nowrap;
}
.site-nav a::after {
  content: '';
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.site-nav a:hover::after, .site-nav a.active::after { transform: scaleX(1); }
.site-nav a.active { color: var(--text); }

.header-right { display: flex; align-items: center; gap: 20px; }
.lang-switch {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.lang-switch a { color: var(--muted); padding: 4px 2px; }
.lang-switch a:hover { color: var(--accent); }
.lang-switch .lang-current { color: var(--text); font-weight: 600; padding: 4px 2px; }
.lang-sep { margin-inline: 2px; opacity: 0.5; }
.lang-switch-mobile { display: none; }

/* burger */
.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  padding: 10px;
  background: none;
  border: 0;
  cursor: pointer;
  z-index: 60;
}
.nav-toggle span {
  display: block;
  height: 2px; width: 100%;
  background: var(--text);
  transition: transform 0.3s var(--ease), opacity 0.2s;
}
.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- home masonry ---------- */
/* Базовая раскладка — CSS columns (работает без JS).
   JS в main.js перекладывает в flex-колонки по принципу «в самую
   короткую» — чтобы не оставалось пустых колонок справа. */
.masonry { columns: 4; column-gap: var(--gap); }
@media (max-width: 1440px) { .masonry { columns: 3; } }
@media (max-width: 1024px) { .masonry { columns: 2; } }
@media (max-width: 600px)  { .masonry { columns: 1; } }

.masonry.masonry-js {
  columns: auto;
  display: flex;
  gap: var(--gap);
}
.masonry-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}
.masonry-js .masonry-item { margin-bottom: 0; }

.masonry-grid {
  columns: auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--gap);
}
@media (max-width: 1024px) { .masonry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px)  { .masonry-grid { grid-template-columns: 1fr; } }
.masonry-grid .masonry-item { margin-bottom: 0; }

.masonry-item {
  display: block;
  break-inside: avoid;
  margin-bottom: var(--gap);
}
.poster-frame {
  position: relative;
  margin: 0;
  overflow: hidden;
  background: #f2f2f2;
}
.poster-frame img {
  width: 100%;
}
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  background: var(--overlay);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
}
.overlay strong {
  color: #fff;
  font-weight: 500;
  font-size: clamp(17px, 1.8vw, 28px);
  letter-spacing: 0.3em;
  line-height: 1.7;
}
@media (hover: hover) {
  .masonry-item:hover .overlay,
  .card-media:hover .overlay { opacity: 1; }
}
/* на тач-устройствах вместо ховера — подпись под постером */
@media (hover: none) {
  .poster-frame .overlay {
    position: static;
    opacity: 1;
    background: none;
    padding: 10px 0 4px;
    justify-content: flex-start;
  }
  .poster-frame .overlay strong {
    color: var(--text);
    font-size: 13px;
    letter-spacing: 0.26em;
  }
  /* на страницах разделов название и так написано под карточкой */
  .card-media .overlay { display: none; }
}

/* ---------- section pages ---------- */
.page-title {
  font-weight: 500;
  font-size: clamp(18px, 2.4vw, 26px);
  letter-spacing: 0.34em;
  text-transform: lowercase;
  margin: 0 0 clamp(28px, 4vw, 56px);
}
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  gap: clamp(32px, 4vw, 56px) clamp(20px, 2.5vw, 32px);
}
.cards-grid-compact {
  grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr));
}
.card {
  scroll-margin-top: clamp(140px, 28vh, 260px);
}
.card-media {
  position: relative;
  margin: 0 0 18px;
  aspect-ratio: 21 / 9;
  overflow: hidden;
  background: #f2f2f2;
}
.card-media img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.card-media.playable { cursor: pointer; }
.play-badge {
  position: absolute;
  right: 14px; bottom: 14px;
  width: 40px; height: 40px;
  color: #fff;
  filter: drop-shadow(0 1px 6px rgba(0,0,0,0.45));
  transition: color 0.25s var(--ease), transform 0.25s var(--ease);
}
.card-media.playable:hover .play-badge { color: var(--accent); transform: scale(1.08); }
.play-badge svg { width: 100%; height: 100%; }

.card-title {
  font-weight: 600;
  font-size: clamp(15px, 1.6vw, 18px);
  letter-spacing: 0.26em;
  line-height: 1.6;
  margin: 0 0 8px;
}
.card-note {
  font-size: 13.5px;
  letter-spacing: 0.14em;
  color: var(--text);
  margin: 0 0 4px;
}
.card-credit {
  font-size: 13px;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0;
}

/* типографская заглушка вместо кадра */
.tile-typo {
  position: relative;
  width: 100%; height: 100%;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, var(--tile-bg-1), var(--tile-bg-2));
  overflow: hidden;
}
.tile-typo.ratio-poster { aspect-ratio: 21 / 9; }
.tile-ghost {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 220px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.05);
  user-select: none;
}
.tile-title {
  position: relative;
  color: #fff;
  font-weight: 500;
  font-size: clamp(13px, 1.4vw, 16px);
  letter-spacing: 0.3em;
  line-height: 1.9;
}

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: minmax(280px, 520px) minmax(0, 720px);
  gap: clamp(32px, 5vw, 72px);
}
@media (max-width: 900px) {
  .about-grid { grid-template-columns: 1fr; }
  .about-portrait { max-width: 520px; }
}
.about-portrait img { width: 100%; }
.portrait-placeholder {
  aspect-ratio: 3 / 4;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--tile-bg-1), var(--tile-bg-2));
}
.portrait-placeholder span {
  color: rgba(255, 255, 255, 0.12);
  font-size: 96px;
  font-weight: 600;
  letter-spacing: 0.1em;
}
.about-text p { margin: 0 0 1.2em; text-align: justify; }
.about-block { margin-top: clamp(36px, 5vw, 56px); }
.about-block h2 {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.34em;
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.press-list, .awards-list {
  margin: 0; padding: 0;
  list-style: none;
}
.press-list li, .awards-list li {
  margin-bottom: 14px;
  font-size: 15px;
  line-height: 1.6;
}
.press-source { color: var(--muted); white-space: nowrap; }
.press-list a { border-bottom: 1px solid var(--line); }
.press-list a:hover { border-color: var(--accent); }
.contact-line { letter-spacing: 0.08em; }
.contact-line a { border-bottom: 1px solid var(--line); }
.contact-line a:hover { border-color: var(--accent); }

/* ---------- footer ---------- */
.site-footer {
  padding: clamp(28px, 4vw, 48px) var(--wrap-pad) calc(clamp(24px, 3vw, 40px) + env(safe-area-inset-bottom));
  text-align: center;
}
.social {
  display: flex;
  justify-content: center;
  gap: 22px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}
.social a {
  display: inline-flex;
  width: 30px; height: 30px;
  color: var(--text);
}
.social a:hover { color: var(--accent); }
.social svg { width: 100%; height: 100%; }
.copyright {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ---------- lightbox (плеер) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 8, 0.94);
  padding: 4vmin;
}
.lightbox[hidden] { display: none; }
.lightbox-body { width: min(1280px, 92vw); }
.lightbox-body video,
.lightbox-body iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  background: #000;
  border: 0;
}
.lightbox-close {
  position: absolute;
  top: 12px; right: 16px;
  width: 52px; height: 52px;
  font-size: 40px;
  line-height: 1;
  color: #fff;
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.25s var(--ease), transform 0.25s var(--ease);
}
.lightbox-close:hover { color: var(--accent); transform: rotate(90deg); }

/* ---------- mobile nav ---------- */
@media (max-width: 900px) {
  .nav-toggle { display: flex; }
  .lang-switch { display: none; }
  .lang-switch-mobile { display: block; margin-top: 40px; font-size: 15px; }
  .site-nav {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s var(--ease), visibility 0.3s;
  }
  .nav-open .site-nav { opacity: 1; visibility: visible; }
  .site-nav ul {
    flex-direction: column;
    align-items: center;
    gap: 26px;
  }
  .site-nav a { font-size: 17px; letter-spacing: 0.34em; }
  .nav-open body { overflow: hidden; }
}
@media (max-width: 480px) {
  .brand { gap: 0.35em; flex-direction: column; }
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}
