:root {
  --bg: #0b0c0c;
  --panel: #101213;
  --card: rgba(19, 22, 23, 0.88);
  --text: #e9f1ea;
  --muted: #aeb8b0;
  --accent: #97e38d;
  --line: #22282a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: #0b0c0c;
  background-image: url("img/ChatGPT\ Image\ 13\ oct\ 2025\,\ 01_38_39.fondo.webp");
  background-repeat: repeat; /* 🔁 Repite el patrón infinitamente */
  background-size: contain; /* Ajusta la imagen completa sin recortarla */
  background-position: center top; /* Centrada y empieza desde arriba */
  background-attachment: scroll; /* Se mueve suavemente con el contenido */
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    sans-serif;
  transition: background-position 0.4s ease-out;
}

header {
  position: sticky; /* se mantiene fijo en la parte superior */
  top: 0;
  z-index: 100; /* se superpone al resto del contenido */
  padding: 28px 20px;
  border-bottom-left-radius: 20px;
  border-bottom-right-radius: 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(11, 12, 12, 0.85); /* ligeramente translúcido */
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px); /* efecto de desenfoque suave */
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

h1 {
  margin: 0;
  font-size: 22px;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 16px 14px;
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  margin-bottom: 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

.thumb {
  width: 140px;
  height: 110px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.id {
  font-weight: 800;
  color: var(--accent);
  margin-top: 2px;
}

.latin {
  font-style: italic;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 10px;
}

.block {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}

.block h4 {
  margin: 0 0 6px 0;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.kv {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}

.kv b {
  color: #cfe7d3;
  font-weight: 700;
}

.hist {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

@media (max-width: 720px) {
  .card {
    grid-template-columns: 1fr;
  }
  .thumb {
    width: 100%;
    height: 180px;
  }
  .row {
    grid-template-columns: 1fr;
  }
}

/* //estilos de bienvenida */
/* Pantalla de bienvenida: overlay a pantalla completa */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999; /* por encima del header sticky */
  display: grid;
  place-items: center;
  background: #000; /* fondo de seguridad mientras carga la imagen */
  overflow: hidden;
  opacity: 1;
  transition: opacity 1700ms ease-out;
}

.welcome-overlay[hidden] {
  display: none;
}

.welcome-overlay.is-fading {
  opacity: 0;
  pointer-events: none;
}

.welcome-overlay .welcome-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* se ajusta al viewport */
}

/* ligera superposición para legibilidad del botón */
.welcome-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.15), rgba(0,0,0,0.45));
}

.welcome-ui {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 16px;
  place-items: center;
}

.welcome-btn {
  appearance: none;
  border: 2px solid var(--accent);
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  font-weight: 700;
  padding: 16px 36px;
  font-size: 24px;
  line-height: 1.2;
  text-align: center;
  max-width: 90vw;
  white-space: normal;
  font-family: Georgia, "Times New Roman", "Palatino Linotype", "Book Antiqua", Garamond, serif;
  text-shadow: 0 1px 1px rgba(0,0,0,0.35);
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  transition: transform 150ms ease, background-color 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.welcome-btn:hover,
.welcome-btn:focus {
  outline: none;
  transform: translateY(-1px);
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 0 0 4px rgba(151, 227, 141, 0.25);
}

.welcome-btn:active {
  transform: translateY(0);
  opacity: 0.95;
}

/* utilidades de accesibilidad */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (prefers-reduced-motion: reduce) {
  .welcome-overlay { transition: none; }
  .welcome-btn { transition: none; }
}

/* ===== Vista compacta de tarjetas ===== */
.card .summary-line{
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card .summary-line .tag{ padding: 2px 8px; border:1px solid var(--line); border-radius: 999px; font-size:12px; color: var(--text); background: rgba(0,0,0,.12); }
html.light .card .summary-line .tag{ background:#ffffff; border-color:#dcded8; color:#2a2a2a; }

.card .card-toggle{
  margin-left: auto;
  height: 28px; min-width: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  display: inline-grid; place-items:center;
  cursor: pointer;
}
.card .card-toggle svg{ transition: transform .2s ease; }
.card.is-expanded .card-toggle svg{ transform: rotate(180deg); }

.card.is-collapsed .row,
.card.is-collapsed .hist{ display:none; }
.card.is-collapsed .thumb{ height: 90px; object-fit: cover; }

/* ===== Intro (sección superior) ===== */
.intro .intro-body{ margin-top: 8px; }
.card.is-collapsed .intro-body{ display: none; }
.intro .bullets{ list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.intro .bullets li{ display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.intro .bullets a{ color: var(--text); text-decoration: none; }
.intro .bullets a:hover{ color: var(--accent); text-decoration: underline; }
.intro .cta{ display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.intro .btn-link{ color: var(--accent); text-decoration: underline; }
.intro .btn-link:hover{ opacity: .9; }
.intro .repo-link{ color: var(--accent); text-decoration: underline; }
.intro .repo-link:hover{ opacity: .9; }

/* Título de intro con estilo similar a .dash-title */
#intro-title{ font-size: 18px; color: var(--accent); margin: 0 0 4px 0; }

footer {
  background: rgba(16, 18, 19, 0.9); /* mismo tono que --panel */
  border-top: 1px solid var(--line);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--muted);
  padding: 28px 16px;
  text-align: center;
  margin-top: 40px;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.3);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
}

footer .brand {
  font-size: 16px;
  color: var(--accent);
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.4px;
}

footer .tagline {
  font-size: 13px;
  color: var(--text);
  margin: 4px 0 10px;
  letter-spacing: 0.3px;
}

footer .meta {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}

footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease-in-out;
}

footer a:hover {
  color: #b8f5ae;
}

/* Contenedor con grid: sidebar + contenido */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 18px 24px;
  display: grid;
  grid-template-columns: 240px 1fr; /* sidebar + main */
  gap: 24px;
  align-items: start; /* 🔸 quita centrado vertical */
}

/* Sidebar fija bajo el header (no centrada) */
.sidebar {
  background: rgba(16, 18, 19, 0.88);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  padding: 10px 12px 14px;
  position: sticky;
  top: calc(var(--header-h) + 8px); /* ✅ pegada bajo el header */
  max-height: calc(100vh - var(--header-h) - 24px);
  overflow: auto;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  width: 220px;
  /* ❌ sin transform, sin top:50% */
}

/* Títulos y enlaces, texto más pequeño */
.side-title {
  font-weight: 800;
  color: var(--accent);
  font-size: 14px;
  margin: 4px 6px 10px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}
.side-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 4px;
}
.side-list a {
  display: block;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 13px; /* pequeño */
  background: rgba(19, 22, 23, 0.65);
  border: 1px solid transparent;
  transition: background 0.2s, border-color 0.2s, transform 0.05s;
}
.side-list a:hover {
  background: rgba(19, 22, 23, 0.9);
  border-color: var(--accent);
  transform: translateX(2px);
}

/* Responsive: oculta en móvil */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}

/* ===== Dashboard / Resumen ===== */
.dash {
  grid-template-columns: 1.2fr 0.8fr;
  align-items: start;
}
.dash-title {
  margin: 0 0 4px 0;
  font-size: 18px;
  color: var(--accent);
}
.dash-sub {
  margin: 0 0 14px 0;
  color: var(--muted);
  font-size: 13px;
}
.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.kpi {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}
.kpi-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.3px;
}
.kpi-value {
  margin-top: 4px;
  font-size: 22px;
  font-weight: 800;
}

.health {
  margin-top: 14px;
}
.health-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.bar {
  position: relative;
  height: 10px;
  background: #131617;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #7bdd71, #97e38d);
  transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.health-legend {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.meta-line {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.dash-right .filters {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}
.filter-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--muted);
  margin-bottom: 8px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  background: #131617;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}
.chip.is-active {
  background: rgba(151, 227, 141, 0.12);
  border-color: #2d3a34;
}

/* Mejoras de contraste en tema claro */
html.light .filters { background: #ffffff; border-color: #dcded8; }
html.light .chip { background: #ffffff; border-color: #dcded8; color: #2a2a2a; }
html.light .chip:hover { border-color: color-mix(in oklab, var(--accent), #2a6b36 25%); color: #2a6b36; }
html.light .chip.is-active { background: rgba(106,191,123,.18); border-color: #bcd8c0; color: #2a6b36; }

.filter-hint {
  margin: 10px 0 0 0;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .dash {
    grid-template-columns: 1fr;
  }
  .kpis {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 540px) {
  .kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* desplazamiento suave al usar scrollTo con anclas */
html {
  scroll-behavior: smooth;
}

/* Botón flotante Volver arriba */
.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--accent);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s 0.25s;
  z-index: 9999;
}

.back-to-top:hover {
  color: #b8f5ae; /* tono más claro del acento */
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
}

.back-to-top:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Respeto a usuarios con reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .back-to-top {
    transition: none;
  }
}

/* ── Logo del header ─────────────────────────────── */
.logo-leaf {
  width: 22px; /* tamaño equilibrado con el texto */
  height: 22px;
  vertical-align: middle; /* alinea con el texto */
  margin-right: 8px; /* separación respecto al título */
  transform: translateY(-2px); /* ajusta alineación vertical fina */
  transition: transform 0.25s ease;
}

/* Efecto suave al pasar el ratón */
h1:hover .logo-leaf {
  transform: translateY(-2px) scale(1.15);
}

/* En modo claro el icono puede quedar más visible si tiene borde sutil */
html.light .logo-leaf {
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.15));
}

/* ── Botones sociales del footer ─────────────────────────────── */
.social-links {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 18px;
}

.social-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  text-decoration: none;
  transition: all 0.25s ease;
}

.social-btn:hover {
  transform: translateY(-2px);
  color: #b8f5ae;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
}

/* Tema claro: apariencia más suave */
html.light .social-btn {
  background: #ffffffd9;
  border-color: #dcded8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
html.light .social-btn:hover {
  color: #5aa26a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Colores específicos opcionales (puedes mantener los neutros si prefieres) */
.social-btn.github:hover {
  color: #58a6ff;
} /* azul GitHub suave */
.social-btn.linkedin:hover {
  color: #0a66c2;
} /* azul LinkedIn */

/* ── Barra de búsqueda ───────────────────────────────────────────── */
.toolbar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin: 10px 0 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
}

.toolbar-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(160px, 1fr)) auto; /* 5 selects + botón */
  gap: 10px;
  align-items: center;
}
.field.grow {
  width: 100%;
  grid-column: 1 / -1; /* el buscador ocupa toda la primera fila */
}

.field {
  display: flex;
  align-items: center;
}

.field.grow {
  width: 100%;
}

.toolbar input[type="search"],
.toolbar select {
  width: 100%;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.toolbar input[type="search"]::placeholder {
  color: var(--muted);
}

.toolbar input[type="search"]:focus,
.toolbar select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(151, 227, 141, 0.15);
}

.btn-clear {
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--accent);
  font-weight: 600;
  cursor: pointer;
}
.btn-clear:hover {
  color: #b8f5ae;
}

.toolbar-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* Responsive */
@media (max-width: 900px) {
  .toolbar-row {
    grid-template-columns: 1fr 1fr;
  }
  .btn-clear {
    grid-column: span 2;
  }
}

/* ╭──────────────── Animaciones suaves ─────────────────╮ */
/* Entrada de tarjetas (stagger) + hover en tarjeta e imagen */
@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes img-in {
  from {
    filter: blur(4px) brightness(0.9);
    transform: scale(1.02);
  }
  to {
    filter: blur(0) brightness(1);
    transform: scale(1);
  }
}

/* Sólo animar cuando el documento está listo (clase en <html>) */
html.ready .card {
  opacity: 0; /* estado inicial */
  animation: card-in 0.48s ease-out both;
}

/* Pequeño “stagger” por posición */
html.ready .card:nth-of-type(1) {
  animation-delay: 0.02s;
}
html.ready .card:nth-of-type(2) {
  animation-delay: 0.05s;
}
html.ready .card:nth-of-type(3) {
  animation-delay: 0.08s;
}
html.ready .card:nth-of-type(4) {
  animation-delay: 0.11s;
}
html.ready .card:nth-of-type(5) {
  animation-delay: 0.14s;
}
/* si tienes muchas, un patrón genérico */
html.ready .card:nth-of-type(6n + 1) {
  animation-delay: 0.02s;
}
html.ready .card:nth-of-type(6n + 2) {
  animation-delay: 0.05s;
}
html.ready .card:nth-of-type(6n + 3) {
  animation-delay: 0.08s;
}
html.ready .card:nth-of-type(6n + 4) {
  animation-delay: 0.11s;
}
html.ready .card:nth-of-type(6n + 5) {
  animation-delay: 0.14s;
}
html.ready .card:nth-of-type(6n + 6) {
  animation-delay: 0.17s;
}

/* Imagen: entrada suave y micro-zoom al pasar el cursor */
.thumb {
  transition: transform 0.25s ease, filter 0.25s ease, box-shadow 0.25s ease;
}
html.ready .thumb {
  animation: img-in 0.5s ease-out both;
}
.card:hover .thumb {
  transform: scale(1.02);
}

/* Tarjeta: levantar sutilmente al hover */
.card {
  transition: transform 0.22s ease, box-shadow 0.22s ease,
    border-color 0.22s ease;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
  border-color: color-mix(in oklab, var(--line), var(--accent) 20%);
}

/* Respeto reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  .card,
  .thumb {
    transition: none !important;
  }
  html.ready .card,
  html.ready .thumb {
    animation: none !important;
    opacity: 1;
    transform: none;
  }
}

/* ╭─────────────────────────── Tema claro/oscuro ───────────────────────────╮ */

/* Botón flotante dentro del header */
.theme-toggle {
  position: absolute;
  top: 22px;
  right: 22px;
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.theme-toggle:hover {
  color: #b8f5ae;
  transform: scale(1.05);
}

/* Tema claro: sobreescribe variables */
html.light {
  --bg: #f2f3ef;
  --panel: #f9f9f7;
  --card: rgba(255, 255, 255, 0.88);
  --text: #222;
  --muted: #666;
  --accent: #6bbf7b;
  --line: #d4d8d1;
  background-color: var(--bg);
}

html.light body {
  background-image: url("img/monstera-day-soft-2.fondo.webp");
  background-repeat: repeat; /* se repite verticalmente sin salto */
  background-size: contain; /* ajusta si la ves muy grande/pequeña */
  background-position: center top;
  background-attachment: scroll; /* suave con el contenido */
}

/* Transición entre temas */
html {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Contrastes en modo CLARO: header + footer ───────────────────── */

/* Header más legible sobre fondo claro */
html.light header {
  background: rgba(249, 249, 247, 0.88); /* panel claro translúcido */
  border-bottom: 1px solid var(--line);
  color: var(--text);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

/* Título y subtítulo con contraste adecuado */
html.light header h1 {
  color: var(--text);
}
html.light header div {
  color: var(--muted);
}

/* Botón del tema: un poco más contrastado en claro */
html.light .theme-toggle {
  background: #ffffffd9;
  border-color: #dcded8;
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Footer claro, legible y discreto */
html.light footer {
  background: rgba(255, 255, 255, 0.92);
  border-top: 1px solid var(--line);
  color: var(--muted);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
}

html.light footer .brand {
  color: var(--accent);
}
html.light footer .tagline {
  color: var(--text);
}
html.light footer .meta {
  color: var(--muted);
}
html.light footer a {
  color: color-mix(in oklab, var(--accent), #2a6b36 20%);
}
html.light footer a:hover {
  color: color-mix(in oklab, var(--accent), #2a6b36 40%);
}

/* ── Mini gráfico donut ─────────────────────────────── */
.mini-charts {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: stretch;
}
.donut-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}
.donut {
  width: 140px;
  height: 140px;
}
.donut-caption {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}
.donut-legend {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 13px;
}
.donut-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.donut-legend .swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--line);
}

/* Tema claro: toques más suaves */
html.light .donut-card {
  background: #ffffff;
  border-color: #dcded8;
}

/* Barras para Luz y Riego (tarjeta a la derecha) */
.bars-card {
  display: grid;
  grid-template-columns: 1fr;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
}
.bars-wrap { display: grid; grid-template-columns: 1fr; gap: 12px; }
.bars-title { margin: 2px 0 6px 0; font-size: 13px; color: var(--muted); }
.bars { display: grid; gap: 8px; width: 100%; }
.baritem { display: grid; grid-template-columns: minmax(140px, 1fr) auto; gap: 10px; align-items: center; }
.barrow { position: relative; height: 10px; background: #131617; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.barrow .fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1); }
.barlabel { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 8px; white-space: normal; }
.barlabel .swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line); display: inline-block; }
.bars-legend { display: none; }

html.light .bars-card { background: #ffffff; border-color: #dcded8; }

@media (max-width: 860px) { .mini-charts { grid-template-columns: 1fr; } }

/* Indicadores de promedio (bajo cada bloque) */
.avg-meter{ margin-top: 10px; }
.avg-head{ display:flex; justify-content:space-between; align-items:center; font-size:12px; color:var(--muted); margin: 0 0 6px 0; }
.avg-head b{ color: var(--text); }

/* ── Descarga del resumen ─────────────────────────────── */
.dash-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-start;
}

.btn {
  height: 40px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.download {
  position: relative;
  display: inline-block;
}
.dl-toggle .caret {
  transition: transform 0.15s ease;
}
.dl-toggle[aria-expanded="true"] .caret {
  transform: rotate(180deg);
}

.dl-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.35);
  padding: 6px;
  min-width: 180px;
  z-index: 99;
}
.dl-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.dl-item:hover {
  background: rgba(151, 227, 141, 0.12);
  color: var(--accent);
}

.utils-note{ font-size: 12px; color: var(--muted); margin-top: 6px; }
.dash-utils{ margin-top: 10px; display: grid; gap: 6px; align-items: center; justify-items: start; }

/* cerrar menú si se desborda en móvil */
@media (max-width: 520px) {
  .dl-menu {
    right: 0;
    left: auto;
  }
}

/* ── Icono del pájaro externo ─────────────────────────────── */
/* Icono pájaro coloreable por tema usando máscara del SVG externo */
.icon-bird {
  width: 18px;
  height: 18px;
  display: block;
  background-color: currentColor; /* el color lo pone el tema */
  -webkit-mask: url("img/bird.svg") no-repeat center / contain;
  mask: url("img/bird.svg") no-repeat center / contain;
  transition: color 0.25s ease, transform 0.2s ease;
}

/* Colores por tema */
html:not(.light) .bubble-btn .icon-bird {
  color: #fff;
} /* oscuro → blanco */
html.light .bubble-btn .icon-bird {
  color: #2a2a2a;
} /* claro → oscuro */

/* Hover y estado activo */
.bubble-btn:hover .icon-bird {
  transform: scale(1.1);
}
.bubble-btn.is-on .icon-bird {
  color: #b8f5ae;
} /* activo → verde suave */

/* ── Soniddo ambiental ─────────────────────────────── */

/* Layout de header: texto | acciones */
.header-grid {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center; /* centra verticalmente los dos */
  gap: 16px;
}

/* Evita salto de línea en el título y permite que se encoja en móviles */
.header-main { min-width: 0; }
.header-main h1 {
  white-space: nowrap;
  /* Sin elipsis: reducimos tamaño de forma más agresiva en pantallas pequeñas */
  font-size: clamp(14px, 4.6vw, 22px);
}

/* Acciones alineadas en FILA a la derecha */
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

/* Botón base */
.bubble-btn {
  background: var(--panel);
  color: var(--accent);
  border: 1px solid var(--line);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  transition: background 0.2s, color 0.2s, transform 0.2s, box-shadow 0.2s;
}
.bubble-btn:hover {
  transform: scale(1.05);
  color: #b8f5ae;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}
.bubble-btn.is-on {
  color: #b8f5ae;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Icono pájaro con máscara para poder colorearlo por tema */
.icon-bird {
  width: 18px;
  height: 18px;
  display: block;
  background-color: currentColor;
  -webkit-mask: url("img/bird.svg") no-repeat center / contain;
  mask: url("img/bird.svg") no-repeat center / contain;
  transition: color 0.25s ease, transform 0.2s ease;
}
.bubble-btn:hover .icon-bird {
  transform: scale(1.1);
}

/* Colores por tema */
html:not(.light) .sound-btn .icon-bird {
  color: #fff;
} /* oscuro → blanco */
html.light .sound-btn .icon-bird {
  color: #2a2a2a;
} /* claro → oscuro */

/* Tema claro: fondo/borde suaves */
html.light .bubble-btn {
  background: #ffffffd9;
  border-color: #dcded8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
html.light .bubble-btn:hover {
  color: #5aa26a;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

/* Nuevo icono: hoja al viento */
.icon-leafwind {
  width: 18px;
  height: 18px;
  display: block;
  background-color: currentColor;
  -webkit-mask: url("img/leaf-fluttering-in-wind.svg") no-repeat center / contain;
          mask: url("img/leaf-fluttering-in-wind.svg") no-repeat center / contain;
  transition: color 0.25s ease, transform 0.2s ease;
}
.bubble-btn:hover .icon-leafwind { transform: scale(1.1); }
html:not(.light) .leaves-btn .icon-leafwind { color: #fff; }
html.light .leaves-btn .icon-leafwind { color: #2a2a2a; }

/* ==== Briznas de luz (canvas) ==== */
.floating-sparks{
  position: fixed;
  inset: 0;
  pointer-events: none; /* no bloquea interacción */
  z-index: 0;           /* misma capa que hojas */
  display: block;
  width: 100vw;         /* asegura tamaño de viewport para clientWidth */
  height: 100vh;
}

/* Icono chispa para el botón */
.icon-spark{
  display: block;
  width: 18px; height: 18px;
  background-color: currentColor; /* permite recolorear por tema */
  -webkit-mask: url("img/luciernagas.png") no-repeat center / contain;
          mask: url("img/luciernagas.png") no-repeat center / contain;
  transition: transform .2s ease, color .2s ease;
}
.bubble-btn:hover .icon-spark{ transform: scale(1.1); }
html:not(.light) .sparks-btn .icon-spark{ color: #fff; }
html.light .sparks-btn .icon-spark{ color: #2a2a2a; }

@media (prefers-reduced-motion: reduce){
  .floating-sparks{ display:none; }
}

/* Responsive: mantiene los dos botones en fila */
@media (max-width: 520px) {
  .header-grid {
    gap: 12px;
  }
  .header-actions {
    gap: 8px;
  }
}

/* Onda activa alrededor del botón de sonido */
.sound-btn {
  position: relative;
  overflow: visible;
}
.sound-btn.is-on::before,
.sound-btn.is-on::after {
  content: "";
  position: absolute;
  inset: -6px; /* tamaño del anillo alrededor */
  border-radius: 999px;
  border: 2px solid currentColor;
  opacity: 0;
  pointer-events: none; /* no bloquear clics */
  animation: sound-wave 2.2s ease-out infinite;
}
.sound-btn.is-on::after {
  animation-delay: 1.1s;
}

@keyframes sound-wave {
  0% {
    transform: scale(0.9);
    opacity: 0.35;
  }
  70% {
    opacity: 0.1;
  }
  100% {
    transform: scale(1.85);
    opacity: 0;
  }
}

/* Respeta reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  .sound-btn.is-on::before,
  .sound-btn.is-on::after {
    animation: none;
    display: none;
  }
}

/* ===== Lightbox (visor de imágenes) ===== */
.lightbox {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: color-mix(in oklab, var(--bg), black 40%);
  backdrop-filter: blur(6px) saturate(1.05);
  -webkit-backdrop-filter: blur(6px) saturate(1.05);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0s 0.25s;
  z-index: 99999;
}
.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.25s ease;
}

.lb-inner {
  position: relative;
  max-width: 96vw;
  max-height: 92vh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.lb-figure {
  margin: 0;
}
.lb-img {
  max-width: 86vw;
  max-height: 86vh;
  display: block;
  border-radius: 10px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}
.lb-caption {
  margin-top: 8px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.lb-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, color 0.2s ease, border-color 0.2s ease;
}
.lb-btn:hover {
  transform: scale(1.06);
  color: var(--accent);
  border-color: var(--accent);
}
.lb-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  z-index: 2;
}

.lb-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Tema claro: suaviza fondo del overlay */
html.light .lightbox {
  background: color-mix(in oklab, var(--bg), white 20%);
}

/* No scroll cuando el lightbox está abierto */
html.no-scroll {
  overflow: hidden;
}

/* ── FIX: alinear theme-toggle en la fila, no absoluto ───────────── */
.header-actions .theme-toggle {
  position: static !important;
  top: auto !important;
  right: auto !important;
  width: 38px;
  height: 38px; /* igual que .bubble-btn */
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
}
/* ── 🍃 Hojas flotantes ───────────────────────────────────────── */
.floating-leaves{
  position: fixed;
  inset: 0;
  pointer-events: none;                 /* no bloquea clics */
  z-index: 0;                           /* detrás del contenido */
  /* Color base por tema */
  color: rgba(255,255,255,.70);         /* modo oscuro: hojas claras */
}
html.light .floating-leaves{
  /* modo claro: gris oscuro para buen contraste */
  color: rgba(34,34,34,.70);
}

/* Cada hoja usa máscara del SVG y “toma” el color vía currentColor */
.floating-leaves .leaf{
  position: absolute;
  top: -12vh;                           /* entra desde arriba */
  width: var(--size, 28px);
  height: var(--size, 28px);
  opacity: var(--opacity, .32);
  transform: translate3d(var(--sx, 10vw), -10vh, 0) rotate(0deg);
  animation: leaf-fall var(--dur, 14s) linear var(--delay, 0s) infinite;
  will-change: transform;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,.15));
}

/* Capa interior: aplica la máscara y el vaivén de rotación */
.floating-leaves .leaf .inner{
  width: 100%; height: 100%; display: block;
  background-color: currentColor;
  -webkit-mask: var(--mask-url) center / contain no-repeat;
          mask: var(--mask-url) center / contain no-repeat;
  will-change: transform;
  animation: leaf-wobble var(--tiltDur, 2.8s) ease-in-out var(--delay, 0s) infinite alternate;
}

/* Trayectoria con ligera oscilación y giro */
@keyframes leaf-fall{
  0%{
    transform: translate3d(var(--sx), -10vh, 0) rotate(0deg);
  }
  50%{
    transform: translate3d(var(--mx, 20vw), 50vh, 0) rotate(90deg);
  }
  100%{
    transform: translate3d(var(--ex), 110vh, 0) rotate(180deg);
  }
}

/* Respeto a usuarios con reducción de movimiento */
@media (prefers-reduced-motion: reduce){
  .floating-leaves{ display: none; }
}

/* Pequeño vaivén de rotación */
@keyframes leaf-wobble{
  from{ transform: rotate(var(--tiltA, -8deg)); }
  to  { transform: rotate(var(--tiltB, 8deg)); }
}

