/* 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; }

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 */
@media (max-width: 1024px) {
  .la-nav {
    position: sticky !important;
    top: 0;
    z-index: 1000;
    display: flex;
    width: 100%;
    min-width: 100%;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px !important;
    background: #F6EFE1 !important;
    backdrop-filter: none !important;
  }

  .la-nav__burger {
    display: flex !important;
    width: 42px;
    height: 40px;
    padding: 0 9px;
    flex: 0 0 42px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    border: 1px solid #d8c9a8;
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
  }

  .la-nav__burger span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 2px;
    background: #16331c;
    transition: transform .25s ease, opacity .2s ease;
  }

  .la-nav.is-open .la-nav__burger span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .la-nav.is-open .la-nav__burger span:nth-child(2) { opacity: 0; }

  .la-nav.is-open .la-nav__burger span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Cerrado de verdad: el panel no pinta ninguna franja. */
  .la-nav__links {
    display: none !important;
  }

  .la-nav.is-open .la-nav__links {
    position: absolute !important;
    top: 100% !important;
    right: 0 !important;
    left: 0 !important;
    display: flex !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    max-height: calc(100dvh - 65px);
    margin: 0 !important;
    padding: 8px 20px 20px !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0 !important;
    border-bottom: 1px solid #e4d9c2;
    background: #F6EFE1 !important;
    box-shadow: 0 20px 36px rgba(22, 51, 28, .18);
    white-space: normal !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  .la-nav__link,
  .la-dropdown__trigger {
    display: block !important;
    width: 100% !important;
    padding: 14px 2px !important;
    border-bottom: 1px solid #ece1c9;
    white-space: normal !important;
  }

  .la-dropdown {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .la-dropdown__chev { display: none !important; }

  .la-dropdown__menu,
  .la-dropdown:hover .la-dropdown__menu,
  .la-dropdown:focus-within .la-dropdown__menu {
    position: static !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 6px 0 10px !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
  }

  .la-dropdown__menu::before { display: none !important; }

  .la-dropdown__item {
    width: 100%;
    max-width: 100%;
    padding: 10px 6px;
  }

  .la-nav__cta,
  .la-nav__panel-btn,
  .la-nav__account {
    width: 100% !important;
    height: auto !important;
    justify-content: center !important;
    margin-top: 10px;
    padding: 12px 15px !important;
    border-radius: 999px !important;
  }

  .la-nav__account::after { content: attr(data-label); }
}

/* 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: 580px !important; }

  .home-video > div:last-child {
    padding: 52px 20px 46px !important;
  }

  .home-video-title {
    font-size: clamp(30px, 9vw, 42px) !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%;
  }
}