:root {
  --lab-ink: #241d1b;
  --lab-muted: #75655d;
  --lab-paper: #fffaf5;
  --lab-card: #fffdfb;
  --lab-line: #eadcd1;
  --lab-red: #bd2446;
  --lab-pink: #df4d6f;
  --lab-gold: #e3a42d;
  --lab-coral: #ed704b;
  --lab-shadow: 0 18px 45px rgba(87, 43, 23, .12);
}

html {
  min-width: 320px;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

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

body.lab-body {
  min-width: 320px;
  margin: 0;
  overflow-x: hidden;
  background: linear-gradient(130deg, #fffaf5, #fff 45%, #fff4eb);
  color: var(--lab-ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  text-rendering: optimizeLegibility;
}

body.lab-body img,
body.lab-body video {
  max-width: 100%;
}

.lab-top {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  min-height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px clamp(18px, 4vw, 72px);
  border-bottom: 1px solid var(--lab-line);
  background: rgba(255, 253, 249, .96);
  backdrop-filter: blur(14px);
}

.lab-brand {
  flex: 0 0 auto;
  color: var(--lab-ink);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -.045em;
  text-decoration: none;
  white-space: nowrap;
}

.lab-brand span { color: var(--lab-coral); }

.lab-back {
  min-width: 0;
  color: var(--lab-ink);
  font-size: .88rem;
  font-weight: 800;
  line-height: 1.3;
  text-align: right;
  text-decoration: none;
}

.lab-back:hover,
.lab-back:focus-visible { color: var(--lab-red); }

.lab-body main,
#lab-app {
  width: 100%;
  min-width: 0;
}

.product-chip,
.case-index {
  margin: 0 0 14px;
  color: var(--lab-red);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.product-chip b { color: var(--lab-gold); }

/* Galería: no permite que el tamaño intrínseco de las capturas ensanche la cuadrícula. */
.showcase-grid,
.process,
.trailer {
  width: min(1440px, calc(100% - 48px));
  margin-inline: auto;
}

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(18px, 2vw, 28px);
  padding: clamp(34px, 5vw, 66px) 0 clamp(70px, 8vw, 118px);
}

.showcase-card {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--lab-line);
  border-radius: 20px;
  background: var(--lab-card);
  box-shadow: var(--lab-shadow);
  transition: transform .25s ease, box-shadow .25s ease;
}

.showcase-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 24px 58px rgba(87, 43, 23, .17);
}

.showcase-image {
  position: relative;
  width: 100%;
  min-width: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: block;
  padding: 0;
  border: 0;
  background: #f6ece5;
  cursor: zoom-in;
  text-align: left;
}

/* Regla crítica: anula la altura HTML de 941 px y conserva la proporción real. */
.showcase-image img {
  display: block;
  width: 100%;
  height: 100% !important;
  min-width: 0;
  max-width: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform .4s ease;
}

.showcase-image:hover img,
.showcase-image:focus-visible img { transform: scale(1.025); }

.showcase-image:focus-visible {
  outline: 3px solid var(--lab-gold);
  outline-offset: -3px;
}

.showcase-image span {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(36, 29, 27, .9);
  color: #fff;
  font-size: .72rem;
  font-weight: 850;
}

.showcase-copy {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: clamp(20px, 2.2vw, 30px);
}

.showcase-copy h2 {
  margin: 0 0 12px;
  font-size: clamp(1.35rem, 2vw, 1.75rem);
  line-height: 1.08;
  letter-spacing: -.04em;
}

.showcase-copy > p:not(.case-index) {
  margin: 0;
  color: var(--lab-muted);
  font-size: .94rem;
  line-height: 1.65;
}

.showcase-copy small {
  display: block;
  margin: 18px 0;
  color: var(--lab-coral);
  font-size: .78rem;
  font-weight: 850;
}

.showcase-copy a {
  align-self: flex-start;
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 15px;
  border-radius: 999px;
  background: var(--lab-red);
  color: #fff;
  font-size: .84rem;
  font-weight: 850;
  text-decoration: none;
}

.showcase-copy a:hover,
.showcase-copy a:focus-visible { filter: brightness(.92); }

.process {
  padding: clamp(62px, 7vw, 94px) 0;
  border-top: 1px solid var(--lab-line);
}

.process h2,
.trailer h2 {
  max-width: 850px;
  margin: 0;
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 1;
  letter-spacing: -.055em;
}

.process ol {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(18px, 2vw, 30px);
  margin: 38px 0 0;
  padding: 0;
  list-style: none;
}

.process li {
  min-width: 0;
  display: grid;
  gap: 10px;
  padding-top: 16px;
  border-top: 3px solid var(--lab-gold);
}

.process b { color: var(--lab-pink); font-size: 1.35rem; }
.process span { font-weight: 750; line-height: 1.4; }

.trailer {
  display: grid;
  grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
  align-items: center;
  gap: clamp(28px, 5vw, 68px);
  padding: clamp(60px, 8vw, 105px) 0 clamp(80px, 9vw, 130px);
}

.trailer-copy { min-width: 0; }

.trailer p:not(.case-index) {
  max-width: 680px;
  color: var(--lab-muted);
  font-size: 1rem;
  line-height: 1.72;
}

.trailer video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 20px;
  background: var(--lab-ink);
  box-shadow: 0 20px 55px rgba(75, 33, 27, .18);
}

dialog.lightbox {
  width: min(96vw, 1540px);
  max-width: none;
  max-height: 94vh;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: rgba(33, 27, 24, .97);
  color: #fff;
}

.lightbox::backdrop { background: rgba(22, 13, 10, .78); }

.lightbox img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 84vh;
  object-fit: contain;
  background: #171210;
}

.lightbox p {
  margin: 0;
  padding: 13px 60px 15px 18px;
  font-weight: 800;
}

.lightbox button {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: var(--lab-ink);
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
}

/* Ajustes específicos para el contenido SEO alrededor del laboratorio. */
.lab-body .seo-lab-intro,
.lab-body .seo-lab-after {
  width: min(1280px, calc(100% - 48px));
}

.lab-body .seo-lab-intro { padding-top: clamp(54px, 7vw, 92px); }
.lab-body .seo-lab-intro h1 { max-width: 1080px; }
.lab-body .seo-lab-intro .seo-card-grid { align-items: stretch; }
.lab-body .seo-lab-after { padding-bottom: clamp(70px, 9vw, 120px); }

@media (max-width: 1080px) {
  .showcase-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .process ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .trailer { grid-template-columns: 1fr; }
  .trailer-copy { max-width: 820px; }
}

@media (max-width: 720px) {
  .lab-top {
    position: relative;
    min-height: 66px;
    padding: 13px 16px;
  }

  .lab-brand { font-size: 1.02rem; }
  .lab-back { max-width: 48%; font-size: .76rem; }

  .showcase-grid,
  .process,
  .trailer,
  .lab-body .seo-lab-intro,
  .lab-body .seo-lab-after {
    width: min(100% - 28px, 1440px);
  }

  .showcase-grid { grid-template-columns: 1fr; padding-top: 30px; }
  .showcase-card:hover { transform: none; }
  .showcase-copy { padding: 20px; }
  .showcase-copy > p:not(.case-index) { font-size: .91rem; }
  .process ol { grid-template-columns: 1fr; gap: 24px; }
  .trailer { padding-top: 45px; }
  .lab-body .seo-lab-intro h1 { font-size: clamp(2.25rem, 12vw, 3.5rem); }
  .lab-body .seo-lab-intro .seo-card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .lab-top { align-items: flex-start; }
  .lab-back { line-height: 1.2; }
  .showcase-image span { right: 9px; bottom: 9px; font-size: .67rem; }
  .lightbox p { padding-right: 54px; font-size: .85rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .showcase-card,
  .showcase-image img { transition: none; }
}
