:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-light: #eef2ff;
  --accent: #f59e0b;
  --grad: linear-gradient(135deg, #6366f1, #8b5cf6 55%, #d946ef);
  --ink: #1e293b;
  --ink-soft: #475569;
  --ink-faint: #94a3b8;
  --bg: #f6f7fb;
  --bg-soft: #eef0f8;
  --card: #ffffff;
  --line: #e2e8f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 30px -14px rgba(79, 70, 229, 0.18);
  --shadow-lg: 0 4px 12px rgba(15, 23, 42, 0.06), 0 24px 60px -24px rgba(79, 70, 229, 0.3);
  --maxw: 1180px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --primary: #818cf8;
  --primary-dark: #a5b4fc;
  --primary-light: #312e81;
  --ink: #f1f5f9;
  --ink-soft: #cbd5e1;
  --ink-faint: #64748b;
  --bg: #0b1120;
  --bg-soft: #131c31;
  --card: #16203a;
  --line: #243049;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 36px -16px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3), 0 28px 70px -28px rgba(0, 0, 0, 0.7);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(139, 92, 246, 0.10), transparent 60%),
    radial-gradient(1000px 500px at -10% 0%, rgba(79, 70, 229, 0.10), transparent 60%),
    var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s ease, color 0.3s ease;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

img { max-width: 100%; display: block; }

.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ============ BARRA DE PROGRESO DE LECTURA ============ */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 4px;
  width: 0%;
  background: var(--grad);
  z-index: 999;
  border-radius: 0 4px 4px 0;
  transition: width 0.08s linear;
}

/* ============ HEADER ============ */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--card) 82%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 16px;
}

.logo {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--grad);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  box-shadow: 0 6px 16px -6px rgba(139, 92, 246, 0.6);
}

.nav-links {
  display: flex;
  gap: 4px;
  align-items: center;
}

.nav-links a {
  color: var(--ink-soft);
  font-weight: 600;
  font-size: 0.93rem;
  padding: 8px 13px;
  border-radius: 9px;
  transition: all 0.15s ease;
}

.nav-links a:hover { background: var(--primary-light); color: var(--primary); }

.nav-links a.active {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 8px 18px -8px rgba(124, 58, 237, 0.6);
}

.nav-cta {
  background: var(--grad);
  color: #fff !important;
  padding: 9px 18px !important;
  border-radius: 10px;
  font-weight: 700;
}
.nav-cta:hover { filter: brightness(1.1); color: #fff !important; }

.menu-toggle {
  display: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 9px;
  font-size: 1.2rem;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--ink);
}

/* Botón modo oscuro */
.theme-toggle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 1.05rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.theme-toggle:hover { background: var(--primary-light); color: var(--primary); transform: rotate(20deg); }

/* ============ AD SLOTS ============ */
.ad-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--card);
  border: 1.5px dashed rgba(99, 102, 241, 0.35);
  border-radius: var(--radius-sm);
  color: var(--ink);
  overflow: hidden;
  min-height: 90px;
  position: relative;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
}

.ad-slot:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.1);
}

.ad-slot .ad-tag {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px 20px;
  width: 100%;
}

.ad-slot .ad-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 12px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.ad-slot .ad-label::before {
  content: "✦";
  font-size: 0.68rem;
}

.ad-slot .ad-text {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.2px;
  text-transform: none;
}

.ad-slot .ad-size {
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-transform: none;
  font-weight: 500;
}

.ad-slot.ad-ready {
  background: transparent;
  border: none;
  min-height: 0;
  box-shadow: none;
}
.ad-slot.ad-ready .ad-tag { display: none; }

.ad-leaderboard { width: 100%; max-width: 728px; margin: 22px auto; }
.ad-infeed { width: 100%; margin: 16px 0; }
.ad-rect { width: 100%; max-width: 336px; min-height: 250px; margin: 16px auto; }
.ad-sidebar { width: 100%; max-width: 300px; min-height: 250px; margin: 16px auto; }
.ad-footer { width: 100%; max-width: 728px; margin: 26px auto; }

/* ============ HERO ============ */
.hero { padding: 48px 0 24px; position: relative; }

.hero-inner {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 44px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -2px;
  line-height: 1.1;
  margin-bottom: 16px;
}

.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 1.12rem;
  color: var(--ink-soft);
  margin-bottom: 28px;
  max-width: 540px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 20px;
  box-shadow: 0 10px 24px -10px rgba(124, 58, 237, 0.6);
}

.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--grad);
  color: #fff;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  font-size: 0.95rem;
  box-shadow: 0 10px 24px -10px rgba(124, 58, 237, 0.6);
}
.btn:hover { filter: brightness(1.08); transform: translateY(-2px); color: #fff; }

.btn-outline {
  background: var(--card);
  color: var(--primary);
  border: 1.5px solid var(--line);
  box-shadow: none;
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.hero-stats { display: flex; gap: 30px; margin-top: 32px; flex-wrap: wrap; }
.hero-stats .stat strong {
  font-size: 1.5rem;
  display: block;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-stats .stat span { color: var(--ink-faint); font-size: 0.85rem; }

.hero-art {
  background: var(--card);
  border-radius: 22px;
  padding: 28px;
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}
.hero-art::before {
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  background: radial-gradient(circle, rgba(139,92,246,0.18), transparent 65%);
  top: -110px; right: -80px;
  pointer-events: none;
}

.hero-art-card {
  background: var(--bg);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  transition: transform 0.2s ease;
}
.hero-art-card:hover { transform: translateX(4px); }
.hero-art-card .ic {
  width: 46px; height: 46px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.3rem;
  box-shadow: var(--shadow);
}
.hero-art-card h4 { font-size: 0.95rem; font-weight: 700; }
.hero-art-card p { font-size: 0.82rem; color: var(--ink-soft); }

/* ============ SECTION HEADER ============ */
.sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 40px 0 22px;
  gap: 12px;
  flex-wrap: wrap;
}
.sec-head h2 { font-size: 1.55rem; font-weight: 800; letter-spacing: -0.5px; }
.sec-head .link-all { font-weight: 700; font-size: 0.9rem; }

/* ============ CARDS / GRID ============ */
.grid { display: grid; gap: 24px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
  display: flex;
  flex-direction: column;
  animation: fadeUp 0.5s ease both;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }

.card-thumb {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #c7d2fe, #fbcfe8);
  position: relative;
  overflow: hidden;
}
.card-thumb .ph {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
}
.card-thumb img { transition: transform 0.4s ease; }
.card:hover .card-thumb img { transform: scale(1.08); }

.card-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.cat-tag {
  align-self: flex-start;
  background: var(--primary-light);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 11px;
  border-radius: 999px;
}

.card-body h3 { font-size: 1.04rem; font-weight: 800; line-height: 1.35; letter-spacing: -0.2px; }
.card-body h3 a { color: var(--ink); }
.card-body h3 a:hover { color: var(--primary); }
.card-body p { font-size: 0.9rem; color: var(--ink-soft); flex: 1; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: auto;
}
.card-meta .avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--grad);
  color: #fff; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; flex-shrink: 0;
}

/* Destacado */
.card-featured { position: relative; }
.card-featured .card-thumb { aspect-ratio: 16 / 7; }
.card-featured .cat-tag {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(124,58,237,.6);
}

/* ============ TENDENCIAS ============ */
.trend-num {
  font-size: 2.2rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ============ NEWSLETTER ============ */
.newsletter {
  margin: 48px 0;
  background: var(--grad);
  border-radius: 20px;
  padding: 44px;
  color: #fff;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 60px -24px rgba(124, 58, 237, 0.6);
}
.newsletter::before, .newsletter::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  animation: float 7s ease-in-out infinite;
}
.newsletter::before { width: 340px; height: 340px; top: -160px; right: -90px; }
.newsletter::after { width: 220px; height: 220px; bottom: -120px; left: -60px; animation-delay: 2s; }

.newsletter h2 { font-size: 1.7rem; font-weight: 800; margin-bottom: 8px; position: relative; z-index: 1; }
.newsletter p { opacity: 0.9; margin-bottom: 22px; max-width: 520px; margin-left: auto; margin-right: auto; position: relative; z-index: 1; }

.newsletter form {
  display: flex;
  gap: 10px;
  max-width: 460px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
  flex-wrap: wrap;
  justify-content: center;
}

.newsletter input {
  flex: 1;
  min-width: 220px;
  padding: 13px 16px;
  border-radius: 12px;
  border: none;
  font-size: 0.95rem;
  outline: none;
}

.newsletter .btn { background: #fff; color: #6d28d9; box-shadow: none; }
.newsletter .btn:hover { background: #f5f3ff; }

.form-msg { font-size: 0.9rem; margin-top: 12px; min-height: 20px; position: relative; z-index: 1; }
.form-msg.ok { color: #a7f3d0; }
.form-msg.err { color: #fecaca; }

/* ============ FOOTER ============ */
.footer {
  margin-top: 60px;
  background: var(--card);
  color: var(--ink-soft);
  padding: 48px 0 24px;
  border-top: 1px solid var(--line);
}
[data-theme="dark"] .footer { background: #0a0f1e; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 32px; }
.footer h4 { color: var(--ink); font-size: 0.95rem; margin-bottom: 14px; }
.footer .logo { color: var(--ink); margin-bottom: 14px; }
.footer p { font-size: 0.88rem; color: var(--ink-faint); max-width: 320px; }
.footer a { color: var(--ink-soft); display: block; padding: 4px 0; font-size: 0.9rem; }
.footer a:hover { color: var(--primary); }
.footer-bottom {
  border-top: 1px solid var(--line);
  padding-top: 20px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--ink-faint);
}

/* ============ ARTICLE PAGE ============ */
.article { max-width: 760px; margin: 0 auto; padding: 40px 0; }

.article .breadcrumb { font-size: 0.85rem; color: var(--ink-faint); margin-bottom: 18px; }
.article .breadcrumb a { color: var(--ink-faint); }
.article h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -1px; line-height: 1.2; margin-bottom: 16px; }

.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.article-meta .avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; box-shadow: 0 8px 16px -8px rgba(124,58,237,.6);
}
.article-meta .who strong { display: block; font-size: 0.95rem; }
.article-meta .who span { font-size: 0.82rem; color: var(--ink-faint); }
.article-meta .readtime { margin-left: auto; background: var(--primary-light); color: var(--primary); font-size: 0.8rem; font-weight: 700; padding: 6px 12px; border-radius: 999px; }

.article-hero-img {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: linear-gradient(135deg, #c7d2fe, #fbcfe8);
  display: flex; align-items: center; justify-content: center;
  font-size: 4rem;
  margin-bottom: 24px;
  border: 1px solid var(--line);
}

.article-body { font-size: 1.06rem; color: var(--ink); }
.article-body p { margin-bottom: 18px; }
.article-body h2 { font-size: 1.5rem; font-weight: 800; margin: 32px 0 14px; letter-spacing: -0.5px; }
.article-body h3 { font-size: 1.2rem; font-weight: 800; margin: 26px 0 10px; }
.article-body ul, .article-body ol { margin: 0 0 18px 22px; }
.article-body li { margin-bottom: 8px; }
.article-body blockquote {
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  padding: 16px 20px;
  border-radius: 0 10px 10px 0;
  margin: 24px 0;
  font-style: italic;
  color: var(--ink-soft);
}
.article-body .callout {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 10px;
  padding: 16px 18px;
  margin: 22px 0;
  font-size: 0.98rem;
}
[data-theme="dark"] .article-body .callout { background: #262411; border-color: #575218; }

.article-share { display: flex; align-items: center; gap: 10px; margin: 32px 0; flex-wrap: wrap; }
.article-share .btn { padding: 10px 16px; font-size: 0.88rem; }

.tags { display: flex; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
.tags span {
  background: var(--bg-soft);
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
}

.related { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--line); }

/* ============ CATEGORY / MISC PAGES ============ */
.page-head { padding: 40px 0 10px; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); font-weight: 800; letter-spacing: -1px; }
.page-head p { color: var(--ink-soft); margin-top: 8px; max-width: 640px; }

.chips { display: flex; gap: 10px; flex-wrap: wrap; margin: 20px 0 8px; }
.chips a {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--ink-soft);
  transition: all 0.15s;
}
.chips a:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.chips a.active { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 18px -8px rgba(124,58,237,.6); }

.simple-page { max-width: 720px; margin: 0 auto; padding: 40px 0; }
.simple-page h1 { font-size: 2rem; font-weight: 800; margin-bottom: 16px; letter-spacing: -0.5px; }
.simple-page p { color: var(--ink-soft); margin-bottom: 14px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 700; font-size: 0.9rem; margin-bottom: 6px; }
.form-group input, .form-group textarea, .form-group select {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-family: var(--font);
  font-size: 0.95rem;
  outline: none;
  background: var(--card);
  color: var(--ink);
  transition: border-color 0.15s;
}
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary); }

/* ============ BACK TO TOP ============ */
.to-top {
  position: fixed;
  bottom: 22px;
  right: 22px;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--grad);
  color: #fff;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all 0.2s ease;
  z-index: 40;
}
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #6366f1, #a855f7); border-radius: 8px; }

/* ============ ANIMACIONES ============ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-18px) scale(1.05); }
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.45); }
  70% { box-shadow: 0 0 0 12px rgba(139, 92, 246, 0); }
}

.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ============ RESPONSIVE ============ */
@media (max-width: 920px) {
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .hero-inner { grid-template-columns: 1fr; gap: 28px; }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
  .menu-toggle { display: block; }
  .nav-links {
    position: fixed;
    top: 68px;
    left: 0;
    right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    padding: 16px 20px 22px;
    gap: 4px;
    display: none;
    box-shadow: var(--shadow-lg);
    z-index: 49;
  }
  .nav-links.open { display: flex; }
  .nav-links a { width: 100%; text-align: left; }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .hero { padding: 32px 0 16px; }
  .newsletter { padding: 28px 20px; }
  .footer-grid { grid-template-columns: 1fr; }
}
