/* ── Дакар 2026 · галерея сборной по ушу-таолу ─────────────────────
   Тема «ночь + золото» — в тон дипломам. Без внешних зависимостей. */

:root {
  --bg: #0e1117;
  --bg-2: #151a23;
  --card: #1a202b;
  --line: #2a3242;
  --gold: #c9a84c;
  --gold-bright: #e3c878;
  --ivory: #ede6d6;
  --muted: #98a2b3;
  --shadow: 0 14px 34px rgba(0, 0, 0, .45);
  /* везде без засечек — и заголовки, и текст */
  --serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ivory);
  background:
    radial-gradient(1100px 480px at 50% -160px, rgba(201, 168, 76, .16), transparent 70%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── Шапка ─────────────────────────────────────────────────────── */

.hero { padding: 72px 20px 40px; text-align: center; }

.hero-top {
  margin: 0 0 26px;
  font-size: .82rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-top .dot { margin: 0 .7em; color: var(--gold); }

.brand {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px dotted rgba(201, 168, 76, .5);
}

.hero h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  letter-spacing: .06em;
  color: var(--ivory);
  text-shadow: 0 0 42px rgba(201, 168, 76, .25);
}

.hero-sub {
  margin: 14px 0 0;
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1rem, 2.6vw, 1.25rem);
  color: var(--gold-bright);
}

.hero-divider {
  width: min(320px, 60vw);
  height: 1px;
  margin: 26px auto;
  background: linear-gradient(90deg, transparent, var(--gold) 25%, var(--gold) 75%, transparent);
  position: relative;
}

.hero-divider::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 9px; height: 9px;
  transform: translate(-50%, -50%) rotate(45deg);
  background: var(--gold);
}

.hero-note { margin: 0; font-size: .95rem; color: var(--muted); }

/* ── «Открывашка»: видео на весь первый экран ──────────────────── */

.featured {
  position: relative;
  height: 100vh;
  height: 100svh;
  background: #000;
  overflow: hidden;
}

.featured video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}

.feat-sound {
  position: absolute;
  right: 22px; bottom: 26px;
  width: 52px; height: 52px;
  font-size: 1.25rem;
  line-height: 1;
  color: var(--ivory);
  background: rgba(10, 12, 17, .55);
  border: 1px solid rgba(201, 168, 76, .6);
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .2s, color .2s, transform .2s;
}

.feat-sound:hover {
  background: rgba(201, 168, 76, .3);
  color: var(--gold-bright);
  transform: scale(1.06);
}

.feat-scroll {
  position: absolute;
  left: 50%; bottom: 22px;
  transform: translateX(-50%);
  width: 46px; height: 46px;
  font-size: 1.6rem;
  line-height: 40px;
  text-align: center;
  text-decoration: none;
  color: var(--ivory);
  background: rgba(10, 12, 17, .45);
  border: 1px solid rgba(237, 230, 214, .35);
  border-radius: 50%;
  backdrop-filter: blur(3px);
  animation: feat-bob 2.2s ease-in-out infinite;
}

.feat-scroll:hover { border-color: var(--gold); color: var(--gold-bright); }

@keyframes feat-bob {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, 7px); }
}

/* ── Фильтры ───────────────────────────────────────────────────── */

/* галерея на всю ширину экрана */
main { flex: 1; width: auto; margin: 0; padding: 6px 14px 60px; }

.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 26px;
}

.counter { margin-left: auto; font-size: .85rem; color: var(--muted); }

.chip {
  font: inherit;
  font-size: .9rem;
  letter-spacing: .04em;
  color: var(--ivory);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 20px;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}

.chip:hover { border-color: var(--gold); color: var(--gold-bright); }

.chip.is-active {
  background: rgba(201, 168, 76, .14);
  border-color: var(--gold);
  color: var(--gold-bright);
}

/* ── Сетка: плоская масонри, подстраивается под пропорции фото ─── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  grid-auto-rows: 4px;            /* мелкая единица — высоту задаёт JS по пропорции */
  grid-auto-flow: dense;          /* плотная упаковка без дыр */
  gap: 10px;
  align-items: start;
}

.card {
  position: relative;
  margin: 0;
  cursor: zoom-in;
  /* плоско: без фона, рамок, скруглений и теней */
  background: none;
  border: 1px solid transparent;
  border-radius: 0;
  transition: border-color .18s ease, filter .18s ease;
}

.card:hover, .card:focus-visible {
  border-color: rgba(201, 168, 76, .6);
  outline: none;
}

.card img {
  width: 100%;
  height: auto;                   /* природные пропорции, никакой обрезки */
  display: block;
}

.card:hover img, .card:focus-visible img { filter: brightness(1.07); }

.card figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 26px 12px 10px;
  background: linear-gradient(transparent, rgba(10, 12, 17, .88));
  font-size: .85rem;
  color: var(--ivory);
  opacity: 0;
  transition: opacity .2s ease;
}

.card:hover figcaption, .card:focus-visible figcaption { opacity: 1; }

.card .badge-date {
  position: absolute;
  top: 8px; right: 8px;
  font-size: .7rem;
  letter-spacing: .06em;
  color: var(--gold-bright);
  background: rgba(10, 12, 17, .72);
  border: 1px solid rgba(201, 168, 76, .4);
  border-radius: 0;
  padding: 3px 8px;
}

.card.is-video .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.card.is-video .play::before {
  content: "";
  width: 58px; height: 58px;
  border-radius: 50%;
  background: rgba(14, 17, 23, .55);
  border: 1.5px solid rgba(201, 168, 76, .8);
  backdrop-filter: blur(2px);
}

.card.is-video .play::after {
  content: "";
  position: absolute;
  width: 0; height: 0;
  margin-left: 4px;
  border-left: 18px solid var(--gold-bright);
  border-top: 11px solid transparent;
  border-bottom: 11px solid transparent;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, .5));
}

.card.is-missing { cursor: default; min-height: 150px; }
.card.is-missing::after {
  content: "файл не найден — проверь путь в media.js";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 12px;
  text-align: center;
  font-size: .8rem;
  color: var(--muted);
  background: repeating-linear-gradient(45deg, #151a23, #151a23 12px, #1d2430 12px, #1d2430 24px);
}
.card.is-missing img { visibility: hidden; }

/* ── Пустое состояние ──────────────────────────────────────────── */

.empty { text-align: center; padding: 70px 20px; color: var(--muted); }

.empty-star { width: 74px; height: 74px; fill: none; stroke: var(--gold); stroke-width: 3; opacity: .8; }

.empty h2 {
  margin: 18px 0 10px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.45rem;
  color: var(--ivory);
}

.empty code {
  font-size: .85em;
  color: var(--gold-bright);
  background: rgba(201, 168, 76, .1);
  border-radius: 6px;
  padding: 2px 7px;
}

/* ── Лайтбокс / видео ──────────────────────────────────────────── */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 10, 14, .93);
  backdrop-filter: blur(4px);
}

.lightbox[hidden] { display: none; }

.lb-figure {
  margin: 0;
  max-width: min(1200px, 92vw);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lb-figure img {
  max-width: 100%;
  max-height: 78vh;
  border-radius: 10px;
  box-shadow: var(--shadow);
  object-fit: contain;
}

.lb-video video {
  width: min(1100px, 92vw);
  max-height: 78vh;
  border-radius: 10px;
  background: #000;
  box-shadow: var(--shadow);
}

.lb-figure figcaption {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-size: .95rem;
  color: var(--ivory);
  text-align: center;
}

.lb-counter { color: var(--muted); white-space: nowrap; }

.lb-close {
  position: absolute;
  top: 18px; right: 22px;
  width: 44px; height: 44px;
  font-size: 1.15rem;
  color: var(--ivory);
  background: rgba(26, 32, 43, .8);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.lb-close:hover { border-color: var(--gold); color: var(--gold-bright); }

.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px; height: 52px;
  font-size: 2rem;
  line-height: 1;
  color: var(--ivory);
  background: rgba(26, 32, 43, .8);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  transition: border-color .2s, color .2s;
}

.lb-nav:hover { border-color: var(--gold); color: var(--gold-bright); }

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

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

.footer {
  text-align: center;
  padding: 34px 20px 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .92rem;
}

.footer p { margin: 6px 0; }

.footer-stars { color: var(--gold); letter-spacing: .6em; text-indent: .6em; }

.footer-dim { font-size: .8rem; opacity: .75; }

/* ── Адаптив и мелочи ──────────────────────────────────────────── */

@media (max-width: 560px) {
  .hero { padding-top: 54px; }
  .lb-nav { display: none; }
  .card figcaption { opacity: 1; padding-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  html { scroll-behavior: auto; }
}

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