/* ==========================================================================
   Baitácora - Prototipo Multi-página
   Estética: Educativa, sobria, cálida y contemporánea. Centrada en la lectura.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Variables de diseño y paleta cromática
   -------------------------------------------------------------------------- */
:root {
  /* Fondo claro cálido y superficies */
  --color-bg: #fbfaf7;
  --color-surface: #ffffff;
  --color-border: #e8e6df;
  --color-border-subtle: #f0eee8;

  /* Tipografía oscura de alto contraste */
  --color-text-main: #1d252c;
  --color-text-body: #2c3640;
  --color-text-muted: #546270;

  /* Acento: Azul Petróleo */
  --color-petroleo: #0f4c5c;
  --color-petroleo-hover: #09333f;
  --color-petroleo-light: #eef5f7;
  --color-petroleo-border: rgba(15, 76, 92, 0.22);

  /* Foco accesible */
  --focus-ring: 2px solid var(--color-petroleo);
  --focus-offset: 3px;

  /* Tipografías del sistema (sin dependencias externas) */
  --font-serif: "Charter", "Bitstream Charter", "Sitka Text", "Cambria", Georgia, serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Contenedores y espaciados */
  --max-width: 860px;
  --header-height: 4.25rem;
  --radius-sm: 4px;
  --radius-md: 8px;
}

/* --------------------------------------------------------------------------
   Reset básico y configuración global
   (Distribución fluida sin overflow-x: hidden)
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 100%;
}

body {
  background-color: var(--color-bg);
  color: var(--color-text-body);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

/* Contenedor centralizado */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

@media (max-width: 360px) {
  .container {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Accesibilidad de foco */
a:focus-visible,
button:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

/* --------------------------------------------------------------------------
   Soporte para prefers-reduced-motion: reduce
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------------------------------------------------
   Encabezado y Navegación
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(251, 250, 247, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--color-border);
  min-height: var(--header-height);
  display: flex;
  align-items: center;
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}

.site-brand {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-text-main);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: color 0.2s ease;
}

.site-brand:hover {
  color: var(--color-petroleo);
}

/* Navegación de escritorio */
.primary-nav .nav-list {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  align-items: center;
}

.nav-link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9375rem;
  font-weight: 500;
  padding: 0.35rem 0.15rem;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-link:hover {
  color: var(--color-petroleo);
  border-bottom-color: var(--color-petroleo);
}

/* Identificación visual de página activa o sección destacada */
.nav-link[aria-current="page"],
.nav-link.is-section-active {
  color: var(--color-petroleo);
  border-bottom-color: var(--color-petroleo);
  font-weight: 600;
}

/* Botón de menú móvil */
.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  cursor: pointer;
  color: var(--color-text-main);
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.menu-toggle:hover {
  background-color: var(--color-surface);
  border-color: var(--color-petroleo-border);
}

.menu-bar {
  display: block;
  width: 1.25rem;
  height: 2px;
  background-color: var(--color-text-main);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.menu-bar + .menu-bar {
  margin-top: 4px;
}

/* Animación a icono "X" cuando el menú está abierto */
.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle[aria-expanded="true"] .menu-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* --------------------------------------------------------------------------
   Presentación principal (Hero - Portada index.html)
   -------------------------------------------------------------------------- */
.hero-section {
  padding-top: 4.5rem;
  padding-bottom: 5rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  overflow-wrap: break-word;
}

.hero-subtitle {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 2.5vw, 1.5rem);
  font-weight: 400;
  color: var(--color-petroleo);
  line-height: 1.35;
  margin-bottom: 1.5rem;
  overflow-wrap: break-word;
}

.hero-text {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-body);
  max-width: 60ch;
  margin-bottom: 2.25rem;
  overflow-wrap: break-word;
}

.hero-action {
  display: flex;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-petroleo);
  color: #ffffff;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  padding: 0.85rem 1.75rem;
  border-radius: var(--radius-sm);
  transition: background-color 0.2s ease, transform 0.1s ease;
  letter-spacing: 0.01em;
  max-width: 100%;
  text-align: center;
}

.btn-primary:hover {
  background-color: var(--color-petroleo-hover);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* --------------------------------------------------------------------------
   Páginas Interiores (Materias, Apuntes, Sobre Baitácora)
   -------------------------------------------------------------------------- */
.page-section {
  padding-top: 3.5rem;
  padding-bottom: 4.5rem;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-family: var(--font-serif);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  overflow-wrap: break-word;
}

.page-subtitle {
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--color-text-body);
  max-width: 65ch;
  margin-bottom: 0;
  overflow-wrap: break-word;
}

.page-eyebrow {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-petroleo);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   Navegación de Ubicación (Migas de pan / Breadcrumbs)
   -------------------------------------------------------------------------- */
.breadcrumbs {
  margin-bottom: 1.5rem;
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  gap: 0.35rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
}

.breadcrumb-item {
  display: inline-flex;
  align-items: center;
}

.breadcrumb-link {
  color: var(--color-petroleo);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.breadcrumb-link:hover {
  color: var(--color-petroleo-hover);
  text-decoration: underline;
}

.breadcrumb-separator {
  color: var(--color-text-muted);
  font-size: 0.8125rem;
  user-select: none;
}

.breadcrumb-current {
  color: var(--color-text-main);
  font-weight: 500;
}

.subject-link {
  color: var(--color-text-main);
  text-decoration: none;
  transition: color 0.2s ease;
}

.subject-link:hover {
  color: var(--color-petroleo);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Tarjetas y Bloques de Contenido
   -------------------------------------------------------------------------- */
.content-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 2.25rem 2.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.card-header--stacked {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 1.35rem;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 700;
  color: var(--color-text-main);
  letter-spacing: -0.01em;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.section-text {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text-body);
  max-width: 65ch;
  overflow-wrap: break-word;
}

/* Estado visible y discreto */
.status-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-petroleo);
  background-color: var(--color-petroleo-light);
  border: 1px solid var(--color-petroleo-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  line-height: 1.35;
  letter-spacing: 0.01em;
  white-space: normal;
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Estructura de Materias por Universidad
   -------------------------------------------------------------------------- */
.university-group {
  margin-top: 1.5rem;
}

.university-group + .university-group {
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--color-border-subtle);
}

.university-title {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-petroleo);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
  line-height: 1.35;
  overflow-wrap: break-word;
}

.subject-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.subject-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 1.125rem 1.25rem;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

@media (min-width: 560px) {
  .subject-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
  }
}

@media (max-width: 360px) {
  .subject-card {
    padding: 1rem;
  }
}

.subject-title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.3;
  margin: 0;
  overflow-wrap: break-word;
}

.subject-card .status-badge {
  margin: 0;
}

/* --------------------------------------------------------------------------
   Listado de Instituciones (Materias)
   -------------------------------------------------------------------------- */
.institution-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.institution-card {
  padding: 1.125rem 1.25rem;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.institution-card:hover {
  border-color: var(--color-petroleo-border);
  background-color: #f6f5ef;
}

.institution-title {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  overflow-wrap: break-word;
}

.institution-link {
  color: var(--color-text-main);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  transition: color 0.2s ease;
}

.institution-link:hover {
  color: var(--color-petroleo);
  text-decoration: underline;
}

.institution-link::after {
  content: "→";
  color: var(--color-petroleo);
  font-size: 1.1rem;
  font-weight: 400;
  transition: transform 0.2s ease;
}

.institution-link:hover::after {
  transform: translateX(4px);
}

/* --------------------------------------------------------------------------
   Espacio de Venta (Tienda y Productos)
   -------------------------------------------------------------------------- */
.format-badge {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8c4a16;
  background-color: #fdf5ee;
  border: 1px solid rgba(199, 108, 43, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.2rem 0.55rem;
  line-height: 1.3;
}

.category-group {
  margin-top: 1rem;
}

.category-title {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--color-petroleo);
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
  line-height: 1.35;
  overflow-wrap: break-word;
}

.product-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.product-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.25rem 1.35rem;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.product-card-main {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 1.25rem;
  flex: 1 1 auto;
}

.product-card-thumb-link {
  display: inline-flex;
  flex-shrink: 0;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.product-thumb-img {
  width: 90px;
  max-width: 90px;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  object-fit: contain;
}

.product-card-thumb-link:hover .product-thumb-img {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16);
}

.product-title-link {
  color: var(--color-text-main);
  text-decoration: none;
  transition: color 0.2s ease;
}

.product-title-link:hover {
  color: var(--color-petroleo);
  text-decoration: underline;
}

@media (min-width: 640px) {
  .product-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
  }

  .product-thumb-img {
    width: 105px;
    max-width: 105px;
  }

  .product-card-action {
    flex-shrink: 0;
  }
}

.product-info {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.product-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.3;
  margin: 0;
  overflow-wrap: break-word;
}

.product-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.link-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-petroleo);
  font-weight: 600;
  font-size: 0.9375rem;
  text-decoration: none;
  padding: 0.55rem 1.15rem;
  border: 1px solid var(--color-petroleo-border);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
  align-self: flex-start;
}

.link-action:hover {
  background-color: var(--color-petroleo-light);
  color: var(--color-petroleo-hover);
  border-color: var(--color-petroleo);
  text-decoration: underline;
}

.product-detail-header {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.product-detail-header .product-meta {
  margin-top: 0.25rem;
}

/* --------------------------------------------------------------------------
   Página Promocional: Guía Interactiva (Cómo evitar estafas por WhatsApp)
   -------------------------------------------------------------------------- */
#que-incluye {
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.promo-container {
  display: flex;
  flex-direction: column;
  gap: 2.25rem;
}

.promo-hero-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 4px solid #c76c2b;
  border-radius: var(--radius-md);
  padding: 2.25rem 2.5rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.promo-hero-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

.promo-cover-wrapper {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}

.promo-cover-img {
  width: 100%;
  max-width: 230px;
  height: auto;
  display: block;
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
  object-fit: contain;
}

.promo-hero-body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

@media (min-width: 768px) {
  .promo-hero-layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 2.5rem;
  }

  .promo-cover-wrapper {
    width: 295px;
    max-width: 295px;
    flex-shrink: 0;
  }

  .promo-cover-img {
    max-width: 295px;
  }

  .promo-hero-body {
    flex: 1 1 auto;
  }
}

.promo-eyebrow {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8c4a16;
  background-color: #fdf5ee;
  border: 1px solid rgba(199, 108, 43, 0.3);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  margin-bottom: 1.25rem;
  line-height: 1.35;
}

.promo-title {
  margin-bottom: 0.75rem;
}

.promo-lead {
  font-family: var(--font-serif);
  font-size: clamp(1.2rem, 2.5vw, 1.45rem);
  font-weight: 600;
  color: var(--color-petroleo);
  line-height: 1.4;
  margin-bottom: 1rem;
  max-width: 60ch;
}

.promo-description {
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-text-body);
  max-width: 65ch;
  margin-bottom: 1.75rem;
}

.promo-action {
  display: flex;
}

.promo-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.promo-section + .promo-section {
  margin-top: 2.25rem;
  padding-top: 2rem;
  border-top: 1px solid var(--color-border-subtle);
}

.promo-section-title {
  font-family: var(--font-serif);
  font-size: clamp(1.35rem, 2.5vw, 1.75rem);
  font-weight: 700;
  color: var(--color-text-main);
  letter-spacing: -0.01em;
  line-height: 1.3;
  margin: 0;
  overflow-wrap: break-word;
}

.promo-section-text {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--color-text-body);
  max-width: 65ch;
  margin: 0;
}

/* Grilla de 4 bloques de características */
.feature-grid {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  margin-top: 0.5rem;
}

@media (min-width: 640px) {
  .feature-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.feature-card {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 1.35rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.feature-card:hover {
  border-color: var(--color-petroleo-border);
  background-color: #f7f6f1;
}

.feature-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-petroleo);
  line-height: 1.3;
  margin: 0;
}

.feature-desc {
  font-size: 0.9625rem;
  line-height: 1.6;
  color: var(--color-text-body);
  margin: 0;
}

/* Grilla de temas */
.topics-list {
  list-style: none;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem 1.5rem;
  margin-top: 0.5rem;
}

@media (min-width: 600px) {
  .topics-list {
    grid-template-columns: 1fr 1fr;
  }
}

.topic-item {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  font-size: 1.03125rem;
  line-height: 1.5;
  color: var(--color-text-body);
  padding: 0.35rem 0;
}

.topic-bullet {
  color: #c76c2b;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}

/* Caja de autoría */
.author-box {
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-petroleo);
  border-radius: var(--radius-sm);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.author-heading {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: 0.2rem;
}

.author-name {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-text-main);
  margin: 0;
}

.author-collection {
  font-size: 0.9375rem;
  font-weight: 600;
  color: #8c4a16;
  margin: 0;
}

/* Caja de cierre */
.closing-box {
  background-color: #fdfcf9;
  border: 1px solid rgba(199, 108, 43, 0.35);
  border-left: 4px solid #c76c2b;
  border-radius: var(--radius-md);
  padding: 2rem 2.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.closing-title {
  font-family: var(--font-serif);
  font-size: clamp(1.3rem, 2.5vw, 1.65rem);
  font-weight: 700;
  color: var(--color-petroleo);
  line-height: 1.3;
  margin: 0;
}

.closing-text {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--color-text-body);
  margin: 0;
  max-width: 60ch;
}

.closing-status {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 600;
  color: #8c4a16;
  background-color: #fdf5ee;
  border: 1px solid rgba(199, 108, 43, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.85rem;
  margin-top: 0.35rem;
}

@media (max-width: 600px) {
  .promo-hero-card,
  .closing-box {
    padding: 1.65rem 1.25rem;
  }
}

/* --------------------------------------------------------------------------
   Programa de Asignatura y Unidades Temáticas
   -------------------------------------------------------------------------- */
.badge-access {
  display: inline-flex;
  align-items: center;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-petroleo);
  background-color: var(--color-petroleo-light);
  border: 1px solid var(--color-petroleo-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  line-height: 1.35;
  margin-top: 1rem;
}

.units-header {
  margin-bottom: 1.75rem;
}

.units-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.unit-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 1.35rem;
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.unit-card:hover {
  border-color: var(--color-petroleo-border);
  background-color: #f7f6f1;
}

.unit-card-main {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.unit-number {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-petroleo);
  display: inline-block;
}

.unit-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-main);
  line-height: 1.35;
  margin: 0;
  overflow-wrap: break-word;
}

.unit-title-link {
  color: var(--color-text-main);
  text-decoration: none;
  transition: color 0.2s ease;
}

.unit-title-link:hover {
  color: var(--color-petroleo);
  text-decoration: underline;
}

.unit-description {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text-body);
  margin-top: 0.35rem;
}

.unit-resources {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

@media (min-width: 640px) {
  .unit-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
  }

  .unit-card-main {
    flex: 1 1 auto;
  }

  .unit-resources {
    flex-shrink: 0;
    justify-content: flex-end;
  }
}

/* Utilidad accesible */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* --------------------------------------------------------------------------
   Pie de página
   -------------------------------------------------------------------------- */
.site-footer {
  margin-top: auto;
  padding-top: 2.25rem;
  padding-bottom: 3rem;
  border-top: 1px solid var(--color-border);
  background-color: var(--color-bg);
}

.footer-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
}

@media (min-width: 640px) {
  .footer-container {
    flex-direction: row;
  }
}

.footer-brand {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.back-to-top {
  color: var(--color-petroleo);
  font-size: 0.9375rem;
  text-decoration: none;
  font-weight: 500;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.back-to-top:hover {
  color: var(--color-petroleo-hover);
  text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Comportamiento Responsive (Móvil y Tablet)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .menu-toggle {
    display: inline-flex;
    flex-direction: column;
  }

  .primary-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background-color: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 1.25rem 1.5rem 1.75rem;
    box-shadow: 0 12px 24px -6px rgba(0, 0, 0, 0.08);
    display: none;
  }

  .primary-nav.is-open {
    display: block;
  }

  .primary-nav .nav-list {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .nav-link {
    display: block;
    width: 100%;
    padding: 0.65rem 0;
    font-size: 1.0625rem;
    border-bottom: 1px solid var(--color-border-subtle);
  }

  .nav-link[aria-current="page"],
  .nav-link.is-section-active {
    color: var(--color-petroleo);
    border-bottom-color: var(--color-petroleo);
  }

  .hero-section {
    padding-top: 3.5rem;
    padding-bottom: 4rem;
  }

  .page-section {
    padding-top: 2.75rem;
    padding-bottom: 3.5rem;
  }

  .content-card {
    padding: 1.75rem 1.25rem;
  }
}

@media (max-width: 360px) {
  .content-card {
    padding: 1.5rem 1rem;
  }

  .btn-primary {
    width: 100%;
  }
}

/* ==========================================================================
   Portada: Tema Integrado con Fondo de Circuitos (exclusivo para .page-home)
   ========================================================================== */
body.page-home {
  background-color: #0a1921; /* Color azul petróleo oscuro de respaldo */
  color: #f5f4ef;
}

/* Encabezado integrado */
.page-home .site-header {
  background-color: rgba(9, 23, 31, 0.96);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.page-home .site-brand {
  color: #fbfaf7; /* Blanco cálido / marfil */
}

.page-home .site-brand:hover {
  color: #e5a170; /* Cobre luminoso */
}

.page-home .nav-link {
  color: #b5c4ce; /* Contraste óptimo sobre fondo oscuro */
}

.page-home .nav-link:hover {
  color: #ffffff;
  border-bottom-color: #e5a170;
}

.page-home .nav-link[aria-current="page"] {
  color: #ffffff;
  border-bottom-color: #e5a170; /* Indicador cobre */
}

.page-home .menu-toggle {
  border-color: rgba(255, 255, 255, 0.22);
  color: #fbfaf7;
}

.page-home .menu-toggle:hover {
  background-color: rgba(255, 255, 255, 0.06);
  border-color: #e5a170;
}

.page-home .menu-bar {
  background-color: #fbfaf7;
}

.page-home a:focus-visible,
.page-home button:focus-visible {
  outline: 2px solid #e5a170;
  outline-offset: 3px;
}

/* Menú móvil en portada */
@media (max-width: 768px) {
  .page-home .primary-nav {
    background-color: #0a1921;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 12px 28px -4px rgba(0, 0, 0, 0.5);
  }

  .page-home .nav-link {
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    color: #cad6df;
  }

  .page-home .nav-link[aria-current="page"] {
    color: #ffffff;
    border-bottom-color: #e5a170;
  }
}

/* Área principal de presentación (Hero) con fondo de circuitos */
.page-home .hero-section {
  position: relative;
  background-color: #0a1921; /* Respaldo azul petróleo mientras carga la imagen */
  background-image: 
    linear-gradient(to right, rgba(9, 23, 31, 0.95) 0%, rgba(9, 23, 31, 0.84) 45%, rgba(9, 23, 31, 0.2) 75%, rgba(9, 23, 31, 0) 100%),
    url('baitacora-b-circuitos.png');
  background-size: cover;
  background-repeat: no-repeat;
  background-position: right center;
  min-height: calc(100vh - var(--header-height) - 5.5rem);
  display: flex;
  align-items: center;
  padding-top: 4.5rem;
  padding-bottom: 5.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.page-home .hero-container {
  display: flex;
  width: 100%;
}

.page-home .hero-content {
  max-width: 580px; /* Ubica el texto en la zona izquierda despejada */
  width: 100%;
}

.page-home .hero-title {
  color: #fbfaf7; /* Blanco cálido / marfil */
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.page-home .hero-subtitle {
  color: #eedccf; /* Marfil cálido suave */
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.page-home .hero-text {
  color: #d6e0e6; /* Marfil / gris claro con contraste superior a 10:1 */
  line-height: 1.75;
}

/* Botón "Conocer los espacios": acento cobre claro / terracota luminoso con texto oscuro */
.page-home .btn-primary {
  background-color: #e5a170; /* Cobre claro / terracota luminoso */
  color: #0e171c; /* Texto oscuro de alto contraste */
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(229, 161, 112, 0.3);
}

.page-home .btn-primary:hover {
  background-color: #efae80;
  color: #070e12;
}

.page-home .btn-primary:active {
  transform: translateY(1px);
}

/* Pie de página integrado en portada */
.page-home .site-footer {
  background-color: #071319;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.page-home .footer-brand {
  color: #8da0ad;
}

.page-home .back-to-top {
  color: #e5a170; /* Cobre luminoso */
}

.page-home .back-to-top:hover {
  color: #efae80;
}

/* Adaptación responsive para celulares en portada */
@media (max-width: 768px) {
  .page-home .hero-section {
    background-image: 
      linear-gradient(to bottom, rgba(9, 23, 31, 0.95) 0%, rgba(9, 23, 31, 0.88) 55%, rgba(9, 23, 31, 0.65) 100%),
      url('baitacora-b-circuitos.png');
    background-position: 80% center;
    min-height: auto;
    height: auto; /* Permite crecer con el contenido, evitando alturas fijas */
    padding-top: 3.5rem;
    padding-bottom: 4rem;
  }

  .page-home .hero-content {
    max-width: 100%;
  }
}

@media (max-width: 360px) {
  .page-home .hero-section {
    padding-top: 3rem;
    padding-bottom: 3.5rem;
  }
}
