/*
 * BWS 2.0 — community.html overrides & new components
 * Loads after streets.css; wins via cascade.
 */

/* ══════════════════════════════════════════════════════════════
   HEADING DROP ANIMATION
══════════════════════════════════════════════════════════════ */

@keyframes communityDropIn {
  0%   { opacity: 0; transform: translateY(-80px) scaleY(.92); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0) scaleY(1); }
}

.streets-hero h1 {
  animation: communityDropIn 4s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: .1s;
}

/* ══════════════════════════════════════════════════════════════
   QUICK-NAV BUTTON STAGGER (one-by-one cascade)
   First button duration = 2s, each subsequent = 0.2s shorter.
   Each start 0.2s after the previous → all complete at ~t=2.2s.
══════════════════════════════════════════════════════════════ */

@keyframes quickNavAppear {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.streets-quick-nav > * {
  opacity: 0;
  animation: quickNavAppear var(--qn-dur, .5s) ease both;
  animation-delay: var(--qn-del, 0s);
}

.streets-quick-nav > *:nth-child(1)  { --qn-dur: 2.0s; --qn-del: 0.0s; }
.streets-quick-nav > *:nth-child(2)  { --qn-dur: 1.8s; --qn-del: 0.2s; }
.streets-quick-nav > *:nth-child(3)  { --qn-dur: 1.6s; --qn-del: 0.4s; }
.streets-quick-nav > *:nth-child(4)  { --qn-dur: 1.4s; --qn-del: 0.6s; }
.streets-quick-nav > *:nth-child(5)  { --qn-dur: 1.2s; --qn-del: 0.8s; }
.streets-quick-nav > *:nth-child(6)  { --qn-dur: 1.0s; --qn-del: 1.0s; }
.streets-quick-nav > *:nth-child(7)  { --qn-dur: 0.8s; --qn-del: 1.2s; }
.streets-quick-nav > *:nth-child(8)  { --qn-dur: 0.6s; --qn-del: 1.4s; }
.streets-quick-nav > *:nth-child(9)  { --qn-dur: 0.4s; --qn-del: 1.6s; }
.streets-quick-nav > *:nth-child(n+10) { --qn-dur: 0.4s; --qn-del: 1.8s; }

/* ══════════════════════════════════════════════════════════════
   THREAD RAIL — FIXED TO BOTTOM
══════════════════════════════════════════════════════════════ */

.thread-rail {
  position: fixed !important;
  top: auto !important;
  bottom: 0 !important;
  left: 0;
  right: 0;
  z-index: 90;
  justify-content: space-between;
  border-top: 1px solid rgba(200,137,42,.24);
  border-bottom: none;
  background: rgba(6,2,0,.96);
  backdrop-filter: blur(16px);
}

/* Give the page enough bottom clearance so the rail doesn't hide content */
.streets-shell {
  padding-bottom: 72px;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Actions group: View Threads + New Thread */
.thread-rail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.thread-rail-view-btn {
  flex-shrink: 0;
  background: transparent;
  color: var(--amber, #c8892a);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  padding: 8px 16px;
  border: 1px solid rgba(200,137,42,.4);
  border-radius: var(--radius-pill, 999px);
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.thread-rail-view-btn:hover,
.thread-rail-view-btn.is-active {
  background: rgba(200,137,42,.15);
  color: #fde48a;
}

/* ══════════════════════════════════════════════════════════════
   THREAD DRAWER
   Slides in from the left; main shell pushes right.
══════════════════════════════════════════════════════════════ */

:root { --drawer-w: min(480px, 90vw); }

.thread-drawer {
  position: fixed;
  inset: 0;
  bottom: 52px; /* above thread rail */
  z-index: 200;
  pointer-events: none;
}

.thread-drawer-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  opacity: 0;
  transition: opacity .35s;
}

.thread-drawer-panel {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--drawer-w);
  background: #0c0500;
  border-right: 1px solid rgba(200,137,42,.28);
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform .35s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
  z-index: 1;
}

/* Open state */
.thread-drawer.is-open {
  pointer-events: all;
}
.thread-drawer.is-open .thread-drawer-overlay {
  opacity: 1;
}
.thread-drawer.is-open .thread-drawer-panel {
  transform: translateX(0);
}

/* Push main content right when drawer is open */
body.thread-drawer-open {
  overflow-x: hidden;
}
body.thread-drawer-open .streets-shell {
  transform: translateX(var(--drawer-w));
}

/* Drawer header */
.thread-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(200,137,42,.18);
  flex-shrink: 0;
  background: rgba(200,137,42,.06);
}

.thread-drawer-title {
  font: 700 13px var(--font-ui);
  color: var(--amber, #c8892a);
  letter-spacing: .08em;
  text-transform: uppercase;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-drawer-close {
  background: transparent;
  border: 1px solid rgba(200,137,42,.28);
  border-radius: 50%;
  width: 28px; height: 28px;
  color: rgba(246,234,215,.6);
  font-size: 13px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background .15s, color .15s;
}
.thread-drawer-close:hover { background: rgba(200,137,42,.12); color: var(--amber); }

/* Drawer body / thread list */
.thread-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(200,137,42,.3) transparent;
}

@keyframes drawerSlideIn {
  from { opacity: 0; transform: translateX(-28px); }
  to   { opacity: 1; transform: translateX(0); }
}

.thread-drawer-list {
  display: grid;
  gap: 8px;
  animation: drawerSlideIn .3s ease both;
}

.thread-drawer-item {
  display: block;
  padding: 12px 14px;
  border: 1px solid rgba(200,137,42,.16);
  border-radius: 8px;
  background: rgba(255,255,255,.025);
  color: inherit;
  text-decoration: none;
  transition: background .15s, border-color .15s;
}
.thread-drawer-item:hover {
  background: rgba(200,137,42,.06);
  border-color: rgba(200,137,42,.36);
}
.thread-drawer-item-title {
  font: 700 13px var(--font-ui);
  color: #f6ead7;
  margin: 0 0 4px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.thread-drawer-item-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 11px;
  color: rgba(246,234,215,.42);
  font-family: var(--font-ui);
}
.thread-drawer-item-cat {
  color: var(--amber, #c8892a);
  font-weight: 700;
}
.thread-drawer-empty {
  color: rgba(246,234,215,.35);
  font-size: 13px;
  text-align: center;
  padding: 32px 0;
}

/* ══════════════════════════════════════════════════════════════
   HOT TOPICS — UNIFORM CARD SIZE
══════════════════════════════════════════════════════════════ */

.hot-topic-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  grid-auto-rows: minmax(240px, 280px) !important;
  gap: 14px !important;
}

/* Cancel the first-card span */
.hot-topic-grid .thread-card:first-child {
  grid-row: auto !important;
  grid-column: auto !important;
}

/* ══════════════════════════════════════════════════════════════
   SPONSORED / BOOSTED GROUPS GRID
══════════════════════════════════════════════════════════════ */

.streets-ad-slot--boosted {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, transparent 20%, rgba(8,3,1,.88) 80%),
    var(--boost-bg, linear-gradient(135deg, rgba(220,148,43,.25), rgba(0,0,0,.9)));
  background-size: cover;
  background-position: center;
}
.streets-ad-slot--boosted::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 30%, rgba(8,3,1,.92) 100%),
    var(--boost-img);
  background-size: cover;
  background-position: center;
  z-index: 0;
}
.streets-ad-slot--boosted > * { position: relative; z-index: 1; }
.streets-ad-slot--boosted .boost-badge {
  display: inline-block;
  font: 800 9px var(--font-ui);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #ffd680;
  background: rgba(200,137,42,.28);
  border: 1px solid rgba(200,137,42,.45);
  border-radius: 4px;
  padding: 3px 7px;
  margin-bottom: 6px;
}
.streets-ad-slot--boosted strong {
  font-size: 18px;
  line-height: 1.1;
  margin-top: 6px;
}
.streets-ad-slot--boosted p {
  color: rgba(246,234,215,.72);
  font-size: 13px;
  margin: 5px 0 0;
  line-height: 1.4;
}
.streets-ad-slot--boosted.is-top-boost strong { font-size: 22px; }

/* ══════════════════════════════════════════════════════════════
   MEETUP CARD — JOIN / APPLY BUTTON
══════════════════════════════════════════════════════════════ */

.meetup-join-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 16px;
  border-radius: 999px;
  font: 700 12px var(--font-ui);
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, background .15s;
  border: 1px solid var(--amber, #c8892a);
  background: var(--amber, #c8892a);
  color: #0a0500;
}
.meetup-join-btn:hover:not(:disabled) { opacity: .85; }
.meetup-join-btn:disabled { opacity: .55; cursor: default; }
.meetup-join-btn--apply {
  background: rgba(200,137,42,.14);
  border-color: rgba(200,137,42,.55);
  color: var(--amber, #c8892a);
}
.meetup-join-btn--member {
  background: rgba(93,219,138,.12);
  border-color: #5ddb8a;
  color: #5ddb8a;
}
.meetup-join-btn--pending {
  background: rgba(200,137,42,.1);
  border-color: rgba(200,137,42,.4);
  color: rgba(200,137,42,.8);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 760px) {
  :root { --drawer-w: 92vw; }

  .hot-topic-grid {
    grid-template-columns: 1fr !important;
    grid-auto-rows: minmax(200px, auto) !important;
  }
}
