:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1c2333;
  --muted: #5f6678;
  --accent: #5b5ef0;
  --accent-soft: #e9e9fd;
  --border: #dfe3ec;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1220;
    --card: #171b2e;
    --text: #e9ebf5;
    --muted: #9aa1b5;
    --accent: #8b8dff;
    --accent-soft: #23284a;
    --border: #2a2f45;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1220;
  --card: #171b2e;
  --text: #e9ebf5;
  --muted: #9aa1b5;
  --accent: #8b8dff;
  --accent-soft: #23284a;
  --border: #2a2f45;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  margin: 0;
  padding: 28px 20px 64px;
}

.wrap {
  max-width: 900px;
  margin: 0 auto;
}

/* ---------- Barra superior ---------- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 56px;
}

.btn-top {
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}

.btn-top:hover { border-color: var(--accent); }
.btn-top:active { transform: scale(0.97); }

/* ---------- Cabecera ---------- */
.hero { margin-bottom: 40px; }

h1 {
  font-family: 'Bricolage Grotesque', 'DM Sans', 'Segoe UI', system-ui, sans-serif;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0 0 12px;
  max-width: 14ch;
}

.hero p {
  margin: 0;
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 48ch;
}

/* ---------- Tarjetas de proyectos ---------- */
.projects {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: 14px;
}

.project {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}

.project:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-icon {
  flex: none;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  font-size: 1.4rem;
  background: var(--accent-soft);
  border-radius: 12px;
}

.project-body { min-width: 0; }

.project-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.project-desc {
  display: block;
  font-size: 0.92rem;
  color: var(--muted);
}

.tag {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
  vertical-align: 2px;
}

/* ---------- Accesibilidad ---------- */
a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

@media (max-width: 480px) {
  .top-bar { margin-bottom: 36px; }
  .btn-top { padding: 8px 12px; font-size: 0.85rem; }
}