/*
Theme Name: AllTeslas
Theme URI: https://x.com/AllTeslas
Author: AllTeslas
Description: Tema oscuro en grises para noticias Tesla. Compatible con Jetpack. Secciones NEWS, SOFTWARE y REFERRALS.
Version: 1.1.3
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 7.4
Text Domain: allteslas
*/

:root {
  --bg: #09090B;
  --surface: #141416;
  --surface-2: #1A1A1D;
  --surface-3: #222226;
  --line: #2A2A2E;
  --line-soft: #1F1F23;
  --text: #F4F4F5;
  --text-dim: #A1A1AA;
  --text-muted: #71717A;
  --accent: #D4D4D8;
  --accent-dim: #52525B;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-full: 999px;
  --shadow: 0 8px 30px rgba(0,0,0,0.35);
  --max: 1120px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .wordmark, .stat-num {
  font-family: 'Space Grotesk', system-ui, sans-serif;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; display: block; }
button { font-family: inherit; border: none; background: none; cursor: pointer; color: inherit; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  gap: 24px;
}

.wordmark {
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  transition: opacity 0.2s var(--ease);
}
.wordmark:hover { opacity: 0.85; }
.wordmark .logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  gap: 4px;
}
.main-nav a {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.04em;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a.active,
.main-nav .current-menu-item > a {
  color: var(--text);
  background: var(--surface-3);
}

.follow-btn {
  background: var(--accent);
  color: #09090B;
  font-weight: 600;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background 0.2s var(--ease), transform 0.15s var(--ease);
  flex-shrink: 0;
  display: inline-block;
}
.follow-btn:hover { background: #fff; color: #09090B; }
.follow-btn:active { transform: scale(0.97); }

/* Hero */
.hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 24px 36px;
  border-bottom: 1px solid var(--line-soft);
}
.hero-link {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px;
  align-items: center;
  transition: opacity 0.2s var(--ease);
}
.hero-link:hover { opacity: 0.94; }
.hero-text { min-width: 0; }
.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}
.hero-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s ease infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.hero h1 {
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.15;
  font-weight: 700;
  margin-bottom: 14px;
}
.hero p {
  color: var(--text-dim);
  font-size: 16px;
  margin-bottom: 16px;
  line-height: 1.55;
}
.hero-meta {
  font-size: 13px;
  color: var(--text-muted);
}
.hero-media {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-soft);
  aspect-ratio: 16 / 10;
  background: var(--surface);
}
.hero-img,
.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease);
}
.hero-link:hover .hero-img,
.hero-link:hover .hero-media img {
  transform: scale(1.03);
}

/* Toolbar + chips */
.news-toolbar {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 0;
}
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  color: var(--text-dim);
  transition: all 0.2s var(--ease);
  display: inline-block;
}
.chip:hover {
  border-color: var(--accent-dim);
  color: var(--text);
}
.chip.active {
  border-color: var(--accent);
  color: var(--bg);
  background: var(--accent);
}

/* Layout */
.news-grid {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 24px 48px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Cards */
.news-card,
.soft-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
  display: flex;
  flex-direction: column;
}
.news-card:hover,
.soft-card:hover {
  border-color: var(--line);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.news-card img,
.soft-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  transition: transform 0.4s var(--ease);
}
.news-card:hover img,
.soft-card:hover img { transform: scale(1.03); }

.news-card-body,
.soft-card-body {
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.news-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.news-card-date {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}
.news-card-cat,
.soft-card-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  letter-spacing: 0.02em;
}
.soft-card-tag {
  display: inline-block;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: none;
  background: none;
  padding: 0;
}

.news-card h3,
.soft-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.3;
}
.news-card p,
.soft-card p {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.45;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 72px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 20px;
}
.profile-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--line);
  margin-bottom: 12px;
  background: var(--surface-2);
}
.profile-handle {
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.profile-handle .verified { color: var(--accent); font-size: 14px; }
.profile-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.profile-bio {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.5;
}
.stat-row {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
}
.stat-num {
  font-size: 16px;
  font-weight: 700;
}
.stat-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.panel .follow-btn {
  display: block;
  text-align: center;
  width: 100%;
}
.panel h3 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.x-live {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.x-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  animation: pulse 2s ease infinite;
}

/* Soft / page heroes */
.soft-hero, .ref-hero, .page-hero {
  max-width: var(--max);
  margin: 0 auto;
  padding: 48px 24px 36px;
  border-bottom: 1px solid var(--line-soft);
}
.soft-hero h1, .ref-hero h1, .page-hero h1 {
  font-size: clamp(28px, 4.5vw, 40px);
  font-weight: 700;
  margin-bottom: 12px;
}
.soft-hero p, .ref-hero p, .page-hero p {
  color: var(--text-dim);
  font-size: 16px;
  max-width: 520px;
  line-height: 1.55;
}
.ref-hero { text-align: center; }
.ref-hero p { margin: 0 auto; }

.soft-grid {
  max-width: var(--max);
  margin: 0 auto;
  padding: 40px 24px 72px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* Referrals */
.ref-content {
  max-width: 960px;
  margin: 0 auto;
  padding: 40px 24px 72px;
}
.ref-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}
.ref-card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.ref-card:hover {
  border-color: var(--line);
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.ref-card img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}
.ref-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}
.ref-card .ref-brand {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
  font-weight: 600;
}
.ref-card h3 {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 8px;
}
.ref-card p {
  font-size: 13.5px;
  color: var(--text-dim);
  margin-bottom: 14px;
  flex-grow: 1;
  line-height: 1.5;
}
.ref-card .ref-code {
  font-family: 'Space Grotesk', monospace, sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 14px;
  word-break: break-all;
}
.ref-card .ref-cta {
  display: block;
  text-align: center;
  width: 100%;
  background: var(--accent);
  color: #09090B;
  font-weight: 600;
  font-size: 13px;
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  transition: background 0.2s var(--ease);
}
.ref-card .ref-cta:hover { background: #fff; color: #09090B; }
.ref-note {
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Single post */
.single-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 24px 72px;
}
.single-wrap .post-thumb {
  width: 100%;
  height: 320px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 28px;
  border: 1px solid var(--line-soft);
}
.single-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.single-wrap h1 {
  font-size: clamp(26px, 4vw, 34px);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
}
.single-cat {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--line);
  background: var(--surface-2);
  padding: 3px 10px;
  border-radius: var(--radius-full);
  margin-bottom: 24px;
}
.single-content {
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.75;
}
.single-content p { margin-bottom: 16px; }
.single-content img {
  border-radius: var(--radius-sm);
  margin: 24px 0;
}
.back-link {
  display: inline-block;
  margin-bottom: 24px;
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.15s var(--ease);
}
.back-link:hover { color: var(--accent); }

.load-more {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease), background 0.2s var(--ease);
  margin-top: 16px;
}
.load-more:hover {
  border-color: var(--accent-dim);
  color: var(--text);
  background: var(--surface);
}

.news-footer-link {
  text-align: center;
  margin-top: 16px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.pagination a,
.pagination span {
  font-size: 13px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
}
.pagination .current {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line-soft);
  padding: 36px 24px 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
}
.site-footer .contact {
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-dim);
}
.site-footer .contact a {
  color: var(--accent);
  font-weight: 500;
  transition: color 0.15s var(--ease);
}
.site-footer .contact a:hover { color: #fff; }
.site-footer .disclaimer {
  font-size: 12px;
  color: var(--text-muted);
}

/* Mobile */
@media (max-width: 900px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 12px 16px 0;
    gap: 0;
  }
  .wordmark { font-size: 16px; }
  .follow-btn { font-size: 12px; padding: 8px 12px; }
  .main-nav {
    order: 3;
    width: 100%;
    display: flex;
    gap: 0;
    border-top: 1px solid var(--line-soft);
    margin-top: 12px;
    padding: 0;
  }
  .main-nav a {
    flex: 1;
    text-align: center;
    font-size: 12px;
    padding: 13px 4px;
    border-radius: 0;
    border-bottom: 2px solid transparent;
    letter-spacing: 0.05em;
  }
  .main-nav a:hover { background: transparent; }
  .main-nav a.active,
  .main-nav .current-menu-item > a {
    background: transparent;
    border-bottom-color: var(--accent);
  }

  .hero, .soft-hero, .ref-hero, .page-hero {
    padding: 32px 16px 28px;
  }
  .hero-link {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .hero-media {
    order: -1;
    aspect-ratio: 16 / 9;
  }
  .news-toolbar { padding: 20px 16px 0; }
  .news-grid {
    grid-template-columns: 1fr;
    padding: 20px 16px 40px;
  }
  .sidebar { position: static; }
  .soft-grid {
    grid-template-columns: 1fr;
    padding: 28px 16px 56px;
  }
  .ref-cards { grid-template-columns: 1fr; }
  .ref-content { padding: 28px 16px 56px; }
  .single-wrap { padding: 28px 16px 56px; }
  .single-wrap .post-thumb { height: 200px; }
}

@media (min-width: 901px) and (max-width: 1100px) {
  .news-grid { grid-template-columns: repeat(2, 1fr); }
  .soft-grid { grid-template-columns: repeat(2, 1fr); }
  .ref-cards { grid-template-columns: repeat(2, 1fr); }
}

/* Compare */
.compare-wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 28px 24px 72px;
}
.compare-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}
.compare-tab {
  font-size: 13px;
  font-weight: 500;
  padding: 10px 16px;
  border-radius: var(--radius-full);
  border: 1px solid var(--line);
  color: var(--text-dim);
  background: transparent;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  font-family: inherit;
}
.compare-tab:hover { border-color: var(--accent-dim); color: var(--text); }
.compare-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.compare-panel { display: none; }
.compare-panel.active { display: block; }

.duel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.duel-side { padding: 28px 24px 24px; text-align: center; }
.duel-side.left { background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%); }
.duel-side.right { background: linear-gradient(180deg, var(--surface-3) 0%, var(--surface) 100%); }
.duel-vs {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  border-left: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  background: var(--bg);
}
.duel-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.duel-name {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.2;
}
.duel-tagline {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 22px;
}
.duel-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.duel-stat {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
}
.duel-stat-val {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 2px;
}
.duel-stat-label {
  font-size: 11px;
  color: var(--text-muted);
}

.scoreboard {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 20px;
}
.score-row {
  display: grid;
  grid-template-columns: 1fr 140px 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line-soft);
  font-size: 14px;
}
.score-row:first-child { border-top: none; }
.score-cat {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 20px 4px;
  background: var(--surface-2);
}
.score-left, .score-right { color: var(--text-dim); }
.score-left { text-align: right; }
.score-mid {
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.score-row.win-left .score-left,
.score-row.win-right .score-right {
  color: var(--text);
  font-weight: 600;
}
.score-row.win-left .score-mid,
.score-row.win-right .score-mid { color: #a3e635; }

.verdict-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 28px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.verdict-col h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 10px;
}
.verdict-col h3 span {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--bg);
  background: var(--accent);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  margin-right: 8px;
  vertical-align: middle;
}
.verdict-col p {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.55;
}
.compare-disclaimer {
  margin-top: 20px;
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .compare-wrap { padding: 20px 16px 56px; }
  .duel { grid-template-columns: 1fr; }
  .duel-vs {
    border: none;
    border-top: 1px solid var(--line-soft);
    border-bottom: 1px solid var(--line-soft);
    padding: 10px;
  }
  .score-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .score-left, .score-right, .score-mid { text-align: left; }
  .verdict-box {
    grid-template-columns: 1fr;
    gap: 18px;
    padding: 20px;
  }
}
