/* ================================================================
   Memento — Global Design System
   Tokens, reset, tipografía, navbar, buttons, toast, animations.
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Funnel+Display:wght@300;400;500;600;700;800&family=Funnel+Sans:wght@300;400;500;600;700;800&family=Anton&display=swap');

/* ── Design Tokens ──────────────────────────────────────────────── */
:root {
  /* Base colors */
  --bg:           #171B1E;
  --surface:      #13131a;
  --surface-up:   #1c1c27;

  /* Borders */
  --border:       rgba(255 255 255 / 0.08);
  --border-hover: rgba(255 255 255 / 0.18);

  /* Text */
  --text-1:  #f0f0f5;
  --text-2:  #8b8ba7;
  --text-3:  #4a4a6a;

  /* Accent & palette */
  --accent:       #50A4F8;
  --accent-glow:  rgba(80 164 248 / 0.25);
  --violet:       #8b5cf6;
  --violet-glow:  rgba(139 92 246 / 0.25);
  --danger:       #ef4444;
  --success:      #22c55e;
  --white:        #FFFFFF;
  --dark:         #2B2E33;

  /* Gradients */
  --grad-accent: linear-gradient(135deg, #50A4F8, #0e80f2);
  --grad-violet: linear-gradient(135deg, #8b5cf6, #6d28d9);
  --grad-hero:   linear-gradient(135deg, #f7c948 0%, #8b5cf6 100%);

  /* Glassmorphism */
  --glass: rgba(43 46 51 / 0.2);;
  --glass-card: rgba(19 19 26 / 0.65);

  /* Shadows */
  --shadow-sm:     0 2px 8px rgba(0 0 0 / 0.4);
  --shadow-md:     0 4px 24px rgba(0 0 0 / 0.5);
  --shadow-lg:     0 8px 48px rgba(0 0 0 / 0.7);
  --shadow-accent: 0 0 24px rgba(80 164 248 / 0.4);
  --shadow-violet: 0 0 24px rgba(139 92 246 / 0.4);

  /* Spacing */
  --s-1: 0.25rem; --s-2: 0.5rem;  --s-3: 0.75rem;
  --s-4: 1rem;    --s-6: 1.5rem;  --s-8: 2rem;
  --s-10: 2.5rem; --s-12: 3rem;   --s-16: 4rem;

  /* Radius */
  --r-sm:   6px;   --r-md:  12px;
  --r-lg:   16px;  --r-xl:  24px;
  --r-2xl:  32px;  --r-full: 9999px;

  /* Typography */
  --ff-ui: 'Funnel Sans', system-ui, sans-serif;
  --ff-ui-serif: 'Funnel Display', sans-serif;
  --ff-meme: 'Anton', 'Impact', 'Arial Black', sans-serif;

  /* Transitions */
  --ease-fast: 150ms ease;
  --ease-base: 250ms ease;
  --ease-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --nav-h: 64px;
  --max-w: 1320px;
}

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

html {
  color-scheme: dark;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background-color: var(--bg);
  color: var(--text-1);
  font-family: var(--ff-ui);
  line-height: 1.6;
  min-height: 100dvh;
}

img, video { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; color: inherit; }
input, textarea, select { font-family: inherit; }
ul, ol { list-style: none; }

/* ── Custom scrollbar ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--surface-up);
  border-radius: var(--r-full);
}
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Typography ─────────────────────────────────────────────────── */
h1, h2, h3, h4, h5 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-1);
}

/* ── Navbar ─────────────────────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  padding-inline: var(--s-8);
  gap: var(--s-6);
  background: var(--dark);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
}

.navbar__logo {
  font-family: var(--ff-ui-serif);
  font-weight: 600;
  font-size: 1.65rem;
  letter-spacing: 0.02em;
  color: var(--accent);
  /*background: var(--grad-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;*/
  flex-shrink: 0;
  transition: opacity var(--ease-fast), filter var(--ease-fast);
}
.navbar__logo:hover {
  opacity: 0.9;
  filter: brightness(1.1);
}

.navbar__nav {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-inline-start: auto;
}

.navbar__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.875rem;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  transition: color var(--ease-fast), background var(--ease-fast);
  white-space: nowrap;
}
.navbar__link:hover {
  color: var(--text-1);
  background: rgba(255 255 255 / 0.06);
}
.navbar__link--active { color: var(--accent); }

.navbar__link--cta {
  background: var(--grad-accent);
  color: var(--white);
  font-weight: 700;
  padding: var(--s-2) var(--s-4);
  border-radius: var(--r-md);
}
.navbar__link--cta:hover {
  box-shadow: var(--shadow-accent);
  transform: translateY(-1px);
  color: var(--white);
}

/* Favorites count badge */
.nav-fav-count {
  display: none;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding-inline: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: var(--r-full);
  line-height: 1;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: var(--s-3) var(--s-6);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-weight: 600;
  transition: all var(--ease-base);
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  line-height: 1.4;
}

.btn--primary {
  background: var(--grad-accent);
  color: var(--text-1);
  border-color: transparent;
}
.btn--primary:hover {
  box-shadow: var(--shadow-accent);
  transform: translateY(-2px);
}

.btn--secondary {
  background: var(--accent);
  color: var(--text-1);
  border-color: var(--border);
}
.btn--secondary:hover {
  background: rgba(255 255 255 / 0.08);
  border-color: var(--border-hover);
}

.btn--violet {
  background: var(--grad-violet);
  color: #fff;
  border-color: transparent;
}
.btn--violet:hover {
  box-shadow: var(--shadow-violet);
  transform: translateY(-2px);
}

.btn--ghost {
  color: var(--text-2);
  border-color: var(--border);
  background: transparent;
}
.btn--ghost:hover {
  color: var(--text-1);
  border-color: var(--border-hover);
  background: rgba(255 255 255 / 0.04);
}

.btn--danger {
  background: rgba(239 68 68 / 0.12);
  color: var(--danger);
  border-color: rgba(239 68 68 / 0.25);
}
.btn--danger:hover { background: rgba(239 68 68 / 0.22); }

.btn--icon {
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: var(--r-md);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Toast notifications ────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: var(--s-8);
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--surface-up);
  color: var(--text-1);
  border: 1px solid var(--border-hover);
  padding: 10px var(--s-6);
  border-radius: var(--r-full);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  transition: opacity var(--ease-base), transform var(--ease-base);
  pointer-events: none;
}
.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast--success { color: var(--success); border-color: rgba(34 197 94 / 0.3); }
.toast--error   { color: var(--danger);  border-color: rgba(239 68 68 / 0.3); }

/* ── Empty state ────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s-4);
  padding: var(--s-16) var(--s-4);
  text-align: center;
  width: 100%;
}
.empty-state__icon  { font-size: 3.5rem; line-height: 1; }
.empty-state__title { font-size: 1.3rem; font-weight: 700; }
.empty-state p      { color: var(--text-2); max-width: 280px; }

/* ── Spinner ────────────────────────────────────────────────────── */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

/* ── Animations ─────────────────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position:  600px 0; }
}

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

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.08); }
}

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

@keyframes heartPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ── Skeleton ───────────────────────────────────────────────────── */
.skeleton {
  border-radius: var(--r-md);
  background: linear-gradient(
    90deg,
    var(--surface)    20%,
    var(--surface-up) 50%,
    var(--surface)    80%
  );
  background-size: 1200px 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* ── Gradient text utility ──────────────────────────────────────── */
.grad-text {
  background: var(--grad-hero);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Container ──────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--s-6);
}

/* ── Utilities ──────────────────────────────────────────────────── */
.hidden { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Reduced motion ─────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Responsive navbar ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .navbar {
    padding-inline: var(--s-4);
    gap: var(--s-2);
  }
  .navbar__logo { font-size: 1.3rem; }
  .navbar__link {
    padding: var(--s-2);
    font-size: 0.8rem;
  }
  .navbar__link--cta {
    padding: var(--s-2) var(--s-3);
    font-size: 0.8rem;
  }
}

/* ── Lucide & Action Icons ──────────────────────────────────────── */
.nav-icon {
  width: 18px;
  height: 18px;
  stroke-width: 2.2px;
}

.action-icon {
  width: 16px;
  height: 16px;
  stroke-width: 2px;
  display: block;
}

/* ── Card actions (copy & favorite buttons in grids) ────────────── */
.card-actions {
  position: absolute;
  top: var(--s-2);
  right: var(--s-2);
  z-index: 3;
  display: flex;
  gap: var(--s-2);
  opacity: 0;
  transform: scale(0.85);
  transition: all var(--ease-base);
}

.meme-card:hover .card-actions,
.meme-card--favorite:hover .card-actions {
  opacity: 1;
  transform: scale(1);
}

/* Base style for card action buttons */
.btn-action {
  width: 34px;
  height: 34px;
  border-radius: var(--r-full);
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-1);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--ease-base);
  cursor: pointer;
}

.btn-action:hover {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.85);
  border-color: var(--text-1);
}

.btn-fav-card--active {
  background: rgba(239, 72, 72, 0.35) !important;
  border-color: rgba(239, 72, 72, 0.55) !important;
  color: #ef4444 !important;
}

.btn-fav-card--active:hover {
  background: rgba(239, 72, 72, 0.5) !important;
  border-color: #ef4444 !important;
}

.btn-fav-card--active svg {
  fill: currentColor;
}

/* Always show action buttons on mobile */
@media (max-width: 640px) {
  .card-actions {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Footer ─────────────────────────────────────────────────────── */
.footer {
  background: var(--dark);
  border-top: 1px solid var(--border);
  padding: var(--s-12) var(--s-8) var(--s-6);
  margin-top: auto;
  color: var(--text-2);
}

.footer-container {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--s-8);
}

.footer-left {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.footer-left .footer-logo {
  font-family: var(--ff-ui-serif);
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  font-size: 1.5rem;
  flex-shrink: 0;
  transition: opacity var(--ease-fast), filter var(--ease-fast);
}

.footer-left .footer-logo:hover {
  opacity: 0.9;
  filter: brightness(1.1);
}

.footer-social-section {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  margin-top: var(--s-2);
}

.footer-social-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-1);
}

.footer-social-links {
  display: flex;
  gap: var(--s-3);
}

.footer-social-link {
  color: var(--text-2);
  transition: color var(--ease-fast), transform var(--ease-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-social-link:hover {
  color: var(--accent);
  transform: translateY(-2px);
}

.footer-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s-4);
  justify-content: space-between;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: var(--s-8);
  font-size: 0.875rem;
}

.footer-links a {
  color: var(--text-1);
  transition: color var(--ease-fast);
  line-height: 1;
}

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

.footer-divider {
  color: var(--accent);
  user-select: none;
  font-size: 1.5rem;
  font-weight: 300;
}

.footer-copyright {
  width: 100%;
  border-top: 1px solid var(--text-1);
  padding-top: var(--s-6);
  margin-top: 0;
  font-size: 0.8rem;
  text-align: center;
  color: var(--text-1);
}

@media (max-width: 768px) {
  .footer-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  
  .footer-left {
    align-items: center;
  }
  
  .footer-right {
    align-items: center;
  }
  
  .footer-links {
    flex-wrap: wrap;
    justify-content: center;
  }
}
