/* ===================== СТРАНИЦА «КАТАЛОГ» ===================== */
/* Страницы листовки берутся из data/catalog.json (см. tools/build-catalog.py): здесь только оформление. */

.kat { background: var(--cream); }
.kat__head { padding-top: calc(var(--header-h) + 56px); padding-bottom: 72px; }
.kat__head .section__head { margin-bottom: 28px; }

/* город и срок действия */
.kat__bar { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-bottom: 34px; }
.kat__tabs { display: inline-flex; gap: 6px; padding: 5px; border-radius: 100px; background: #fff; border: 1px solid var(--border); box-shadow: 0 10px 26px rgba(10,60,35,.06); max-width: 100%; }
.kat__tab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-family: "Unbounded", sans-serif; font-weight: 500; font-size: clamp(12.3px, calc(11.64px + 0.207vw), 13.5px);
  color: var(--ink); padding: 11px 22px; border-radius: 100px; white-space: nowrap;
  transition: background .3s ease, color .3s ease;
  -webkit-tap-highlight-color: transparent;
}
.kat__tab.is-active { background: var(--green-dark); color: #fff; }
@media (hover: hover) { .kat__tab:not(.is-active):hover { background: rgba(46,159,107,.12); } }
.kat__tab:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.kat__meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 14px; min-height: 22px; font-size: 13.5px; font-weight: 300; color: var(--ink-soft); text-align: center; transition: opacity .3s ease; }
.kat__meta[hidden] { display: none; }
.kat__meta b { font-weight: 500; color: var(--ink); }
.kat__meta .is-ended { color: #b3402c; font-weight: 500; }
.kat__pdf { display: inline-flex; align-items: center; gap: 6px; color: var(--green-dark); font-weight: 500; }
.kat__pdf i { display: flex; font-size: 15px; }
@media (hover: hover) { .kat__pdf:hover { text-decoration: underline; } }

/* сетка страниц */
.kat__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 18px; transition: opacity .3s ease; }
.kat__grid.is-swap { opacity: 0; }
.kpage {
  position: relative; display: block; padding: 0; border: 1px solid var(--border); border-radius: 18px; background: #fff; overflow: hidden;
  cursor: pointer; text-align: left; box-shadow: 0 10px 24px rgba(10,60,35,.06);
  transition: transform .35s cubic-bezier(.22,.8,.3,1), box-shadow .35s ease;
  -webkit-tap-highlight-color: transparent;
}
.kpage__img { display: block; aspect-ratio: 2480 / 3508; background: linear-gradient(160deg, rgba(46,159,107,.10), rgba(46,159,107,.03)); }
.kpage__img img { display: block; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .45s ease; }
.kpage__img img.is-ready { opacity: 1; }
.kpage__n {
  position: absolute; left: 10px; bottom: 10px; min-width: 30px; height: 30px; padding: 0 10px; border-radius: 100px;
  display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 600; color: var(--green-dark);
  background: rgba(255,255,255,.94); box-shadow: 0 4px 12px rgba(10,60,35,.16);
}
.kpage__zoom {
  position: absolute; right: 10px; bottom: 10px; width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff; background: rgba(10,99,45,.88); opacity: 0; transform: scale(.85); transition: opacity .25s ease, transform .25s ease;
}
@media (hover: hover) and (pointer: fine) {
  .kpage:hover { transform: translateY(-5px); box-shadow: var(--shadow); }
  .kpage:hover .kpage__zoom { opacity: 1; transform: none; }
}
.kpage:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.kpage:active { transform: scale(.985); }
.kpage--sk { aspect-ratio: 2480 / 3508; cursor: default; background: linear-gradient(110deg, rgba(46,159,107,.08) 30%, rgba(46,159,107,.16) 50%, rgba(46,159,107,.08) 70%); background-size: 200% 100%; animation: katsk 1.3s linear infinite; box-shadow: none; }
@keyframes katsk { to { background-position: -200% 0; } }

/* появление карточек: волной, один раз */
.kpage.rv { opacity: 0; transform: translateY(22px); }
.kpage.rv.is-in { opacity: 1; transform: none; transition: opacity .7s cubic-bezier(.22,.8,.3,1) var(--rd, 0ms), transform .7s cubic-bezier(.22,.8,.3,1) var(--rd, 0ms), box-shadow .35s ease; }

.kat__err { text-align: center; color: var(--ink-soft); margin-top: 24px; }

/* ---- окно просмотра страницы ---- */
html:has(body.kat-lock) { scrollbar-gutter: stable; }
body.kat-lock { overflow: hidden; }
.kview { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity .32s ease, visibility .32s; }
.kview[hidden] { display: none; }
.kview.is-open { opacity: 1; visibility: visible; }
.kview__back { position: absolute; inset: -120px 0; background: rgba(8,20,14,.97); }
.kview__stage { position: absolute; inset: 0; padding: 68px 96px 120px; box-sizing: border-box; overflow: hidden; touch-action: none; display: flex; align-items: center; justify-content: center; cursor: zoom-in; }
.kview__stage.is-zoomed { cursor: grab; }
.kview__stage.is-drag { cursor: grabbing; }
.kview__img {
  display: block; max-width: 100%; max-height: 100%; width: auto; height: auto; border-radius: 6px; background: #fff;
  box-shadow: 0 24px 70px rgba(0,0,0,.5); user-select: none; -webkit-user-drag: none; transform-origin: 0 0; will-change: transform;
  opacity: 0; transition: opacity .3s ease;
}
.kview__img.is-ready { opacity: 1; }
.kview__top { position: absolute; top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; justify-content: center; padding-top: env(safe-area-inset-top); pointer-events: none; }
.kview__count { padding: 7px 16px; border-radius: 100px; background: rgba(255,255,255,.14); color: #fff; font-size: 13px; font-weight: 500; letter-spacing: .02em; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.kview__btn {
  appearance: none; border: 0; cursor: pointer; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.94); color: var(--green-dark); font-size: 24px; box-shadow: 0 6px 18px rgba(0,0,0,.3); pointer-events: auto;
  transition: transform .2s ease, background .2s ease, opacity .25s ease; -webkit-tap-highlight-color: transparent;
}
.kview__btn i { display: flex; }
.kview__btn:active { transform: scale(.92); }
@media (hover: hover) { .kview__btn:hover { background: #fff; transform: scale(1.06); } }
.kview__btn:disabled { opacity: .35; pointer-events: none; }
.kview__close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 14px; }
.kview__nav { position: absolute; top: 50%; margin-top: -22px; z-index: 2; }
.kview__nav--prev { left: 14px; }
.kview__nav--next { right: 14px; }
.kview__mnav { display: none; }
.kview__tools { position: absolute; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; gap: 10px; z-index: 2; }

@media (max-width: 800px) {
  .kat__head { padding-top: calc(var(--header-h) + 36px); padding-bottom: 56px; }
  .kat__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .kpage { border-radius: 14px; }
  .kpage__n { left: 8px; bottom: 8px; height: 26px; min-width: 26px; font-size: 12px; }
  .kat__tab { padding: 10px 16px; }
  .kat__bar { margin-bottom: 26px; }
  /* на телефоне стрелки переехали вниз, к кнопкам приближения: у краёв они закрывали бы страницу */
  .kview__nav { display: none; }
  .kview__mnav { display: flex; }
  /* страница центрируется в области между счётчиком и нижними кнопками: снизу оставлено место под ряд кнопок, поэтому ничто не залезает друг на друга */
  .kview__stage { inset: 56px 0 0 0; padding: 6px 0 calc(92px + env(safe-area-inset-bottom)); }
  .kview__tools { bottom: calc(20px + env(safe-area-inset-bottom)); }
  .kview__img { max-width: 100%; max-height: 100%; border-radius: 0; }
}
@media (max-width: 380px) { .kat__tab { padding: 10px 13px; letter-spacing: -.01em; } }
@media (prefers-reduced-motion: reduce) {
  .kpage, .kpage__img img, .kview, .kview__img, .kat__grid { transition: none; }
  .kpage.rv { opacity: 1; transform: none; }
  .kpage--sk { animation: none; }
}

/* низкий экран (телефон лёжа): кнопки справа внизу в углу, поля поменьше */
@media (max-height: 480px) and (max-width: 960px) { .kview__stage { padding: 4px 70px calc(64px + env(safe-area-inset-bottom)); } .kview__tools { bottom: calc(10px + env(safe-area-inset-bottom)); } .kview__nav { display: flex; } .kview__mnav { display: none; } }
