/* КультФонд — календарь мероприятий.
   Подключается самой страницей static-pages/kalendar-konkursov.php.
   Цвета — из variables.css (--cf-*, --cf-cal-*). */

.cf-cal { overflow: clip; padding-bottom: 2rem; color: var(--cf-ink); }

/* ── Шапка и фильтр ─────────────────────────────────────── */
.cf-cal__header { margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.cf-cal__eyebrow { margin: 0 0 10px; color: var(--cf-event-type); font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; }
.cf-cal__title { margin: 0; color: var(--cf-heading); font-size: clamp(30px, 4vw, 52px); font-weight: 700; line-height: 1.08; letter-spacing: -1.2px; text-wrap: balance; }
.cf-cal__title span { white-space: nowrap; }
.cf-cal__filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; }
.cf-cal__chip { min-height: 36px; padding: 6px 18px; border: 1px solid var(--cf-chip-line); border-radius: 999px; background: var(--cf-chip-bg); color: var(--cf-chip-text); font-family: var(--cf-font); font-size: 14px; font-weight: 600; line-height: 1.2; cursor: pointer; transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s; }
.cf-cal__chip:hover { border-color: var(--cf-chip-hover-line); }
.cf-cal__chip:focus-visible { outline: 3px solid var(--cf-gold); outline-offset: 2px; }
.cf-cal__chip.is-active { border-color: var(--cf-blue-button-line); background: var(--cf-chip-active-bg); color: var(--cf-chip-active-text); box-shadow: var(--cf-blue-button-shadow); }
.cf-cal__empty { margin-left: auto; color: var(--cf-muted); font-size: 14px; }
.cf-cal__empty[hidden] { display: none; }

/* ── Месяц ──────────────────────────────────────────────── */
.cf-cal__month + .cf-cal__month { margin-top: clamp(2rem, 4vw, 3.25rem); }
.cf-cal__month-heading { margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--cf-cal-month-line); }
.cf-cal__month-heading h2 { margin: 0; color: var(--cf-heading); font-size: clamp(24px, 2.4vw, 34px); font-weight: 700; line-height: 1.1; letter-spacing: -.6px; }
.cf-cal__month-heading > span { color: var(--cf-event-type); font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; white-space: nowrap; }
.cf-cal .cf-cal__grid { --bs-gutter-x: 14px; --bs-gutter-y: 0; margin-top: 0; row-gap: 16px; }
.cf-cal .cf-cal__grid > * { margin-top: 0; }

/* ── Карточка ───────────────────────────────────────────── */
.cf-cal-event { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; overflow: hidden; border: 1px solid var(--cf-cal-card-line); border-radius: 14px; background: var(--cf-event-background); box-shadow: var(--cf-event-shadow); color: var(--cf-ink); transition: transform .25s, box-shadow .25s; }
.cf-cal-event:hover, .cf-cal-event:focus-within { transform: translateY(-3px); box-shadow: var(--cf-cal-card-hover-shadow); }
.cf-cal-event__media { position: relative; flex-shrink: 0; aspect-ratio: 425 / 180; overflow: hidden; background: var(--cf-event-art-background); }
.cf-cal-event__media img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.cf-cal-event:hover .cf-cal-event__media img { transform: scale(1.04); }
.cf-cal-event__date { position: absolute; top: 8px; left: 8px; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 52px; min-height: 52px; padding: 5px 8px; border: 1px solid var(--cf-event-badge-line); border-radius: 10px; background: var(--cf-cal-date-bg); color: var(--cf-white); text-align: center; box-shadow: 0 4px 12px rgba(5, 27, 80, .25); }
.cf-cal-event__date strong { font-size: 22px; font-weight: 700; line-height: 1; }
.cf-cal-event__date span { margin-top: 3px; color: var(--cf-cal-date-month); font-size: 11px; font-weight: 700; line-height: 1; letter-spacing: 1.5px; }
.cf-cal-event__badge { position: absolute; inset: auto 0 0 0; padding: 5px 8px; background: var(--cf-gold-gradient); color: var(--cf-cal-badge-text); font-size: 11px; font-weight: 700; line-height: 1.2; letter-spacing: 1px; text-align: center; text-transform: uppercase; }
.cf-cal-event__body { display: flex; flex-direction: column; flex: 1; gap: 8px; padding: 12px 12px 14px; text-align: center; }
.cf-cal-event__format { align-self: center; padding: 4px 11px; border-radius: 999px; font-size: 10px; font-weight: 700; line-height: 1.1; letter-spacing: 1px; text-transform: uppercase; }
.cf-cal-event__format--live { background: var(--cf-cal-pill-live-bg); color: var(--cf-cal-pill-live-text); }
.cf-cal-event__format--remote { background: var(--cf-cal-pill-remote-bg); color: var(--cf-cal-pill-remote-text); }
.cf-cal-event__name { display: flex; align-items: center; justify-content: center; min-height: 2.4em; margin: 0; font-size: clamp(15px, 1.1vw, 17px); font-weight: 700; line-height: 1.2; letter-spacing: -.2px; }
.cf-cal-event__name a { color: var(--cf-heading); text-decoration: none; }
.cf-cal-event__name a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.cf-cal-event__name a:focus-visible { outline: 3px solid var(--cf-gold); outline-offset: 4px; border-radius: 4px; }
.cf-cal-event__rule { display: block; width: 32px; height: 2px; margin-inline: auto; border-radius: 2px; background: var(--cf-gold-gradient); }
.cf-cal-event__full-name { margin: 0; color: var(--cf-muted); font-size: 12px; line-height: 1.35; text-wrap: pretty; }
.cf-cal-event__action { display: block; margin-top: auto; padding: 9px 10px; border: 1px solid var(--cf-chip-line); border-radius: 9px; background: var(--cf-paper); color: var(--cf-chip-text); font-size: 12px; font-weight: 700; letter-spacing: .6px; line-height: 1.2; text-transform: uppercase; transition: background-color .2s, color .2s, border-color .2s; }
.cf-cal-event:hover .cf-cal-event__action { border-color: var(--cf-blue-button-line); background: var(--cf-chip-active-bg); color: var(--cf-white); }

/* Идёт приём заявок — синяя карточка */
.cf-cal-event--active { border-color: var(--cf-blue-button-line); background: var(--cf-cal-active-bg); color: var(--cf-cal-active-text); }
.cf-cal .cf-cal-event--active .cf-cal-event__name, .cf-cal .cf-cal-event--active .cf-cal-event__name a, .cf-cal .cf-cal-event--active .cf-cal-event__name a:hover, .cf-cal .cf-cal-event--active .cf-cal-event__name a:focus-visible { color: var(--cf-cal-active-text) !important; }
.cf-cal-event--active .cf-cal-event__full-name { color: var(--cf-cal-active-muted); }
.cf-cal-event--active .cf-cal-event__action { border-color: var(--cf-gold-button-line); background: var(--cf-gold-gradient); color: var(--cf-cal-badge-text); box-shadow: var(--cf-gold-button-shadow); }
.cf-cal-event--active:hover .cf-cal-event__action { background: var(--cf-gold-button-hover); color: var(--cf-cal-badge-text); border-color: var(--cf-gold-button-line); }

/* ── Фильтрация: плавное скрытие ────────────────────────── */
.cf-cal__grid > [data-type], .cf-cal__month { transition: opacity .3s ease, transform .3s ease; }
.cf-cal__grid > [data-type].is-hiding { opacity: 0; transform: scale(.96); pointer-events: none; }
.cf-cal__month.is-hiding { opacity: 0; }
.cf-cal__grid > [data-type].is-hidden, .cf-cal__month.is-hidden { display: none !important; }

/* ── Телефон: горизонтальная лента ──────────────────────── */
@media (max-width: 767.98px) {
  .cf-cal__month-heading { align-items: flex-start !important; flex-direction: column; gap: 4px !important; }
  .cf-cal__grid { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 8px; }
  .cf-cal__grid::-webkit-scrollbar { display: none; }
  .cf-cal__grid > [data-type] { flex: 0 0 78%; max-width: 78%; scroll-snap-align: start; }
  .cf-cal__empty { width: 100%; margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cf-cal__grid > [data-type], .cf-cal__month, .cf-cal-event, .cf-cal-event__media img, .cf-cal__chip { transition: none !important; }
  .cf-cal-event:hover, .cf-cal-event:focus-within { transform: none; }
  .cf-cal-event:hover .cf-cal-event__media img { transform: none; }
}
