:root {
  --bg-base: #0a0a0b;
  --bg-surface: #141416;
  --bg-elevated: #1a1a1d;
  --text-primary: #f5f5f6;
  --text-secondary: #b4b4b8;
  --text-muted: #6e6e73;
  --accent-primary: #118c44;
  --accent-secondary: #12a8a1;
  --border-light: #26262a;
  --border-medium: #33333a;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.6);
  --glow: 0 0 20px rgba(255, 107, 53, 0.15);
}

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

body {
  font-family: 'Epilogue', -apple-system, system-ui, sans-serif;
  background: radial-gradient(ellipse at top, #1a1a1d 0%, #0a0a0b 50%);
  background-attachment: fixed;
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.015;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' /%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' /%3E%3C/svg%3E");
  z-index: 9999;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header */
header {
  background: var(--bg-surface);
  border-bottom: 2px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  animation: slideDown 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-wrapper {
  position: relative;
}

.logo {
  width: 56px;
  height: 56px;
  background: linear-gradient(135deg, #118c44 0%, #118c44 100%);
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  font-style: italic;
  color: #0a0a0b;
  box-shadow: var(--shadow-md), var(--glow);
  transform: rotate(-3deg);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.logo:hover {
  transform: rotate(0deg) scale(1.05);
}

.brand-text h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  font-weight: 400;
  font-style: italic;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.brand-text p {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.header-actions {
  display: flex;
  gap: 12px;
  flex: 1;
  max-width: 600px;
}

.search-wrapper {
  position: relative;
  flex: 1;
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

#search {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 2px solid var(--border-light);
  border-radius: 12px;
  background: var(--bg-base);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  transition: all 0.3s ease;
}

#search:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 4px rgba(255, 107, 53, 0.1);
  background: var(--bg-surface);
}

.btn-primary {
  padding: 12px 24px;
  background: var(--accent-primary);
  color: white;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-sm);
  white-space: nowrap;
}

.btn-primary:hover {
  background: #11919a;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Controls Bar */
.controls-bar {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-light);
  padding: 16px 0;
  animation: fadeIn 0.8s ease 0.2s both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.controls-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 16px;
  border: 2px solid var(--border-medium);
  background: var(--bg-base);
  color: var(--text-secondary);
  border-radius: 24px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.filter-btn.active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.sort-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sort-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

select {
  padding: 8px 32px 8px 12px;
  border: 2px solid var(--border-medium);
  border-radius: 8px;
  background: var(--bg-base);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23b4b4b8' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

/* Main Content */
main {
  padding: 48px 0;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}

.feed-section {
  animation: fadeInUp 0.8s ease 0.3s both;
}

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

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--border-light);
}

.section-title {
  font-family: 'DM Serif Display', serif;
  font-size: 32px;
  font-style: italic;
  color: var(--text-primary);
}

.post-count {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-base);
  padding: 6px 14px;
  border-radius: 20px;
  border: 2px solid var(--border-light);
}

/* Feed Cards */
.feed {
  display: grid;
  gap: 24px;
}

.card {
  background: var(--bg-surface);
  border: 2px solid var(--border-light);
  border-radius: 16px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: cardEnter 0.5s ease both;
}

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

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--glow);
  border-color: var(--accent-primary);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.card-title {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  font-style: italic;
  margin-bottom: 8px;
}

.card-title a {
  color: var(--text-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

.card-title a:hover {
  color: var(--accent-primary);
}

.vote-widget {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 48px;
  background: var(--bg-base);
  border: 2px solid var(--border-light);
  border-radius: 12px;
  padding: 8px;
}

.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  transition: all 0.2s ease;
  line-height: 1;
}

.vote-btn:hover {
  color: var(--accent-primary);
  transform: scale(1.2);
}

.vote-btn.voted {
  color: var(--accent-primary);
}

.vote-count {
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary);
}

.card-description {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  margin-bottom: 16px;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  background: var(--bg-base);
  border: 2px solid var(--border-medium);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  transition: all 0.2s ease;
  cursor: pointer;
}

.tag:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: var(--bg-surface);
}

.tag::before {
  content: '#';
  opacity: 0.5;
  margin-right: 2px;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.author-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.author-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #118c44 0%, #12a8a1 100%);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #0a0a0b;
  font-size: 12px;
}

.author-name {
  font-weight: 600;
  color: var(--text-primary);
}

.post-date {
  font-size: 13px;
  color: var(--text-muted);
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 120px;
  animation: fadeInUp 0.8s ease 0.5s both;
}

.sidebar-section {
  background: var(--bg-surface);
  border: 2px solid var(--border-light);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
}

.sidebar-title {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  font-style: italic;
  margin-bottom: 16px;
  color: var(--text-primary);
}

.stats-grid {
  display: grid;
  gap: 12px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  padding: 12px;
  background: var(--bg-base);
  border-radius: 8px;
  border: 2px solid var(--border-light);
}

.stat-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}

.stat-value {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent-primary);
}

.popular-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cta-box {
  background: linear-gradient(135deg, #118c44 0%, #12a8a1 100%);
  color: #0a0a0b;
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  box-shadow: var(--glow);
}

.cta-box h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  font-style: italic;
  margin-bottom: 8px;
}

.cta-box p {
  font-size: 14px;
  margin-bottom: 16px;
  opacity: 0.9;
}

.btn-secondary {
  padding: 10px 20px;
  background: #0a0a0b;
  color: #118c44;
  border: 2px solid #0a0a0b;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-block;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-muted);
}

.empty-state-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 28px;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-state p {
  font-size: 15px;
}

.hidden {
  display: none;
}

/* Footer */
footer {
  background: var(--bg-surface);
  border-top: 2px solid var(--border-light);
  padding: 32px 0;
  margin-top: 80px;
}

.footer-content {
  background: var(--bg-base);
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

.footer-content code {
  background: var(--bg-base);
  padding: 2px 8px;
  border-radius: 4px;
  font-family: 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  color: var(--accent-primary);
}

/* Responsive */
@media (max-width: 1024px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: static;
  }
}

@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .header-actions {
    max-width: 100%;
  }
  
  .controls-content {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group,
  .sort-group {
    width: 100%;
    justify-content: center;
  }
  
  .card {
    padding: 20px;
  }
  
  .card-title {
    font-size: 20px;
  }
}

/* Loading Animation */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.spinner {
  width: 40px;
  height: 40px;
  margin: 0 auto 16px;
  border: 4px solid var(--border-light);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}
