/*
 * Bloque «Noticias» (hakuna/noticias): tarjetas + modal con el aspecto de las
 * Cartas de Josepe del espacio del pringado (assets/css/mi-perfil.css,
 * `.hk-pringado-card`, `.hk-pringado-modal`). Paleta en variables; el modal se
 * mueve a <body> desde JS, así que lleva sus propias variables.
 */

.hk-noticias,
.hk-noticias-modal {
  --hkn-heading: #2c423d;
  --hkn-ink: #0f1e37;
  --hkn-text: #283551;
  --hkn-muted: #5f7597;
  --hkn-line: rgba(29, 44, 76, 0.12);
  --hkn-surface: #fff;
  --hkn-media-bg: linear-gradient(120deg, #eef5ff, #f8fbff);
  --hkn-accent: #0e6f98;
  --hkn-accent-strong: #1a5f83;
  --hkn-accent-bg: #f7fbff;
  --hkn-accent-line: #cae7f6;
  --hkn-link: #0d6b93;
  --hkn-more-ink: #1f5f96;
  --hkn-more-bg: linear-gradient(120deg, #edf4ff, #dcecff);
  --hkn-more-line: #9ec1e8;
  --hkn-shadow: 0 14px 32px rgba(11, 26, 55, 0.1);
  --hkn-shadow-hover: 0 20px 40px rgba(11, 26, 55, 0.16);
  --hkn-backdrop: rgba(8, 16, 34, 0.72);
  --hkn-error: #b42318;
  --hkn-radius: 16px;
  --hkn-font: var(--wp--preset--font-family--montserrat, "Montserrat", sans-serif);
}

.hk-noticias,
.hk-noticias *,
.hk-noticias *::before,
.hk-noticias *::after,
.hk-noticias-modal,
.hk-noticias-modal *,
.hk-noticias-modal *::before,
.hk-noticias-modal *::after {
  box-sizing: border-box;
}

/* ── Sección ─────────────────────────────────────────────── */

/* Padding y no margin: el layout de WordPress anula el margen del último bloque. */
/* El lateral lo pone el contenedor del tema (`has-global-padding`, 24px en
   móvil); solo a ancho completo hace falta uno propio. */
.hk-noticias {
  padding: clamp(48px, 7vw, 96px) 0 clamp(56px, 8vw, 104px);
  font-family: var(--hkn-font);
  color: var(--hkn-text);
}

.hk-noticias.alignfull {
  padding-left: clamp(16px, 4vw, 48px);
  padding-right: clamp(16px, 4vw, 48px);
}

/* Como los títulos de sección de la página (p. ej. «ASOCIACIÓN & FUNDACIÓN»). */
.hk-noticias .hk-noticias__heading {
  margin: 0 0 clamp(20px, 3vw, 36px);
  color: var(--hkn-heading);
  font-size: clamp(1.743rem, 1.743rem + ((1vw - 0.266rem) * 2.595), 3rem);
  font-weight: 900;
  line-height: 1.1;
  text-align: center;
  text-transform: uppercase;
}

/* Columnas de ancho fijo con `auto-fit`: si hay menos noticias que columnas
   (p. ej. 2 en inglés) se centran en vez de quedarse a la izquierda. */
.hk-noticias .hk-noticias__grid {
  --hkn-gap: clamp(14px, 2vw, 22px);
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-content: center;
  gap: var(--hkn-gap);
  margin: 0;
  padding: 0;
}

@media (min-width: 600px) {
  .hk-noticias .hk-noticias__grid {
    grid-template-columns: repeat(auto-fit, calc((100% - var(--hkn-gap)) / 2));
  }
}

@media (min-width: 1024px) {
  .hk-noticias .hk-noticias__grid {
    grid-template-columns: repeat(auto-fit, calc((100% - 3 * var(--hkn-gap)) / 4));
  }
}

.hk-noticias .hk-noticias__empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--hkn-line);
  border-radius: var(--hkn-radius);
  color: var(--hkn-muted);
  text-align: center;
}

/* ── Tarjeta ─────────────────────────────────────────────── */

.hk-noticias .hk-noticia-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--hkn-line);
  border-radius: var(--hkn-radius);
  background: var(--hkn-surface);
  box-shadow: var(--hkn-shadow);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.hk-noticias .hk-noticia-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--hkn-shadow-hover);
}

.hk-noticias .hk-noticia-card.is-new {
  animation: hk-noticia-in 0.35s ease-out both;
  animation-delay: var(--hk-noticia-delay, 0ms);
}

@keyframes hk-noticia-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.hk-noticias .hk-noticia-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--hkn-media-bg);
}

.hk-noticias .hk-noticia-card__img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.hk-noticias .hk-noticia-card:hover .hk-noticia-card__img {
  transform: scale(1.03);
}

.hk-noticias .hk-noticia-card__media--empty {
  display: grid;
  place-items: center;
  color: var(--hkn-accent-line);
}

.hk-noticias .hk-noticia-card__placeholder {
  width: 44px;
  height: 44px;
}

.hk-noticias .hk-noticia-card__body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 8px;
  padding: 16px 16px 18px;
}

.hk-noticias .hk-noticia-card__title {
  margin: 0;
  color: var(--hkn-ink);
  font-family: var(--hkn-font);
  font-size: 18px;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: normal;
  text-transform: none;
}

.hk-noticias .hk-noticia-card__subtitle {
  margin: 0;
  color: var(--hkn-accent-strong);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.hk-noticias .hk-noticia-card__excerpt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--hkn-text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.hk-noticias .hk-noticia-card__more {
  appearance: none;
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 8px;
  min-height: 0;
  margin: auto 0 0;
  padding: 9px 14px;
  border: 1px solid var(--hkn-accent-line);
  border-radius: 999px;
  background: var(--hkn-accent-bg);
  color: var(--hkn-accent);
  font-family: var(--hkn-font);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: none;
  transition: transform 0.15s ease, filter 0.15s ease;
}

/* El `margin-top: auto` del botón lo baja al pie (tarjetas de igual alto);
   esto solo le da aire respecto a lo que tenga encima. */
.hk-noticias .hk-noticia-card__body > :nth-last-child(2) {
  margin-bottom: 6px;
}

.hk-noticias .hk-noticia-card__more svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.hk-noticias .hk-noticia-card__more:hover,
.hk-noticias .hk-noticia-card:hover .hk-noticia-card__more {
  transform: translateY(-1px);
  filter: brightness(0.97);
}

.hk-noticias .hk-noticia-card__more:focus-visible,
.hk-noticias .hk-noticias__more:focus-visible,
.hk-noticias-modal .hk-noticias-modal__close:focus-visible {
  outline: 3px solid var(--hkn-accent);
  outline-offset: 2px;
}

/* ── Ver anteriores ──────────────────────────────────────── */

.hk-noticias .hk-noticias__status {
  min-height: 0;
  margin: 16px 0 0;
  color: var(--hkn-muted);
  font-size: 14px;
  text-align: center;
}

.hk-noticias .hk-noticias__status:empty {
  margin: 0;
}

.hk-noticias .hk-noticias__status.is-error {
  color: var(--hkn-error);
  font-weight: 600;
}

.hk-noticias .hk-noticias__actions {
  display: flex;
  justify-content: center;
  margin-top: clamp(22px, 3vw, 32px);
}

.hk-noticias .hk-noticias__actions[hidden] {
  display: none;
}

.hk-noticias .hk-noticias__more {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 0;
  margin: 0;
  padding: 12px 22px;
  border: 1px solid var(--hkn-more-line);
  border-radius: 999px;
  background: var(--hkn-more-bg);
  color: var(--hkn-more-ink);
  font-family: var(--hkn-font);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 10px 18px rgba(80, 131, 186, 0.16);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hk-noticias .hk-noticias__more:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px rgba(70, 119, 170, 0.22);
}

.hk-noticias .hk-noticias__more svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.hk-noticias .hk-noticias__more[aria-busy="true"] {
  cursor: progress;
  opacity: 0.75;
}

.hk-noticias .hk-noticias__more[aria-busy="true"] svg {
  animation: hk-noticias-bounce 0.8s ease-in-out infinite;
}

@keyframes hk-noticias-bounce {
  0%, 100% { transform: translateY(-2px); }
  50% { transform: translateY(3px); }
}

/* ── Modal (como .hk-pringado-modal) ─────────────────────── */

html.hk-noticias-modal-open,
body.hk-noticias-modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

.hk-noticias-modal {
  position: fixed;
  inset: 0;
  z-index: 120000;
  display: grid;
  place-items: center;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  padding: 12px;
  overflow: hidden;
  overscroll-behavior: contain;
  background: var(--hkn-backdrop);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  font-family: var(--hkn-font);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.hk-noticias-modal[hidden] {
  display: none;
}

.hk-noticias-modal.is-open {
  opacity: 1;
}

.hk-noticias-modal .hk-noticias-modal__dialog {
  width: min(1120px, calc(100vw - 24px));
  height: calc(100vh - 24px);
  height: calc(100dvh - 24px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 0 clamp(18px, 2vw, 28px) clamp(22px, 3vw, 36px);
  border: 1px solid var(--hkn-line);
  border-radius: 18px;
  background: var(--hkn-surface);
  box-shadow: 0 35px 70px rgba(6, 14, 30, 0.45);
  outline: none;
  transform: translateY(8px) scale(0.99);
  transition: transform 0.22s ease;
}

.hk-noticias-modal.is-open .hk-noticias-modal__dialog {
  transform: none;
}

.hk-noticias-modal .hk-noticias-modal__head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 6px;
  padding: clamp(14px, 2vw, 22px) 0 10px;
  background: var(--hkn-surface);
}

.hk-noticias-modal .hk-noticias-modal__kicker,
.hk-noticias-modal .hk-noticias-modal__date {
  display: block;
  margin: 0;
  color: var(--hkn-muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
}

.hk-noticias-modal .hk-noticias-modal__close {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 1px solid #d2deeb;
  border-radius: 999px;
  background: var(--hkn-accent-bg);
  color: #1d3f62;
  cursor: pointer;
}

.hk-noticias-modal .hk-noticias-modal__close svg {
  width: 18px;
  height: 18px;
}

.hk-noticias-modal .hk-noticias-modal__body {
  max-width: 860px;
  margin: 0 auto;
}

.hk-noticias-modal .hk-noticias-modal__date {
  margin: 4px 0 10px;
}

.hk-noticias-modal .hk-noticias-modal__title {
  margin: 0 0 12px;
  color: var(--hkn-ink);
  font-family: var(--hkn-font);
  font-size: clamp(26px, 3vw, 40px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: normal;
  text-transform: none;
}

.hk-noticias-modal .hk-noticias-modal__subtitle {
  margin: 0 0 18px;
  color: var(--hkn-accent-strong);
  font-size: clamp(17px, 1.6vw, 21px);
  font-weight: 700;
  line-height: 1.35;
}

.hk-noticias-modal .hk-noticias-modal__figure {
  margin: 0 0 22px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--hkn-media-bg);
}

.hk-noticias-modal .hk-noticias-modal__img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  margin: 0;
  object-fit: cover;
}

.hk-noticias-modal .hk-noticias-modal__content {
  color: var(--hkn-text);
  font-size: 16px;
  line-height: 1.62;
  overflow-wrap: anywhere;
}

.hk-noticias-modal .hk-noticias-modal__content > :first-child {
  margin-top: 0;
}

.hk-noticias-modal .hk-noticias-modal__content > :last-child {
  margin-bottom: 0;
}

.hk-noticias-modal .hk-noticias-modal__content p {
  margin: 0 0 1em;
}

.hk-noticias-modal .hk-noticias-modal__content a {
  color: var(--hkn-link);
  text-decoration: underline;
}

.hk-noticias-modal .hk-noticias-modal__content strong {
  font-weight: 800;
}

.hk-noticias-modal .hk-noticias-modal__content h2,
.hk-noticias-modal .hk-noticias-modal__content h3,
.hk-noticias-modal .hk-noticias-modal__content h4 {
  margin: 1.4em 0 0.5em;
  color: var(--hkn-ink);
  line-height: 1.2;
}

.hk-noticias-modal .hk-noticias-modal__content blockquote {
  margin: 1em 0;
  padding: 10px 14px;
  border-left: 3px solid #72cce7;
  border-radius: 8px;
  background: rgba(114, 204, 231, 0.1);
}

.hk-noticias-modal .hk-noticias-modal__content ul,
.hk-noticias-modal .hk-noticias-modal__content ol {
  margin: 0.8em 0 0.8em 1.25em;
  padding: 0;
}

.hk-noticias-modal .hk-noticias-modal__content img,
.hk-noticias-modal .hk-noticias-modal__content video,
.hk-noticias-modal .hk-noticias-modal__content iframe {
  max-width: 100%;
  height: auto;
}

.hk-noticias-modal .hk-noticias-modal__content iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
}

.hk-noticias-modal .hk-noticias-modal__content figure {
  margin: 1.2em 0;
}

@media (max-width: 599px) {
  .hk-noticias-modal {
    padding: 8px;
  }

  .hk-noticias-modal .hk-noticias-modal__dialog {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    height: calc(100dvh - 16px);
    border-radius: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .hk-noticias .hk-noticia-card,
  .hk-noticias .hk-noticia-card__img,
  .hk-noticias .hk-noticia-card__more,
  .hk-noticias .hk-noticias__more,
  .hk-noticias-modal,
  .hk-noticias-modal .hk-noticias-modal__dialog {
    transition: none;
  }

  .hk-noticias .hk-noticia-card.is-new,
  .hk-noticias .hk-noticias__more[aria-busy="true"] svg {
    animation: none;
  }

  .hk-noticias .hk-noticia-card:hover,
  .hk-noticias .hk-noticia-card:hover .hk-noticia-card__img {
    transform: none;
  }
}
