/* =========================================================
   NAZAROV — абсурдный минимализм
   Чёрное на белом. Ничего лишнего. Только имя и фотографии.
   ========================================================= */

:root {
  /* цвета задаёт тема (theme.js); тут — значения по умолчанию «Молоко» */
  --bg: #faf7f2;
  --ink: #2b2a27;
  --muted: #ece7df;     /* фон-заглушка под фото */
  --gap: 24px;          /* расстояние между фото */
  --col: 340px;         /* целевая ширина столбца — под неё всё подгоняется */
  --edge: 6vw;          /* огромные поля по краям */
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Archivo Black", "Arial Black", sans-serif;
  min-height: 100vh;
  transition: background-color 0.35s ease, color 0.35s ease;
}

/* ---------- ЛОГОТИП: имя во всю ширину ---------- */
.masthead {
  padding: 14vh var(--edge) 12vh;
}

.logo {
  display: block;
  width: 100%;
  height: auto;
}

.logo text {
  font-family: "Anton", "Archivo Black", sans-serif;
  fill: var(--ink);
  font-size: 200px;
  letter-spacing: -2px;
}

/* ---------- ЭКРАН ЗАГРУЗКИ ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5vh;
  transition: opacity 0.5s ease;
}

.loader.done {
  opacity: 0;
  pointer-events: none;
}

.loader-num {
  font-family: "Anton", sans-serif;
  font-size: clamp(70px, 17vw, 240px);
  line-height: 0.85;
  letter-spacing: -3px;
  display: flex;
  align-items: baseline;
}

.loader-unit {
  font-size: 0.38em;
  margin-left: 0.08em;
  opacity: 0.5;
}

.loader-track {
  width: min(62vw, 540px);
  height: 3px;
  background: var(--muted);
  overflow: hidden;
}

.loader-bar {
  height: 100%;
  width: 0%;
  background: var(--ink);
  transition: width 0.25s ease;
}

/* ---------- СТАТИСТИКА ---------- */
.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 5vw;
  padding: 0 var(--edge) 9vh;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-family: "Anton", sans-serif;
  font-size: clamp(44px, 7vw, 112px);
  line-height: 0.88;
  letter-spacing: -1px;
}

.stat-label {
  font-family: "Anton", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.26em;
  font-size: clamp(10px, 1vw, 13px);
  margin-top: 12px;
  opacity: 0.55;
}

/* ---------- СЕТКА (masonry, как в Pinterest) ---------- */
main {
  padding: 0 var(--edge) 0;
}

.grid {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  width: 100%;
}

.grid .column {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  flex: 1 1 0;
  min-width: 0;
}

.grid figure {
  margin: 0;
  cursor: zoom-in;
  perspective: 950px;                  /* глубина 3D-наклона карточки */
  opacity: 0;                          /* старт появления при скролле */
  transform: translateY(28px);
  transition: opacity 0.7s ease,
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.grid figure.in {
  opacity: 1;
  transform: none;
}

/* карточка наклоняется целиком (как капсула в Steam) — без приближения */
.grid .card {
  position: relative;
  overflow: hidden;
  background: var(--muted);
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.16s ease-out, box-shadow 0.3s ease,
    background-color 0.35s ease;
}

.grid figure:hover .card {
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.22);
}

.grid img {
  display: block;
  width: 100%;
  height: auto;
}

.grid img[data-loading] {
  opacity: 0;
}

/* ---------- ПУСТОЕ СОСТОЯНИЕ ---------- */
.empty {
  padding: 10vh var(--edge);
  text-align: center;
  font-family: "Anton", sans-serif;
  font-size: 8vw;
  opacity: 0.15;
}

/* ---------- ПОДВАЛ ---------- */
.footer {
  padding: 16vh var(--edge) 8vh;
  display: flex;
  justify-content: center;
}

.footer span {
  font-family: "Anton", sans-serif;
  font-size: 14px;
  letter-spacing: 0.6em;
  text-transform: uppercase;
}

/* ---------- ЛАЙТБОКС ---------- */
.lightbox[hidden] {
  display: none;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4vw;
  z-index: 100;
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.lightbox.open {
  opacity: 1;
}

.lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  transform: scale(0.9);
  transition: transform 0.45s cubic-bezier(0.2, 0.74, 0.2, 1), opacity 0.18s ease;
  will-change: transform;
}

.lightbox.open img {
  transform: none;
}

/* стрелки листания */
.lb-nav {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  z-index: 101;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease, background-color 0.2s ease, color 0.2s ease;
}

.lightbox.open .lb-nav {
  opacity: 1;
}

.lb-prev { left: 20px; }
.lb-next { right: 20px; }

.lb-nav:hover {
  background: var(--ink);
  color: var(--bg);
}

@media (max-width: 600px) {
  .lb-nav { width: 44px; height: 44px; font-size: 24px; }
  .lb-prev { left: 10px; }
  .lb-next { right: 10px; }
}

/* ---------- ПЕРЕКЛЮЧАТЕЛЬ ТЕМ ---------- */
.theme-switch {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.theme-toggle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--bg);
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.35s ease, border-color 0.35s ease;
}

.theme-toggle .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ink);
}

.theme-list {
  display: none;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  padding: 12px;
  border: 2px solid var(--ink);
  background: var(--bg);
}

.theme-switch.open .theme-list {
  display: grid;
}

.swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.swatch .sw-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.swatch.active {
  box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ink);
}

/* ---------- КНОПКА «НАВЕРХ» ---------- */
.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 50;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--bg);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease,
    background-color 0.35s ease, border-color 0.35s ease, color 0.2s ease;
}

.to-top.show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.to-top:hover {
  background: var(--ink);
  color: var(--bg);
}

/* ---------- УВАЖЕНИЕ К reduce-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .grid figure {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .grid .card {
    transition: box-shadow 0.3s ease, background-color 0.35s ease;
  }
  .lightbox img {
    transform: none;
    transition: none;
  }
}

/* ---------- МОБИЛЬНЫЕ ---------- */
@media (max-width: 600px) {
  :root {
    --edge: 5vw;
    --gap: 14px;
  }
  .masthead {
    padding: 8vh var(--edge) 6vh;
  }
}
