/* =========================================================
   FOTOS DE OBRAS (páginas de servicio) y logos de clientes
   ========================================================= */
.works { padding: clamp(56px, 8vw, 110px) 0; border-top: 1px solid var(--rule); }
.work + .work { margin-top: clamp(44px, 5vw, 76px); }
.work__head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; padding-bottom: .9rem; margin-bottom: 1.1rem; border-bottom: 1px solid var(--rule); }
.work__head h3 { font-size: clamp(1.3rem, 2vw, 1.75rem); font-weight: 400; letter-spacing: -.025em; line-height: 1.1; }
.work__more { color: var(--muted); font-size: .92rem; flex: none; text-decoration: underline; text-underline-offset: .3em; transition: color .2s; }
.work__more:hover { color: var(--ink); }
.work__grid { display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 12px; }
.w-open { display: block; width: 100%; padding: 0; border: 0; background: var(--soft); cursor: zoom-in; overflow: hidden; }
.w-open img { width: 100%; height: 100%; aspect-ratio: 4 / 5; object-fit: cover; transition: transform .6s var(--ease), opacity .3s; }
.work__grid[style*="--cols:2"] .w-open img { aspect-ratio: 3 / 2; }
.w-open:hover img { transform: scale(1.04); }
.w-open:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.logos--img li { background: var(--white); border: 1px solid var(--rule); padding: 14px; aspect-ratio: auto; height: 116px; }
.logos--img img { max-width: 100%; max-height: 88px; width: auto; height: auto; object-fit: contain; filter: grayscale(1); opacity: .8; transition: filter .3s, opacity .3s; }
.logos--img li:hover img { filter: none; opacity: 1; }

@media (max-width: 760px) {
  .work__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work__grid .w-open img, .work__grid[style*="--cols:2"] .w-open img { aspect-ratio: 1 / 1; }
}
@media (prefers-reduced-motion: reduce) { .w-open img { transition: none; } }

/* Galería de Proyectos: cuadrícula pareja para que se vea ordenada */
.gallery { columns: auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(14px, 1.6vw, 22px); }
.g-item { margin: 0; }
.g-open { overflow: hidden; }
.g-open img { aspect-ratio: 4 / 3; height: auto; object-fit: cover; transition: transform .6s var(--ease), opacity .3s; }
.g-open:hover img { transform: scale(1.04); opacity: 1; }
.g-cap { margin-top: .55rem; font-size: .9rem; }
.g-cap span { font-size: .82rem; }
@media (max-width: 1000px) { .gallery { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-cap span { display: none; } }

.logos--img { grid-template-columns: repeat(8, minmax(0, 1fr)); }
@media (max-width: 1000px) { .logos--img { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 560px) { .logos--img { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* Videos cortos de obra */
.work__videos { --vh: clamp(200px, 22vw, 300px); display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; }
.w-video { flex: none !important; height: var(--vh); aspect-ratio: var(--ar); background: var(--black); overflow: hidden; }
.w-video video { display: block; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 760px) {
  .work__videos { --vh: 300px; flex-wrap: nowrap; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .w-video { scroll-snap-align: start; }
}

/* =========================================================
   CATÁLOGO DE PROYECTOS
   ========================================================= */
.catalog { list-style: none; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(28px, 3vw, 44px) var(--gap); padding-bottom: clamp(56px, 8vw, 110px); }
.pc[hidden] { display: none; }
.pc__open { display: grid; gap: .3rem; width: 100%; padding: 0; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.pc__img { display: block; overflow: hidden; background: var(--soft); margin-bottom: .75rem; position: relative; }
.pc__img img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .7s var(--ease); }
.pc__img::after { content: "Ver proyecto"; position: absolute; left: 14px; bottom: 14px; padding: .45rem .9rem; border-radius: 999px; background: var(--white); color: var(--ink); font-size: .85rem; opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s var(--ease); }
.pc__open:hover .pc__img img, .pc__open:focus-visible .pc__img img { transform: scale(1.05); }
.pc__open:hover .pc__img::after, .pc__open:focus-visible .pc__img::after { opacity: 1; transform: none; }
.pc__open:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
.pc__name { font-size: clamp(1.25rem, 1.8vw, 1.6rem); letter-spacing: -.025em; line-height: 1.15; }
.pc__meta { color: var(--muted); font-size: .9rem; }

.ficha { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--white); color: var(--ink); overflow-y: auto; overscroll-behavior: contain; }
.ficha::backdrop { background: rgba(0,0,0,.5); }
.ficha[open] { animation: fichaIn .45s var(--ease); }
@keyframes fichaIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
.ficha__bar { position: sticky; top: 0; z-index: 2; display: flex; justify-content: flex-end; padding: 16px clamp(16px, 2.5vw, 32px); background: linear-gradient(var(--white) 60%, rgba(255,255,255,0)); }
.ficha__close { width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--rule); background: var(--white); font: 300 1rem/1 var(--font); cursor: pointer; transition: border-color .2s; }
.ficha__close:hover { border-color: var(--ink); }
.ficha__body { padding-bottom: clamp(56px, 8vw, 110px); }
.ficha__cat { color: var(--muted); font-size: .92rem; margin-bottom: .8rem; }
.ficha__head h2 { font-size: clamp(2.4rem, 5.6vw, 5rem); font-weight: 400; letter-spacing: -.045em; line-height: 1; }
.ficha__place { margin-top: .9rem; color: var(--muted); font-size: 1.05rem; }
.ficha__info { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(28px, 6vw, 100px); padding: clamp(36px, 5vw, 64px) 0; border-bottom: 1px solid var(--rule); }
.ficha__text { font-size: clamp(1.1rem, 1.6vw, 1.35rem); line-height: 1.5; color: #2a2a2a; max-width: 46ch; }
.ficha__h { font-weight: 500; margin-bottom: 1rem; }
.ficha__block { padding-top: clamp(36px, 5vw, 56px); }
.ficha__block h3 { font-size: 1.15rem; font-weight: 500; margin-bottom: 1.1rem; display: flex; gap: .6rem; align-items: baseline; }
.ficha__block h3 span { color: var(--muted); font-weight: 400; font-size: .95rem; }
.ficha__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.ficha__grid .w-open img { aspect-ratio: 4 / 3; }
.ficha .work__videos { margin-top: 0; }
.ficha__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 1.2rem 2rem; margin-top: clamp(40px, 5vw, 64px); padding-top: clamp(28px, 4vw, 40px); border-top: 1px solid var(--rule); }
.lightbox { z-index: 10; }

@media (max-width: 1000px) { .catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ficha__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .catalog { grid-template-columns: minmax(0, 1fr); }
  .ficha__info { grid-template-columns: minmax(0, 1fr); }
  .ficha__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { .ficha[open] { animation: none; } .pc__img img, .pc__img::after { transition: none; } }
.w-video .w-open { height: 100%; }
.w-video .w-open img { height: 100%; aspect-ratio: auto; }

/* =========================================================
   USABILIDAD
   ========================================================= */
html { -webkit-tap-highlight-color: transparent; }
a, button, .chip, video { touch-action: manipulation; }
h1, h2, .pc__name, .ficha__head h2 { text-wrap: balance; }

/* videos: tocar para pausar, con ícono de play cuando están en pausa */
.w-video { position: relative; cursor: pointer; }
.w-video.is-paused::after {
  content: ""; position: absolute; inset: 50% auto auto 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: rgba(0,0,0,.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7l9 5-9 5z' fill='white'/%3E%3C/svg%3E") center / 26px no-repeat;
  pointer-events: none;
}

/* ficha: botón de siguiente proyecto */
.ficha__next { margin-left: auto; display: grid; gap: .2rem; text-align: right; padding: .4rem 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: clamp(1.1rem, 1.6vw, 1.4rem); letter-spacing: -.02em; cursor: pointer; transition: opacity .2s; }
.ficha__next span { color: var(--muted); font-size: .85rem; letter-spacing: 0; }
.ficha__next:hover { opacity: .7; }
.ficha__head h2:focus { outline: none; }

/* en pantallas táctiles no hay "pasar el mouse": la etiqueta Ver proyecto siempre visible */
@media (hover: none) {
  .pc__img::after { opacity: 1; transform: none; }
}

/* portada: indicador para bajar */
.scroll-cue { position: absolute; left: clamp(18px, 2.2vw, 30px); bottom: 28px; z-index: 40; display: grid; justify-items: start; gap: .5rem; color: rgba(255,255,255,.75); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.scroll-cue::after { content: ""; width: 1px; height: 38px; background: linear-gradient(currentColor, transparent); animation: cue 1.8s var(--ease) infinite; transform-origin: top; }
@keyframes cue { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }

@media (max-width: 760px) {
  /* filtros en una sola fila deslizable */
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 4px; }
  .filters::-webkit-scrollbar { display: none; }
  .chip { flex: none; }
  .ficha__next { margin-left: 0; text-align: left; }
}
@media (prefers-reduced-motion: reduce) { .scroll-cue::after { animation: none; } }
[id] { scroll-margin-top: calc(var(--header-h, 72px) + 16px); }
