/* ── Variables ────────────────────────────────────── */
:root {
  --sidebar-w: 240px;
  --header-h:  56px;
  --footer-h:  52px;
  --bg:        #1a1a1a;
  --sidebar-bg:#141414;
  --header-bg: #111111;
  --text:      #e4e4e7;
  --muted:     #9ca3af;
  --accent:    #e8536a;
  --border:    rgba(255,255,255,0.09);
  --trans:     0.25s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ── Header ────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
}

.hamburger {
  width: 26px;
  height: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.hamburger span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform var(--trans), opacity var(--trans);
  transform-origin: center;
}

.hamburger.is-open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.hamburger.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.is-open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

.logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.5px;
}

/* ── Layout ────────────────────────────────────────── */
.layout {
  display: flex;
  height: calc(100vh - var(--header-h) - var(--footer-h));
  position: relative;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  overflow: hidden;
  transition: width var(--trans);
}

.sidebar.collapsed { width: 0; }

.sidebar-inner {
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 22px 0 0;
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: var(--muted);
  padding: 0 18px 10px;
}

.category-list { list-style: none; flex: 1; }

.category-list li a {
  display: block;
  padding: 11px 18px;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: background var(--trans), color var(--trans), border-color var(--trans);
}

.category-list li a:hover { background: rgba(255,255,255,0.04); }

.category-list li.active a {
  color: var(--accent);
  border-left-color: var(--accent);
  background: rgba(232,83,106,0.07);
}

.ad-block {
  margin: 16px;
  height: 220px;
  border: 1px dashed rgba(255,255,255,0.1);
  border-radius: 8px;
  background: rgba(255,255,255,0.02);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.ad-block::before { content: "\1F4E2"; font-size: 24px; }

/* ── Mobile overlay ────────────────────────────────── */
.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 50;
  backdrop-filter: blur(3px);
}

.overlay.visible { display: block; }

/* ── Main content / Scroll Feed ────────────────────── */
#feed {
  flex: 1;
  min-width: 0;
  height: 100%;
}

.meme-slide {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

/* Card to keep memes uniform */
.meme-card {
  width: min(820px, 92%);
  max-width: 820px;
  height: min(78vh, 820px);
  background: linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0.008));
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.03);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.meme-media {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: rgba(255,255,255,0.005);
  border-radius: 8px;
}

.meme-media img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  transform: scale(0.995);
  transition: opacity 240ms ease, transform 260ms ease;
}

.meme-media img.is-loaded { opacity: 1; transform: scale(1); }

/* ── Footer ────────────────────────────────────────── */
.app-footer {
  height: var(--footer-h);
  background: var(--header-bg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
}

.footer-inner {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.footer-links { display: flex; gap: 20px; }

.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  transition: color var(--trans);
}

.footer-links a:hover { color: var(--text); }

.footer-copy {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* ── Mobile ────────────────────────────────────────── */
@media (max-width: 768px) {
  /* sidebar becomes fixed overlay */
  .sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    z-index: 60;
    width: var(--sidebar-w) !important;
    transform: translateX(-100%);
    transition: transform var(--trans);
  }

  .sidebar.mobile-open { transform: translateX(0); }

  .app-footer { height: auto; padding: 12px 16px; }

  .footer-inner {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
  }

  .footer-links { flex-wrap: wrap; justify-content: center; gap: 12px; }
}
