:root {
  --bg: #141210;
  --bg-soft: #1b1815;
  --ink: #e9e3d5;
  --ink-dim: #93897a;
  --accent: #c9a86a;
  --gap: 22px;
}

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

html { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Courier Prime', 'Courier New', monospace;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent); color: var(--bg); }

/* --- защита от сохранения (лёгкая) --- */
img {
  -webkit-user-drag: none;
  user-select: none;
  -webkit-user-select: none;
}
.shot img { pointer-events: none; }

.js .site-header .kicker,
.js .site-header h1,
.js .site-header .sub,
.js .site-header .hall-link,
.js .site-header .prints-link {
  opacity: 0;
}

/* --- film grain (static noise + steps animation, дёшево для GPU) --- */
.grain {
  position: fixed;
  inset: -100px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
  z-index: 90;
  animation: grain 0.9s steps(4) infinite;
}

@keyframes grain {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-30px, 20px); }
  50%  { transform: translate(20px, -25px); }
  75%  { transform: translate(-15px, -10px); }
  100% { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .grain { animation: none; }
}

.vignette {
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.28) 100%);
  pointer-events: none;
  z-index: 80;
}

/* --- custom cursor --- */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 999;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  will-change: transform;
}
.cursor-dot {
  width: 6px; height: 6px;
  background: var(--accent);
}
.cursor-ring {
  width: 34px; height: 34px;
  border: 1px solid rgba(201, 168, 106, 0.55);
  transition: width 0.25s ease, height 0.25s ease, border-color 0.25s ease;
}
body.cursor-focus .cursor-ring {
  width: 58px; height: 58px;
  border-color: var(--accent);
}
.cursor-ring::before, .cursor-ring::after {
  content: "";
  position: absolute;
  background: rgba(201, 168, 106, 0.6);
  transition: opacity 0.25s ease;
}
.cursor-ring::before { top: 50%; left: -7px; width: 5px; height: 1px; }
.cursor-ring::after  { top: -7px; left: 50%; width: 1px; height: 5px; }
@media (hover: none), (pointer: coarse) {
  .cursor-dot, .cursor-ring { display: none; }
}
@media (hover: hover) and (pointer: fine) {
  body { cursor: none; }
  a, button, .shot { cursor: none; }
}

/* --- camera shutter intro --- */
.shutter {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.shutter-blade {
  position: absolute;
  background: #0a0908;
  transition: transform 1s cubic-bezier(0.76, 0, 0.24, 1);
}
.b1 { top: 0; left: 0; right: 0; height: 50.5%; }
.b2 { bottom: 0; left: 0; right: 0; height: 50.5%; }
.shutter.open .b1 { transform: translateY(-101%); }
.shutter.open .b2 { transform: translateY(101%); }
.shutter-flash {
  position: absolute;
  inset: 0;
  background: #f5eeda;
  opacity: 0;
}
.shutter-label {
  position: relative;
  z-index: 2;
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.55em;
  text-transform: uppercase;
  color: var(--ink-dim);
  opacity: 0;
  transition: opacity 0.6s ease;
}
.shutter.show-label .shutter-label { opacity: 1; }
.shutter.gone { display: none; }

/* --- film sprocket strips --- */
.sprockets {
  position: fixed;
  top: 0; bottom: 0; left: 10px;
  width: 16px;
  z-index: 70;
  opacity: 0.35;
  pointer-events: none;
  background-image: radial-gradient(circle at 50% 50%, var(--ink-dim) 2.2px, transparent 2.8px);
  background-size: 16px 34px;
  background-position: 0 calc(var(--scrollpx, 0px) * -0.4);
}
.sprockets.right { left: auto; right: 10px; }
@media (max-width: 820px) { .sprockets { display: none; } }

/* --- header: hero на весь первый экран --- */
.site-header {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 24px;
}
.kicker {
  margin: 0 0 18px;
  font-size: 0.7rem;
  letter-spacing: 0.55em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.site-header h1 {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 4.8rem);
  letter-spacing: 0.03em;
  line-height: 1;
}
.site-header .sub {
  margin: 16px 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.6em;
  color: var(--ink-dim);
}
.site-header::after {
  content: "";
  display: block;
  width: 56px;
  height: 1px;
  margin: 30px auto 0;
  background: var(--accent);
  opacity: 0.6;
}
.scroll-hint {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--ink-dim);
  animation: hintPulse 2.2s ease-in-out infinite;
  pointer-events: none;
}
@keyframes hintPulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 0.95; }
}

/* --- masonry gallery with museum frames --- */
.gallery {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 40px 40px;
  column-count: 1;
  column-gap: var(--gap);
}
@media (min-width: 640px)  { .gallery { column-count: 2; } }
@media (min-width: 1024px) { .gallery { column-count: 3; } }
@media (min-width: 1500px) { .gallery { column-count: 4; } }

.shot {
  margin: 0 0 var(--gap);
  break-inside: avoid;
  perspective: 900px;
}

.frame {
  position: relative;
  padding: 12px;
  background: linear-gradient(145deg, #2b231a 0%, #1d1712 40%, #241c14 70%, #171310 100%);
  border: 1px solid #0c0a08;
  box-shadow:
    0 1px 0 rgba(233, 227, 213, 0.05) inset,
    0 14px 30px rgba(0, 0, 0, 0.5),
    0 4px 12px rgba(0, 0, 0, 0.4);
  transform-style: preserve-3d;
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.shot:hover .frame {
  transform: rotateX(2deg) rotateY(-2deg) translateY(-4px);
  box-shadow:
    0 1px 0 rgba(233, 227, 213, 0.07) inset,
    0 22px 44px rgba(0, 0, 0, 0.6),
    0 8px 18px rgba(0, 0, 0, 0.45);
}

.frame img {
  display: block;
  width: 100%;
  height: auto;
  filter: grayscale(0.85) sepia(0.3) brightness(0.72) contrast(1.05);
  opacity: 0;
  transition:
    filter 1.8s ease,
    opacity 1.4s ease,
    transform 0.5s ease;
}
.shot.developed .frame img {
  filter: grayscale(0) sepia(0.04) brightness(1) contrast(1.02);
  opacity: 1;
}
.shot .frame:hover img {
  filter: grayscale(0) sepia(0) brightness(1.05) contrast(1.03);
}

.glass {
  position: absolute;
  inset: 12px;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(
    115deg,
    rgba(255, 255, 255, 0.055) 0%,
    rgba(255, 255, 255, 0.012) 18%,
    transparent 32%,
    transparent 68%,
    rgba(255, 255, 255, 0.03) 88%,
    transparent 100%
  );
}

/* --- footer --- */
.site-footer {
  text-align: center;
  padding: 40px 24px 70px;
}
.hall-link {
  display: inline-block;
  margin-top: 44px;
  padding: 19px 40px 19px calc(40px + 0.5em); /* левый паддинг компенсирует letter-spacing — текст ровно по центру */
  border: 1px solid rgba(201, 168, 106, 0.55);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  box-shadow: 0 0 0 rgba(201, 168, 106, 0);
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}
.hall-link:hover {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 34px rgba(201, 168, 106, 0.35);
}

/* переходка на 2D-ленту внизу главной */
.prints-link {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.62rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--ink-dim);
  text-decoration: none;
  transition: color 0.25s ease;
}
.prints-link:hover { color: var(--accent); }
.prints-link.pulse { animation: hintPulse 2.2s ease-in-out infinite; }

/* компактная шапка для внутренних страниц */
.site-header.compact {
  min-height: 0;
  display: block;
  padding: clamp(70px, 12vh, 130px) 24px clamp(50px, 8vh, 90px);
}

/* ссылка «домой» на внутренних страницах */
.home-link {
  position: fixed;
  top: 26px;
  left: 26px;
  z-index: 60;
  color: var(--ink-dim);
  text-decoration: none;
  font-size: 0.66rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  transition: color 0.25s ease;
}
.home-link:hover { color: var(--accent); }
.site-footer p {
  margin: 0;
  font-size: 0.68rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* --- lightbox --- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(12, 10, 9, 0.97);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.lightbox.open { opacity: 1; visibility: visible; }
.lb-img {
  max-width: 92vw;
  max-height: 86vh;
  object-fit: contain;
  box-shadow: 0 20px 80px rgba(0, 0, 0, 0.6);
  user-select: none;
  -webkit-user-drag: none;
}
.lb-btn {
  position: absolute;
  z-index: 302;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: none;
  border: 0;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}
.lb-btn:hover { color: var(--accent); }
.lb-close { top: 18px; right: 18px; }
.lb-prev  { left: 14px;  top: 50%; transform: translateY(-50%); }
.lb-next  { right: 14px; top: 50%; transform: translateY(-50%); }
.lb-prev:hover { transform: translateY(-50%) translateX(-3px); }
.lb-next:hover { transform: translateY(-50%) translateX(3px); }
.lb-counter {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  letter-spacing: 0.4em;
  color: var(--ink-dim);
}
@media (max-width: 640px) {
  .gallery { padding: 0 16px 30px; }
  .lb-img  { max-width: 100vw; max-height: 80vh; }
  .lb-prev { left: 2px; }
  .lb-next { right: 2px; }
}
