/* ============================================================
   Sochi Run /  Family — общие стили
   Палитра и приёмы перенесены со стиля членского сайта:
   Manrope, фиол.→индиго градиент, сетка + glow, ring-карточки.
   ============================================================ */

:root {
  --font-sans: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Manrope', var(--font-sans);

  /* Бренд */
  --purple: #a855f7;
  --indigo: #4f46e5;
  --violet-600: #7c3aed;

  /* Акцент по умолчанию (переопределяется в темах run/ride) */
  --accent: #a855f7;
  --accent-2: #4f46e5;

  /* Светлая палитра (как на членском сайте) */
  --bg: #f6f7fb;
  --surface: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --dimmed: #94a3b8;
  --ring: rgba(15, 23, 42, 0.08);
  --ring-strong: rgba(15, 23, 42, 0.12);

  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 12px 32px -12px rgba(15, 23, 42, 0.18);
  --shadow-glow: 0 20px 60px -20px rgba(124, 58, 237, 0.45);

  --maxw: 1120px;
}

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

/* Атрибут hidden должен скрывать даже элементы с заданным display (.btn, flex и т.п.) */
[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.55;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.08;
  margin: 0;
}

/* ---------- Тема: беговой клуб (чёрный) ---------- */
body[data-theme='run'] {
  --bg: #0a0a0b;
  --surface: #141416;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --dimmed: #71717a;
  --ring: rgba(255, 255, 255, 0.1);
  --ring-strong: rgba(255, 255, 255, 0.18);
  --accent: #f97316; /* тёплый оранжевый из фото/бейджей */
  --accent-2: #ef4444;
}

/* ---------- Тема: велоклуб (тёмная + фиолетовый акцент) ---------- */
body[data-theme='ride'] {
  --bg: #0a0a0b;
  --surface: #141416;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --dimmed: #71717a;
  --ring: rgba(255, 255, 255, 0.1);
  --ring-strong: rgba(255, 255, 255, 0.18);
  --accent: var(--purple);
  --accent-2: var(--indigo);
}

/* ============================================================
   Фоновые эффекты
   ============================================================ */
.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: linear-gradient(to right, var(--ring) 1px, transparent 1px),
    linear-gradient(to bottom, var(--ring) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 40%, transparent 100%);
  opacity: 0.6;
}

.hero-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(40% 35% at 18% 8%, rgba(168, 85, 247, 0.4), transparent 60%),
    radial-gradient(45% 40% at 85% 12%, rgba(79, 70, 229, 0.32), transparent 60%);
  filter: blur(20px);
  opacity: 0.8;
  animation: glow-float 16s ease-in-out infinite alternate;
}

body[data-theme='run'] .hero-glow {
  background:
    radial-gradient(40% 35% at 15% 6%, rgba(249, 115, 22, 0.22), transparent 60%),
    radial-gradient(48% 42% at 88% 10%, rgba(239, 68, 68, 0.18), transparent 60%);
}

@keyframes glow-float {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(-3%, 4%, 0) scale(1.1);
  }
}

/* ============================================================
   Раскладка
   ============================================================ */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.section {
  padding: 96px 0;
  position: relative;
  z-index: 1;
}

.section--tight {
  padding: 64px 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
}

.section-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.section-lead {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 60ch;
  margin-top: 14px;
}

/* ============================================================
   Кнопки
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.98rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.25s ease, background 0.25s ease, border-color 0.25s ease;
  white-space: nowrap;
}

.btn:active {
  transform: translateY(1px) scale(0.99);
}

.btn--primary {
  background: linear-gradient(135deg, var(--purple), var(--indigo));
  color: #fff;
  box-shadow: var(--shadow-glow);
}

body[data-theme='run'] .btn--primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 18px 50px -18px rgba(249, 115, 22, 0.6);
}

.btn--primary:hover {
  transform: translateY(-2px);
}

.btn--ghost {
  background: transparent;
  border-color: var(--ring-strong);
  color: var(--text);
}

.btn--ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   Карточки
   ============================================================ */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--ring), var(--shadow-md);
  overflow: hidden;
}

/* ============================================================
   Хедер
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--ring);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.brand__mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 80%, transparent);
  flex: none;
}

/* Внутри цветной плитки — наш SVG-логотип, всегда белый */
.brand__mark img {
  width: 66%;
  height: auto;
  filter: brightness(0) invert(1);
}

/* Контурные иконки (наследуют цвет через currentColor) */
.ico {
  width: 1.15em;
  height: 1.15em;
  display: inline-block;
  vertical-align: -0.18em;
  flex: none;
}
.btn .ico {
  margin-right: 2px;
}
.stat__num .ico {
  width: 30px;
  height: 30px;
  stroke: var(--accent);
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand__name {
  font-size: 1.05rem;
  line-height: 1.05;
}

.brand__sub {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 600;
}

.nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.nav__links {
  display: flex;
  gap: 26px;
}

.nav a {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s ease;
}

.nav a:hover {
  color: var(--text);
}

.nav__cta {
  margin-left: 6px;
}

/* Кнопка в шапке: текст не должен наследовать приглушённый цвет .nav a */
.nav a.btn--primary {
  color: #fff;
}
.nav a.btn--ghost {
  color: var(--text);
}

/* Активный пункт меню (напр. «Галерея» на странице галереи) */
.nav a.is-current {
  color: var(--accent);
  position: relative;
}
.nav a.is-current::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* Переключатель бег / вело */
.club-switch {
  display: inline-flex;
  padding: 4px;
  gap: 2px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  border: 1px solid var(--ring);
}

.club-switch a {
  width: 38px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 1.05rem;
  line-height: 1;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.club-switch a:hover {
  transform: translateY(-1px);
}

.club-switch a.is-active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 80%, transparent);
}

/* Переключатель прижат к правому краю навбара */
.nav .club-switch {
  margin-left: 4px;
}

/* На узких экранах прячем текст бренда, чтобы поместились лого, меню и переключатель */
@media (max-width: 560px) {
  .brand__text {
    display: none;
  }
}

@media (max-width: 820px) {
  .nav__links {
    display: none;
  }
}

/* ============================================================
   Анонсы недели
   ============================================================ */
.anons-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 44px;
}

@media (max-width: 900px) {
  .anons-grid {
    grid-template-columns: 1fr;
    max-width: 460px;
    margin-inline: auto;
  }
}

.anons-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--ring), var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.anons-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 0 0 1px var(--ring-strong), 0 28px 60px -24px rgba(0, 0, 0, 0.4);
}
[data-theme=ride] .anons-card__img{
  aspect-ratio: 9 / 16 !important;
}
.anons-card__img {
  aspect-ratio: 71 / 100;
  object-fit: cover;
  object-position: top;
  width: 100%;
  background: #1118;
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}

.anons-card__img:hover {
  opacity: 0.92;
}

.anons-card__body {
  padding: 18px 20px 22px;
}

.anons-card__loc {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.anons-card__sched {
  color: var(--muted);
  font-size: 0.9rem;
  white-space: pre-line;
}

/* ============================================================
   Локации
   ============================================================ */
.loc-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 44px;
}

@media (max-width: 820px) {
  .loc-grid {
    grid-template-columns: 1fr;
  }
}

.loc-card {
  padding: 26px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--ring);
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.loc-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 0 1px var(--ring-strong), var(--shadow-md);
}

.loc-card__pin {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent);
  font-size: 1.2rem;
  margin-bottom: 16px;
}

.loc-card__name {
  font-size: 1.2rem;
  margin-bottom: 6px;
}

.loc-card__addr {
  color: var(--muted);
  font-size: 0.92rem;
}

/* ============================================================
   Галерея
   ============================================================ */
.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 40px;
}

.gallery img,
.gallery .ph {
  border-radius: var(--radius-sm);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  width: 100%;
  box-shadow: 0 0 0 1px var(--ring);
}

.gallery .ph {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), var(--surface));
}

.gallery img:nth-child(1),
.gallery .ph:nth-child(1) {
  grid-row: span 2;
  aspect-ratio: 1 / 2;
}

@media (max-width: 720px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
  .gallery img:nth-child(1),
  .gallery .ph:nth-child(1) {
    grid-row: auto;
    aspect-ratio: 1 / 1;
  }
}

/* ============================================================
   История анонсов
   ============================================================ */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 40px;
}

.history-week {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--ring);
  overflow: hidden;
}

.history-week__head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--ring);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.history-week__label {
  font-weight: 700;
  font-size: 0.95rem;
}

.history-week__date {
  font-size: 0.78rem;
  color: var(--dimmed);
}

.history-week__thumbs {
  display: flex;
  gap: 2px;
}

.history-week__thumbs img {
  flex: 1;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

/* ============================================================
   Приветствие новичкам
   ============================================================ */
.welcome {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 48px;
  align-items: center;
}

@media (max-width: 860px) {
  .welcome {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

.welcome-card {
  padding: 32px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--ring), var(--shadow-md);
  position: relative;
}

.contact-btns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.welcome-card__quote {
  white-space: pre-line;
  color: var(--muted);
  font-size: 1rem;
}

.stat-row {
  display: flex;
  gap: 36px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.stat__num {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.stat__label {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ============================================================
   Footer
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--ring);
  padding: 48px 0 40px;
  position: relative;
  z-index: 1;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-links {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent);
}

/* ============================================================
   Лайтбокс
   ============================================================ */
.lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 8, 10, 0.92);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.lb-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.lb-img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
  transform: scale(0.97);
  transition: transform 0.25s ease;
}

.lb-overlay.is-open .lb-img {
  transform: scale(1);
}

.lb-btn {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.2s ease, transform 0.15s ease;
  user-select: none;
}

.lb-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lb-close {
  top: 20px;
  right: 24px;
}
.lb-prev {
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
}
.lb-next {
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
}
.lb-prev:hover {
  transform: translateY(-50%) scale(1.06);
}
.lb-next:hover {
  transform: translateY(-50%) scale(1.06);
}

.lb-single .lb-prev,
.lb-single .lb-next {
  display: none;
}

@media (max-width: 560px) {
  .lb-prev,
  .lb-next {
    width: 40px;
    height: 40px;
  }
}

/* кликабельные превью в галерее */
.gallery img {
  cursor: zoom-in;
  transition: transform 0.25s ease, opacity 0.2s ease;
}
.gallery img:hover {
  opacity: 0.92;
}

/* ============================================================
   Промо галереи в афише + архив анонсов
   ============================================================ */
.anons-card--promo {
  position: relative;
  cursor: pointer;
}

.anons-card--promo::after {
  content: 'Галерея';
  position: absolute;
  top: 12px;
  left: 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

/* Блок «фотоотчёт с прошлого события» под афишей */
.promo-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-top: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--ring), var(--shadow-md);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  max-width: 640px;
}
.promo-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 0 0 1px var(--ring-strong), 0 24px 50px -22px rgba(0, 0, 0, 0.45);
}
.promo-card__img {
  width: 200px;
  flex: none;
  object-fit: cover;
  align-self: stretch;
}
@media (max-width: 560px) {
  .promo-card__img {
    width: 130px;
  }
}
.promo-card__body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px 24px;
}
.promo-card__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.2rem;
  margin-bottom: 4px;
}
.promo-card__date {
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 10px;
}
.promo-card__sub {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.92rem;
}

/* Отступы блоков афиши (вместо инлайновых стилей) */
#anons-promo { margin-top: 40px; }
.anons-tg-cta { margin-top: 32px; }
.welcome-card__cta { margin-top: 22px; }
.archive-week__gallery { margin-top: 14px; }

/* Фотоотчёты под афишей — широкие карточки в столбик */
.promo-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 16px;
}
.promo-list .promo-card { max-width: 600px; width: 100%; margin-top: 0; }
.promo-card__img { width: 240px; }
@media (max-width: 560px) { .promo-card__img { width: 130px; } }

/* Виджет записи на событие */
.reg-widget {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--ring);
}
.reg-widget__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.reg-widget__count {
  font-weight: 800;
  font-size: 0.95rem;
}
.reg-widget__btn {
  padding: 9px 18px;
  font-size: 0.9rem;
}
.reg-widget__btn:disabled {
  opacity: 0.6;
  cursor: default;
  filter: grayscale(0.4);
}
/* honeypot — скрыт от людей */
.reg-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* ---- Модалка записи на событие ---- */
.reg-overlay {
  position: fixed;
  inset: 0;
  z-index: 230;
  background: rgba(8, 8, 10, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.reg-overlay.is-open { opacity: 1; pointer-events: auto; }
.reg-modal {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px var(--ring), 0 40px 90px -30px rgba(0, 0, 0, 0.7);
  padding: 30px 26px 26px;
  transform: scale(0.96);
  transition: transform 0.25s ease;
}
.reg-overlay.is-open .reg-modal { transform: scale(1); }
.reg-modal__close {
  position: absolute; top: 14px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: color-mix(in srgb, var(--text) 10%, transparent);
  color: var(--text); font-size: 1.3rem; cursor: pointer; line-height: 1;
}
.reg-modal__title { font-family: var(--font-display); font-weight: 800; font-size: 1.3rem; }
.reg-modal__event { color: var(--accent); font-weight: 700; margin: 4px 0 18px; }
.reg-modal__form label { display: block; font-size: 0.82rem; font-weight: 700; margin: 12px 0 6px; color: var(--text); }
.reg-modal__opt { color: var(--muted); font-weight: 500; }
.reg-modal__form input[type=text] {
  width: 100%; padding: 11px 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--ring-strong); background: var(--surface); color: var(--text);
  font: inherit; outline: none;
}
.reg-modal__form input[type=text]:focus { border-color: var(--accent); }
.reg-modal__submit { width: 100%; margin-top: 18px; }
.reg-modal__err { color: #ef4444; font-weight: 600; font-size: 0.9rem; margin-top: 10px; min-height: 1em; }
.reg-modal__done {
  white-space: pre-line;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  padding: 14px 4px;
}
.reg-modal__done::before { content: '✔'; display: block; color: #16a34a; font-size: 2rem; margin-bottom: 8px; }

.archive-toggle-wrap {
  margin-top: 28px;
}

.archive-week {
  margin-top: 40px;
}

.archive-week:first-child {
  margin-top: 36px;
}

.archive-week__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--ring);
  padding-bottom: 10px;
}

.archive-week__head h3 {
  font-size: 1.15rem;
}

.archive-week__head span {
  color: var(--dimmed);
  font-size: 0.85rem;
}

.archive-week .anons-grid {
  margin-top: 22px;
}

/* Велоклуб: архив плитками + пагинация */
.archive-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 36px;
}

.a-tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--ring), var(--shadow-md);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.a-tile:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 0 1px var(--ring-strong), 0 24px 50px -22px rgba(0, 0, 0, 0.45);
}

.a-tile__img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  object-position: top;
  background: #1118;
  cursor: zoom-in;
  transition: opacity 0.2s ease;
}

.a-tile__img:hover {
  opacity: 0.92;
}

.a-tile__ph {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), var(--surface));
  cursor: default;
}

.a-tile__body {
  padding: 14px 16px 18px;
}

.a-tile__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.02rem;
  margin-bottom: 4px;
}

.a-tile__date {
  color: var(--muted);
  font-size: 0.84rem;
}

.a-tile__g {
  display: inline-block;
  margin-top: 10px;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent);
}

.a-tile__g:hover {
  text-decoration: underline;
}

.archive-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 32px;
}

.archive-pager__info {
  font-weight: 700;
  color: var(--muted);
  font-size: 0.92rem;
}

.archive-pager .btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
}

/* ============================================================
   Галереи (страница gallery.html)
   ============================================================ */
.gallery-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 22px;
  margin-top: 40px;
}

.g-tile {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 0 0 1px var(--ring), var(--shadow-md);
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.g-tile:hover {
  transform: translateY(-6px);
  box-shadow: 0 0 0 1px var(--ring-strong), 0 28px 60px -24px rgba(0, 0, 0, 0.4);
}

.g-tile__cover {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #1118;
  overflow: hidden;
}

.g-tile__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

/* затемнение снизу — чтобы дата читалась на любом фото */
.g-tile__cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) 46%);
  pointer-events: none;
}

/* крупная тонкая дата в формате 20/06 */
.g-tile__date {
  position: absolute;
  left: 18px;
  bottom: 12px;
  z-index: 1;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 2.7rem);
  font-weight: 200;
  letter-spacing: 0.01em;
  line-height: 1;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

.g-tile:hover .g-tile__cover img {
  transform: scale(1.04);
}

.g-tile__ph {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, var(--surface)), var(--surface));
}

.g-tile__body {
  padding: 16px 18px 20px;
}

.g-tile__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.g-tile__meta {
  color: var(--muted);
  font-size: 0.86rem;
}

/* Кнопка возврата к списку галерей */
.gallery-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--ring-strong);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.15s ease;
}
.gallery-back:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateX(-2px);
}

/* Сетка фото внутри галереи */
.gallery-masonry {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 36px;
}

.g-photo {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius-sm);
  box-shadow: 0 0 0 1px var(--ring);
  cursor: zoom-in;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

.g-photo:hover {
  opacity: 0.92;
  transform: translateY(-2px);
}

/* Видео-карточки */
.video-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.video-card {
  position: relative;
  border: none;
  padding: 0;
  cursor: pointer;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000;
  box-shadow: 0 0 0 1px var(--ring);
}

.video-card img,
.video-card__ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.video-card__ph {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 28%, #000), #000);
}

.video-card__play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  border: 2px solid rgba(255, 255, 255, 0.85);
  color: #fff;
  font-size: 1.3rem;
  padding-left: 4px;
  transition: transform 0.2s ease, background 0.2s ease;
}

.video-card:hover .video-card__play {
  transform: scale(1.1);
  background: var(--accent);
}

/* Оверлей видео */
.video-overlay {
  position: fixed;
  inset: 0;
  z-index: 210;
  background: rgba(8, 8, 10, 0.94);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.video-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.video-frame {
  width: min(960px, 94vw);
  aspect-ratio: 16 / 9;
}

.video-frame iframe {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.8);
}

.video-close {
  top: 20px;
  right: 24px;
}

/* ============================================================
   Модалка Telegram (фолбэк для кнопки чата)
   ============================================================ */
.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 220;
  background: rgba(8, 8, 10, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.chat-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.chat-modal {
  position: relative;
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 0 0 1px var(--ring), 0 40px 90px -30px rgba(0, 0, 0, 0.7);
  padding: 32px 28px 26px;
  text-align: center;
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.chat-overlay.is-open .chat-modal {
  transform: scale(1);
}

.chat-modal__close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: color-mix(in srgb, var(--text) 8%, transparent);
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}

.chat-modal__close:hover {
  background: color-mix(in srgb, var(--text) 16%, transparent);
}

.chat-modal__icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}

.chat-modal__icon svg {
  width: 28px;
  height: 28px;
}

.chat-modal__title {
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.chat-modal__text {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 20px;
}

.chat-modal__open,
.chat-modal__app {
  width: 100%;
  margin-bottom: 10px;
}

.chat-modal__user {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
  margin: 16px 0 10px;
}

.chat-modal__user code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--text) 8%, transparent);
}

.chat-copy {
  border: 1px solid var(--ring-strong);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.chat-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.chat-modal__hint {
  color: var(--dimmed);
  font-size: 0.82rem;
  margin: 6px 0 0;
}

/* ============================================================
   Появление при скролле
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
  html {
    scroll-behavior: auto;
  }
}
