/* bananopx — sitio público
   Negro puro, una tipografía, y vidrio que toma el color del trabajo en pantalla. */

:root {
  --ink: #000;
  --paper: #f3f3f1;
  --mute: rgba(243, 243, 241, .56);
  --faint: rgba(243, 243, 241, .32);
  --line: rgba(255, 255, 255, .12);
  --tint: 128, 128, 140;            /* lo actualiza site.js con el color de la pieza */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.4, .5, 1);
  --pad: clamp(16px, 3vw, 40px);
  --font: "Instrument Sans", ui-sans-serif, -apple-system, "SF Pro Text", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { background: var(--ink); color: var(--paper); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body { font: 400 15px/1.5 var(--font); min-height: 100dvh; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
img, video { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid rgba(255, 255, 255, .9); outline-offset: 3px; border-radius: 8px; }
::selection { background: rgba(var(--tint), .6); color: #fff; }

/* ---------------- Vidrio líquido ---------------- */
.glass {
  position: relative;
  isolation: isolate;
  --shade: .24;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .16), rgba(255, 255, 255, .04) 55%, rgba(255, 255, 255, .07)),
    linear-gradient(rgba(var(--tint), .18), rgba(var(--tint), .18)),
    linear-gradient(rgba(0, 0, 0, var(--shade)), rgba(0, 0, 0, var(--shade)));
  text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  backdrop-filter: blur(16px) saturate(180%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .42),
    inset 0 -1px 0 rgba(255, 255, 255, .10),
    inset 0 0 18px rgba(255, 255, 255, .05),
    0 12px 32px -12px rgba(0, 0, 0, .65);
  transition: background .9s var(--ease);
}
/* Borde especular */
.glass::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(140deg, rgba(255, 255, 255, .7), rgba(255, 255, 255, .06) 32%, rgba(255, 255, 255, 0) 60%, rgba(255, 255, 255, .28));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 1;
}
/* Refracción real (solo navegadores Chromium; site.js activa la clase) */
.refract .glass.lens-fx {
  -webkit-backdrop-filter: url(#lg-refract) blur(6px) saturate(190%);
  backdrop-filter: url(#lg-refract) blur(6px) saturate(190%);
}

/* ---------------- Barra superior ---------------- */
.top {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) var(--pad) 0;
  pointer-events: none;
}
.top > * { pointer-events: auto; }
/* texto blanco que se lee sobre cualquier pieza al bajar */
.top { mix-blend-mode: difference; }
.brand { font-weight: 600; font-size: 17px; letter-spacing: -.02em; padding: 8px 0; text-shadow: 0 1px 12px rgba(0, 0, 0, .4); }

.seg {
  position: relative;
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.2vw, 30px);
}
.seg > a, .seg > button {
  position: relative;
  padding: 6px 0;
  font-size: 14.5px;
  color: var(--mute);
  transition: color .3s var(--ease);
  white-space: nowrap;
}
.seg > a:hover, .seg > button:hover { color: var(--paper); }
.seg > .on { color: var(--paper); }
.seg-lens {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: var(--paper);
  opacity: 0;
  pointer-events: none;
  transition: transform .5s var(--ease), width .5s var(--ease), opacity .3s;
}

/* ---------------- Inicio: destacados en vertical ---------------- */
.home { position: relative; padding: 0 var(--pad) max(48px, env(safe-area-inset-bottom)); }
/* Resplandor fijo que toma el color de la pieza que está al centro */
.home::before {
  content: "";
  position: fixed;
  left: 50%;
  top: 55%;
  z-index: -1;
  width: min(1500px, 130vw);
  height: 80vh;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(var(--tint), .22), transparent);
  pointer-events: none;
  transition: background .9s var(--ease);
}
/* Portada: el primer destacado a todo lo ancho, con el título encima.
   site.js pone --hp (0 arriba … 1 cuando ya bajaste una pantalla): se encoge y redondea hasta volverse tarjeta. */
.hero {
  --hp: 0;
  position: relative;
  height: 100svh;
  min-height: 560px;
  margin: 0 calc(var(--pad) * -1);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 0 var(--pad) clamp(56px, 10vh, 104px);
}
.cover {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #0b0b0b;
  border-radius: calc(var(--hp) * 18px);
  transform: translate3d(0, calc(var(--hp) * 6vh), 0) scale(calc(1 - .12 * var(--hp)));
  transform-origin: 50% 100%;
  will-change: transform;
}
.cover-media { position: absolute; inset: 0; transform: scale(1.12); opacity: 0; }
.intro-done .cover-media { animation: cover-in 1.9s var(--ease) both; }
@keyframes cover-in { from { transform: scale(1.12); opacity: 0; } to { transform: none; opacity: 1; } }
.cover-media img, .cover-media video { display: block; width: 100%; height: 100%; object-fit: cover; }
/* sombra arriba (menú) y abajo (título) para que el texto se lea sobre cualquier video */
.cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .38), transparent 22%, transparent 48%, rgba(0, 0, 0, .7));
  pointer-events: none;
}
.hero-text {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 48px;
  pointer-events: none;
  transform: translate3d(0, calc(var(--hp) * -60px), 0);
  opacity: calc(1 - var(--hp) * 1.8);
}
.hero-text a { pointer-events: auto; }
.cover-label {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 15px;
  white-space: nowrap;
  opacity: 0;
}
.intro-done .cover-label { animation: fade-up .9s var(--ease) .5s both; }
.cover-label .num { color: var(--mute); font-variant-numeric: tabular-nums; }
.cover-label b { font-weight: 500; }
.cover-label .go { color: var(--mute); transition: color .3s; }
.cover-label .go::after { content: " →"; }
.cover-label:hover .go { color: var(--paper); }
.statement {
  max-width: 22ch;
  font-weight: 500;
  font-size: clamp(30px, 3.6vw, 56px);
  line-height: 1.02;
  letter-spacing: -.035em;
  text-wrap: balance;
}
/* Cada palabra sube desde abajo de su renglón */
.statement .w { display: inline-block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; vertical-align: top; }
.statement .w > span { display: inline-block; transform: translateY(110%); }
.intro-done .statement .w > span { animation: word-in 1s var(--ease) both; animation-delay: calc(var(--i) * 70ms + 80ms); }
@keyframes word-in { from { transform: translateY(110%); } to { transform: none; } }
@keyframes fade-up { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Esquinas de abajo: rol a la izquierda, ubicación a la derecha (fijas al bajar) */
.corner {
  position: fixed;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 25;
  color: var(--mute);
  font-size: 14px;
  pointer-events: none;
  mix-blend-mode: difference;
  opacity: 0;
  transition: opacity .6s var(--ease) .4s;
}
.intro-done .corner { opacity: 1; }
.corner-l { left: var(--pad); }
.corner-r { right: var(--pad); }
.corner:empty { display: none; }

/* "scroll": una línea que baja sola */
.scroll-hint {
  position: absolute;
  z-index: 2;
  left: 50%;
  margin-left: -24px;
  width: 48px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--mute);
  font-size: 13px;
  opacity: 0;
}
.intro-done .scroll-hint { animation: fade-up .9s var(--ease) .6s both; }
.scroll-hint i { position: relative; width: 1px; height: 54px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.scroll-hint i::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 40%;
  background: var(--paper);
  animation: drip 1.8s var(--ease) infinite;
}
@keyframes drip { from { transform: translateY(-100%); } to { transform: translateY(250%); } }
.scroll-hint:hover { color: var(--paper); }

/* Las piezas: una debajo de otra, grandes, a su proporción real.
   site.js pone --in (0 → 1 al entrar) y --par (-1 abajo … 1 arriba) en cada una. */
.works { padding-top: clamp(96px, 16vh, 180px); display: flex; flex-direction: column; align-items: center; gap: clamp(72px, 12vh, 150px); }
.work {
  --in: 1;
  --par: 0;
  display: block;
  width: min(100%, 1180px, calc(78vh * var(--r)));
  opacity: calc(.08 + .92 * var(--in));
  transform: translate3d(0, calc((1 - var(--in)) * 80px + var(--par) * -18px), 0) scale(calc(.9 + .1 * var(--in)));
  transform-origin: 50% 0;
  will-change: transform, opacity;
}
.work-media {
  position: relative;
  display: block;
  aspect-ratio: var(--r);
  border-radius: 16px;
  overflow: hidden;
  background: #0b0b0b;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .06), 0 40px 70px -40px rgba(0, 0, 0, .95);
}
.work-media img, .work-media video { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 1.1s var(--ease); }
.work:hover .work-media img, .work:hover .work-media video { transform: scale(1.025); }
.work-meta {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  align-items: baseline;
  gap: 14px;
  padding: 18px 2px 0;
  font-size: 15px;
}
.work-meta .num { color: var(--faint); font-variant-numeric: tabular-nums; }
.work-meta b { font-weight: 500; font-size: clamp(18px, 1.6vw, 22px); letter-spacing: -.02em; }
.work-meta .sub { color: var(--mute); }
.work-meta .go { color: var(--mute); transition: color .3s, transform .4s var(--spring); }
.work-meta .go::after { content: " →"; }
.work:hover .go { color: var(--paper); transform: translateX(4px); }

.home-foot { position: relative; display: flex; justify-content: center; padding: clamp(80px, 14vh, 160px) 0 24px; }
.more {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: .35em;
  font-weight: 500;
  font-size: clamp(28px, 4.4vw, 64px);
  letter-spacing: -.035em;
  line-height: 1.1;
}
.more::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.08em;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .6s var(--ease);
}
.more:hover::after { transform: scaleX(1); }
.more em { font-style: normal; font-size: .38em; color: var(--mute); font-variant-numeric: tabular-nums; align-self: flex-start; margin-top: .2em; }
.more i { font-style: normal; color: var(--mute); transition: transform .5s var(--ease), color .3s; }
.more:hover i { color: var(--paper); transform: translateX(.15em); }

.empty {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--mute);
  padding: var(--pad);
}

/* ---------------- Galería ---------------- */
.gallery { padding: 120px var(--pad) 80px; }
.gallery-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.gallery-head h1 { font-weight: 500; font-size: clamp(44px, 7vw, 96px); letter-spacing: -.045em; line-height: .9; }
.gallery-head h1 sup { font-size: .26em; letter-spacing: 0; color: var(--mute); vertical-align: top; margin-left: .3em; font-weight: 400; }

.grid { display: flex; flex-wrap: wrap; gap: 10px; }
.grid::after { content: ""; flex-grow: 1e5; }
.tile {
  position: relative;
  flex-grow: var(--r);
  flex-basis: calc(var(--r) * var(--row, 300px));
  aspect-ratio: var(--r);
  overflow: hidden;
  border-radius: 8px;
  background: #0e0e0e;
  cursor: pointer;
}
.tile img, .tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease), opacity .4s; }
.tile video { opacity: 0; }
.tile.playing video { opacity: 1; }
.tile:hover img, .tile:hover video { transform: scale(1.03); }
.tile::after {
  content: "";
  position: absolute;
  inset: 50% 0 0;
  z-index: 2;
  background: linear-gradient(transparent, rgba(0, 0, 0, .6));
  opacity: 0;
  transition: opacity .4s var(--ease);
  pointer-events: none;
}
.tile .tag {
  position: absolute;
  z-index: 3;
  left: 14px;
  right: 14px;
  bottom: 12px;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .3s, transform .5s var(--ease);
}
.tile:hover::after, .tile:focus-visible::after { opacity: 1; }
.tile:hover .tag, .tile:focus-visible .tag { opacity: 1; transform: none; }
.tile.hidden { display: none; }
@media (hover: none) { .tile .tag { opacity: 1; transform: none; } .tile::after { opacity: 1; } }

/* ---------------- Proyecto ---------------- */
.project {
  position: fixed;
  inset: 0;
  z-index: 30;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--ink);
  animation: sheet .6s var(--ease) both;
}
@keyframes sheet { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
.project.closing { animation: sheet-out .35s var(--ease) both; }
@keyframes sheet-out { to { opacity: 0; transform: translateY(30px); } }
.project-inner { max-width: 1480px; margin: 0 auto; padding: 120px var(--pad) 110px; }
.close {
  position: fixed;
  z-index: 35;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  font-size: 15px;
  font-weight: 500;
  color: #fff;
  mix-blend-mode: difference;
}
.close svg { width: 12px; height: 12px; transition: transform .5s var(--ease); }
.close:hover svg { transform: rotate(90deg); }

.p-head { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px 56px; align-items: end; margin-bottom: 48px; }
.p-title { font-weight: 500; font-size: clamp(44px, 7.5vw, 120px); line-height: .9; letter-spacing: -.05em; text-wrap: balance; }
.p-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 22px; font-size: 14.5px; }
.p-facts dt { color: var(--faint); }
.p-facts dd { color: var(--paper); }
.p-desc { grid-column: 1 / -1; max-width: 62ch; font-size: clamp(17px, 1.6vw, 21px); line-height: 1.5; color: rgba(243, 243, 241, .82); }

.blocks { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; gap: 12px; }
.cell {
  position: relative;
  flex: var(--r) 1 0;
  aspect-ratio: var(--r);
  min-width: 0;
  border-radius: 10px;
  overflow: hidden;
  background: #0d0d0d;
}
.row.single .cell { max-height: 88dvh; }
.row.single.tall { justify-content: center; }
.row.single.tall .cell { flex: 0 0 auto; height: min(88dvh, 1100px); }
.cell img, .cell video { width: 100%; height: 100%; object-fit: cover; }
.cell img { cursor: zoom-in; }
.text-block { max-width: 62ch; padding: 36px 0; font-size: clamp(17px, 1.5vw, 20px); line-height: 1.55; color: rgba(243, 243, 241, .82); white-space: pre-line; }

.next {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-top: 96px;
  padding: 40px 0 24px;
  border-top: 1px solid var(--line);
}
.next img { width: 120px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; }
.next small { display: block; color: var(--faint); font-size: 14px; }
.next strong { font-weight: 500; font-size: clamp(28px, 4vw, 52px); letter-spacing: -.04em; line-height: 1; }
.next:hover strong { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 6px; }

/* ---------------- Visor de imagen ---------------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .94); display: grid; place-items: center; cursor: zoom-out; animation: fade .3s both; }
.lightbox img { max-width: 96vw; max-height: 94dvh; object-fit: contain; border-radius: 6px; }
@keyframes fade { from { opacity: 0; } }

/* ---------------- Contacto ---------------- */
.contact-layer {
  position: fixed;
  inset: 0;
  z-index: 38; /* debajo del menú, para poder ir a otra sección */
  display: flex;
  align-items: flex-end;
  padding: 120px var(--pad) calc(max(20px, env(safe-area-inset-bottom)) + 96px); /* deja aire para "close" */
  background: var(--ink);
  animation: fade .35s var(--ease) both;
  overflow-y: auto;
}
.contact-card { width: 100%; max-width: 1200px; animation: fade-up .7s var(--ease) .05s both; }
.c-label { color: var(--mute); font-size: 15px; }
.mail {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: .3em .5em;
  margin-top: 14px;
  font-weight: 500;
  font-size: clamp(34px, 6.4vw, 96px);
  letter-spacing: -.045em;
  line-height: 1;
  text-align: left;
}
.mail span { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .6s var(--ease); padding-bottom: .04em; }
.mail:hover span { background-size: 100% 1px; }
.mail em { font-style: normal; font-size: clamp(13px, .2em, 19px); letter-spacing: 0; color: var(--mute); }
.mail.copied em { color: var(--paper); }
.contact-card .about { max-width: 56ch; margin-top: 28px; color: rgba(243, 243, 241, .82); line-height: 1.55; white-space: pre-line; }
.socials { margin-top: 40px; display: flex; flex-wrap: wrap; gap: 10px 32px; }
.socials a { font-size: 17px; color: var(--mute); transition: color .25s; }
.socials a i { font-style: normal; margin-left: 4px; font-size: .85em; }
.socials a:hover { color: var(--paper); }


/* ---------------- Móvil ---------------- */
@media (max-width: 760px) {
  .seg { gap: 18px; }
  .seg > a, .seg > button { font-size: 14px; }
  .hero { height: 88svh; min-height: 480px; padding-bottom: 72px; }
  .hero-text { flex-direction: column; align-items: flex-start; gap: 14px; }
  .cover-label { font-size: 14px; }
  .works { padding-top: 72px; }
  .scroll-hint { display: none; }
  .works { gap: 64px; }
  .work { width: min(100%, calc(72vh * var(--r))); }
  .work-media { border-radius: 10px; }
  .work-meta { grid-template-columns: auto 1fr auto; row-gap: 2px; padding-top: 12px; font-size: 14px; }
  .work-meta .sub { grid-column: 2 / -1; grid-row: 2; }
  .home-foot { flex-direction: column; align-items: stretch; padding-bottom: 44px; }
  .grid { gap: 6px; }
  .tile { --row: 150px; border-radius: 6px; }
  .p-head { grid-template-columns: 1fr; gap: 24px; margin-bottom: 32px; }
  .blocks, .row { gap: 6px; }
  .row { flex-wrap: wrap; }
  .row .cell { flex-basis: calc(var(--r) * 170px); }
  .row.single.tall .cell { height: auto; flex: 1 1 100%; }
  .cell { border-radius: 6px; }
  .next img { width: 84px; }
}

/* ---------------- Pantalla de carga (primera visita de la sesión) ---------------- */
.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: var(--ink);
  clip-path: inset(0 0 0 0);
  transition: clip-path .9s cubic-bezier(.7, 0, .2, 1);
}
.intro.out { clip-path: inset(0 0 100% 0); }
.intro-name { font-weight: 600; font-size: 20px; letter-spacing: -.02em; animation: fade-up .7s var(--ease) both; }
.intro-bar { position: relative; width: 120px; height: 1px; background: rgba(255, 255, 255, .14); overflow: hidden; }
.intro-bar i {
  position: absolute;
  inset: 0;
  background: var(--paper);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 1.8s cubic-bezier(.2, .7, .3, 1);
}
.intro.out .intro-name, .intro.out .intro-bar { opacity: 0; transition: opacity .3s; }
/* La barra de arriba entra después de la cortina */
.top { transition: opacity .6s var(--ease) .2s; }
html:not(.intro-done) .top { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
