/* LabAncestral · main.css */

*, *::before, *::after {
  box-sizing: border-box;
}

html,
body {
  display: block;
  width: 100%;
  min-width: 100%;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  background: #F6EFE1;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  /* El pie queda pegado abajo aunque la página tenga poco contenido. */
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

body > main { flex: 1 0 auto; }

main {
  display: block;
  position: relative;
  width: 100%;
  min-width: 100%;
  margin: 0;
  padding: 0;
}

img,
video,
svg,
canvas,
iframe {
  display: block;
  max-width: 100%;
}

img,
svg,
canvas,
iframe {
  height: auto;
}

p,
h1,
h2,
h3,
a,
span {
  overflow-wrap: anywhere;
}

::selection {
  background: #EE9A1C;
  color: #0E3D22;
}

/* Página de inicio */
.home {
  display: block;
  position: relative;
  width: 100%;
  min-width: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'IBM Plex Sans', sans-serif;
  color: #152514;
  background: #F6EFE1;
}

.home > div {
  width: 100%;
  min-width: 100%;
}

/* Solo los hijos de flex y grid necesitan poder encogerse. */
.news-grid > *,
.principles-grid > *,
.work-grid > *,
.territory-grid > *,
.pillars-grid > *,
.la-footer__grid > *,
.news-list-item > div:last-child {
  min-width: 0;
}

/* Inputs */
.la-input {
  width: 100%;
  padding: 13px 15px;
  margin-bottom: 0;
  border: 1px solid #d8c9a8;
  border-radius: 11px;
  background: #fff;
  color: #152514;
  font: 15px 'IBM Plex Sans', sans-serif;
  transition: border-color .15s, box-shadow .15s;
}

.la-input:focus {
  outline: none;
  border-color: #18713A;
  box-shadow: 0 0 0 3px rgba(24, 113, 58, .14);
}

input::placeholder { color: #a9a08a; }

/* Mensajes Django */
.la-messages {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 9999;
  display: flex;
  max-width: 360px;
  flex-direction: column;
  gap: 10px;
}

.la-message {
  padding: 12px 18px;
  border: 1px solid #e4d9c2;
  border-radius: 10px;
  background: #fff;
  color: #152514;
  font: 14px 'IBM Plex Sans', sans-serif;
}

.la-message--error {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #991b1b;
}

.la-message--success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

/* Navegación de escritorio */
.la-nav {
  width: 100%;
  min-width: 100%;
}

.la-nav__burger { display: none; }

.la-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.la-dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
}

.la-dropdown__chev {
  flex: 0 0 auto;
  transition: transform .25s ease;
}

.la-dropdown:hover .la-dropdown__chev,
.la-dropdown:focus-within .la-dropdown__chev {
  transform: rotate(180deg);
}

.la-dropdown__menu {
  position: absolute;
  top: 100%;
  left: 50%;
  z-index: 60;
  min-width: 264px;
  margin: 0;
  padding: 8px;
  visibility: hidden;
  border: 1px solid #e4d9c2;
  border-radius: 16px;
  background: #fffdf8;
  box-shadow: 0 22px 48px -16px rgba(22, 51, 28, .28),
              0 4px 12px -6px rgba(22, 51, 28, .12);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
  transition: opacity .22s ease, transform .22s ease, visibility .22s;
}

.la-dropdown__menu::before {
  content: '';
  position: absolute;
  top: -14px;
  right: 0;
  left: 0;
  height: 14px;
}

.la-dropdown:hover .la-dropdown__menu,
.la-dropdown:focus-within .la-dropdown__menu {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateX(-50%) translateY(8px);
}

.la-dropdown__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 11px;
  color: #4a4636;
  text-decoration: none;
  transition: background .18s ease, color .18s ease;
}

.la-dropdown__item:hover {
  background: #f4ecda;
  color: #16331c;
}

.la-dropdown__ico {
  display: flex;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: #eef3ea;
  color: #18713A;
}

.la-dropdown__item:hover .la-dropdown__ico {
  background: #18713A;
  color: #fff;
}

.la-dropdown__txt {
  display: flex;
  min-width: 0;
  flex-direction: column;
  line-height: 1.25;
}

.la-dropdown__title {
  color: #16331c;
  font-size: 14px;
  font-weight: 600;
}

.la-dropdown__desc {
  margin-top: 2px;
  color: #8a8268;
  font-size: 12px;
}

/* Footer */
.la-footer {
  display: block;
  position: relative;
  width: 100%;
  min-width: 100%;
  margin: 0;
  padding: 72px 44px 40px;
  overflow: hidden;
  background: #0a2a17;
  color: #cfe0d2;
}

.la-footer__container {
  width: 100%;
  max-width: 1240px;
  min-width: 0;
  margin: 0 auto;
}

.la-footer__grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 48px;
  border-bottom: 1px solid #1f5a3e;
}

.la-footer__bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 24px;
  color: #6fae83;
  font: 11.5px 'IBM Plex Mono', monospace;
}

/* Animaciones */
@keyframes la_rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes la_glow {
  0%, 100% { opacity: .55; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.25); }
}

@keyframes la_pan {
  0%   { transform: scale(1.12) translate(0, 0); }
  50%  { transform: scale(1.2) translate(-2.5%, -1.8%); }
  100% { transform: scale(1.12) translate(0, 0); }
}

@keyframes la_sun {
  0%, 100% { transform: translate(0, 0); opacity: .8; }
  50%      { transform: translate(3%, 2%); opacity: 1; }
}

@keyframes la_marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* Tablet */
@media (max-width: 900px) {
  .news-grid,
  .territory-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .pillars-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
}

/* Navegación móvil: vive completa en templates/partials/_nav.html
   (cajón lateral). Aquí no se define nada para no pisarla con !important. */

/* Contenido móvil */
@media (max-width: 700px) {
  .home-section {
    padding: 64px 20px !important;
  }

  .home-hero-content {
    padding: 120px 20px 80px !important;
  }

  .news-grid,
  .principles-grid,
  .work-grid,
  .territory-grid,
  .pillars-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .principles-grid { margin-top: 42px !important; }

  .principles-grid > div {
    padding: 26px 0 !important;
    border-right: 0 !important;
    border-bottom: 1px solid #e0d3b6;
  }

  .principles-grid > div:last-child { border-bottom: 0; }

  .home-hero-title {
    font-size: clamp(42px, 14vw, 64px) !important;
  }

  .home-hero-lead { font-size: 18px !important; }

  .home-video { min-height: 0 !important; }

  .home-video > div:last-child {
    padding: 30px 20px !important;
    column-gap: 20px !important;
  }

  .home-video-title {
    font-size: clamp(19px, 4.6vw, 24px) !important;
  }

  .work-grid > div {
    padding: 26px 22px !important;
    gap: 18px !important;
  }

  .la-m2 {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .la-messages {
    right: 16px;
    left: 16px;
    max-width: none;
  }

  .la-footer {
    padding: 52px 20px 30px;
  }

  .la-footer__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
    padding-bottom: 36px;
  }

  .la-footer__bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Teléfonos estrechos */
@media (max-width: 420px) {
  .home-hero-badge {
    align-items: flex-start !important;
    border-radius: 16px !important;
    line-height: 1.5;
  }

  .news-list-item {
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .news-list-item > div:first-child {
    width: 76px !important;
    height: 64px !important;
    flex-basis: 76px !important;
  }

  .la-m2 {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@supports (width: 100dvw) {
  body,
  main,
  .home,
  .home > div,
  .la-nav,
  .la-footer {
    width: 100dvw;
  }
}

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

/* ──────────────────────────────────────
   Footer · estilos completos
   Este bloque debe permanecer al final.
────────────────────────────────────── */
.la-footer {
  font-family: 'IBM Plex Sans', sans-serif;
}

.la-footer__about,
.la-footer__column {
  min-width: 0;
}

.la-footer__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
  color: #fff;
  font: 600 23px 'Spectral', serif;
  text-decoration: none;
}

.la-footer__logo {
  display: block;
  width: 42px !important;
  max-width: 42px !important;
  height: 42px !important;
  padding: 2px;
  flex: 0 0 42px;
  border-radius: 50%;
  background: #fff;
  object-fit: contain;
}

.la-footer__brand > span {
  color: #fff;
  white-space: nowrap;
  overflow-wrap: normal;
}

.la-footer__description {
  max-width: 360px;
  margin: 0;
  color: #9ec0a8;
  font-size: 15px;
  line-height: 1.65;
}

.la-footer__heading {
  margin: 0 0 16px;
  color: #6fae83;
  font: 500 11px 'IBM Plex Mono', monospace;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.la-footer__links,
.la-footer__contact {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 11px;
  color: #cfe0d2;
  font-size: 14.5px;
  line-height: 1.5;
}

.la-footer__links a,
.la-footer__contact a {
  display: block;
  color: #cfe0d2;
  text-decoration: none;
}

.la-footer__links a:hover,
.la-footer__contact a:hover {
  color: #fff;
}

.la-footer__contact span:last-child {
  color: #9ec0a8;
}

.la-footer__description,
.la-footer__contact span,
.la-footer__contact a,
.la-footer__bottom span {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  .la-footer {
    width: 100% !important;
    padding: 48px 20px 30px !important;
  }

  .la-footer__container {
    width: 100% !important;
    max-width: 100% !important;
  }

  .la-footer__grid {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 34px !important;
    padding-bottom: 36px !important;
  }

  .la-footer__about,
  .la-footer__column {
    width: 100%;
    min-width: 0;
  }

  .la-footer__brand {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .la-footer__logo {
    width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    flex-basis: 48px;
  }

  .la-footer__brand > span {
    font-size: 21px;
    white-space: normal;
  }

  .la-footer__description {
    width: 100%;
    max-width: 100%;
    font-size: 14px;
  }

  .la-footer__links,
  .la-footer__contact {
    width: 100%;
    font-size: 14px;
  }

  .la-footer__bottom {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100%;
    gap: 8px !important;
    font-size: 10.5px;
    line-height: 1.6;
  }

  .la-footer__bottom span {
    display: block;
    width: 100%;
  }
}

/* ==========================================================
   Placeholder de imagen: isotipo LabAncestral cuando no hay foto
   Se usa via {% include 'partials/_logo_placeholder.html' %}
   dentro de un contenedor con position:relative.
   ========================================================== */
/* !important: las hojas de cada página se cargan despues de main.css y usan
   selectores como `.nd-cover img`, que si no ganarian y estirarian el isotipo. */
img.la-img-ph {
  position: absolute !important;
  inset: 0 !important;
  margin: auto !important;
  width: 42% !important;
  max-width: 88px;
  min-width: 34px;
  height: auto !important;
  object-fit: contain !important;
  opacity: .55;
  pointer-events: none;
  user-select: none;
}

/* Sobre fondos oscuros (verdes) el isotipo necesita más presencia */
img.la-img-ph--dark {
  opacity: .8;
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .25));
}
