/* Фотоотчёт «Конференция исцеления тела и души».
   Дизайн-система — как у сайта регистрации (konfaiscelenia/DESIGN.md):
   изумрудный «зал», кремовый свет, золото — единственный акцент; Sofia Sans + Sofia Sans Extra Condensed. */

@font-face {
  font-family: "Sofia Sans";
  src: url("fonts/sofia-sans-cyrillic.woff2") format("woff2");
  font-weight: 1 1000;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Sofia Sans";
  src: url("fonts/sofia-sans-latin.woff2") format("woff2");
  font-weight: 1 1000;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Sofia Sans Extra Condensed";
  src: url("fonts/sofia-sans-xc-800-cyrillic.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Sofia Sans Extra Condensed";
  src: url("fonts/sofia-sans-xc-800-latin.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329,
    U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: dark;
  --pine-950: #051a17;
  --pine-900: #071f1c;
  --pine-850: #0a2622;
  --pine-800: #0e2d28;
  --pine-700: #163d36;
  --pine-600: #22524a;
  --cream-50: #fbf6ea;
  --cream-100: #f4ead3;
  --cream-200: #efe2c4;
  --cream-300: #e3d2ae;
  --gold-300: #e2cb93;
  --gold-400: #d6b978;
  --gold-500: #c9ab6a;
  --ink: var(--cream-200);
  --ink-muted: #c9bf9f;
  --hairline: rgb(201 171 106 / 0.3);
  --radius-control: 12px;
  --radius-container: 20px;
  --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1);
  --font-sans: "Sofia Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Sofia Sans Extra Condensed", "Sofia Sans", system-ui, sans-serif;
  --gutter: 16px;
}
@media (min-width: 640px) {
  :root { --gutter: 32px; }
}

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

html {
  background: var(--pine-900);
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--pine-600) var(--pine-950);
}
html.viewer-open { overflow: hidden; }

body {
  margin: 0;
  background: var(--pine-900);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

::selection { background: var(--gold-400); color: var(--pine-950); }

:where(a, button):focus-visible {
  outline: 3px solid var(--gold-400);
  outline-offset: 3px;
  border-radius: 6px;
}

p { margin: 0; }
.nowrap { white-space: nowrap; }

.skip {
  position: absolute;
  left: -9999px;
  top: 16px;
  z-index: 100;
  padding: 12px 16px;
  border-radius: var(--radius-control);
  background: var(--gold-400);
  color: var(--pine-950);
  font-weight: 700;
  text-decoration: none;
}
.skip:focus { left: 16px; }

/* ---------- Иконки (линейные, как Phosphor bold) ---------- */
.i {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.i-inline {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.22em;
  color: var(--gold-400);
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3.25rem;
  padding: 0 1.375rem;
  border-radius: var(--radius-control);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms var(--ease-out-strong), background-color 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn-gold {
  background: var(--gold-400);
  color: var(--pine-950);
  box-shadow: inset 0 1px 0 rgb(255 248 225 / 0.45), 0 10px 28px -14px rgb(201 171 106 / 0.65);
}
@media (hover: hover) and (pointer: fine) {
  .btn-gold:hover { background: var(--gold-300); }
}
.btn-sm {
  min-height: 2.75rem;
  padding: 0 1rem;
  font-size: 0.9375rem;
}
.btn-sm .i { width: 20px; height: 20px; }

/* ---------- Зал и шапка ---------- */
.hall { position: relative; isolation: isolate; }
.hall::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 0 auto;
  height: min(70vh, 640px);
  background: radial-gradient(60% 75% at 32% 0%, rgb(241 225 194 / 0.07), transparent 70%);
  pointer-events: none;
}

.hero {
  max-width: 1320px;
  margin: 0 auto;
}
.banner img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1672 / 941;
  background: var(--pine-850);
}

.poster {
  display: grid;
  gap: 28px;
  padding: 28px var(--gutter) 0;
}
.kicker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-400);
}
.kicker::after {
  content: "";
  width: 48px;
  height: 1px;
  background: var(--gold-500);
  opacity: 0.6;
}
.type-date {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.75rem, 1.6rem + 6vw, 4.75rem);
  line-height: 0.9;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--cream-50);
}
.type-title {
  margin: 14px 0 0;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: clamp(1.375rem, 1.15rem + 0.9vw, 1.75rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--cream-100);
  text-wrap: balance;
}
.meta {
  margin-top: 10px;
  color: var(--ink-muted);
  font-size: 1rem;
}
.poster-action {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.hint {
  max-width: 22rem;
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--ink-muted);
}

@media (min-width: 900px) {
  .poster {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    gap: 40px;
    padding-top: 40px;
  }
  .poster-action { align-items: flex-end; text-align: right; }
}
@media (min-width: 1024px) {
  .hero { padding: 32px var(--gutter) 0; }
  .banner img { border-radius: var(--radius-container); }
  .poster { padding-left: 0; padding-right: 0; }
}

/* ---------- Компактная полоса сверху ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  background: var(--pine-950);
  border-bottom: 1px solid var(--hairline);
  transform: translateY(-105%);
  transition: transform 260ms var(--ease-out-strong);
}
.topbar.show { transform: none; }
.topbar-in {
  max-width: 1320px;
  margin: 0 auto;
  padding: max(8px, env(safe-area-inset-top)) var(--gutter) 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.375rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.type-poster-sm { color: var(--cream-50); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-dates { color: var(--gold-400); white-space: nowrap; }
@media (max-width: 479px) {
  .topbar-dates { display: none; }
}

/* ---------- Галерея: ровные ряды без JS ----------
   Каждый элемент растёт пропорционально своему соотношению сторон (--r = ширина/высота),
   поэтому все фото в ряду получаются одной высоты. ::after не даёт растянуть последний ряд. */
.gallery {
  max-width: 1320px;
  margin: 44px auto 0;
  padding: 0 var(--gutter);
}
.gallery-hint {
  padding-top: 20px;
  margin-bottom: 16px;
  border-top: 1px solid var(--hairline);
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--ink-muted);
}
.grid {
  --row: 112px;
  --gap: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.grid::after { content: ""; flex: 1000 1 0px; }
.grid li { flex: var(--r) 1 calc(var(--r) * var(--row)); min-width: 0; }
@media (min-width: 420px) { .grid { --row: 136px; } }
@media (min-width: 768px) { .grid { --row: 190px; --gap: 6px; } }
@media (min-width: 1200px) { .grid { --row: 236px; --gap: 8px; } }
@media (min-width: 1024px) { .gallery { margin-top: 56px; } }

.ph {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  background: var(--pine-850);
  -webkit-tap-highlight-color: transparent;
}
.ph img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--r);
  object-fit: cover;
  transition: transform 450ms var(--ease-out-strong), filter 200ms ease;
}
.ph:active img { transform: scale(0.98); }
@media (min-width: 768px) {
  .ph { border-radius: 8px; }
}
@media (hover: hover) and (pointer: fine) {
  .ph:hover img { transform: scale(1.035); filter: brightness(1.06); }
}

/* ---------- Подвал ---------- */
.footer {
  max-width: 1320px;
  margin: 64px auto 0;
  padding: 0 var(--gutter) max(40px, env(safe-area-inset-bottom));
}
.footer-in {
  display: flex;
  align-items: center;
  gap: 18px;
  padding-top: 24px;
  border-top: 1px solid var(--hairline);
  font-size: 0.9375rem;
  line-height: 1.4;
  color: var(--ink-muted);
}
.mono {
  width: 58px;
  height: auto;
  flex: none;
  fill: none;
  stroke: var(--cream-300);
  stroke-width: 16;
}

/* ---------- Просмотрщик ---------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: rgb(5 26 23 / var(--bg-a, 1));
  color: var(--cream-100);
  overscroll-behavior: contain;
  opacity: 0;
  transition: opacity 200ms ease;
}
.viewer[hidden] { display: none; }
.viewer.on { opacity: 1; }

.viewer-bar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  transition: opacity 200ms ease;
}
.viewer-count {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.625rem;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--cream-50);
}
.viewer-count .sep { margin: 0 0.3em; color: var(--gold-500); }
.viewer-actions { display: flex; align-items: center; gap: 6px; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 48px;
  height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--cream-100);
  font: 700 1rem/1 var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms var(--ease-out-strong), background-color 160ms ease;
}
.icon-btn:active { transform: scale(0.94); }
#v-dl {
  padding: 0 16px 0 14px;
  background: var(--gold-400);
  color: var(--pine-950);
}
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover { background: rgb(244 234 211 / 0.1); }
  #v-dl:hover { background: var(--gold-300); }
}

.viewer-stage {
  position: relative;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.viewer-track {
  position: absolute;
  inset: 0;
  display: flex;
  transform: translate3d(-100%, 0, 0);
  will-change: transform;
}
.viewer-track.anim { transition: transform 340ms var(--ease-out-strong); }

.slide {
  --pad-x: 0px;
  --pad-b: max(12px, env(safe-area-inset-bottom));
  position: relative;
  flex: 0 0 100%;
  margin: 0;
}
.slide.empty { visibility: hidden; }
.slide img {
  position: absolute;
  top: 0;
  bottom: var(--pad-b);
  left: var(--pad-x);
  right: var(--pad-x);
  width: calc(100% - 2 * var(--pad-x));
  height: calc(100% - var(--pad-b));
  object-fit: contain;
  -webkit-user-drag: none;
  user-select: none;
  transform-origin: 50% 50%;
  transition: transform 260ms var(--ease-out-strong);
}
.slide .lo { filter: blur(6px); }
.slide .hi { opacity: 0; transition: opacity 180ms ease, transform 260ms var(--ease-out-strong); }
.slide .hi.ready { opacity: 1; }
.viewer-stage.panning .slide img { transition: none; }
.viewer.zoomed .viewer-stage { cursor: grab; }
@media (min-width: 768px) {
  .slide { --pad-x: 88px; --pad-b: 24px; }
}

.nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  display: none;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-top: -4px;
  border: 1px solid rgb(214 185 120 / 0.35);
  border-radius: 50%;
  background: rgb(5 26 23 / 0.6);
  color: var(--cream-100);
  cursor: pointer;
  transition: opacity 200ms ease, background-color 160ms ease, transform 160ms var(--ease-out-strong);
}
.nav .i { width: 26px; height: 26px; }
.nav.prev { left: 16px; }
.nav.next { right: 16px; }
.nav:active { transform: scale(0.94); }
.nav:disabled { opacity: 0.25; cursor: default; }
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  .nav { display: grid; }
  .nav:hover:not(:disabled) { background: var(--pine-700); }
}

.viewer.ui-off .viewer-bar,
.viewer.ui-off .nav { opacity: 0; pointer-events: none; }

.swipe-hint {
  position: absolute;
  left: 50%;
  bottom: max(28px, calc(env(safe-area-inset-bottom) + 16px));
  z-index: 4;
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--pine-950);
  border: 1px solid var(--hairline);
  color: var(--cream-100);
  font-size: 0.9375rem;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 300ms ease;
}
.swipe-hint.gone { opacity: 0; }

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