/* Клуб 30lll — второй экран главной в виде журнала (js/feed.js).
   Компьютер (от 1100px): главная история — кадр 4:5 и подпись рядом, справа список всех записей.
   Планшет: кадр и подпись в две колонки, записи полосой ниже. Телефон: всё в столбик, записи полосой.
   Кадр истории стоит фиксированной пропорцией, поэтому смена истории не двигает страницу. */

/* снизу отступ даёт сама вешалка (.rail), сверху — такой же ритм */
.club { padding-block: clamp(48px, 5vw, 72px) 0; scroll-margin-top: var(--hdr); }
.club[hidden] { display: none; }
/* ссылки: зона касания 44 px, вёрстка не двигается */
.club__all, .club__go, .club__more .link { padding-block: 15px; margin-block: -15px; }
.club__all::after, .club__go::after, .club__more .link::after { bottom: 15px; }

.club__top { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 40px; flex-wrap: wrap; margin-bottom: clamp(18px, 2vw, 32px); }
.club__ttl { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.club__all { font-size: 12px; white-space: nowrap; }
.club__title { font: 600 clamp(36px, 4vw, 64px)/.9 var(--f-text); letter-spacing: -.045em; }

/* Фильтры: строка текста с числами, без кнопок-плашек */
.club__tabs { display: flex; gap: 4px 22px; flex-wrap: wrap; }
.club__tabs:empty { display: none; }
.club__tab { position: relative; padding: 14px 0; color: var(--muted); font: inherit; text-transform: inherit; transition: color .2s; }
.club__tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: 9px; height: 1.5px; background: currentColor; transform: scaleX(0); transform-origin: right; transition: transform .3s var(--ease); }
.club__tab:hover { color: var(--ink); }
.club__tab[aria-pressed="true"] { color: var(--ink); }
.club__tab[aria-pressed="true"]::after { transform: scaleX(1); transform-origin: left; }

.club__grid { display: grid; gap: 20px; }
.club__lead { display: grid; gap: 18px; align-items: start; min-width: 0; }

/* Кадр истории */
.club__media { position: relative; aspect-ratio: 4 / 5; overflow: hidden; background: var(--light); touch-action: pan-y; -webkit-user-select: none; user-select: none; }
.club__media.has-many { cursor: pointer; }
.club__fs { position: absolute; inset: 0; }
.club__f { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; }
.club__f.is-in { opacity: 0; transform: scale(1.025); transition: opacity .5s var(--ease), transform .9s var(--ease); }
.club__f.is-in.is-on { opacity: 1; transform: none; }
.club__type { display: grid; grid-template-rows: auto 1fr; padding: clamp(18px, 2.4vw, 32px); background: var(--ink); color: var(--white); }
.club__type .label { color: rgba(255, 255, 255, .6); }
.club__type .sign { align-self: center; justify-self: end; width: 60%; margin-right: 4%; transform: rotate(-17deg); }

/* Полоски кадров — как в историях */
.club__bars { position: absolute; left: 12px; right: 12px; top: 12px; z-index: 2; display: flex; gap: 4px; pointer-events: none; }
.club__bars:empty { display: none; }
.club__bars i { flex: 1; height: 2px; background: rgba(255, 255, 255, .42); box-shadow: 0 0 6px rgba(0, 0, 0, .18); transition: background .25s; }
.club__bars i.is-on { background: var(--white); }
.club__fnav { position: absolute; right: 12px; bottom: 12px; z-index: 2; display: flex; gap: 6px; }
.club__fnav[hidden] { display: none; }
.club__fnav button { width: 44px; height: 44px; display: grid; place-items: center; background: var(--white); color: var(--ink); font-size: 18px; transition: background .2s, color .2s; }
.club__fnav button:hover { background: var(--ink); color: var(--white); }
.club__fnav button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
/* без мыши кадры листаются свайпом и касанием по краю — стрелки не закрывают одежду */
@media (hover: none) { .club__fnav { display: none; } }

/* Подпись истории */
.club__info { display: flex; flex-direction: column; gap: 14px; min-width: 0; align-self: start; }
.club__info.is-in > * { animation: club-in .5s var(--ease) both; }
.club__info.is-in > :nth-child(2) { animation-delay: .04s; }
.club__info.is-in > :nth-child(n+3) { animation-delay: .08s; }
@keyframes club-in { from { opacity: 0; transform: translateY(8px); } }
.club__meta { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.club__h { font: 600 clamp(26px, 2.5vw, 40px)/1 var(--f-text); letter-spacing: -.035em; text-wrap: balance; }
.club__text { font-size: 15px; line-height: 1.55; color: #2a2a2a; max-width: 46ch; }
.club__facts { display: grid; margin: 0; border-top: 1px solid var(--line); font-size: 14px; }
.club__facts div { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.club__facts dt { font: 500 11px/1.6 var(--f-display); text-transform: uppercase; color: var(--muted); }
.club__facts dd { margin: 0; }
.club__until { font-variant-numeric: tabular-nums; }
.club__until:empty { display: none; }
.club__end { display: grid; gap: 18px; margin-top: clamp(6px, .8vw, 14px); }
.club__end .link { font-size: 13px; }

/* Остальные кадры записи */
.club__shots { display: none; gap: 10px; }
/* контактная полоска: всегда один ряд по 8 ячеек (кадров 4 или 8); активная — линия снизу */
.club__sl { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 4px; }
.club__sl button { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: var(--light); }
.club__sl button::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink); transform: scaleX(0); transition: transform .3s var(--ease); }
.club__sl button[aria-pressed="true"]::after { transform: none; }
.club__sl button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.club__sl img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
@media (hover: hover) { .club__sl button:hover img { transform: scale(1.06); } }
@media (min-width: 640px) { .club__shots { display: grid; } }

/* Вещи из записи */
.club__items { display: grid; gap: 10px; }
.club__items ul { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.club__items a { display: grid; gap: 4px; align-content: start; }
.club__ii { display: block; aspect-ratio: 1; background: var(--light); overflow: hidden; }
.club__ii img { width: 100%; height: 100%; object-fit: contain; transition: transform .5s var(--ease); }
.club__items a:hover .club__ii img { transform: translateY(-4px); }
.club__in { font-size: 12px; line-height: 1.3; color: var(--muted); overflow-wrap: break-word; }
.club__items .price { font-size: 12px; }

/* Список записей. На узких экранах — горизонтальная полоса */
.club__list { display: grid; grid-auto-flow: column; grid-auto-columns: 132px; gap: 10px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); scroll-padding-inline: var(--gutter); }
.club__list::-webkit-scrollbar { display: none; }
.club__list > li { scroll-snap-align: start; min-width: 0; }
.club__row { position: relative; display: grid; gap: 8px; width: 100%; text-align: left; align-content: start; }
.club__th { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--light); }
.club__th img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.club__tt { position: absolute; inset: 0; display: grid; place-items: center; background: var(--ink); color: var(--white); }
.club__tt .sign { width: 46%; transform: rotate(-17deg); }
.club__rt { display: grid; gap: 3px; min-width: 0; }
.club__rk { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 10px; font: 500 11px/1.25 var(--f-display); text-transform: uppercase; color: var(--muted); }
.club__rn { font-size: 14px; font-weight: 500; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.club__row[aria-selected="true"] .club__th { outline: 2px solid var(--ink); outline-offset: 2px; }
.club__row[aria-selected="true"] .club__rk { color: var(--ink); }
.club__row:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.club__more { display: grid; align-items: center; }
.club__more .link { justify-self: start; font-size: 12px; }
@media (hover: hover) {
  .club__row:hover .club__rn { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
  .club__row:hover .club__th img { transform: scale(1.05); }
}

/* Планшет: кадр и подпись рядом */
@media (min-width: 640px) {
  .club__lead { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 3vw, 36px); align-items: stretch; }
  .club__info { padding-top: 2px; }
  .club__list { grid-auto-columns: 150px; }
}

/* Компьютер: история (кадр + подпись) и колонка записей */
@media (min-width: 1100px) {
  .club__grid { grid-template-columns: minmax(0, 8.6fr) minmax(0, 4fr); gap: clamp(28px, 2.8vw, 48px); align-items: start; }
  .club__lead { grid-template-columns: minmax(0, 5fr) minmax(0, 3.6fr); }
  .club__media { max-height: calc(100vh - 280px); max-height: calc(100svh - 280px); min-height: 460px; width: 100%; }
  /* оглавление: до 7 строк и «Все записи», без внутренней прокрутки */
  .club__list {
    grid-auto-flow: row; grid-auto-columns: auto; align-content: start; gap: 0;
    margin: 0; padding: 0; overflow: visible; scroll-snap-type: none;
    border-top: 1px solid var(--ink);
  }
  .club__row { grid-template-columns: 48px minmax(0, 1fr); gap: 16px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
  /* выбранная строка «отступает» через transform: сдвигаются миниатюра, тип и название, дата и маркер стоят на месте */
  .club__row .club__th, .club__row .club__rn, .club__row .club__rk > :first-child { transition: transform .35s var(--ease); }
  .club__rn { max-width: calc(100% - 18px); }
  .club__row[aria-selected="true"] .club__th, .club__row[aria-selected="true"] .club__rn, .club__row[aria-selected="true"] .club__rk > :first-child { transform: translateX(18px); }
  .club__th { width: 48px; }
  .club__rn { -webkit-line-clamp: 1; font-size: 15px; }
  /* выбранная строка помечена квадратом слева, фокус клавиатуры — рамкой всей строки (не миниатюры) */
  .club__row[aria-selected="true"] .club__th, .club__row:focus-visible .club__th { outline: none; }
  .club__row:focus-visible { outline-offset: 3px; }
  .club__more { padding-top: 16px; }
  /* вещи: на компьютере три в ряд, подписи целиком */
  .club__items ul { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .club__items li:nth-child(n+4) { display: none; }
  .club__row[aria-selected="true"]::before { content: ""; position: absolute; left: 0; top: 50%; width: 8px; height: 8px; margin-top: -4px; background: var(--ink); }
  .club__row[aria-selected="true"] .club__rn { font-weight: 600; }
  .club__row:focus-visible .club__th { outline-offset: 2px; }
}

/* «Все записи» одна: на компьютере — строкой под оглавлением, на телефоне и планшете — в шапке блока */
@media (max-width: 1099px) {
  .club__list { align-items: start; }
  .club__more { display: none; }
}
@media (min-width: 1100px) {
  .club__all { display: none; }
}
@media (max-width: 639px) {
  .club__top { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .club__tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(-1 * var(--gutter)); padding-inline: var(--gutter); gap: 18px; }
  .club__tabs::-webkit-scrollbar { display: none; }
  .club__tab { white-space: nowrap; }
  .club__items ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .club__f.is-in { opacity: 1; transform: none; transition: none; }
  .club__info.is-in > * { animation: none; }
  .club__th img, .club__ii img, .club__tab::after, .club__row .club__th, .club__row .club__rn, .club__row .club__rk > :first-child { transition: none; }
}

/* Вешалка идёт сразу за клубом: тень «наезда» нужна только на стыке с роликом первого экрана */
.home .club + .rail { box-shadow: none; }

/* ---------- запись поверх страницы (/club и главная, postDialog в js/feed.js) ----------
   Компьютер — окно: кадр 4:5 слева, текст справа. Телефон — шторка снизу во весь экран. */
html.is-dlg { overflow: hidden; }
.cl-dlg {
  width: min(1240px, calc(100% - 64px)); max-width: none; height: min(880px, calc(100vh - 64px)); height: min(880px, calc(100dvh - 64px)); max-height: none;
  margin: auto; padding: 0; border: 0; background: var(--white); color: var(--ink); overflow: hidden;
}
.cl-dlg::backdrop { background: rgba(11, 11, 11, .62); }
.cl-dlg[open] { animation: cl-in .45s var(--ease); }
.cl-dlg[open]::backdrop { animation: cl-fade .35s ease; }
.cl-dlg.is-closing { animation: cl-out .26s ease forwards; }
.cl-dlg.is-closing::backdrop { animation: cl-fade .26s ease reverse forwards; }
@keyframes cl-in { from { opacity: 0; transform: translateY(24px); } }
@keyframes cl-out { to { opacity: 0; transform: translateY(16px); } }
@keyframes cl-fade { from { opacity: 0; } }
.cl-dlg__in { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); height: 100%; }
.cl-dlg__media.club__media { height: 100%; width: auto; aspect-ratio: 4 / 5; max-width: 58vw; max-height: none; min-height: 0; }
.cl-dlg__body { display: flex; flex-direction: column; gap: 16px; padding: clamp(24px, 3vw, 44px) clamp(20px, 3vw, 44px) 32px; overflow-y: auto; overscroll-behavior: contain; }
.cl-dlg__body > .club__meta { padding-right: 52px; }
.cl-dlg__h { font: 600 clamp(28px, 2.8vw, 46px)/1 var(--f-text); letter-spacing: -.04em; max-width: 20ch; text-wrap: balance; }
.cl-dlg__text { font-size: 16px; line-height: 1.6; color: #2a2a2a; max-width: 56ch; white-space: pre-line; }
.cl-dlg__body .club__facts { max-width: 480px; }
.cl-dlg__body .club__items ul { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cl-dlg__body .club__items li { display: block; }
.cl-dlg__body .club__go { margin-top: 4px; }
.cl-dlg__shots { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; max-width: 520px; }
.cl-dlg__shots button { position: relative; aspect-ratio: 3 / 4; overflow: hidden; background: var(--light); }
.cl-dlg__shots button::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--ink); transform: scaleX(0); transition: transform .3s var(--ease); }
.cl-dlg__shots button[aria-pressed="true"]::after { transform: none; }
.cl-dlg__shots button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.cl-dlg__shots img { width: 100%; height: 100%; object-fit: cover; }
.cl-dlg__nav { display: flex; justify-content: space-between; gap: 16px; margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.cl-dlg__nav a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; max-width: 48%; }
.cl-dlg__nav a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; font-family: var(--f-text); font-size: 14px; }
.cl-dlg__nav a:last-child { margin-left: auto; text-align: right; }
.cl-dlg__nav a:hover span { text-decoration: underline; text-underline-offset: 3px; }
.cl-dlg__x { position: absolute; right: 12px; top: 12px; z-index: 3; width: 44px; height: 44px; display: grid; place-items: center; background: var(--white); color: var(--ink); font-size: 20px; transition: background .2s, color .2s; }
.cl-dlg__x:hover { background: var(--ink); color: var(--white); }
.cl-dlg__x:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Телефон: шторка снизу во весь экран, кадр сверху, текст ниже, всё прокручивается вместе */
@media (max-width: 767px) {
  .cl-dlg { width: 100%; height: 100%; height: 100dvh; max-height: none; margin: 0; inset: 0; }
  .cl-dlg[open] { animation: cl-up .45s var(--ease); }
  .cl-dlg.is-closing { animation: cl-down .26s ease forwards; }
  @keyframes cl-up { from { transform: translateY(100%); } }
  @keyframes cl-down { to { transform: translateY(100%); } }
  .cl-dlg__in { display: block; overflow-y: auto; overscroll-behavior: contain; }
  .cl-dlg__media.club__media { width: 100%; height: auto; max-width: none; }
  .cl-dlg__body { overflow: visible; padding: 20px var(--gutter) calc(28px + env(safe-area-inset-bottom)); }
  .cl-dlg__body > .club__meta { padding-right: 0; }
  .cl-dlg__x { position: fixed; top: calc(10px + env(safe-area-inset-top)); right: 10px; }
  .cl-dlg__body .club__items ul { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .cl-dlg[open], .cl-dlg[open]::backdrop, .cl-dlg.is-closing, .cl-dlg.is-closing::backdrop { animation: none; }
  .cl-dlg__shots button::after { transition: none; }
}
