:root {
  --fondo: #ece8e1;   /* claro cálido, no blanco puro */
  --tinta: #1d1b18;   /* oscuro cálido, no negro puro */
  --tinta-2: #46423c; /* texto largo */
  --tenue: #7a756c;
  --linea: #cfc9be;
  --hover: #e2ddd4;
  --acento: #2f6b55;  /* verde del letrero, oscuro para leerse sobre claro */
  --sombra: 38, 30, 20; /* color de las sombras, en RGB */
  --alto: 400px;
  --ancho: 256px;
  --slot: 258px;
  --margen: 40px;
  --rotulo: 92px;
  --curva: cubic-bezier(.76, 0, .24, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--fondo);
  color: var(--tinta);
  font-family: 'Geist', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* Grano fino encima de todo */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: .07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 1px solid var(--acento); outline-offset: 3px; }

.mono { font-family: 'Geist Mono', monospace; }

/* ---------- Barra superior ---------- */
.barra {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px var(--margen);
}
.firma { display: flex; align-items: baseline; gap: 12px; }
.firma-nombre { font-weight: 600; font-size: 15px; letter-spacing: -.01em; }
.firma-rol { font-family: 'Geist Mono', monospace; font-size: 11px; color: var(--tenue); text-transform: uppercase; letter-spacing: .06em; }

.boton-pildora {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--linea);
  border-radius: 99px;
  font-size: 12.5px;
  color: var(--tinta);
  text-decoration: none;
  background: rgba(236, 232, 225, .7);
  backdrop-filter: blur(8px);
  transition: border-color .25s, background .25s;
}
.boton-pildora:hover { border-color: var(--tenue); background: var(--hover); }

/* ---------- Escenario de discos ---------- */
.escenario {
  position: fixed;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: opacity .5s var(--curva), transform .7s var(--curva), filter .5s;
}
body.con-proyecto .escenario { opacity: .15; transform: scale(.97); filter: blur(4px); }

.pista {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(50% - (var(--alto) + var(--rotulo)) / 2 - 10px);
  height: calc(var(--alto) + var(--rotulo));
}

.disco {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--slot);
  height: 100%;
  will-change: transform;
}
/* El mouse solo cuenta sobre la etiqueta y la zona fija del puesto (no sobre la foto que se mueve) */
.disco { pointer-events: none; }
.rotulo, .zona { pointer-events: auto; }
.zona {
  position: absolute;
  top: var(--rotulo);
  left: 0;
  width: var(--slot);
  height: var(--alto);
  cursor: pointer;
}

.rotulo {
  position: relative;
  display: block;
  width: 100%;
  height: var(--rotulo);
  padding-right: 18px;
  text-align: left;
}
.disco.der .rotulo { text-align: right; padding-right: 0; padding-left: 18px; }
.disco.der .rotulo-play { left: auto; right: 0; }
.disco.centro .rotulo { text-align: center; padding: 0; }
.disco.centro .rotulo-play { left: calc(50% - 4.5px); right: auto; }
.rotulo-nombre {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -.005em;
  overflow: hidden;
}
.rotulo-rubro:empty { display: none; }
.rotulo-rubro {
  display: block;
  margin-top: 3px;
  font-size: 11.5px;
  color: var(--tenue);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rotulo-play {
  position: absolute;
  left: 0;
  bottom: 24px;
  width: 9px;
  height: 9px;
  fill: var(--tinta);
  transition: transform .3s var(--curva), fill .3s;
}
.disco:hover .rotulo-play, .disco.activo .rotulo-play { fill: var(--acento); }
.disco:hover .rotulo-play { transform: scale(1.4); }

/* Cada foto gira desde su borde: las de la izquierda desde el izquierdo,
   las de la derecha desde el derecho (clase .der). El ángulo lo pone app.js. */
.funda {
  position: absolute;
  z-index: 2;
  top: var(--rotulo);
  left: 0;
  width: var(--ancho);
  height: var(--alto);
  transform-origin: 0 50%;
  transform-style: preserve-3d;
  pointer-events: none;
  background: #d9d3c9;
  will-change: transform;
}
.halo {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 34px 70px rgba(0, 0, 0, .75);
}
.disco.der .funda { left: calc(var(--ancho) * -1); transform-origin: 100% 50%; }

/* Se oscurece hacia el borde que se aleja */
.sombra {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, .05), rgba(0, 0, 0, .55) 35%, #000 85%);
}
.disco.der .sombra { background: linear-gradient(270deg, rgba(0, 0, 0, .05), rgba(0, 0, 0, .55) 35%, #000 85%); }

/* Lomo: el canto de la foto, lo único que se ve de la del centro */
.lomo {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--lomo);
  transform-origin: 0 50%;
  transform: rotateY(90deg);
  background-color: var(--tono);
  background-size: cover;
  background-position: left center;
  pointer-events: none;
}
.lomo::after {
  /* un poco de luz en el canto */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, .14), transparent 40%, rgba(0, 0, 0, .25));
}
.disco.der .lomo {
  left: auto;
  right: 0;
  transform-origin: 100% 50%;
  transform: rotateY(-90deg);
  background-position: right center;
}

/* Portada (sirve para la fila y para la ficha del proyecto) */
.portada { position: absolute; inset: 0; overflow: hidden; }
.portada img, .portada video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.portada-base {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 70% at 15% 0%, color-mix(in oklab, var(--tono) 70%, white 30%) 0%, transparent 60%),
    linear-gradient(170deg, var(--tono) 30%, color-mix(in oklab, var(--tono) 45%, black) 100%);
}
.portada-base::after {
  /* surcos sutiles, como cartón de funda */
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(0, 0, 0, .05) 0 1px, transparent 1px 5px);
  mix-blend-mode: multiply;
}
.portada-nombre {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 7%;
  font-weight: 600;
  font-size: calc(var(--w, var(--ancho)) * .17);
  line-height: .88;
  letter-spacing: -.045em;
  color: #fff;
  overflow-wrap: anywhere;
}
.portada-base.claro .portada-nombre { color: #111; }

/* ---------- Pie ---------- */
.pie {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: end;
  gap: 24px;
  padding: 0 var(--margen) 26px;
  pointer-events: none;
}
.pie > * { pointer-events: auto; }
.pie, .barra { transition: opacity .4s var(--curva); }
body.con-proyecto .pie, body.con-proyecto .barra { opacity: 0; pointer-events: none; }
body.con-proyecto .pie > * { pointer-events: none; }

.activo { min-width: 0; }
.activo-nombre {
  margin: 0;
  overflow: hidden;
  font-size: clamp(1.9rem, min(3.4vw, 6.2vh), 3.4rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -.04em;
  /* Los títulos largos pasan a dos líneas parejas en vez de cortarse */
  text-wrap: balance;
  overflow-wrap: break-word;
  padding-bottom: .06em;
}
.activo-nombre span { display: inline-block; max-width: 100%; }
.activo-nombre span.entra { animation: entra .55s var(--curva); }
@keyframes entra {
  from { transform: translateY(70%); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.activo-dato {
  margin: 6px 0 0;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--tenue);
}

.controles { display: flex; align-items: center; gap: 8px; padding-bottom: 6px; }
.control {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--linea);
  border-radius: 99px;
  transition: border-color .25s, background .25s, color .25s;
}
.control svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.control:hover { border-color: var(--tenue); background: var(--hover); }
.control-abrir { width: auto; padding: 0 16px; font-size: 12.5px; }
.control-abrir:hover { background: var(--tinta); color: var(--fondo); border-color: var(--tinta); }

.recorrido {
  justify-self: end;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  padding-bottom: 18px;
}
.pista-ayuda {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--tenue);
  transition: opacity .6s;
}
.pista-ayuda.oculta { opacity: 0; }
.recorrido-linea { position: relative; width: 140px; height: 1px; background: var(--linea); overflow: hidden; }
.recorrido-linea i {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: calc(100% / 9);
  background: var(--tinta);
}

/* ---------- Proyecto abierto ---------- */
.proyecto {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--linea) transparent;
  background: rgba(236, 232, 225, .94);
  opacity: 0;
  transition: opacity .45s var(--curva);
}
.proyecto.abierto { opacity: 1; }
.proyecto[hidden] { display: none; }

.proy-cerrar { position: fixed; z-index: 60; top: 22px; right: var(--margen); }

.proy-grid {
  display: grid;
  grid-template-columns: minmax(280px, 38%) 1fr;
  gap: 40px;
  padding: 0 var(--margen);
}

.proy-ficha {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  gap: 18px;
  padding: 70px 0 40px;
  overflow-y: auto;
  scrollbar-width: none;
}
.proy-funda {
  --w: min(24dvh, 220px);
  position: relative;
  width: var(--w);
  height: calc(var(--w) * 4 / 3);
  flex: none;
  transform-origin: 0 0;
  background: #d9d3c9;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(var(--sombra), .2);
}
.proy-rubro {
  margin: 0 0 8px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tenue);
}
.proy-nombre {
  margin: 0;
  font-size: clamp(2.2rem, min(4.4vw, 9vh), 4.6rem);
  font-weight: 500;
  line-height: .95;
  letter-spacing: -.045em;
}
.proy-cuenta { margin: 10px 0 0; font-size: 13px; color: var(--tenue); }
.proy-nav { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 12.5px; color: var(--tenue); }
.proy-nav button { transition: color .2s; }
.proy-nav button:hover { color: var(--tinta); }

.proyecto .proy-texto, .proyecto .proy-nav, .proyecto .clip {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity .6s var(--curva), transform .8s var(--curva);
}
.proyecto.abierto .proy-texto, .proyecto.abierto .proy-nav, .proyecto.abierto .clip { opacity: 1; transform: none; }
.proyecto.abierto .proy-texto { transition-delay: .25s; }
.proyecto.abierto .proy-nav { transition-delay: .35s; }
.proyecto.abierto .clip:nth-child(1) { transition-delay: .3s; }
.proyecto.abierto .clip:nth-child(2) { transition-delay: .4s; }
.proyecto.abierto .clip:nth-child(3) { transition-delay: .5s; }

.proy-videos {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9dvh;
  padding: 8dvh 0 14dvh;
}

.clip { margin: 0; }
.marco {
  position: relative;
  height: min(84dvh, 820px);
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border-radius: 12px;
  background: #d9d3c9;
  box-shadow: 0 14px 40px rgba(var(--sombra), .18);
}
.clip.horizontal .marco { height: auto; width: min(100%, 980px); aspect-ratio: 16 / 9; }
.clip.horizontal { width: 100%; display: flex; flex-direction: column; align-items: center; }
.marco video, .marco iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; background: #000; }
.marco video { cursor: pointer; }
.marco.red-instagram { aspect-ratio: auto; width: min(400px, 84dvh * .5); height: min(88dvh, 760px); background: #fff; }

.marco.vacio {
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(135deg, #e4dfd6 0 12px, #e8e3db 12px 24px);
}
.marco.vacio span {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tenue);
}

/* Foto sola en grande */
.clip.ancha { width: 100%; display: flex; flex-direction: column; align-items: center; }
.marco.foto { aspect-ratio: 1; height: auto; width: min(100%, 900px, 84dvh); }
.marco.foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--hover); }
@supports (height: 1dvh) { .marco.foto { max-height: 84dvh; } }

/* Carrusel de imágenes */
.marco.galeria { aspect-ratio: 3 / 4; outline: none; }
.tira {
  position: absolute;
  inset: 0;
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.tira::-webkit-scrollbar { display: none; }
.tira img {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  object-fit: cover;
  scroll-snap-align: start;
  user-select: none;
}
.galeria .mandos { justify-content: space-between; opacity: 1; }
.contador {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  letter-spacing: .05em;
  padding: 6px 10px;
  border-radius: 99px;
  background: rgba(0, 0, 0, .45);
  backdrop-filter: blur(8px);
}
.mando:disabled { opacity: .3; cursor: default; }
.puntos {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  right: 12px;
  display: flex;
  justify-content: center;
  gap: 4px;
  pointer-events: none;
}
.puntos i { flex: 1; max-width: 32px; height: 2px; border-radius: 2px; background: rgba(255, 255, 255, .3); transition: background .3s; }
.puntos i.on { background: #fff; }

.clip figcaption {
  margin-top: 12px;
  font-size: 13px;
  color: var(--tenue);
}

.mandos {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
  transition: opacity .3s;
}
.marco:hover .mandos, .marco.pausado .mandos, .marco:focus-within .mandos { opacity: 1; }
@media (hover: none) { .mandos { opacity: 1; } }
.mando {
  height: 30px;
  padding: 0 12px;
  border-radius: 99px;
  font-size: 12px;
  background: rgba(0, 0, 0, .55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .12);
}
.mando:hover { background: rgba(0, 0, 0, .8); }
.mando-pantalla { margin-left: auto; }
.avance { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; height: 2px; background: rgba(255, 255, 255, .12); }
.avance i { display: block; height: 100%; width: 0; background: var(--acento); }

/* ---------- Celular ---------- */
@media (max-width: 760px) {
  :root { --rotulo: 70px; }
  .rotulo { padding-right: 10px; }
  .rotulo-play { bottom: 12px; }
  .barra { padding: 16px var(--margen); }
  .firma-rol { display: none; }
  .pie { grid-template-columns: 1fr auto; padding-bottom: max(18px, env(safe-area-inset-bottom)); }
  .recorrido { display: none; }
  .controles .control:not(.control-abrir) { display: none; }

  .proy-grid { grid-template-columns: 1fr; gap: 0; }
  .proy-ficha { position: static; height: auto; padding: 76px 0 10px; gap: 18px; }
  .proy-funda { --w: 34vw; width: var(--w); height: calc(var(--w) * 4 / 3); }
  .proy-videos { padding-top: 6dvh; gap: 7dvh; }
  .clip { width: 100%; display: flex; flex-direction: column; align-items: center; }
  .marco { height: auto; width: min(100%, 78dvh * .5625); }
  .marco.galeria { width: min(100%, 78dvh * .75); }
  .marco.red-instagram { width: 100%; height: 76dvh; }
}

@media (prefers-reduced-motion: reduce) {
  .escenario, .proyecto, .proyecto .clip, .proyecto .proy-texto, .proyecto .proy-nav { transition: none !important; }
  .activo-nombre span.entra { animation: none; }
}

/* ---------- Pie de foto y ficha técnica ---------- */
.proy-pie {
  margin: 14px 0 0;
  max-width: 44ch;
  font-size: 14px;
  line-height: 1.55;
  color: var(--tinta-2);
}
.proy-pie:empty, .proy-datos:empty { display: none; }
.proy-datos {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px 18px;
  margin: 18px 0 0;
  max-width: 46ch;
  padding-top: 14px;
  border-top: 1px solid var(--linea);
  font-size: 12.5px;
}
.proy-datos dt {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--tenue);
  padding-top: 2px;
}
.proy-datos dd { margin: 0; color: var(--tinta); }

/* ---------- Modo cascada (MODO = 'cascada' en app.js) ----------
   La del centro al frente; las demás detrás, más chicas y montadas hacia los lados. */
html.modo-cascada { --rotulo: 0px; }
.modo-cascada .rotulo, .modo-cascada .zona, .modo-cascada .lomo, .modo-cascada .halo { display: none; }
.modo-cascada .funda {
  transform-origin: 50% 50%;
  transform-style: flat;
  border-radius: 14px;
  overflow: hidden;
  pointer-events: auto;
  cursor: pointer;
  box-shadow: 0 22px 44px rgba(var(--sombra), .22), 0 3px 10px rgba(var(--sombra), .14);
}
.modo-cascada .sombra { background: var(--fondo); } /* las de atrás se funden un poco con el fondo */
@media (max-width: 760px) { .modo-cascada .funda { border-radius: 10px; } }
