/* Anillo: diez fotos en un cilindro 3D. Todo el movimiento lo maneja app.js (un solo reloj). */
:root {
  --base: #0f0b09;
  --tinta: #efe6dc;
  --tinta-2: rgba(239, 230, 220, .55);
  --margen: clamp(16px, 2.8vw, 44px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--base);
  color: var(--tinta);
  font-family: 'Figtree', system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* Fondo: un tono casi negro con un halo del color del trabajo del frente (lo pinta app.js). */
.fondo { position: fixed; inset: 0; background: var(--base); }

/* El color del trabajo abierto: nace como un círculo desde la foto (clip-path, lo mueve app.js)
   y va tapando el anillo; al cerrar se achica y lo descubre. Por eso va por encima de la escena. */
.tinte { position: fixed; inset: 0; z-index: 6; display: none; pointer-events: none; }

/* Cabecera */
.cabecera {
  position: fixed; z-index: 20; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(var(--margen) * .8) var(--margen);
  pointer-events: none;
}
.cabecera > * { pointer-events: auto; opacity: 0; }
.marca { font-weight: 500; font-size: 11px; letter-spacing: .24em; text-transform: uppercase; transition: color .5s ease; }
/* "Get in touch": abre la hoja de contacto. El punto late apenas, para que se note que se puede tocar. */
.mail {
  display: inline-flex; align-items: center; gap: 11px;
  margin: -12px 0; padding: 12px 0 12px 12px;
  font-weight: 500; font-size: 11px; letter-spacing: .24em; text-transform: uppercase;
}
.mail i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: late 2.8s ease-in-out infinite; }
@keyframes late { 0%, 100% { opacity: 1; transform: none; } 50% { opacity: .35; transform: scale(.7); } }
@media (hover: hover) {
  .mail { background: linear-gradient(currentColor, currentColor) no-repeat 100% calc(100% - 7px) / 0 1px; transition: background-size .55s cubic-bezier(.16, 1, .3, 1); }
  .mail:hover { background-size: calc(100% - 29px) 1px; }
}
.cerrar {
  position: absolute; right: var(--margen);
  font-weight: 500; font-size: 11px; letter-spacing: .24em; text-transform: uppercase;
  padding: 10px 0 10px 14px; visibility: hidden;
}
.cerrar::before { content: ''; display: inline-block; width: 18px; height: 1px; background: currentColor; vertical-align: middle; margin-right: 12px; opacity: .6; }

/* Escena 3D */
.escena {
  position: fixed; inset: 0; z-index: 5;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  user-select: none; -webkit-user-select: none;
}
.escena.arrastrando { cursor: grabbing; }
.anillo {
  position: absolute; left: 50%; top: 50%;
  width: 0; height: 0;
  transform-style: preserve-3d;
}
.anillo.mueve { will-change: transform; }
.carta {
  position: absolute; left: 0; top: 0;
  opacity: 0;
  backface-visibility: visible;
  overflow: hidden;
  will-change: transform;
}
/* La foto y el velo van cada uno en su capa: al girar, apagarse o darse vuelta la carta no se vuelve a dibujar
   (redibujarla obliga a decodificar otra vez la foto, y eso trababa la entrada). */
.carta img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; will-change: transform; }
.carta.dorso img { transform: scaleX(-1); }
.carta .velo { position: absolute; inset: 0; background: #0a0706; pointer-events: none; will-change: opacity; }
.carta.frente { cursor: pointer; }

/* Pie: flecha, título + contador, flecha. El ancho es fijo para que las flechas no se corran al cambiar el título. */
.pie {
  position: fixed; z-index: 20; left: 50%; bottom: clamp(14px, 3vh, 30px);
  width: min(calc(100vw - 32px), 480px);
  transform: translateX(-50%);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  white-space: nowrap; opacity: 0; pointer-events: none;
}
.pie-centro { display: flex; align-items: center; gap: 16px; min-width: 0; }
.pie-flecha {
  flex: none; width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid rgba(239, 230, 220, .26);
  pointer-events: auto;
  transition: background-color .35s ease, border-color .35s ease, color .35s ease, transform .2s ease;
}
.pie-flecha svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .45s cubic-bezier(.16, 1, .3, 1); }
@media (hover: hover) {
  .pie-flecha:hover { background-color: var(--tinta); border-color: var(--tinta); color: var(--base); }
  #antes:hover svg { transform: translateX(-3px); }
  #despues:hover svg { transform: translateX(3px); }
}
.pie-flecha:active { transform: scale(.93); }
.pie.fuera .pie-flecha { pointer-events: none; }
.pie-titulo { font-weight: 800; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; }
.pie-raya { width: 28px; height: 1px; background: var(--tinta-2); }
.pie-num { font-weight: 500; font-size: 12px; letter-spacing: .08em; color: var(--tinta-2); font-variant-numeric: tabular-nums; }

/* Vista abierta */
.obra { position: fixed; inset: 0; z-index: 10; pointer-events: none; visibility: hidden; color: var(--tinta); }
.obra.activa { visibility: visible; }
.obra-texto { position: absolute; z-index: 2; }
.obra-titulo { font-weight: 800; text-transform: uppercase; line-height: .9; letter-spacing: -.01em; }
.obra-titulo .linea { display: block; overflow: hidden; }
.obra-titulo .linea-in { display: inline-block; white-space: nowrap; }
.obra-tipo { margin-top: 16px; font-weight: 500; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--tinta-2); opacity: 0; }

.obra-num {
  position: absolute; opacity: 0;
  font-weight: 500; font-size: 12px; letter-spacing: .08em; color: var(--tinta-2);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.obra-num b { font-weight: 800; color: var(--tinta); }

.sostener {
  position: absolute; opacity: 0; transform: translateX(-50%);
  font-weight: 500; font-size: 10px; letter-spacing: .24em; text-transform: uppercase;
  color: var(--tinta-2); white-space: nowrap; font-variant-numeric: tabular-nums;
}

/* Cada foto del trabajo abierto es una pieza: la principal (grande) y las cartas que salen de atrás. */
.pieza {
  position: absolute; left: 0; top: 0; z-index: 1;
  transform-origin: 50% 50%;
  pointer-events: auto; cursor: pointer;
  touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.pieza.fija { cursor: default; }
.pieza.principal { z-index: 3; cursor: zoom-in; }
.pieza.principal.lupa { cursor: move; }
.pieza-in {
  position: absolute; inset: 0; overflow: hidden;
  box-shadow: 0 14px 30px -18px rgba(0, 0, 0, .55);
}
.pieza.principal .pieza-in, .pieza.vuela .pieza-in { box-shadow: 0 34px 80px -34px rgba(0, 0, 0, .6); }
/* Rincón de 2 px donde las otras fotos del trabajo quedan dibujadas en grande: así el cambio no las decodifica en pleno vuelo. */
.tibio { position: absolute; left: 0; top: 0; z-index: 0; width: 2px; height: 2px; overflow: hidden; opacity: .01; pointer-events: none; }
.tibio img { position: absolute; left: 0; top: 0; display: block; height: auto; }
.lente { position: absolute; inset: 0; transform-origin: 0 0; }
.lente img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; transition: opacity .5s ease; }
/* La foto todavía no llegó: el marco muestra un fondo suave que late despacio, y la foto aparece cuando está. */
.pieza.vacia .lente img { opacity: 0; }
.pieza.vacia .pieza-in { background: color-mix(in srgb, var(--tinta) 9%, transparent); animation: late-marco 1.5s ease-in-out infinite alternate; }
.pieza.vacia.pedida { cursor: progress; }
.pieza.vacia.pedida .pieza-in { background: color-mix(in srgb, var(--tinta) 18%, transparent); }
@keyframes late-marco { from { opacity: 1; } to { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .pieza.vacia .pieza-in { animation: none; } }
.recorte { position: absolute; inset: 0; background-repeat: no-repeat; }
.etiqueta {
  position: absolute; left: 8px; bottom: 7px;
  font-weight: 800; font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: #fff;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .55);
  pointer-events: none;
}

/* Entrada: la foto principal a pantalla completa y la palabra calada encima */
.portada { position: fixed; z-index: 14; left: 0; top: 0; overflow: hidden; pointer-events: none; transform-origin: 50% 50%; }
.portada img { display: block; width: 100%; height: 100%; }
.palabra { position: fixed; inset: 0; z-index: 30; width: 100%; height: 100%; display: none; pointer-events: none; }

/* Contacto: hoja clara a pantalla completa. Se abre en círculo desde el botón (clip-path, lo mueve app.js). */
.contacto {
  --papel: #efe6dc; --negro: #17110e; --negro-2: rgba(23, 17, 14, .55);
  position: fixed; inset: 0; z-index: 40;
  display: flex; flex-direction: column;
  background: var(--papel); color: var(--negro);
  overflow-y: auto; visibility: hidden;
}
.contacto.activa { visibility: visible; }
.contacto :focus-visible { outline-color: var(--negro); }
.contacto-cab {
  flex: none; display: flex; justify-content: space-between; align-items: center;
  padding: calc(var(--margen) * .8) var(--margen);
  font-weight: 500; font-size: 11px; letter-spacing: .24em; text-transform: uppercase;
}
.contacto-cab span { color: var(--negro-2); }
.contacto-cerrar { font-weight: 500; letter-spacing: .24em; text-transform: uppercase; margin: -10px 0; padding: 10px 0 10px 14px; }
.contacto-cerrar::before { content: ''; display: inline-block; width: 18px; height: 1px; background: currentColor; vertical-align: middle; margin-right: 12px; opacity: .6; }
.contacto-cuerpo {
  flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
  gap: clamp(26px, 6vh, 70px);
  padding: 24px var(--margen) calc(var(--margen) * 1.1);
}
.contacto-titulo { font-weight: 800; font-size: min(11.6vw, 25vh); line-height: .9; letter-spacing: -.02em; text-transform: uppercase; }
.contacto-titulo .linea { display: block; overflow: hidden; padding-top: .04em; }
.contacto-titulo .linea-in { display: inline-block; white-space: nowrap; }
/* cada fila: nombre de la red, el dato en grande y su acción; la raya de arriba se dibuja de izquierda a derecha */
.fila {
  position: relative;
  display: grid; grid-template-columns: clamp(96px, 15vw, 220px) minmax(0, 1fr) auto; align-items: center; gap: 6px 16px;
  padding: clamp(14px, 2.6vh, 26px) 0;
}
.fila::before, .fila:last-child::after {
  content: ''; position: absolute; left: 0; right: 0; top: 0; height: 1px;
  background: rgba(23, 17, 14, .2);
  transform: scaleX(var(--raya, 1)); transform-origin: 0 50%;
}
.fila:last-child::after { top: auto; bottom: 0; }
.fila > * { opacity: var(--ver, 1); transform: translateY(calc((1 - var(--ver, 1)) * 16px)); }
.fila-nombre { font-weight: 500; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--negro-2); }
.fila-valor {
  justify-self: start; max-width: 100%;
  font-weight: 500; font-size: clamp(21px, 3.3vw, 48px); line-height: 1.1; letter-spacing: -.015em;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) no-repeat 100% 100% / 0 1px;
  transition: background-size .6s cubic-bezier(.16, 1, .3, 1);
}
.fila-accion {
  min-width: 96px; padding: 11px 16px; border-radius: 999px;
  border: 1px solid rgba(23, 17, 14, .3);
  font-weight: 500; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; text-align: center;
  transition: background-color .3s ease, color .3s ease, border-color .3s ease;
}
.fila-accion.flecha {
  min-width: 0; padding: 0 6px; border: 0;
  font-size: clamp(20px, 2.2vw, 30px); letter-spacing: 0; line-height: 1;
  transition: translate .45s cubic-bezier(.16, 1, .3, 1);
}
@media (hover: hover) {
  .fila-valor:hover { background-position: 0 100%; background-size: 100% 1px; }
  button.fila-accion:hover { background-color: var(--negro); border-color: var(--negro); color: var(--papel); }
  .fila:hover .flecha { translate: 4px -4px; }
}

:focus-visible { outline: 1px solid var(--tinta); outline-offset: 4px; }

@media (prefers-reduced-motion: reduce) {
  .mail i { animation: none; }
}

@media (max-width: 700px) {
  .marca, .cerrar, .mail, .contacto-cab { font-size: 10px; }
  .pie { gap: 8px; }
  .pie-centro { gap: 10px; }
  .pie-flecha { width: 40px; height: 40px; }
  .contacto-titulo { font-size: min(13.6vw, 16vh); }
  .fila { grid-template-columns: minmax(0, 1fr) auto; }
  .fila-nombre { grid-column: 1 / -1; font-size: 10px; }
  .fila-accion { min-width: 84px; padding: 10px 14px; font-size: 10px; }
  .pie-titulo { font-size: 11px; }
  .pie-raya { width: 20px; }
  .obra-num { display: none; }
  .obra-tipo { margin-top: 12px; font-size: 10px; }
  .sostener { font-size: 9px; }
  .etiqueta { left: 6px; bottom: 5px; font-size: 8px; }
}
