:root {
  --bg: #0a0e17;
  --surface: #111827;
  --surface-2: #1a2332;
  --border: #1e293b;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --accent: #10b981; /* Green */
  --accent-gold: #f59e0b;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: 'SF Mono', 'Cascadia Code', 'Fira Code', monospace;
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- Header --- */
.site-header {
  padding: 40px 24px 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  background: radial-gradient(ellipse at top, rgba(16, 185, 129, 0.1), transparent 70%);
}

.header-inner {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

.back-link {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--accent);
}

/* --- Language Switch --- */
.lang-switch {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px;
}

.lang-switch button {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: all 0.2s;
}

.lang-switch button.active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.lang-switch button:hover:not(.active) {
  color: var(--text);
}

.logo {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.logo .dot {
  color: var(--accent);
}

.tagline {
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  letter-spacing: 0.05em;
}

/* --- Grid Layout --- */
.grid-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 32px 24px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
  flex: 1;
}

/* --- Meme Card --- */
.meme-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
  display: flex;
  flex-direction: column;
}

.meme-card:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  box-shadow: 0 10px 30px rgba(16, 185, 129, 0.15);
}

.card-image-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: #000;
  overflow: hidden;
}

.card-image-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-content {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.1);
  color: var(--accent);
  border: 1px solid rgba(16, 185, 129, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag.gold {
  background: rgba(245, 158, 11, 0.1);
  color: var(--accent-gold);
  border-color: rgba(245, 158, 11, 0.3);
}

.card-headline {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 14, 23, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px) scale(0.95);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.6);
}

.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}

.close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-btn:hover {
  background: var(--accent);
  color: #000;
}

.modal-image-wrap {
  width: 100%;
  background: #000;
  border-radius: 16px 16px 0 0;
  overflow: hidden;
}

.modal-image-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.modal-text-wrap {
  padding: 24px;
}

.modal-tags {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}

.modal-headline {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.3;
}

.modal-body {
  font-size: 0.95rem;
  color: var(--text-dim);
  line-height: 1.6;
}

/* --- Tombol Aksi Modal (Share & Source) --- */
.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  border: 1px solid transparent;
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* Tombol Copy Link */
.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.btn-secondary.copied {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent);
  border-color: var(--accent);
}

/* Tombol Source Link */
.btn-primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: #0ea371;
  border-color: #0ea371;
}

/* --- Footer --- */
footer {
  text-align: center;
  padding: 32px 24px;
  font-size: 0.75rem;
  color: var(--text-dim);
  border-top: 1px solid var(--border);
}

/* --- Responsive --- */
@media (max-width: 768px) {
  .header-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  
  .back-link, .lang-switch {
    position: static;
    transform: none;
    align-self: center;
  }

  .grid-container {
    grid-template-columns: 1fr;
    padding: 20px 16px;
  }

  .modal-overlay {
    padding: 16px;
    align-items: flex-end;
  }

  .modal-content {
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }

  .modal-overlay.active .modal-content {
    transform: translateY(0);
  }
}