:root {
  --dark: #050507;
  --tray: #0a0a0c;
  --safelight: #c92a1c;
  --safelight-glow: #ff4d3a;
  --paper: #f4ede4;
  --paper-dim: #d6cec4;
  --ink: #121212;
  --graphite: #8f8880;
  --line: rgba(255, 255, 255, 0.06);
  --rope: #3b3631;
  --pad: clamp(16px, 5vw, 60px);
  
  /* Detalles vanguardistas */
  --glass-bg: rgba(5, 5, 7, 0.45);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-blur: blur(20px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--dark);
  color: var(--paper);
  font-family: 'Manrope', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
.mono { font-family: 'Space Mono', monospace; letter-spacing: 0.06em; }

.eyebrow {
  font-family: 'Space Mono', monospace;
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--safelight-glow); display: inline-block;
}

/* ---------- ATMÓSFERA Y VANGUARDIA ---------- */
.ambient-glow {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: 
    radial-gradient(circle at 15% 20%, rgba(104, 52, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(45, 143, 219, 0.06) 0%, transparent 40%);
  filter: blur(60px);
  animation: breathe 15s ease-in-out infinite alternate;
}

@keyframes breathe {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.1); opacity: 1; }
}

.grain {
  position: fixed; inset: -150px; z-index: 200; pointer-events: none;
  opacity: 0.04; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 0.4s steps(2) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0,0); }
  100% { transform: translate(-2%,2%); }
}

.safelight {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    radial-gradient(ellipse 65% 50% at 50% -10%, rgba(201,42,28,0.12) 0%, transparent 70%);
}

/* ---------- NAV GLASSMORPHISM ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px var(--pad);
  background: var(--glass-bg);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--glass-border);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-brand-wrap { display: flex; align-items: center; gap: 12px; }
.nav-logo { font-family: 'Playfair Display', serif; font-size: clamp(18px, 2vw, 22px); font-weight: 500; letter-spacing: -0.02em; }
.nav-logo span { color: var(--safelight-glow); }
.version-tag { font-size: 9px; padding: 3px 8px; border-radius: 20px; background: rgba(255,255,255,0.05); color: var(--paper-dim); border: 1px solid var(--line); display: none; }

.lab-controls { display: flex; align-items: center; margin-left: auto; }
.lab-btn {
  background: rgba(255,255,255,0.03); border: 1px solid var(--glass-border);
  color: var(--paper-dim); font-size: 10px; padding: 8px 16px; border-radius: 20px;
  transition: all 0.3s ease;
}
.lab-btn:hover { background: rgba(255,255,255,0.08); color: var(--paper); border-color: rgba(255,255,255,0.2); }
.lab-btn.highlight { color: var(--safelight-glow); border-color: rgba(255,77,58,0.3); }

.nav-links { display: flex; gap: 24px; list-style: none; margin-left: 24px; }
.nav-links a {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--graphite); padding: 4px 0; position: relative;
  transition: color .3s ease;
}
.nav-links a::after {
  content: ''; position: absolute; bottom: 0; left: 0; width: 0%; height: 1px;
  background: var(--safelight-glow); transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-links a:hover { color: var(--paper); }
.nav-links a:hover::after { width: 100%; }

.nav-toggle { display: none; border: 1px solid var(--glass-border); color: var(--paper); padding: 8px 14px; border-radius: 20px; font-size: 10px; margin-left: 16px; }

/* Responsive Nav */
@media (min-width: 768px) {
  .version-tag { display: inline-block; }
}
@media (max-width: 980px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; position: absolute; top: 100%; left: 0; right: 0;
    background: var(--glass-bg); backdrop-filter: var(--glass-blur); 
    border-bottom: 1px solid var(--glass-border); flex-direction: column; gap: 0;
    padding: 10px 0; margin-left: 0;
  }
  .nav-links a { padding: 16px var(--pad); display: block; border-bottom: 1px solid rgba(255,255,255,0.03); }
  .nav-toggle { display: block; }
}

/* ---------- AMPLIADOR / HERO ---------- */
.enlarger {
  position: relative; min-height: 100vh; min-height: 100svh;
  border-bottom: 1px solid var(--line); display: flex; flex-direction: column; justify-content: flex-end;
  padding-top: 100px; overflow: hidden;
}
.hero-content-wrap {
  position: relative; width: 100%; max-width: 1400px; margin: 0 auto;
  display: flex; flex-direction: column; align-items: center; padding-bottom: 8vh;
}
.dust-canvas { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.beam {
  position: absolute; top: 0; left: 50%; width: 100%; max-width: 1200px; height: 100%; transform: translateX(-50%);
  clip-path: polygon(45% 0%, 55% 0%, 90% 100%, 10% 100%);
  background: linear-gradient(to bottom, rgba(255,230,200,0.06) 0%, rgba(255,210,180,0.01) 60%, transparent 100%);
  z-index: 1; transform-origin: top center;
}

.tray {
  position: relative; z-index: 3; width: calc(100% - var(--pad) * 2); max-width: 750px; aspect-ratio: 3/2;
  background: var(--tray); border: 1px solid var(--glass-border); box-shadow: 0 40px 100px rgba(0,0,0,0.9);
  border-radius: 4px; overflow: hidden; will-change: transform;
}
.tray-liquid {
  position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(135deg, rgba(201,42,28,0.1) 0%, rgba(255,255,255,0.03) 50%, rgba(201,42,28,0.05) 100%);
}
.tray img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: invert(1) grayscale(1) contrast(2) brightness(1.2);
}
.tray img.is-missing { display: none; }
.tray-fallback {
  display: none; position: absolute; inset: 0; z-index: 1; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--graphite); font-size: 12px; background: #0a0a0a;
}
.tray img.is-missing ~ .tray-fallback { display: flex; }
.tray-label { position: absolute; left: 16px; bottom: 12px; z-index: 3; font-size: 9px; color: rgba(255,255,255,0.5); }

.hero-overlay {
  width: 100%; padding: 0 var(--pad);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; z-index: 4;
  margin-top: -80px; pointer-events: none;
}
.hero-text { pointer-events: auto; will-change: transform; }
.hero-text h1 {
  font-family: 'Playfair Display', serif; font-weight: 400; font-size: clamp(2rem, 5.5vw, 4.5rem);
  max-width: 18ch; line-height: 1.05; margin-top: 16px; color: var(--paper); letter-spacing: -0.02em;
}
.hero-text h1 em { font-style: italic; font-weight: 300; color: var(--safelight-glow); }
.hero-text p { max-width: 45ch; color: var(--paper-dim); font-size: clamp(14px, 1.5vw, 16px); font-weight: 300; margin-top: 20px; line-height: 1.8; }
.hero-scroll { font-size: 10px; color: var(--graphite); writing-mode: vertical-rl; align-self: flex-end; margin-bottom: 20px; }

@media (max-width: 768px) {
  .hero-overlay { flex-direction: column; align-items: flex-start; margin-top: 30px; }
  .hero-scroll { display: none; }
  .tray { aspect-ratio: 4/5; } /* Mejor encuadre móvil */
}

/* ---------- ROLLER SECUENCIA ---------- */
section.roll { padding: clamp(60px, 10vw, 120px) 0; scroll-margin-top: 80px; border-bottom: 1px solid var(--line); position: relative; z-index: 10; }
.roll-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: clamp(40px, 6vw, 60px); flex-wrap: wrap; padding: 0 var(--pad); }
.roll-head h2 { font-family: 'Playfair Display', serif; font-weight: 400; font-size: clamp(28px, 4vw, 48px); margin-top: 8px; }
.roll-head p { max-width: 50ch; color: var(--graphite); font-size: clamp(14px, 1.5vw, 15px); font-weight: 300; }
.roll-count { font-size: 11px; color: var(--safelight-glow); border: 1px solid var(--glass-border); padding: 6px 12px; border-radius: 20px; }

.line-wrap { position: relative; padding-top: 40px; }
.rope {
  position: absolute; top: 40px; left: 0; right: 0; height: 1px;
  background: var(--rope); box-shadow: 0 1px 2px rgba(0,0,0,0.5); transition: opacity 0.4s ease;
}

.line-row {
  display: flex; gap: clamp(20px, 4vw, 40px); align-items: flex-start; overflow-x: auto; scroll-snap-type: x proximity;
  padding: 0 var(--pad) 40px; scrollbar-width: none;
  perspective: 1000px;
}
.line-row::-webkit-scrollbar { display: none; }

.print {
  position: relative; flex: 0 0 auto; scroll-snap-align: center; cursor: pointer;
  transform-origin: top center; opacity: 0;
}
.print.portrait { width: clamp(200px, 35vw, 280px); }
.print.portrait .print-photo { aspect-ratio: 4/5; }
.print.landscape { width: clamp(260px, 45vw, 380px); }
.print.landscape .print-photo { aspect-ratio: 3/2; }
.print.square { width: clamp(220px, 38vw, 320px); }
.print.square .print-photo { aspect-ratio: 1/1; }

.pin {
  position: absolute; top: -12px; left: 50%; transform: translateX(-50%); width: 12px; height: 18px; z-index: 2; transition: opacity 0.3s;
}
.pin::before { content: ''; position: absolute; inset: 0; background: #a3907c; border-radius: 2px 2px 4px 4px; box-shadow: 0 2px 4px rgba(0,0,0,0.5); }

.print-frame {
  background: var(--paper); padding: 10px 10px 12px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4); border-radius: 2px;
  transition: box-shadow 0.3s ease;
}
.print:hover .print-frame { box-shadow: 0 30px 60px rgba(0,0,0,0.6); }

.print-photo { position: relative; width: 100%; overflow: hidden; background: #111; border-radius: 1px; }
.print-photo img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  filter: invert(calc(1 - var(--dev, 0))) grayscale(calc(1 - var(--dev, 0))) contrast(calc(1 + 0.8 * (1 - var(--dev, 0)))) brightness(calc(0.6 + 0.4 * var(--dev, 0)));
}
.print-photo img.is-missing { display: none; }
.print-fallback { display: none; position: absolute; inset: 0; z-index: 1; flex-direction: column; align-items: center; justify-content: center; background: #e0d6c8; color: var(--ink); font-size: 10px; }
.print-photo img.is-missing ~ .print-fallback { display: flex; }

/* ---------- HOJA DE CONTACTO (GRID MODE) ---------- */
body.contact-sheet-mode .rope, body.contact-sheet-mode .pin { opacity: 0; }
body.contact-sheet-mode .line-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(140px, 20vw, 220px), 1fr));
  gap: clamp(10px, 2vw, 24px); overflow-x: visible; 
  background: var(--glass-bg); backdrop-filter: var(--glass-blur);
  padding: clamp(16px, 3vw, 32px); border-radius: 8px;
  border: 1px solid var(--glass-border); margin: 0 var(--pad);
}
body.contact-sheet-mode .print { width: 100% !important; scroll-snap-align: none; }
body.contact-sheet-mode .print-frame {
  background: #000; padding: 16px 8px 24px; border: 1px solid #222; position: relative; box-shadow: none;
}
body.contact-sheet-mode .print-frame::before {
  content: 'KODAK TX 400'; position: absolute; top: 4px; left: 8px;
  font-family: 'Space Mono', monospace; font-size: 7px; color: #a88132; letter-spacing: 1px;
}
body.contact-sheet-mode .print-frame::after {
  content: attr(data-frame); position: absolute; bottom: 4px; right: 8px;
  font-family: 'Space Mono', monospace; font-size: 8px; color: #a88132;
}

/* ---------- MESA DE LUZ GLASSMORPHISM ---------- */
.lighttable {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(3, 3, 5, 0.85); backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px);
  display: none; align-items: center; justify-content: center; padding: var(--pad);
  opacity: 0;
}
.lighttable.open { display: flex; }
.lt-frame { position: relative; max-width: min(1200px, 100%); width: 100%; display: flex; flex-direction: column; gap: 16px; opacity: 0; transform: scale(0.95); }
.lt-glow {
  background: radial-gradient(circle at center, rgba(244,237,228,0.95) 0%, rgba(220,210,195,0.9) 100%);
  padding: clamp(12px, 2vw, 40px); box-shadow: 0 30px 100px rgba(0,0,0,0.9); border-radius: 4px;
}
.lt-glow img { width: 100%; max-height: 70vh; object-fit: contain; display: block; border-radius: 2px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.lt-metadata { text-align: center; font-size: 9px; color: #6b645c; margin-top: 16px; letter-spacing: 0.1em; }
.lt-cap { display: flex; justify-content: space-between; align-items: center; font-size: 11px; color: var(--paper-dim); }
.lt-close, .lt-prev, .lt-next {
  position: absolute; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); color: var(--paper);
  font-size: 10px; padding: 10px 16px; border-radius: 24px; backdrop-filter: blur(10px);
  transition: all .2s ease;
}
.lt-close:hover, .lt-prev:hover, .lt-next:hover { background: rgba(255,255,255,0.15); color: var(--safelight-glow); border-color: var(--safelight-glow); }

.lt-close { top: -60px; right: 0; }
.lt-prev { left: -70px; top: 50%; transform: translateY(-50%); }
.lt-next { right: -70px; top: 50%; transform: translateY(-50%); }

@media (max-width: 850px) {
  .lt-prev, .lt-next { position: static; transform: none; flex: 1; text-align: center; }
  .lt-close { top: auto; bottom: -60px; right: 0; width: 100%; text-align: center; }
  .lt-nav-row { display: flex; justify-content: space-between; gap: 12px; margin-top: 12px; }
  .lt-glow img { max-height: 55vh; }
}

/* ---------- FOOTER ---------- */
footer { position: relative; padding-top: 40px; border-top: 1px solid var(--line); z-index: 10; background: var(--dark); }
.f-inner { padding: 40px var(--pad) 80px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 30px; }
.f-brand { font-family: 'Playfair Display', serif; font-size: 18px; }
.f-brand span { color: var(--safelight-glow); }
.f-links { display: flex; gap: clamp(16px, 3vw, 30px); flex-wrap: wrap; }
footer a.mono, footer span.mono { font-size: 11px; color: var(--graphite); transition: color 0.3s; }
footer a.mono:hover { color: var(--paper); }