/* ============================================================
   site.css — витрина alekphoto. Дизайн-токены alekhub (тёмный минимализм).
   ============================================================ */

:root {
  --bg:            #0a0a0b;
  --bg-card:       #131316;
  --bg-card-hover: #1a1a1f;
  --border:        #232328;
  --border-hover:  #34343c;
  --text:          #e7e7ea;
  --text-dim:      #8a8a93;
  --text-faint:    #5a5a63;
  --accent:        #6ea8fe;
  --radius:        16px;
  --maxw:          1180px;
}

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

html { scroll-behavior: smooth; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  animation: pageIn .5s ease both;
}

@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

a { color: inherit; }

.hidden { display: none !important; }
.mono { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace; }

/* плавный уход страницы при переходе на альбом/назад */
body.leaving { opacity: 0; transition: opacity .26s ease; }

/* ===================== HERO (лендинг) ===================== */
.hero {
  position: relative;
  height: 86vh;
  min-height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  text-align: center;
}
.hero__slideshow { position: absolute; inset: 0; z-index: 0; }
.hero__slide {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.6s ease;
}
.hero__slide.is-active { opacity: 1; }
.hero__overlay {
  position: absolute; inset: 0; z-index: 1;
  background:
    radial-gradient(circle at 50% 40%, rgba(10,10,11,.45), rgba(10,10,11,.82) 80%),
    linear-gradient(to bottom, rgba(10,10,11,.4), var(--bg) 96%);
}
.hero__content { position: relative; z-index: 2; padding: 0 20px; }
.hero__eyebrow {
  font-family: ui-monospace, Menlo, monospace;
  text-transform: uppercase; letter-spacing: .32em;
  font-size: .72rem; color: var(--text-dim); margin-bottom: 18px;
}
.hero__title {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-weight: 600; letter-spacing: -.04em; line-height: 1;
  font-size: clamp(2.6rem, 9vw, 5rem);
  text-shadow: 0 4px 40px rgba(0,0,0,.5);
}
.hero__title .dot { color: var(--accent); }
.hero__text {
  margin-top: 20px; color: var(--text-dim);
  font-size: clamp(.95rem, 2.4vw, 1.1rem); max-width: 30em; margin-inline: auto;
}
.hero__arrow {
  position: absolute; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 2; width: 30px; height: 30px; color: var(--text-dim);
  cursor: pointer; animation: bob 2.4s ease-in-out infinite;
}
.hero__arrow svg { width: 100%; height: 100%; }
@keyframes bob { 0%,100%{transform:translateX(-50%) translateY(0)} 50%{transform:translateX(-50%) translateY(7px)} }

/* ===================== СЕТКА АЛЬБОМОВ ===================== */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; margin: 56px 0 24px;
}
.section-head h2 {
  font-family: ui-monospace, Menlo, monospace; font-weight: 600;
  letter-spacing: -.02em; font-size: 1.4rem;
}
.section-head .count { color: var(--text-faint); font-size: .85rem; }

.albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 18px;
  padding-bottom: 64px;
}
.album-card {
  display: block; position: relative;
  aspect-ratio: 4 / 3; border-radius: var(--radius); overflow: hidden;
  background: var(--bg-card); border: 1px solid var(--border);
  text-decoration: none;
  transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
  animation: fadeUp .5s ease both;
}
.album-card img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: 0; transition: opacity .5s ease, transform .4s ease;
}
.album-card img.loaded { opacity: .85; }
.album-card__shade {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(8,8,10,.86) 0%, rgba(8,8,10,.15) 55%, transparent 100%);
}
.album-card__meta { position: absolute; left: 18px; right: 18px; bottom: 16px; }
.album-card__title {
  font-family: ui-monospace, Menlo, monospace; font-weight: 600;
  font-size: 1.15rem; letter-spacing: -.01em;
}
.album-card__sub { color: var(--text-dim); font-size: .82rem; margin-top: 3px; }
.album-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  box-shadow: 0 18px 40px -16px rgba(110,168,254,.32);
}
.album-card:hover img { opacity: 1; transform: scale(1.04); }
.album-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.empty {
  color: var(--text-faint); text-align: center; padding: 80px 0; font-size: .95rem;
}

/* ===================== СТРАНИЦА АЛЬБОМА ===================== */
.topbar {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(10,10,11,.72);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  max-width: var(--maxw); margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 20px 14px;
  display: flex; align-items: center; gap: 16px;
}
.back {
  display: inline-flex; align-items: center; gap: 7px;
  color: var(--text-dim); text-decoration: none; font-size: .9rem;
  transition: color .18s;
}
.back:hover { color: var(--text); }
.back svg { width: 16px; height: 16px; }
.topbar__title { font-family: ui-monospace, Menlo, monospace; font-weight: 600; letter-spacing: -.01em; }
.topbar__title .yr { color: var(--text-faint); font-weight: 400; margin-left: 8px; }

.album-intro { max-width: var(--maxw); margin: 0 auto; padding: 40px 20px 8px; }
.album-intro h1 {
  font-family: ui-monospace, Menlo, monospace; font-weight: 600;
  letter-spacing: -.03em; font-size: clamp(1.8rem, 5vw, 2.8rem);
}
.album-intro h1 .yr { color: var(--text-faint); font-weight: 400; font-size: .6em; margin-left: 12px; }
.album-intro p { color: var(--text-dim); margin-top: 12px; max-width: 46em; }

/* ===================== JUSTIFIED-ГАЛЕРЕЯ ===================== */
.stream { max-width: var(--maxw); margin: 0 auto; padding: 28px 20px 80px; }
.j-row { display: flex; gap: 6px; margin-bottom: 6px; }
.j-tile {
  position: relative; overflow: hidden; border-radius: 8px;
  cursor: zoom-in; background: var(--bg-card);
}
.j-tile img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  opacity: 0; transition: opacity .5s ease, transform .35s ease;
}
.j-tile img.loaded { opacity: 1; }
.j-tile:hover img { transform: scale(1.05); }
.j-tile::after {
  content: ""; position: absolute; inset: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
  border-radius: 8px; pointer-events: none;
}

/* мобильная лента — одна колонка */
@media (max-width: 680px) {
  .j-row { flex-direction: column; }
  .j-tile { width: 100% !important; height: auto !important; }
}

/* ===================== FOOTER ===================== */
.footer {
  text-align: center; color: var(--text-faint);
  font-size: .8rem; padding: 40px 20px; border-top: 1px solid var(--border);
}
.footer a { color: var(--text-dim); text-decoration: none; }
.footer a:hover { color: var(--accent); }

/* ===================== LIGHTBOX ===================== */
.lb-backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(6,6,8,.92);
  opacity: 0; pointer-events: none; transition: opacity .28s ease;
}
.lb-backdrop.open { opacity: 1; pointer-events: auto; }
.lightbox {
  position: fixed; inset: 0; z-index: 91;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity .28s ease;
  -webkit-user-select: none; user-select: none;
}
.lightbox.open { opacity: 1; pointer-events: auto; }
/* два слоя картинки — кроссфейд между фото */
.lb-img {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  max-width: 92vw; max-height: 84vh; object-fit: contain;
  border-radius: 6px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.8);
  opacity: 0; transition: opacity .45s ease; -webkit-user-drag: none; pointer-events: none;
}
.lb-img.show { opacity: 1; }
.lb-caption {
  position: fixed; left: 50%; bottom: 50px; transform: translateX(-50%);
  color: var(--text-dim); font-size: .85rem; text-align: center; max-width: 80vw; min-height: 1em;
}
.lb-close, .lb-nav {
  position: fixed; z-index: 92; background: rgba(20,20,24,.6);
  border: 1px solid var(--border); color: var(--text);
  width: 46px; height: 46px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .18s, border-color .18s;
}
.lb-close:hover, .lb-nav:hover { background: rgba(40,40,48,.85); border-color: var(--accent); }
.lb-close svg, .lb-nav svg { width: 22px; height: 22px; }
.lb-close { top: 20px; right: 20px; }
.lb-nav--prev { left: 18px; top: 50%; transform: translateY(-50%); }
.lb-nav--next { right: 18px; top: 50%; transform: translateY(-50%); }
.lb-counter {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 92; color: var(--text-faint); font-size: .8rem;
  font-family: ui-monospace, Menlo, monospace;
}
@media (max-width: 680px) {
  .lb-nav { width: 40px; height: 40px; }
  .lb-nav--prev { left: 8px; } .lb-nav--next { right: 8px; }
}

/* На тач-устройствах hover «залипает» при тапе — глушим зум, чтобы фото не скакали */
@media (hover: none) {
  .album-card:hover { transform: none; box-shadow: none; }
  .album-card:hover img { transform: none; }
  .j-tile:hover img { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .hero__arrow { animation: none; }
  body, .album-card { animation: none; }
  .album-card, .album-card img, .j-tile img, .lb-img { transition: none; }
}
