/* LabAncestral · noticia_detalle.css
   Estilos exclusivos del detalle de una noticia. */

.nd-page {
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: #f6efe1;
  color: #152514;
  font-family: 'IBM Plex Sans', sans-serif;
}

.nd-page *,
.nd-page *::before,
.nd-page *::after {
  min-width: 0;
}

.nd-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

.nd-article {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 54px 44px 90px;
}

.nd-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 30px;
  color: #18713a;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}

.nd-back span {
  font-size: 17px;
}

.nd-header {
  margin-bottom: 34px;
}

.nd-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.nd-category {
  display: inline-flex;
  padding: 6px 12px;
  background: #ee9a1c;
  border-radius: 999px;
  color: #0e3d22;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.nd-date {
  color: #9a8f74;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  line-height: 1.5;
}

.nd-header h1 {
  margin: 0;
  color: #152514;
  font-family: 'Spectral', serif;
  font-size: 42px;
  font-weight: 400;
  letter-spacing: -.015em;
  line-height: 1.12;
  overflow-wrap: normal;
  word-break: normal;
}

.nd-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  margin-bottom: 38px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 74% 14%, #f6ce7e 0%, #e59a2c 18%, transparent 50%),
    linear-gradient(180deg, #c89a55 0%, #9e7038 26%, #5e8f33 27%, #3c7a2c 56%, #1d6a35 80%, #124a27 100%);
  border-radius: 18px;
  box-shadow: 0 30px 60px -34px rgba(14, 61, 34, .5);
}

.nd-cover img,
.nd-gallery-item img,
.nd-related-image img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nd-content {
  color: #3a3a2e;
  font-size: 18px;
  line-height: 1.75;
}

.nd-content p {
  margin: 0 0 22px;
}

.nd-content p:last-child {
  margin-bottom: 0;
}

.nd-content .nd-empty {
  color: #9a957f;
  font-style: italic;
}

.nd-gallery {
  margin-top: 46px;
}

.nd-section-label {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 22px;
  color: #9a8f74;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
  letter-spacing: .2em;
  text-transform: uppercase;
}

.nd-section-label > span {
  display: block;
  width: 28px;
  height: 1px;
  flex: 0 0 28px;
  background: #c2b48f;
}

.nd-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: 16px;
}

.nd-gallery-item {
  position: relative;
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
  background: linear-gradient(160deg, #4a9433, #1d6a35);
  border-radius: 14px;
  box-shadow: 0 18px 36px -26px rgba(14, 61, 34, .55);
  cursor: zoom-in;
}

.nd-gallery-item:focus-visible {
  outline: 3px solid #ee9a1c;
  outline-offset: 3px;
}

.nd-gallery-item img {
  transition: transform .3s ease;
}

.nd-gallery-item:hover img {
  transform: scale(1.035);
}

.nd-gallery-item figcaption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 22px 12px 10px;
  background: linear-gradient(180deg, transparent, rgba(10, 30, 16, .78));
  color: #fff;
  font-size: 12.5px;
}

.nd-related {
  padding: 64px 44px 80px;
  background: #efe6d2;
  border-top: 1px solid #e4d9c2;
}

.nd-related .nd-section-label {
  margin-bottom: 32px;
}

.nd-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 28px;
}

.nd-related-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #ece1c9;
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  transition: transform .2s ease, box-shadow .2s ease;
}

.nd-related-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 38px -28px rgba(14, 61, 34, .55);
}

.nd-related-image {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(160deg, #4a9433, #1d6a35);
}

.nd-related-body {
  padding: 20px;
}

.nd-related-meta {
  margin-bottom: 9px;
  color: #18713a;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .1em;
  line-height: 1.5;
  text-transform: uppercase;
}

.nd-related-card h3 {
  margin: 0;
  color: #1a2417;
  font-family: 'Spectral', serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.28;
}

.nd-lightbox[hidden] {
  display: none !important;
}

.nd-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 76px;
  background: rgba(10, 22, 12, .93);
}

.nd-lightbox button {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  background: rgba(255, 255, 255, .12);
  border: 0;
  border-radius: 50%;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
}

.nd-lightbox button:hover,
.nd-lightbox button:focus-visible {
  background: rgba(255, 255, 255, .22);
}

.nd-lightbox-close {
  top: 18px;
  right: 22px;
  z-index: 2;
  width: 42px !important;
  height: 42px !important;
  font-size: 20px !important;
}

.nd-lightbox-prev {
  left: 16px;
}

.nd-lightbox-next {
  right: 16px;
}

.nd-lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 1100px;
  max-height: 100%;
  margin: 0;
}

.nd-lightbox-figure img {
  display: block;
  max-width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 12px;
}

.nd-lightbox-figure figcaption {
  color: #e6dcc4;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12.5px;
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 700px) {
  .nd-article {
    padding: 42px 20px 64px;
  }

  .nd-back {
    margin-bottom: 24px;
  }

  .nd-header {
    margin-bottom: 28px;
  }

  .nd-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .nd-header h1 {
    font-size: clamp(32px, 10vw, 42px);
    line-height: 1.14;
  }

  .nd-cover {
    margin-bottom: 30px;
    border-radius: 14px;
  }

  .nd-content {
    font-size: 16.5px;
    line-height: 1.72;
  }

  .nd-gallery {
    margin-top: 38px;
  }

  .nd-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .nd-related {
    padding: 52px 20px 64px;
  }

  .nd-related-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .nd-lightbox {
    align-items: center;
    padding: 68px 16px 76px;
  }

  .nd-lightbox-figure img {
    max-height: calc(100dvh - 170px);
  }

  .nd-lightbox-nav {
    top: auto;
    bottom: 16px;
  }

  .nd-lightbox-prev {
    left: calc(50% - 58px);
  }

  .nd-lightbox-next {
    right: calc(50% - 58px);
  }
}

@media (max-width: 430px) {
  .nd-article {
    padding-right: 16px;
    padding-left: 16px;
  }

  .nd-date {
    font-size: 11.5px;
  }

  .nd-gallery-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .nd-related {
    padding-right: 16px;
    padding-left: 16px;
  }

  .nd-lightbox-close {
    top: 14px;
    right: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nd-page *,
  .nd-page *::before,
  .nd-page *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}