
/* ═══════════════════════════════════════════════════════════════
   THREE-COLUMN LAYOUT
   Left 28% | Center 40% | Right 32%
   ═══════════════════════════════════════════════════════════════ */
/* Skip link: первый Tab на странице ведёт к содержимому, а не в меню.
   Вне фокуса ссылка убрана за верхнюю границу, в фокусе — возвращается. */
.skip-link{
  position:fixed;left:var(--space-4);top:calc(-1 * var(--space-16));
  z-index:var(--z-toast);
  padding:var(--space-3) var(--space-5);
  border-radius:var(--radius-pill);
  background:var(--color-fg);color:var(--color-fg-inverse);
  font-weight:var(--weight-semibold);text-decoration:none;
  transition:top var(--duration-fast) var(--ease-standard);
}
.skip-link:focus{top:var(--space-4);}

/* ── Курсор кликабельных элементов ───────────────────────────────────────
   <button>, <summary> и <label> по умолчанию показывают обычную стрелку,
   хотя кликаются. Одно правило на весь сайт: новые кнопки и аккордеоны
   не должны терять палец. Отключённые элементы честно показывают запрет. */
button,
summary,
label,
[role="button"]{cursor:pointer;}
button:disabled,
button[aria-disabled="true"],
[role="button"][aria-disabled="true"]{cursor:not-allowed;}
/* Лайк блокируется на время запроса, но курсор не должен показывать
   «запрещено»: это короткая техническая блокировка, а не недоступное действие. */
.profile-card-like:disabled,
.profile-card-like[aria-disabled="true"]{cursor:pointer;}

.app-layout{
  width:100%;min-height:100vh;
  margin:0; /* сайдбар прижат к левому краю, центрируется только контент */
  /* Контент виден сразу: без JS страница обязана оставаться читаемой
     (A11Y-01). Никакого скрытия прозрачностью до загрузки скриптов. */
}

/* ── LEFT SIDEBAR */
.sidebar-left{
  width:260px;max-width:260px;flex:0 0 260px;
  border-right:1px solid var(--border);
  display:flex;flex-direction:column;align-items:stretch;
  position:sticky;top:0;height:100vh;align-self:flex-start;
  /* Верхнего отступа нет намеренно: .sidebar-left-inner внутри ровно 100vh,
     и лишние 8px сверху делали колонку на 8px выше экрана — страница всегда
     получала вертикальную прокрутку даже с пустым содержимым. */
  padding:0 16px 8px 24px;
}
.sidebar-left-inner{
  /* Сайдбар не прокручивается: он стоит на месте, прокручивается только
     центральная колонка. Пунктов меню немного, поэтому всё влезает. */
  width:100%;display:flex;flex-direction:column;gap:8px;
  position:sticky;top:0;padding:8px 0 12px;
  height:100vh;overflow:hidden;
}

/* Logo */
/* Brand: a plain circle plus the wordmark (no borrowed social icon).
   Manrope 800 (latin subset, OFL) is self-hosted — no CDN. */
@font-face{
  font-family:'KruugWordmark';
  src:url("/static/fonts/unbounded-600.811b2e3fc69c.ttf") format('truetype');
  font-weight:600;font-style:normal;font-display:swap;
}
.sidebar-logo{
  display:flex;align-items:center;gap:10px;height:54px;
  padding:0 12px;border-radius:0;width:fit-content;
  color:var(--text);text-decoration:none;
  margin-left:0;
}
.sidebar-logo:hover{background:none;text-decoration:none;color:var(--text);}
.logo-mark{
  width:36px;height:36px;flex:0 0 36px;display:block;object-fit:contain;
}
.logo-word{
  font-family:'KruugWordmark',var(--font);
  font-size:var(--text-xl);font-weight:600;letter-spacing:-0.03em;line-height:1;
  color:var(--text);
}

/* Nav items */
.sidebar-nav{display:flex;flex-direction:column;gap:6px;width:100%;margin-top:8px;}
.sidebar-nav a{
  display:flex;align-items:center;gap:16px;font-size:var(--text-md);color:var(--text);
  padding:12px 16px;border-radius:var(--radius-full);font-weight:400;
  transition:background var(--t);text-decoration:none;white-space:nowrap;
  width:100%;border:none;
}
.sidebar-nav a:hover{background:var(--bg-hover);text-decoration:none;color:var(--text);}
/* Текущий раздел: aria-current, а не отдельный класс — состояние видно и
   скринридеру, и глазу, и не расходится с двумя копиями меню. */
.sidebar-nav a[aria-current="page"],
.mobile-menu .mobile-menu-item[aria-current="page"]{
  background:var(--bg-hover);font-weight:var(--weight-semibold);
}
.sidebar-nav a .nav-icon{width:var(--space-6);height:var(--space-6);flex-shrink:0;display:flex;align-items:center;justify-content:center;}
.sidebar-nav a .nav-icon svg{width:var(--space-6);height:var(--space-6);fill:currentColor;}

/* Nav label */
.sidebar-nav a .nav-label{display:none;}
@media(min-width:1000px){.sidebar-nav a .nav-label{display:inline;}}

/* Prominent CTA button */
.sidebar-cta{
  background:var(--text);color:var(--surface);font-weight:700;font-size:var(--text-base);
  padding:14px 0;border-radius:var(--radius-full);text-align:center;
  text-decoration:none;width:100%;
  transition:background-color var(--duration-instant) var(--ease-standard),
    color var(--duration-instant) var(--ease-standard),
    border-color var(--duration-instant) var(--ease-standard);
  display:inline-flex;align-items:center;justify-content:center;gap:var(--space-2);
  margin-top:var(--space-2);border:var(--border-width) solid transparent;
}
a.sidebar-cta,a.sidebar-cta:visited{color:var(--surface);}
a.sidebar-cta:hover{
  background:var(--surface);color:var(--text);border-color:var(--text);text-decoration:none;
}

/* User chip */
.sidebar-user{
  display:flex;align-items:center;gap:10px;padding:8px 14px;
  border:none;border-radius:var(--radius-full);cursor:pointer;
  transition:background var(--t);margin-top:auto;margin-bottom:6px;
  text-decoration:none;color:var(--text);width:100%;
}
.sidebar-user:hover{background:var(--bg-hover);text-decoration:none;color:var(--text);}
.sidebar-user-avatar{
  width:40px;height:40px;border-radius:var(--radius-md);
  background:var(--bg-input);flex-shrink:0;
  display:flex;align-items:center;justify-content:center;
  font-size:var(--text-md);color:var(--text-muted);overflow:hidden;
}
.sidebar-user-avatar img{width:100%;height:100%;object-fit:cover;}
.sidebar-user-info{display:flex;flex-direction:column;font-size:var(--text-sm);min-width:0;}
.sidebar-user-name{font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
.sidebar-user-email{color:var(--text-gray);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}

/* Logout link — sits under the user chip and matches the nav items above */
.sidebar-logout-form{display:block;margin:0 0 16px;}
button.sidebar-logout{
  display:flex;align-items:center;gap:16px;width:100%;
  padding:12px 16px;border-radius:var(--radius-full);
  background:none;border:none;cursor:pointer;text-align:left;
  font-family:var(--font);font-size:var(--text-md);font-weight:400;color:var(--text);
  transition:background var(--t),color var(--t);
}
button.sidebar-logout .nav-icon{
  width:var(--space-6);height:var(--space-6);flex-shrink:0;display:flex;align-items:center;justify-content:center;
}
button.sidebar-logout .nav-icon svg{
  width:var(--space-6);height:var(--space-6);fill:currentColor;
}
button.sidebar-logout .nav-label{display:none;}
@media(min-width:1000px){button.sidebar-logout .nav-label{display:inline;}}
button.sidebar-logout:hover{background:var(--bg-hover);color:var(--danger);}

/* ── CENTER COLUMN */
.feed{
  flex:1 1 auto;min-width:0;margin:0;
  /* Никакого perspective: он делает .feed containing block для
     position:fixed, и тосты/меню уезжают внутрь ленты. */
}

/* Раскладка: сайдбар слева на всю высоту, справа сверху шапка, под ней центр.
   Шапка — тот же блок .app-layout, что и сайдбар, но вне .feed: при переходах
   htmx её не перерисовывает. */
.app-layout{
  display:grid;
  grid-template-columns:260px minmax(0,1fr);
  grid-template-rows:auto 1fr;
}
.app-layout .sidebar-left{grid-column:1;grid-row:1 / span 2;align-self:start;}
.app-layout .feed-header{grid-column:2;grid-row:1;}
.app-layout .feed{grid-column:2;grid-row:2;}

/* ── Полоса фильтров под шапкой: город, организация, тип ─────────────── */
.filters-bar{
  display:flex;align-items:center;gap:var(--space-3);
  padding:var(--space-3) var(--layout-gutter);
  background:var(--color-surface);
  border-bottom:var(--border-default);
}
.filters-bar .city-picker{
  flex:1 1 0;min-width:0;
  background:var(--color-surface-subtle);
  border-radius:var(--radius-pill);
}
.filters-bar .city-picker__summary{height:var(--space-10);}
.filters-bar .city-picker__menu{border-radius:var(--radius-lg);}
@media (max-width:1000px){
  /* На телефоне эти же пикеры живут в бургер-меню. */
  .filters-bar{display:none;}
}
.feed-content{max-width:980px;margin:0;width:100%;}
.app-layout--wide .feed-content{max-width:none;margin:0;}

/* Center top bar */
.feed-header{
  position:sticky;top:0;z-index:var(--z-toast);min-height:54px;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  background:var(--surface);
  border-bottom:1px solid var(--border);
  padding:12px 16px;
}
.feed-header h1{font-size:var(--text-lg);font-weight:700;margin:0;align-self:flex-end;line-height:1.1;padding-bottom:2px;}
/* Кнопка нужна только на телефоне: на десктопе CTA живёт в сайдбаре. */
.feed-header-cta{display:none;}

/* Tabs / sub-nav */
.feed-tabs{display:flex;border-bottom:1px solid var(--border);}
.feed-tabs a{
  flex:1;text-align:center;padding:16px 0;font-weight:500;font-size:var(--text-base);
  color:var(--text-gray);text-decoration:none;position:relative;
  transition:background var(--t);
}
.feed-tabs a:hover{background:var(--bg-hover-light);}
.feed-tabs a.active{color:var(--text);font-weight:600;}
.feed-tabs a.active::after{
  content:'';position:absolute;bottom:0;left:50%;transform:translateX(-50%);
  width:56px;height:4px;background:var(--accent);border-radius:var(--radius-xs);
}

/* ═══════════════════════════════════════════════════════════════
   TOASTS — уведомление о действии.
   Белая карточка, иконка состояния, текст, закрытие и таймер.
   ═══════════════════════════════════════════════════════════════ */
.toast-stack{
  position:fixed;left:50%;bottom:var(--space-5);z-index:var(--z-toast);
  transition:bottom var(--duration-base) var(--ease-standard);
  transform:translateX(-50%);
  display:flex;flex-direction:column;align-items:center;gap:var(--space-2);
  width:min(92vw,520px);pointer-events:none;
}
.toast{
  position:relative;pointer-events:auto;overflow:hidden;
  display:grid;grid-template-columns:auto minmax(0,1fr) auto;align-items:center;
  gap:var(--space-3);width:100%;padding:var(--space-3);
  border:var(--border-default);border-radius:var(--radius-lg);
  background:var(--color-surface);box-shadow:var(--shadow-lg);
  font-size:var(--text-sm);color:var(--color-fg);
  opacity:0;transform:translateY(var(--space-3)) scale(0.98);
  transition:opacity var(--duration-fast) var(--ease-standard),
    transform var(--duration-fast) var(--ease-standard);
}
.toast.is-visible{opacity:1;transform:none;}
.toast.is-leaving{opacity:0;transform:translateY(var(--space-2)) scale(0.98);}
.toast__icon{
  display:grid;place-items:center;width:var(--space-8);height:var(--space-8);
  border-radius:var(--radius-pill);
  background:var(--color-surface-muted);color:var(--color-fg-secondary);
}
.toast__icon .icon{width:var(--space-4);height:var(--space-4);}
.toast__text{
  padding-block:var(--space-1);font-weight:var(--weight-semibold);
  line-height:var(--leading-snug);
}
.toast__close{
  display:grid;place-items:center;width:var(--space-8);height:var(--space-8);
  border:0;border-radius:var(--radius-pill);background:transparent;
  color:var(--color-fg-secondary);cursor:pointer;
  transition:background-color var(--duration-instant) var(--ease-standard),
    color var(--duration-instant) var(--ease-standard);
}
.toast__close:hover{background:var(--color-surface-hover);color:var(--color-fg);}
.toast__close .icon{width:var(--space-4);height:var(--space-4);}
.toast__progress{
  position:absolute;left:0;right:0;bottom:0;height:var(--space-1);
  background:var(--color-fg);transform-origin:left center;
  animation:toastTimer var(--duration-loop) linear forwards;
}
@keyframes toastTimer{from{transform:scaleX(1);}to{transform:scaleX(0);}}
.toast-success .toast__icon{background:var(--color-success-bg);color:var(--color-success);}
.toast-success .toast__progress{background:var(--color-success);}
.toast-error .toast__icon{background:var(--color-danger-bg);color:var(--color-danger);}
.toast-error .toast__progress{background:var(--color-danger);}
.toast-warning .toast__icon{background:var(--color-warning-bg);color:var(--color-warning);}
.toast-warning .toast__progress{background:var(--color-warning);}
.toast-info .toast__icon{background:var(--color-info-bg);color:var(--color-accent);}
.toast-info .toast__progress{background:var(--color-accent);}
/* Пока висит информационная плашка cookie, уведомления встают над ней. */
body.has-cookie-notice .toast-stack{bottom:calc(var(--space-5) + var(--space-16) + var(--space-4));}
@media (max-width:760px){
  .toast-stack{bottom:var(--space-3);width:calc(100vw - var(--space-6));}
  body.has-cookie-notice .toast-stack{bottom:calc(var(--space-3) + var(--space-16) + var(--space-6));}
}

/* ═══════════════════════════════════════════════════════════════
   PROFILE CARDS — glass + 3D tilt + multi-layer shadows
   ═══════════════════════════════════════════════════════════════ */

/* При подмене центра htmx прокручивает сам целевой блок в вид
   (scrollIntoView). Без отступа это уводит страницу вниз на высоту шапки —
   контент «сам листается» под неё. scroll-margin делает такую прокрутку
   нулевой: блок и так стоит сразу под шапкой. */
#main-feed{overflow-anchor:none;scroll-margin-top:75px;}

/* Breathing room between the sticky header and the first card */
#club-list{padding-top:10px;position:relative;}
#club-list-spinner{position:absolute;top:8px;right:12px;z-index:var(--z-raised);pointer-events:none;}

/* Карточка клуба — та же форма, что у карточки события: обложка сверху,
   заголовок и текст под ней, действия внизу. */
.profile-card{
  /* В лентах контейнер задаёт cursor:grab для прокрутки, но сама карточка —
     ссылка: палец важнее, drag остаётся на пустом месте ленты. */
  cursor:pointer;
  display:flex;flex-direction:column;padding:0;height:100%;
  text-decoration:none;color:var(--text);
  background:var(--color-surface);border:var(--border-default);
  box-shadow:var(--shadow-sm);
  transition:box-shadow var(--duration-base) var(--ease-standard),
    border-color var(--duration-base) var(--ease-standard);
  border-radius:var(--radius-xl);
  margin:0;
  position:relative;overflow:hidden;
}
.profile-card:hover{
  background:var(--color-surface);
  border-color:var(--color-border-strong);
  box-shadow:var(--shadow-md);
  text-decoration:none;color:var(--text);
}

.profile-card-cover{
  position:relative;display:flex;align-items:center;justify-content:center;
  width:100%;flex:0 0 auto;aspect-ratio:16/9;
  background:linear-gradient(135deg,var(--bg-card),var(--color-surface-muted));
  overflow:hidden;
}
.profile-card-cover img{
  width:100%;height:100%;object-fit:cover;display:block;
}
.profile-card-cover-letter{
  font-size:var(--text-2xl);font-weight:800;color:var(--text-muted);
}
/* Главный клуб раздела: золотая звезда в белом круге в правом верхнем углу. */
.profile-card-main-badge{
  position:absolute;top:10px;right:10px;z-index:var(--z-raised);
  display:grid;place-items:center;width:44px;height:44px;
  border-radius:50%;background:#fff;color:#f5b900;
  font-size:26px;font-weight:700;line-height:1;
  /* Свечение — только у самой звезды, белый круг остаётся чистым. */
  box-shadow:0 1px 3px rgba(0,0,0,.2);
}
.profile-card-main-badge-glyph{
  display:block;transform:translateY(2px);
}
/* Корона главного клуба вуза на мобильной карточке — размер как у звезды. */
.profile-card-main-badge--crown svg{
  width:24px;height:24px;fill:currentColor;
}
/* Главный клуб вуза: корона в белом круге, крупнее звёзд разделов. */
.org-main-club-crown{
  position:absolute;top:6px;right:12px;z-index:2;
  display:grid;place-items:center;width:60px;height:60px;
  border-radius:50%;background:#fff;color:#f5b900;
  box-shadow:0 1px 4px rgba(0,0,0,.2);
}
.org-main-club-crown svg{
  width:34px;height:34px;fill:currentColor;
}
.profile-card-event-date{
  position:absolute;top:10px;left:10px;z-index:var(--z-raised);
  display:inline-flex;align-items:center;gap:5px;
  padding:3px 10px;border:1px solid var(--color-fg);border-radius:var(--radius-pill);
  background:var(--surface);color:var(--color-ink);
  font-size:var(--text-xs);font-weight:700;white-space:nowrap;
}
.profile-card-event-label{font-weight:600;color:var(--color-ink);}

.profile-card-body{
  flex:1 1 auto;min-width:0;padding:14px 16px 16px;display:flex;flex-direction:column;
  /* Та же высота, что у тела карточки события: карточки клуба и события
     должны стоять в сетке одного размера. */
  min-height:137px;
}

.profile-card-title{
  /* Название клуба — всегда одна строка: по правилу оно не переносится. */
  font-size:var(--text-md);font-weight:700;line-height:1.25;letter-spacing:-0.01em;
  display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;
}
.profile-card-title:hover{text-decoration:none;}
.profile-card-slug{color:var(--text-gray);font-size:0.875rem;margin-left:4px;}

/* Whole-card link: the title carries the href and its ::after stretches
   over the card, so the card stays clickable while the club-site link below
   remains a real, separately clickable <a> (nested <a> is invalid HTML). */
.profile-card-link{color:inherit;text-decoration:none;}
.profile-card-link:hover{text-decoration:none;}
.profile-card-link::after{content:"";position:absolute;inset:0;z-index:var(--z-raised);}

/* Up to two lines; anything longer is clamped with an ellipsis. */
.profile-card-desc{
  /* Краткое описание — две строки без многоточия: предел длины задан моделью. */
  font-size:1rem;color:var(--text);margin:4px 0 8px;line-height:1.45;
  max-height:2.9em;overflow:hidden;white-space:normal;min-width:0;
}

/* Tags: a single line; the JS collapses overflow into a trailing "…" chip */
.profile-card-tags{display:flex;gap:6px;flex-wrap:nowrap;overflow:hidden;max-height:24px;margin-bottom:6px;min-width:0;}
.profile-card-tag{
  padding:2px 10px;background:var(--surface);color:var(--text);
  border:1px solid var(--text);border-radius:var(--radius-full);font-size:0.75rem;
  flex:0 0 auto;white-space:nowrap;
  transition:background var(--t);
}
.profile-card-tag:hover{background:var(--bg-hover-light);}
/* The nearest event is the filled date pill from the poster. */
.profile-card-tag.event-tag{background:var(--text);color:var(--surface);border-color:var(--text);font-weight:600;}
.profile-card-tag.event-tag:hover{background:var(--text);}
.profile-card-tag-more{font-weight:700;letter-spacing:1px;}

/* Bottom row: views on the left, the club-site link on the right */
.profile-card-footer{
  display:flex;align-items:center;gap:8px;width:100%;min-width:0;
  margin-top:auto;position:relative;z-index:var(--z-raised);
}
.profile-card-footer .profile-card-tags{flex:1 1 auto;min-width:0;margin-bottom:0;}
.profile-card-like-form{margin:0;display:flex;align-items:center;flex:0 0 auto;}
.profile-card-action{
  display:inline-flex;align-items:center;gap:4px;
  padding:6px 10px;border-radius:var(--radius-full);
  color:var(--text-gray);font-size:var(--text-sm);border:none;background:none;
  cursor:pointer;transition:background-color var(--duration-instant) var(--ease-standard),color var(--duration-instant) var(--ease-standard);text-decoration:none;
}
.profile-card-action:hover{color:var(--text);background:var(--bg-hover-light);text-decoration:none;}
.profile-card-action.disabled{opacity:0.35;pointer-events:none;}

/* The club site is the public page, so its entry point is framed rather
   than a plain text link: an outlined pill that inverts to a solid black
   button on hover. Class selectors outbid the global a:visited rule, so the
   label stays black before hover and white during it. */
.profile-card-like{color:var(--color-like);font-weight:var(--weight-bold);gap:7px;padding:4px 8px;}
.profile-card-like:hover{color:var(--color-like-hover);background:color-mix(in srgb,var(--color-like) 7%,transparent);}
.profile-card-like.is-liked{color:var(--color-like);}
.profile-card-like svg{
  width:20px;height:20px;flex:0 0 20px;
  fill:none;stroke:currentColor;stroke-width:2;stroke-linejoin:round;
  filter:drop-shadow(0 0 4px color-mix(in srgb,var(--color-like) 38%,transparent));
}
.profile-card-like.is-liked svg{fill:currentColor;}
.profile-card-like-count{
  font-variant-numeric:tabular-nums;font-size:var(--text-base);font-weight:700;color:var(--text);
}

/* Status badge */
.status-badge{
  display:inline-block;padding:2px 8px;border-radius:var(--radius-full);
  font-size:0.75rem;font-weight:500;margin-left:6px;
}
.status-hidden{background:var(--bg-input);color:var(--text-gray);}
.status-published{background:var(--success-bg);color:var(--color-success);}
.status-blocked{background:var(--danger-bg);color:var(--color-danger);}

/* ═══════════════════════════════════════════════════════════════
   DETAIL PAGE
   ═══════════════════════════════════════════════════════════════ */
.detail{padding:16px;}
.detail h1{font-size:var(--text-lg);margin:8px 0 16px;font-weight:700;}
.detail-section{margin:16px 0;}
.detail-section h2{font-size:var(--text-xs);font-weight:600;color:var(--text-gray);text-transform:uppercase;letter-spacing:0.03em;margin-bottom:6px;}
.detail-logo{max-width:160px;border-radius:var(--radius-xl);margin:12px 0;}
.detail-meta{margin-top:16px;padding-top:12px;border-top:1px solid var(--border);display:flex;gap:16px;font-size:var(--text-sm);color:var(--text-gray);}
.club-site-address{margin:0 0 12px;font-size:var(--text-sm);color:var(--text-gray);}
.club-site-address a{font-weight:600;color:var(--text);text-decoration:underline;text-underline-offset:3px;}
