/* PÁGINAS DE PROYECTO / CASE STUDY */

.case-study {
  background: var(--bg);
}

.case-container {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
}

.case-hero {
  padding: 90px 0 80px;
}

.case-back {
  display: inline-block;
  margin-bottom: 70px;
  color: var(--muted);
  font-size: 12px;
}

.case-back:hover {
  color: var(--text);
}

.case-hero h1 {
  margin: 0;
  max-width: 1000px;
  font-size: clamp(54px, 9vw, 118px);
  line-height: .88;
  letter-spacing: -.075em;
  font-weight: 600;
}

.case-intro-grid {
  display: grid;
  grid-template-columns: 1.4fr .6fr;
  gap: 80px;
  margin-top: 60px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}

.case-lead {
  margin: 0;
  max-width: 680px;
  color: var(--text-soft);
  font-size: clamp(17px, 2vw, 22px);
  line-height: 1.55;
}

.case-meta {
  margin: 0;
}

.case-meta > div {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.case-meta dt {
  color: var(--subtle);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.case-meta dd {
  margin: 0;
  font-size: 12px;
}

.case-media,
.case-media-grid {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto 28px;
}

.case-media-wide {
  width: min(1440px, calc(100% - 32px));
}

.case-media img,
.case-media video,
.case-media-grid img,
.case-media-grid video {
  display: block;
  width: 100%;
  height: auto;
  background: var(--surface);
}

.case-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.video-player {
  position: relative;
  min-width: 0;
}

.video-toggle {
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 1px solid #ffffff80;
  border-radius: 50%;
  background: #1c1c1ed9;
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease;
}

.video-toggle svg { width: 100%; height: 100%; }
.video-player.is-paused .video-toggle,
.video-toggle:focus-visible { opacity: 1; }
.video-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
@media (hover: hover) {
  .video-player:hover .video-toggle { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .video-toggle { transition: none; }
}

/* Variante de 3 imágenes */

.case-media-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

.gallery-image {
  cursor: zoom-in;
}

.case-text {
  padding: 100px 0;
}

.case-text-inner {
  width: min(760px, calc(100% - 48px));
  margin: 0 auto;
}

.case-text h2 {
  margin: 0 0 28px;
  font-size: clamp(38px, 5vw, 68px);
  line-height: .98;
  letter-spacing: -.055em;
}

.case-text p {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.8;
}

.case-ending {
  margin-top: 110px;
  padding: 100px 0;
  background: var(--dark);
  color: var(--on-dark);
}

.case-ending .case-container {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 80px;
}

.case-ending h2 {
  max-width: 730px;
  margin: 0;
  font-size: clamp(42px, 6vw, 82px);
  line-height: .94;
  letter-spacing: -.06em;
}

.case-next {
  flex: 0 0 auto;
  border-bottom: 1px solid currentColor;
  padding-bottom: 5px;
  font-size: 13px;
}

/* LIGHTBOX */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(var(--shadow-rgb), .96);
}

.lightbox.is-open {
  display: flex;
}

.lightbox-stage {
  touch-action: pan-y pinch-zoom;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(86vw, 1500px);
  height: 88vh;
}

.lightbox-image {
  display: block;
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  user-select: none;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 2;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--on-dark);
  cursor: pointer;
  font-family: Arial, sans-serif;
}

.lightbox-close {
  top: 20px;
  right: 28px;
  font-size: 42px;
  line-height: 1;
  opacity: .8;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  opacity: .55;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  padding: 20px;
  font-size: 64px;
  line-height: 1;
}

.lightbox-prev {
  left: 14px;
}

.lightbox-next {
  right: 14px;
}

.lightbox-counter {
  position: absolute;
  left: 50%;
  bottom: 4px;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
}

body.lightbox-open {
  overflow: hidden;
}

@media (max-width: 800px) {
  .case-container,
  .case-media,
  .case-media-grid,
  .case-text-inner {
    width: min(100% - 30px, 1180px);
  }

  .case-media-wide {
    width: min(100% - 20px, 1440px);
  }

  .case-hero {
    padding: 65px 0 55px;
  }

  .case-back {
    margin-bottom: 45px;
  }

  .case-intro-grid,
  .case-media-grid {
    grid-template-columns: 1fr;
  }

  /* La grilla de 3 imágenes mantiene 2 columnas en tablet */

  .case-media-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .case-intro-grid {
    gap: 35px;
  }

  .case-text {
    padding: 70px 0;
  }

  .case-ending {
    margin-top: 70px;
    padding: 75px 0;
  }

  .case-ending .case-container {
    display: block;
  }

  .case-next {
    display: inline-block;
    margin-top: 45px;
  }

  .lightbox-stage {
    width: 88vw;
    height: 82vh;
  }

  .lightbox-nav {
    font-size: 46px;
    padding: 12px;
  }

  .lightbox-prev {
    left: 0;
  }

  .lightbox-next {
    right: 0;
  }

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

}

@media (max-width: 520px) {
  .case-media-grid-3 {
    grid-template-columns: 1fr;
  }

}

/* VISOR PDF / BROCHURE */

.pdf-viewer-section {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto 80px;
}

.pdf-viewer {
  padding: 0;
  border: 0;
  background: transparent;
}

.pdf-viewer-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 28px;
}

.pdf-viewer-head .eyebrow {
  margin-bottom: 8px;
}

.pdf-viewer-head h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1;
  letter-spacing: -.045em;
}

.pdf-page-status {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: .08em;
}

.pdf-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 70px;
  overflow: visible;
  background: transparent;
}

.pdf-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

#pdf-canvas {
  display: block;
  max-width: 100%;
  height: auto;
  background: var(--paper);
  box-shadow: 0 12px 35px rgba(var(--shadow-rgb), .12);
}

.pdf-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  transform: translateY(-50%);
  width: auto;
  height: auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--subtle);
  cursor: pointer;
  font: 300 54px/1 Arial, sans-serif;
  transition: color .2s ease, opacity .2s ease;
}

.pdf-nav:hover {
  background: transparent;
  color: var(--text);
}

.pdf-nav:disabled {
  opacity: .2;
  cursor: default;
}

.pdf-prev {
  left: 8px;
}

.pdf-next {
  right: 8px;
}

.pdf-mobile-controls {
  display: none;
}

.pdf-error {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 800px) {
  .pdf-viewer-section {
    width: min(100% - 30px, 1180px);
    margin-bottom: 55px;
  }

  .pdf-viewer-head {
    margin-bottom: 20px;
  }

  .pdf-stage {
    padding: 0;
  }

  .pdf-nav {
    display: none;
  }

  .pdf-mobile-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
  }

  .pdf-mobile-controls button {
    appearance: none;
    border: 1px solid var(--line-strong);
    background: var(--paper);
    padding: 12px;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: 12px;
  }

  .pdf-mobile-controls button:disabled {
    opacity: .35;
    cursor: default;
  }

}

@media (max-width: 520px) {
  .pdf-viewer-head {
    align-items: start;
    gap: 20px;
  }

  .pdf-viewer-head h2 {
    font-size: 26px;
  }

}
