/* ── Feed page — Reddit structure + Instagram card aesthetic ── */
.feed-layout {
  max-width: 1060px;
  margin: 0 auto;
  padding: var(--sp-lg) var(--sp-lg) var(--sp-sec);
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--sp-lg);
  align-items: start;
}

/* ── Sort bar ── */
.sort-bar {
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: 10px var(--sp-md);
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-md);
}
.feed-count { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }

/* ── Meme card — Instagram post style with Reddit vote strip ── */
.meme-card {
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  overflow: hidden;
  display: flex;
  margin-bottom: var(--sp-md);
  transition: box-shadow 0.15s;
}
.meme-card:hover { box-shadow: 0 2px 16px rgba(0,0,0,0.08); border-color: transparent; }

/* Reddit-style left vote column */
.vote-strip {
  width: 44px;
  flex-shrink: 0;
  background: var(--surface-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--sp-md) 0 var(--sp-sm);
  gap: 3px;
  border-right: 1px solid var(--hairline);
}
.vote-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
  line-height: 1.2;
}
.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-full);
  color: var(--muted);
  transition: color 0.12s, background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.vote-btn:hover { background: var(--surface-strong); color: var(--vote-up); }
.vote-btn.upvoted { color: var(--coral); }

/* Card content */
.card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* Instagram-style user header */
.card-user-header {
  padding: var(--sp-sm) var(--sp-md);
  display: flex;
  align-items: center;
  gap: var(--sp-xs);
}
.card-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--r-full);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  /* Instagram gradient ring on avatar */
  background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366);
  padding: 2px;
  position: relative;
}
.card-avatar-inner {
  width: 100%;
  height: 100%;
  border-radius: var(--r-full);
  background: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  border: 2px solid var(--card-bg);
}
.card-user-info { flex: 1; min-width: 0; }
.card-username { font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.2; }
.card-time { font-size: 11px; color: var(--muted); }
.cat-chip {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--surface-strong);
  color: var(--muted);
  margin-left: auto;
  flex-shrink: 0;
}
.cat-chip.dank      { background: #ffe5dd; color: #cc3a1b; }
.cat-chip.gaming    { background: #dcf5e3; color: #1e6e30; }
.cat-chip.tech      { background: #ddeeff; color: #0055aa; }
.cat-chip.wholesome { background: #d5faf4; color: #0a7a60; }
.cat-chip.meta      { background: #e8e4ff; color: #5533cc; }
.cat-chip.classic   { background: var(--surface-strong); color: var(--muted); }

/* Full-bleed image — Instagram style */
.card-img-wrap {
  background: var(--surface-strong);
  overflow: hidden;
  cursor: pointer;
}
.card-img-wrap img {
  width: 100%;
  max-height: 540px;
  object-fit: contain;
  display: block;
  background: var(--surface-soft);
}

/* Caption area */
.card-caption-area {
  padding: var(--sp-xs) var(--sp-md) var(--sp-sm);
}
.card-title {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.4;
  cursor: pointer;
}
.card-title strong { font-weight: 700; }

/* Instagram-style action bar */
.meme-card-actions {
  padding: 2px var(--sp-xs) var(--sp-sm);
  display: flex;
  align-items: center;
  gap: 0;
}
.meme-card-actions .action-btn svg { width: 22px; height: 22px; }
.meme-card-actions .action-btn:first-child { padding-left: var(--sp-xs); }
.spacer { flex: 1; }

/* ── Sidebar ── */
.feed-sidebar { position: sticky; top: calc(54px + var(--sp-lg)); }

.sidebar-card {
  background: var(--card-bg);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: var(--sp-md);
}
.sidebar-banner {
  height: 72px;
  background: linear-gradient(135deg, #f09433 0%, #dc2743 50%, #bc1888 100%);
}
.sidebar-body { padding: var(--sp-md); }
.sidebar-avatar {
  width: 52px;
  height: 52px;
  border-radius: var(--r-full);
  background: linear-gradient(135deg, var(--primary), #7091E6);
  border: 3px solid var(--card-bg);
  margin-top: -26px;
  margin-bottom: var(--sp-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  font-style: italic;
}
.sidebar-title { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.sidebar-desc { font-size: 13px; color: var(--muted); line-height: 1.5; margin-bottom: var(--sp-md); }
.sidebar-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-xs);
  margin-bottom: var(--sp-md);
  padding-bottom: var(--sp-md);
  border-bottom: 1px solid var(--hairline);
}
.sidebar-stat-num { font-size: 17px; font-weight: 700; color: var(--ink); }
.sidebar-stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 1px; }
.sidebar-btn { width: 100%; justify-content: center; margin-bottom: var(--sp-xs); }

.sidebar-rules { list-style: none; }
.sidebar-rules li {
  padding: 9px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 13px;
  color: var(--body);
  display: flex;
  gap: var(--sp-sm);
  align-items: flex-start;
}
.sidebar-rules li:last-child { border-bottom: none; }
.rule-num { font-weight: 700; color: var(--ink); min-width: 18px; flex-shrink: 0; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 64px 0;
  color: var(--muted);
}
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--body); margin: var(--sp-md) 0 var(--sp-sm); }

/* ── Modal ── */
#memeModal .modal { max-width: 680px; }
.modal-img { width: 100%; max-height: 480px; object-fit: contain; background: var(--surface-soft); display: block; }
.modal-wrap { position: relative; }

/* ── Upload form ── */
#uploadModal .modal { max-width: 480px; }
label.field-label { font-size: 13px; font-weight: 600; color: var(--body); display: block; margin-bottom: 6px; }
.field-input {
  width: 100%;
  height: 42px;
  padding: 0 var(--sp-md);
  background: var(--surface-soft);
  border: 1.5px solid var(--hairline);
  border-radius: var(--r-md);
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  -webkit-appearance: none;
  transition: border-color 0.15s;
}
.field-input:focus { border-color: var(--primary); background: var(--card-bg); }

/* ── Responsive ── */
@media (max-width: 960px) {
  .feed-layout {
    grid-template-columns: 1fr;
    padding: var(--sp-md) var(--sp-md) var(--sp-sec);
  }
  .feed-sidebar { position: static; display: none; }
}
@media (max-width: 640px) {
  .feed-layout { padding: var(--sp-xs) var(--sp-xs) var(--sp-xxl); gap: var(--sp-xs); }
  .meme-card { border-radius: var(--r-lg); margin-bottom: var(--sp-xs); }
  .vote-strip { display: none; } /* on mobile, vote is in action bar instead */
  .sort-bar { border-radius: var(--r-lg); padding: 8px var(--sp-sm); flex-wrap: wrap; gap: 4px; }
}
