/* ========== RESET & BASE ========== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #ffffff;
  --surface: #f8f9fa;
  --text: #1a1a1a;
  --text-muted: #6c757d;
  --primary: #0d6efd;
  --primary-hover: #0b5ed7;
  --border: #dee2e6;
  --shadow: rgba(0, 0, 0, 0.08);
  --shadow-lg: rgba(0, 0, 0, 0.12);
  --gradient-start: #f8f9fa;
  --gradient-end: #ffffff;
}

body.dark-theme {
  --bg: #0d1117;
  --surface: #161b22;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --primary: #58a6ff;
  --primary-hover: #1f6feb;
  --border: #30363d;
  --shadow: rgba(0, 0, 0, 0.4);
  --shadow-lg: rgba(0, 0, 0, 0.6);
  --gradient-start: #161b22;
  --gradient-end: #0d1117;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.3s, color 0.3s;
  font-size: 16px;
}

/* ========== TOPBAR ========== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.75rem;
  box-shadow: 0 2px 8px var(--shadow);
  transition: background 0.3s;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  white-space: nowrap;
}

.brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
}

.nav a {
  padding: 0.4rem 0.65rem;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.75rem;
  border-radius: 5px;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav a:hover,
.nav a:focus {
  background: var(--primary);
  color: white;
}

#themeToggle {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
  flex-shrink: 0;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#themeToggle:hover {
  background: var(--primary-hover);
  transform: scale(1.05);
}

/* ========== MAIN & SECTIONS ========== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem;
  width: 100%;
}

.section {
  padding: 1.5rem 1rem;
  margin-bottom: 1.5rem;
  scroll-margin-top: 70px;
  width: 100%;
}

/* ========== HERO - COMPACTO NO MOBILE ========== */
.hero {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  align-items: center;
  background: linear-gradient(
    135deg,
    var(--gradient-start) 0%,
    var(--gradient-end) 100%
  );
  border-radius: 12px;
  padding: 1.5rem 1rem;
  transition: background 0.3s;
  width: 100%;
  min-height: auto;
}

.hero-content {
  width: 100%;
  text-align: center;
}

.hero-content h1 {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-direction: column;
  width: 100%;
}

.hero-image {
  width: 100%;
  max-width: 400px;
}

.hero-image img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 6px 20px var(--shadow-lg);
  display: block;
}

/* ========== CARD ========== */
.card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 4px 16px var(--shadow);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.3s, box-shadow 0.3s;
  width: 100%;
}

.card .media {
  width: 100%;
  height: 200px;
  overflow: hidden;
  background: var(--border);
  flex-shrink: 0;
}

.card .media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
  display: block;
}

.card:hover .media img {
  transform: scale(1.05);
}

.card .content {
  padding: 1.5rem 1.25rem;
  flex: 1;
}

.card h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
  line-height: 1.3;
}

.bullets {
  list-style: none;
  padding: 0;
}

.bullets li {
  padding: 0.65rem 0;
  padding-left: 1.4rem;
  position: relative;
  font-size: 0.9rem;
  line-height: 1.6;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.bullets li:last-child {
  border-bottom: none;
}

.bullets li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
}

/* ========== REFS ========== */
.refs ul {
  list-style: none;
  padding: 0;
}

.refs li {
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border);
}

.refs li:last-child {
  border-bottom: none;
}

.refs a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.9rem;
  transition: color 0.2s;
  word-break: break-word;
  line-height: 1.5;
}

.refs a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  cursor: pointer;
  border: none;
  text-align: center;
  width: 100%;
}

.btn.primary {
  background: var(--primary);
  color: white;
}

.btn.primary:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--shadow-lg);
}

.btn.ghost {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn.ghost:hover {
  background: var(--primary);
  color: white;
}

.btn.download {
  background: #28a745;
  color: white;
}

.btn.download:hover {
  background: #218838;
}

/* ========== FOOTER ========== */
.footer {
  background: var(--surface);
  padding: 1.5rem 1rem;
  text-align: center;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  transition: background 0.3s;
}

.footer span {
  color: var(--text);
  font-size: 0.85rem;
}

/* ========== BACK TO TOP ========== */
#backToTop {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: var(--primary);
  color: white;
  border: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
}

#backToTop.show {
  opacity: 1;
  visibility: visible;
}

#backToTop:hover {
  background: var(--primary-hover);
  transform: translateY(-4px);
}

/* ========== RESPONSIVE - TABLET (768px+) ========== */
@media (min-width: 768px) {
  body {
    font-size: 17px;
  }

  .topbar {
    padding: 1rem 2rem;
  }

  .brand {
    font-size: 1.05rem;
  }

  .brand-logo {
    width: 38px;
    height: 38px;
  }

  .nav {
    gap: 0.6rem;
  }

  .nav a {
    font-size: 0.85rem;
    padding: 0.5rem 0.9rem;
  }

  #themeToggle {
    min-width: 44px;
    min-height: 44px;
  }

  main {
    padding: 2rem;
  }

  .section {
    padding: 2.5rem 2rem;
    margin-bottom: 2rem;
  }

  .hero {
    flex-direction: row;
    padding: 2.5rem 2rem;
    gap: 2.5rem;
  }

  .hero-content {
    text-align: left;
    flex: 1;
  }

  .hero-content h1 {
    font-size: 2rem;
  }

  .subtitle {
    font-size: 1.05rem;
  }

  .meta {
    font-size: 0.95rem;
  }

  .hero-actions {
    flex-direction: row;
    width: auto;
  }

  .hero-image {
    flex: 1;
    max-width: 500px;
  }

  .card {
    flex-direction: row;
  }

  .card .media {
    width: 40%;
    height: auto;
    min-height: 320px;
  }

  .card .content {
    width: 60%;
    padding: 2rem 1.75rem;
  }

  .card h2 {
    font-size: 1.65rem;
  }

  .bullets li {
    font-size: 0.95rem;
    padding: 0.75rem 0;
  }

  .btn {
    width: auto;
    padding: 0.8rem 1.5rem;
    font-size: 0.95rem;
  }

  #backToTop {
    width: 54px;
    height: 54px;
    bottom: 2rem;
    right: 2rem;
  }
}

/* ========== RESPONSIVE - DESKTOP (1024px+) ========== */
@media (min-width: 1024px) {
  body {
    font-size: 18px;
  }

  .topbar {
    padding: 1.25rem 3rem;
  }

  .brand {
    font-size: 1.15rem;
  }

  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .nav {
    gap: 0.75rem;
  }

  .nav a {
    font-size: 0.9rem;
    padding: 0.55rem 1.1rem;
  }

  #themeToggle {
    min-width: 48px;
    min-height: 48px;
  }

  main {
    padding: 3rem;
  }

  .section {
    padding: 3.5rem 3rem;
  }

  .hero {
    padding: 3.5rem 3rem;
    gap: 3rem;
  }

  .hero-content h1 {
    font-size: 2.5rem;
  }

  .subtitle {
    font-size: 1.15rem;
  }

  .meta {
    font-size: 1rem;
  }

  .card .media {
    width: 42%;
    min-height: 380px;
  }

  .card .content {
    width: 58%;
    padding: 2.5rem 2.25rem;
  }

  .card h2 {
    font-size: 1.85rem;
  }

  .bullets li {
    font-size: 1rem;
  }
}

/* ========== RESPONSIVE - DESKTOP GRANDE (1400px+) ========== */
@media (min-width: 1400px) {
  .topbar {
    padding: 1.5rem 4rem;
  }

  .hero {
    padding: 4rem 3.5rem;
  }

  .hero-content h1 {
    font-size: 3rem;
  }

  .card .media {
    min-height: 420px;
  }

  .card .content {
    padding: 3rem 2.75rem;
  }
}

/* ========== AJUSTES ESPECÍFICOS MOBILE ========== */
@media (max-width: 374px) {
  .brand span {
    display: none;
  }

  .nav a {
    font-size: 0.7rem;
    padding: 0.35rem 0.5rem;
  }

  .hero-content h1 {
    font-size: 1.25rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }
}

/* Landscape mobile */
@media (max-width: 767px) and (orientation: landscape) {
  .hero {
    padding: 1.25rem 1rem;
  }

  .hero-image {
    max-width: 300px;
  }

  .card .media {
    height: 180px;
  }
}
