:root {
  --paper: #ffffff;
  --logo-slot: #d8d8d8;
  --ink: #3a3a3a;
  --ink-soft: #9a9a9a;
  --type: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --text-size: 9px;
  --gutter: 0.65vw;
  --caption-gap: 1.75em;
}

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

html {
  font-size: var(--text-size);
}

html,
body,
body[data-page="index"],
body[data-page="pieza"] {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink) !important;
  font-family: var(--type) !important;
  font-size: var(--text-size) !important;
  font-weight: 400 !important;
  letter-spacing: 0.02em;
  line-height: 1.3;
  -webkit-font-smoothing: antialiased;
}

/* Piece / detail: near-black stage */
body[data-page="pieza"] {
  --paper: #0a0a0a;
  --ink: #d6d6d6;
  --ink-soft: #8c8c8c;
  background: #0a0a0a;
  color: var(--ink) !important;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body,
body * {
  font-family: var(--type) !important;
}

a,
a:link,
a:visited {
  color: var(--ink) !important;
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover,
a:focus-visible {
  color: var(--ink-soft) !important;
}

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

h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
button,
label,
.caption,
.volver,
.pieza-meta,
.pieza-meta .titulo,
.pieza-meta .cliente,
.error {
  font-family: var(--type) !important;
  font-size: var(--text-size) !important;
  font-weight: 400 !important;
  color: var(--ink) !important;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

/*
  Broken / asymmetrical masonry:
  each tile keeps its own landscape height from its width (16:9),
  so a 2/3 cell is taller than a 1/3 cell in the same row.
*/
.obra-list {
  --columns: 24;
  display: grid;
  grid-template-columns: repeat(var(--columns), minmax(0, 1fr));
  column-gap: var(--gutter);
  row-gap: calc(var(--gutter) + var(--caption-gap));
  align-items: start;
  width: 100%;
  padding: var(--gutter);
  background: var(--paper);
}

.logo-cell,
.obra-card.cols-8 {
  grid-column: span 8;
}

.obra-card.cols-16 {
  grid-column: span 16;
}

.logo-cell {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--logo-slot);
  /* % padding is vs width: 5.6% ≈ 10% of 16:9 height; 6.7% right matches mockup */
  padding: 0 6.7% 5.6% 0;
  overflow: hidden;
}

.logo-img {
  display: block;
  width: 47%;
  max-width: 47%;
  height: auto;
  max-height: 50%;
  object-fit: contain;
  object-position: right bottom;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.obra-card {
  position: relative;
  min-width: 0;
  width: 100%;
}

.obra-card a,
.obra-card__surface {
  display: block;
  position: relative;
  width: 100%;
}

.obra-card--nolink,
.obra-card--nolink .obra-card__surface {
  cursor: default;
  pointer-events: auto;
}

.obra-card--nolink a {
  pointer-events: none;
}

.thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #111;
}

.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.caption {
  position: absolute;
  left: 0;
  top: calc(100% + 0.4em);
  width: 100%;
  text-transform: uppercase;
  transition: color 0.15s ease;
}

/* Beat global span { font-weight: 400 !important } */
.caption .cliente {
  font-weight: 700 !important;
  font-synthesis: weight;
}

.caption .titulo {
  font-weight: 400 !important;
}

.caption .cliente::after {
  content: " ";
  white-space: pre;
}

.obra-card a:hover .caption,
.obra-card a:focus-visible .caption,
.obra-card a:hover .caption *,
.obra-card a:focus-visible .caption * {
  color: var(--ink-soft) !important;
}

/* —— Piece / video page —— */
.pieza {
  flex: 1 1 auto;
  width: min(1100px, 100%);
  margin: 0 auto;
  padding: clamp(1rem, 2.5vw, 2rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-sizing: border-box;
}

body[data-page="pieza"] .site-footer {
  flex: 0 0 auto;
}

/* Shared column: VOLVER + player + meta (width synced to video frame) */
.pieza-stage {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 1rem;
  justify-items: stretch;
}

.volver {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink) !important;
  transition: color 0.15s ease;
}

.volver__icon {
  display: block;
  width: 0.95em;
  height: 0.95em;
  flex: 0 0 auto;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.volver:hover,
.volver:focus-visible {
  color: var(--ink-soft) !important;
}

/* —— Film curtain (multi-page nav) —— */
.film-curtain {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  visibility: hidden;
  /* Transparent shell — only slats are opaque so the destination page shows in gaps */
  background: transparent;
}

.film-curtain.is-closing,
.film-curtain.is-opening,
.film-curtain.is-closed {
  visibility: visible;
  pointer-events: auto;
}

.film-curtain__slat {
  flex: 1 1 0;
  background: #050505;
  transform: scaleY(0);
  transform-origin: center;
  will-change: transform;
}

.film-curtain.is-closed .film-curtain__slat {
  transform: scaleY(1);
}

.film-curtain.is-closing .film-curtain__slat {
  animation: film-curtain-close 0.14s cubic-bezier(0.76, 0, 0.24, 1) forwards;
  animation-delay: calc(var(--i) * 4ms);
}

.film-curtain.is-opening .film-curtain__slat {
  transform: scaleY(1);
  animation: film-curtain-open 0.14s cubic-bezier(0.76, 0, 0.24, 1) forwards;
  animation-delay: calc(var(--i) * 4ms);
}

@keyframes film-curtain-close {
  from {
    transform: scaleY(0);
  }
  to {
    transform: scaleY(1);
  }
}

@keyframes film-curtain-open {
  from {
    transform: scaleY(1);
  }
  to {
    transform: scaleY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .film-curtain,
  .film-curtain__slat {
    animation: none !important;
    transition: none !important;
  }
}

.player-shell {
  --player-ar: 16 / 9;
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0;
  aspect-ratio: var(--player-ar);
  max-height: min(78vh, 820px);
  line-height: 0;
  background: #000;
  overflow: hidden;
  isolation: isolate;
  user-select: none;
  -webkit-user-select: none;
}

.player-shell video {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  object-fit: contain;
  background: #000;
  cursor: pointer;
}

.player-shell video::-webkit-media-controls,
.player-shell video::-webkit-media-controls-enclosure {
  display: none !important;
}

.player-ui {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.7rem 0.55rem;
  pointer-events: none;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.45) 0%,
    rgba(0, 0, 0, 0.12) 55%,
    rgba(0, 0, 0, 0) 100%
  );
}

.player-progress {
  pointer-events: auto;
  flex: 1 1 auto;
  position: relative;
  height: 28px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
  z-index: 3;
}

.player-progress-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.player-progress-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.player-progress-input::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.player-progress-track {
  position: relative;
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  pointer-events: none;
  z-index: 1;
}

.player-progress-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
}

.player-progress-knob {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 11px;
  height: 11px;
  margin-top: -5.5px;
  margin-left: -5.5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
  opacity: 0.95;
}

.player-fs {
  pointer-events: auto;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff !important;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0 !important;
}

.player-fs svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.player-fs:hover,
.player-fs:focus-visible {
  opacity: 0.85;
  outline: none;
  color: #fff !important;
}

.player-shell:fullscreen,
.player-shell:-webkit-full-screen {
  width: 100%;
  height: 100%;
  max-height: none;
  aspect-ratio: auto;
  background: #000;
}

.player-shell:fullscreen video,
.player-shell:-webkit-full-screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: contain;
}

.player-shell:fullscreen .player-ui,
.player-shell:-webkit-full-screen .player-ui {
  z-index: 2;
}

.pieza-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1.25rem;
  width: 100%;
}

.pieza-meta .titulo {
  margin: 0;
  font-style: normal;
  text-transform: uppercase;
  text-align: left;
}

.pieza-meta .cliente {
  margin: 0;
  text-transform: uppercase;
  text-align: right;
  color: var(--ink) !important;
  flex: 0 1 auto;
}

.error {
  padding: 2rem;
  color: var(--ink-soft) !important;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 70px;
  padding: 0 var(--gutter);
  box-sizing: border-box;
  background: var(--paper);
  font-family: var(--type) !important;
  font-size: var(--text-size) !important;
  font-weight: 400 !important;
  letter-spacing: 0.02em;
  color: var(--ink) !important;
}

.site-footer__left {
  color: var(--ink) !important;
  font-size: var(--text-size) !important;
}

.site-footer__end {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.site-footer__ig {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--ink) !important;
  text-decoration: none;
  transition: color 0.15s ease;
  flex: 0 0 auto;
}

.site-footer__ig svg {
  display: block;
  width: 100%;
  height: 100%;
}

.site-footer__right {
  color: var(--ink) !important;
  font-size: var(--text-size) !important;
  text-decoration: none;
  transition: color 0.15s ease;
}

.site-footer__ig:hover,
.site-footer__ig:focus-visible,
.site-footer__right:hover,
.site-footer__right:focus-visible {
  color: var(--ink-soft) !important;
}

@media (max-width: 800px) {
  .obra-list {
    --gutter: 8px;
    --caption-gap: 1.5em;
  }

  .logo-cell,
  .obra-card.cols-8,
  .obra-card.cols-16 {
    grid-column: span 24;
  }

  .site-footer {
    padding: 0 8px;
  }
}
