/* components.css — tarjetas, callout, pull quote, buscador, carrusel. Fuente: Design.md > Components */

/* Imagen con contención hairline */
.media { overflow: hidden; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--slate-100); }
.media img { width: 100%; height: 100%; object-fit: cover; }
.media--16x9 { aspect-ratio: 16 / 9; }
.media--4x3 { aspect-ratio: 4 / 3; }

.meta { display: flex; flex-wrap: wrap; gap: 0 0.5rem; color: var(--text-muted); font-size: 0.8125rem; line-height: 1.25rem; }
.meta > * + *::before { content: "·"; margin-right: 0.5rem; }
.meta__demo { font-weight: 700; color: #854d0e; } /* etiqueta de contenido de demostración (AA sobre blanco) */

/* Enlace que cubre toda la tarjeta (los pills quedan por encima con z-index) */
.card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card__link:hover { color: var(--emerald-text); }

/* Standard Card */
.card {
  position: relative; display: flex; flex-direction: column; background: #fff; overflow: hidden;
  border: 1px solid var(--line); border-radius: var(--r-lg);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-2); }
.card:focus-within { border-color: var(--emerald); }
.card .media { border: 0; border-radius: 0; border-bottom: 1px solid var(--line); }
.card__body { display: flex; flex-direction: column; gap: 0.625rem; padding: var(--space-md) 1.125rem 1.25rem; flex: 1; }
.card__title { font-size: 1.25rem; line-height: 1.75rem; font-weight: 600; }
.card__excerpt { color: var(--text-muted); font-size: 0.9375rem; line-height: 1.5rem; }
.card__body .meta { margin-top: auto; padding-top: 0.25rem; }

/* Tarjeta compacta (carrusel) */
.card--compact .card__title { font-size: 1.0625rem; line-height: 1.5rem; }
.card--compact .card__body { padding: 0.875rem 1rem 1rem; gap: 0.5rem; }

/* Tarjeta de "Recientes" (grande, con extracto) */
.card--wide { flex-direction: column; }
@media (min-width: 640px) {
  .card--wide { flex-direction: row; }
  .card--wide .media { flex: 0 0 42%; border-bottom: 0; border-right: 1px solid var(--line); aspect-ratio: auto; min-height: 13rem; }
  .card--wide .card__title { font-size: 1.5rem; line-height: 2rem; }
}

/* Featured Editorial Card (hero): 2 columnas asimétricas en escritorio */
.featured {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-lg);
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden;
}
.featured .media { border: 0; border-radius: 0; }
.featured__body { display: flex; flex-direction: column; gap: var(--space-md); padding: 0 var(--space-lg) var(--space-lg); }
.featured__title { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-weight: 600; }
.featured__lead { font-size: 1.125rem; line-height: 1.875rem; color: var(--text-muted); }
.author { display: flex; align-items: center; gap: 0.75rem; margin-top: var(--space-sm); }
.author__avatar {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: var(--ink); color: #fff; font-weight: 700; font-size: 0.875rem;
}
.author__avatar--logo { background: transparent; }
.author__avatar--logo img { width: 100%; height: 100%; object-fit: contain; }
.author__name { font-weight: 500; font-size: 0.9375rem; line-height: 1.25rem; }
@media (min-width: 1024px) {
  .featured { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: stretch; gap: 0; }
  .featured .media { aspect-ratio: auto; min-height: 30rem; height: 100%; order: 2; }
  .featured__body { justify-content: center; padding: var(--space-xl); order: 1; }
}

/* Science Data Callout Box */
.callout {
  background: var(--slate-50); border-left: 3px solid var(--emerald); border-radius: 0 var(--r-md) var(--r-md) 0;
  padding: var(--space-md) 1.25rem;
}
.callout__title { font-family: var(--font-sans); font-size: 0.6875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--emerald-text); margin-bottom: 0.375rem; }
.callout p { font-size: 0.9375rem; line-height: 1.5rem; color: var(--text); }

/* Pull Quote */
.pull-quote { text-align: center; max-width: 46rem; margin-inline: auto; padding-block: var(--space-lg); border-block: 1px solid var(--line-strong); }
.pull-quote__mark { display: block; font-family: var(--font-serif); font-size: 3.5rem; line-height: 1.5rem; height: 1.75rem; color: var(--emerald); }
.pull-quote p { font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: 1.25rem; line-height: 1.875rem; letter-spacing: -0.01em; color: var(--ink); }
.pull-quote footer { margin-top: var(--space-md); color: var(--text-muted); }
@media (min-width: 768px) { .pull-quote p { font-size: 1.5rem; line-height: 2.25rem; } }

/* Search Bar */
.search { position: relative; display: block; width: 100%; }
.search__icon { position: absolute; left: 0.875rem; top: 50%; width: 1.125rem; height: 1.125rem; transform: translateY(-50%); color: var(--text-muted); pointer-events: none; }
.search__input {
  width: 100%; height: 2.75rem; padding: 0 1rem 0 2.5rem; background: var(--slate-100);
  border: 1px solid transparent; border-radius: var(--r-full); outline: none;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.search__input::placeholder { color: #475569; }
.search__input:focus { background: #fff; border-color: var(--emerald); }

/* Bloque publicitario (sidebar) */
.ad-slot {
  display: grid; place-items: center; text-align: center; min-height: 15rem; padding: var(--space-md);
  border: 1px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--slate-50); color: var(--text-muted);
}

/* Widget Populares y categorías */
.popular { counter-reset: pop; }
.popular li { counter-increment: pop; display: flex; gap: 0.875rem; padding-block: 0.75rem; border-top: 1px solid var(--line); }
.popular li::before { content: counter(pop); font-family: var(--font-serif); font-size: 1.75rem; line-height: 1.75rem; font-weight: 600; color: var(--line-strong); min-width: 1.5rem; }
.popular a { font-family: var(--font-serif); font-weight: 600; font-size: 1.0625rem; line-height: 1.5rem; }
.popular a:hover { color: var(--emerald-text); }
.cat-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Carrusel "Lo más relevante" (primer bloque de la columna principal: sin espacio superior extra) */
#trending { padding-top: 0; }
.carousel { position: relative; }
.carousel__track {
  display: flex; gap: var(--space-md); overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: none; padding: 2px 2px 0.5rem;
}
.carousel__track::-webkit-scrollbar { display: none; }
.carousel__track > li { flex: 0 0 72%; scroll-snap-align: start; display: flex; }
.carousel__track > li > .card { width: 100%; }
.carousel__track.is-dragging { scroll-snap-type: none; scroll-behavior: auto; cursor: grabbing; user-select: none; }
/* Carrusel infinito (Noticias relacionadas): sin imanes de scroll; el movimiento continuo lo hace carousel.js */
.carousel__track--loop { scroll-snap-type: none; scroll-behavior: auto; }
.carousel__controls { display: none; gap: 0.5rem; }
.carousel__btn {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: 50%;
  background: #fff; border: 1px solid var(--line-strong); color: var(--ink);
  transition: background-color 150ms ease, color 150ms ease, opacity 150ms ease;
}
.carousel__btn:hover:not(:disabled) { background: var(--ink); color: #fff; }
.carousel__btn:disabled { opacity: 0.35; cursor: default; }
.carousel__btn svg { width: 1.125rem; height: 1.125rem; }
@media (min-width: 640px) { .carousel__track > li { flex-basis: 42%; } }
@media (min-width: 1024px) { .carousel__track > li { flex-basis: 31%; } .carousel__track { cursor: grab; } }
/* Flechas solo con puntero preciso; en táctil se usa swipe */
@media (hover: hover) and (pointer: fine) { .carousel__controls { display: flex; } }

/* Artículo individual */
.art-head { max-width: 48rem; margin-inline: auto; display: flex; flex-direction: column; gap: var(--space-md); padding-top: var(--space-xl); }
.art-title { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-weight: 600; }
.art-lead { font-size: 1.125rem; line-height: 1.875rem; color: var(--text-muted); }
.art-figure { max-width: 64rem; margin: var(--space-lg) auto 0; }
.art-figure figcaption { margin-top: 0.5rem; color: var(--text-muted); }
.art-body { max-width: 44rem; margin: var(--space-xl) auto 0; display: flex; flex-direction: column; gap: var(--space-md); }
.art-body p { font-size: 1.0625rem; line-height: 1.85rem; }
.art-body h2, .prose h2 { font-size: 1.75rem; line-height: 2.25rem; font-weight: 500; letter-spacing: -0.01em; margin-top: var(--space-md); }
.link { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; word-break: break-word; }
.link:hover { color: var(--emerald-text); }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: var(--space-md); }
.tags li { padding: 0.25rem 0.75rem; border: 1px solid var(--line); border-radius: var(--r-full); background: var(--slate-50); font-size: 0.8125rem; color: var(--text-muted); }

/* Páginas de texto (acerca de, legales, publicidad, contacto) */
.page-head { max-width: 48rem; padding-block: var(--space-xl) var(--space-md); display: flex; flex-direction: column; gap: var(--space-md); }
.page-head h1 { font-size: var(--fs-display); line-height: var(--lh-display); letter-spacing: var(--ls-display); font-weight: 600; }
.prose { max-width: 44rem; display: flex; flex-direction: column; gap: var(--space-md); padding-bottom: var(--space-xl); }
.prose p, .prose li { font-size: 1.0625rem; line-height: 1.85rem; }
.prose ul { list-style: disc; padding-left: 1.5rem; display: flex; flex-direction: column; gap: 0.25rem; }
.prose a { color: var(--cyan); text-decoration: underline; text-underline-offset: 3px; }
.prose a.btn { color: #fff; text-decoration: none; align-self: flex-start; }
.prose a.btn:hover { color: #fff; }

/* Equipo */
.team { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-lg); padding-bottom: var(--space-xl); }
@media (min-width: 640px) { .team { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.team__card { border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--space-lg); text-align: center; }
.team__photo { display: grid; place-items: center; width: 5rem; height: 5rem; margin: 0 auto var(--space-md); border-radius: 50%; background: var(--slate-100); border: 1px solid var(--line); color: var(--text-muted); font-family: var(--font-serif); font-size: 1.75rem; }
.team__photo { overflow: hidden; }
.team__photo img { width: 100%; height: 100%; object-fit: cover; }
.team__card h2 { font-size: 1.25rem; line-height: 1.75rem; }
.team__card p { color: var(--text-muted); font-size: 0.9375rem; }

/* Formularios */
.form { display: flex; flex-direction: column; gap: var(--space-md); max-width: 36rem; padding-bottom: var(--space-xl); }
.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field label { font-weight: 500; font-size: 0.9375rem; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.75rem 1rem; background: var(--slate-100); border: 1px solid transparent; border-radius: var(--r-lg); outline: none;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.field textarea { min-height: 9rem; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { background: #fff; border-color: var(--emerald); }
.form__status { font-size: 0.9375rem; color: var(--text-muted); }
.form__status.is-ok { color: var(--emerald-text); }
.field__error { font-size: 0.875rem; color: #b42318; }
.field__error[hidden] { display: none; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: #b42318; }
.form-aviso { max-width: 36rem; margin-bottom: var(--space-lg); }
.form__fieldset { display: flex; flex-direction: column; gap: var(--space-md); min-width: 0; margin: 0; padding: 0; border: 0; }
.form__fieldset:disabled { opacity: 0.55; }
.form__fieldset:disabled .btn, .form__fieldset:disabled input, .form__fieldset:disabled select, .form__fieldset:disabled textarea { cursor: not-allowed; }

/* Espacios publicitarios */
.ad-types { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-md); padding-bottom: var(--space-xl); }
@media (min-width: 768px) { .ad-types { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Estados de carga/error */
.state-msg { padding: var(--space-lg); border: 1px dashed var(--line-strong); border-radius: var(--r-lg); color: var(--text-muted); }

@media (prefers-reduced-motion: reduce) {
  .card:hover { transform: none; }
  .carousel__track { scroll-behavior: auto; }
}

/* Aviso de cookies de analítica (assets/js/analytics.js): mismos botones para Aceptar y Rechazar */
.cookie-banner { position: fixed; left: 0.75rem; right: 0.75rem; bottom: 0.75rem; z-index: 60; display: flex; flex-direction: column; gap: var(--space-md); max-width: 36rem; padding: var(--space-md); background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.14); }
.cookie-banner__texto { margin: 0; font-size: 0.9375rem; line-height: 1.5rem; color: var(--text); }
.cookie-banner__texto a { color: var(--emerald-text); text-decoration: underline; text-underline-offset: 3px; }
.cookie-banner__acciones { display: flex; gap: var(--space-sm); }
.cookie-banner__btn { flex: 1; background: #fff; color: var(--ink); border-color: var(--ink); }
.cookie-banner__btn:hover, .cookie-banner__btn:focus-visible { background: var(--ink); color: #fff; }
@media (min-width: 640px) { .cookie-banner { right: auto; left: 1.25rem; bottom: 1.25rem; } .cookie-banner__btn { flex: 0 0 auto; } }
@media print { .cookie-banner { display: none; } }
.link-btn { padding: 0; background: none; border: 0; font: inherit; color: #e2e8f0; cursor: pointer; }
.link-btn:hover { color: #6ee7b7; text-decoration: underline; text-underline-offset: 3px; }
/* Formulario de solicitudes de privacidad: campo trampa oculto y estado de error */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form__status.is-error { color: #b42318; font-weight: 500; }