:root {
  /* Paleta solicitada */
  --bg: #f2f4f7; /* gris claro */
  --bordo: #8B1E3F; /* bordo */
  --bordo-700: #6f1732;
  --celeste-osc: #0b3d5c; /* celeste oscuro */
  --text: #0c1117; /* texto principal */
  --muted: #475569; /* texto secundario */
  --border: #e5e7eb; /* bordes */
  --card: #ffffff; /* fondo tarjeta */
  
  /* Fuentes */
  --font-family-body: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Arial, sans-serif;

  /* Espaciado */
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --space-5: 24px;
}

/* Base */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family-body);
  line-height: 1.65;
  font-size: 16.5px;
}

/* Tipografía */
h1 {
  margin: 0 0 6px 0;
  font-size: clamp(24px, 3.6vw, 38px);
  letter-spacing: .2px;
  color: var(--celeste-osc);
  font-weight: 800;
}

/* Estilo para los enlaces generales */
a {
  color: var(--celeste-osc);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

a:hover,
a:focus {
  color: #FFF;
  text-decoration: underline;
  text-decoration-color: #FFF;
}

a:focus-visible {
  outline: 3px solid var(--bordo);
  outline-offset: 2px;
}

/* Estilo para el botón de descarga
  Aseguramos que el estado :hover del botón NO tenga subrayado
*/
.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: var(--celeste-osc);
  color: #fff;
  font-weight: 600;
  text-decoration: none; /* Asegura que el botón no tenga subrayado por defecto */
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(11, 61, 92, .25);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  margin: 5px;
}

.btn-download:hover {
  background: #115784;
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(11, 61, 92, .35);
  text-decoration: none; /* Vuelve a declarar que no debe tener subrayado */
}

.btn-download:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(11, 61, 92, .2);
}

/* Estilo para el ícono SVG dentro del botón */
.btn-download svg {
  width: 20px;
  height: 20px;
  stroke: #fff;
}

.sub {
  color: var(--muted);
  margin: 0 0 14px 0;
  font-size: clamp(14px, 2.2vw, 16px);
}

.commission h2 {
  margin: 0;
  font-size: clamp(18px, 2.8vw, 22px);
  color: var(--bordo);
  font-weight: 800;
}

.block h3 {
  margin: 10px 0 10px 6px;
  font-size: clamp(16px, 2.4vw, 18px);
  color: var(--celeste-osc);
  font-weight: 700;
  letter-spacing: .2px;
}

.title {
  font-weight: 800;
  margin: 6px 0;
  line-height: 1.35;
  font-size: clamp(17px, 2.6vw, 20px);
  color: #111827;
}

.authors {
  font-size: clamp(16px, 2.4vw, 18px);
  color: var(--celeste-osc);
  font-weight: 700;
  margin-top: 2px;
}

/* Estructura y Layout */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, rgba(242, 244, 247, .96), rgba(242, 244, 247, .9));
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.header-image {
  width: 100%;
  height: auto;
  display: block;
}

.header .wrap {
  display: flex;
  align-items: center;
  gap: 15px;
}

.wrap {
  max-width: 1140px;
  margin: 0 auto;
  padding: 18px;
}

main {
    max-width: 1200px; /* Ancho máximo para legibilidad en pantallas grandes */
    margin: 2rem auto; /* Centra el contenido */
    padding: 1rem 2rem; /* Espaciado interno */
}

.searchbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 6px 0 2px 0;
}

.searchbar input {
  flex: 1;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff;
  border: 2px solid var(--border);
  color: var(--text);
  outline: none;
  font-size: 16px;
  font-weight: 500;
}

.searchbar input:focus {
  border-color: var(--celeste-osc);
  box-shadow: 0 0 0 3px rgba(11, 61, 92, .15);
}

.searchbar input::placeholder {
  color: #8fa0b3;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 2px 0;
}

.tab {
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
  color: var(--celeste-osc);
  font-weight: 700;
  letter-spacing: .2px;
}

.tab.active {
  background: linear-gradient(90deg, var(--bordo), var(--celeste-osc));
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(139, 30, 63, .25);
}

.commission {
  border-left: 5px solid var(--bordo);
  padding-left: 14px;
  margin: 28px 0;
}

.commission .h2 {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.block {
  margin: 14px 0 8px 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

/* Tarjetas */
.card {
  position: relative;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, .06);
  transition: transform .06s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 23, 42, .10);
}

.order {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--bordo);
  color: #fff;
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: .4px;
  box-shadow: 0 6px 14px rgba(139, 30, 63, .25);
}

.footer {
  color: var(--muted);
  text-align: center;
  font-size: 13px;
  margin: 28px 0 18px 0;
}

/* Accesibilidad y Usabilidad */
button:focus-visible, 
.tab:focus-visible, 
input:focus-visible {
  outline: 3px solid var(--bordo);
  outline-offset: 2px;
}

/* Media Queries */
@media (max-width: 480px) {
  body {
    font-size: 17px;
  }
  
  .searchbar input {
    font-size: 17px;
  }
  
  .grid {
    grid-template-columns: 1fr;
  }
  
  .card {
    padding: 20px;
  }
  
  .order {
    top: 8px;
    right: 8px;
  }
  
  .commission {
    border-left: 8px solid var(--bordo);
    padding-left: 8px;
  }
  
  .wrap {
    padding: 18px 0;
  }
}
/* ===== Mejores defaults responsive & accesibilidad ===== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-size: clamp(15.5px, 1.7vw, 17px); /* afina legibilidad entre 320–1440px */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Evita subrayado accidental en el botón y asegura foco visible */
.btn-download:hover,
.btn-download:focus {
  text-decoration: none;
}
.btn-download:focus-visible {
  outline: 3px solid var(--bordo);
  outline-offset: 2px;
}

/* Header más sólido en iOS + wrap limpio en mobile */
.header {
  padding-top: env(safe-area-inset-top);
}
.header .wrap {
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
}
.header .wrap > * {
  flex: 0 1 auto;
}

/* Main container respira mejor en móviles */
main {
  max-width: min(1200px, 92vw);
  padding: clamp(12px, 2vw, 24px);
}

/* Searchbar full-width en mobile y foco visible */
.searchbar {
  width: 100%;
}
.searchbar input {
  width: 100%;
  min-height: 44px; /* target táctil */
}

/* Tabs scrolleables en móviles + snap */
.tabs {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  gap: 8px;
  padding-bottom: 6px;
}
.tab {
  scroll-snap-align: start;
  white-space: nowrap;
  min-height: 40px;
  padding: 10px 14px;
}

/* Grid más tolerante en pantallas angostas */
@media (max-width: 480px) {
  .grid {
    grid-template-columns: 1fr; /* ya lo tenés; lo dejamos explícito */
    gap: 12px;
  }
}

/* Ajuste fino para dispositivos muy angostos (<=360px) */
@media (max-width: 360px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  .card {
    padding: 16px;
  }
  .order {
    font-size: 13px;
    padding: 5px 8px;
  }
}

/* Mejoras tipográficas graduales */
.title {
  font-size: clamp(16px, 2.4vw, 20px);
}
.authors {
  font-size: clamp(15px, 2.2vw, 18px);
}

/* Comisión: reduce borde/offset en mobile y mejora alineación */
@media (max-width: 480px) {
  .commission {
    border-left: 6px solid var(--bordo);
    padding-left: 10px;
    margin: 22px 0;
  }
}

/* Hover sensible a dispositivos sin hover (evita saltitos en touch) */
@media (hover: hover) and (pointer: fine) {
  .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(15, 23, 42, .10);
  }
  .btn-download:hover {
    transform: translateY(-2px);
  }
}

/* Respeta reducción de movimiento del usuario */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Header compacto cuando hay muchos elementos */
@media (max-width: 768px) {
  .header .wrap {
    align-items: flex-start;
  }
  .header .wrap h1 {
    flex: 1 1 100%;
    order: -1; /* título arriba */
    margin-bottom: 6px;
  }
  .btn-download {
    padding: 10px 16px;
    gap: 6px;
  }
}

/* Grilla: respira mejor en tablets */
@media (min-width: 768px) and (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
  }
}

/* Max-width progresivo en pantallas grandes */
@media (min-width: 1400px) {
  .wrap {
    max-width: 1280px;
  }
  main {
    max-width: 1280px;
  }
}

/* (Opcional) Variante de botón secundario con paleta definida */
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  color: var(--celeste-osc);
  border: 2px solid var(--celeste-osc);
  border-radius: 10px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(11, 61, 92, .08);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.btn-secondary:hover {
  background: #f7fafc;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(11, 61, 92, .18);
}
.btn-secondary:focus-visible {
  outline: 3px solid var(--bordo);
  outline-offset: 2px;
}

