/* =========================
   VARIABLES
   ========================= */

:root {
  --bg: #0f1115;
  --surface: #161a22;
  --text: #e6e8eb;
  --muted: #9aa1aa;
  --border: #242a36;
  --accent: #4da3ff;

  --radius: 10px;
  --max-width: 1100px;
}

[data-theme="light"] {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --accent: #2563eb;
}

/* =========================
   RESET / BASE
   ========================= */

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Ubuntu, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* =========================
   LAYOUT
   ========================= */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  text-align: center;
}

main {
  padding: 3rem 0;
}

section {
  margin-bottom: 3rem;
}

/* =========================
   HEADER / NAV
   ========================= */

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* izquierda | centro | derecha */
  align-items: center;
  height: 64px;
}

/* Marca izquierda */
.brand {
  justify-self: start;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

/* Menú centrado */
.nav-links {
  justify-self: center;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--muted);
  font-size: 0.95rem;
  padding: 0.35rem 0.15rem;
}

.nav-links a:hover {
  color: var(--text);
  text-decoration: none;
}
/* Botón tema derecha */
.theme-toggle {
  justify-self: end;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}

.theme-toggle:hover {
  opacity: 0.9;
}

/* Móvil: apilar menú debajo sin “raro” */
@media (max-width: 640px) {
  .nav {
    grid-template-columns: 1fr auto; /* marca | botón tema */
    height: auto;
    padding: 0.75rem 0;
    row-gap: 0.75rem;
  }

  .nav-links {
    grid-column: 1 / -1;
    justify-self: center;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
  }
}
/* =========================
   BUTTONS
   ========================= */

.btn {
  border: 1px solid var(--border);
  background: transparent;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn:hover {
  opacity: 0.9;
}

/* =========================
   HERO
   ========================= */

.hero h1 {
  font-size: 2.3rem;
  margin-bottom: 0.75rem;
}

.hero p {
  max-width: 60ch;
  margin: 0 auto;
  color: var(--muted);
}

/* =========================
   GRID / CARDS
   ========================= */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.card p {
  color: var(--muted);
  font-size: 0.95rem;
}

/* =========================
   LISTAS CENTRADAS
   ========================= */

ul {
  list-style-position: inside;
  padding-left: 0;
  margin: 1rem 0;
  text-align: center;
}

ul li {
  margin: 0.3rem 0;
}

/* =========================
   ARTÍCULOS / POSTS
   ========================= */

.article {
  max-width: 75ch;
  margin: 0 auto;
  text-align: left;
}

.article h1,
.article h2,
.article h3 {
  margin-top: 2rem;
}

.article p,
.article li {
  color: var(--text);
}

.article code {
  background: var(--surface);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.9em;
}

.article pre {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 1rem;
  overflow-x: auto;
  border-radius: var(--radius);
}

.article img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1rem auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.article figure { margin: 1.25rem 0; }
.article figcaption {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin-top: 0.5rem;
}
/* =========================
   FOOTER
   ========================= */

footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}
