/* ═══ RICCARDO SANVITI — estils compartits ═══ */

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

:root {
  --fons:    #0E0D0B;
  --text:    #EDEAE3;
  --oro:     #C79A4B;
  --oro-clar:#E0BA76;
  --grigio:  #191714;
}

html { scroll-behavior: smooth; }

body {
  background: var(--fons);
  color: var(--text);
  font-family: 'DM Mono', monospace;
  overflow-x: hidden;
}

/* La pàgina d'entrada no té scroll */
body.entrada {
  overflow: hidden;
  height: 100vh;
}

/* ── ETIQUETA DE SECCIÓ (compartida) ─────────────────── */
.etichetta-sezione {
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.65rem, 1vw, 0.8rem);
  color: var(--oro);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin-bottom: 1.8em;
}

/* ── NAV DE SUBPÀGINES ───────────────────────────────── */
.nav-pagina {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(16px, 2vw, 28px) clamp(24px, 4vw, 60px);
  z-index: 100;
  pointer-events: none;
}

.nav-pagina a {
  pointer-events: all;
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.7rem, 1vw, 0.85rem);
  color: var(--oro);
  text-decoration: none;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.75;
  transition: opacity 0.25s;
}

.nav-pagina a:hover { opacity: 1; }

.nav-pagina .nav-links {
  display: flex;
  gap: clamp(16px, 3vw, 40px);
  pointer-events: all;
}

.nav-pagina a.attiva {
  opacity: 1;
  border-bottom: 1px solid var(--oro);
}

/* ── ESCENA D'ENTRADA ────────────────────────────────── */
.escena {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.capa {
  position: relative;
  height: 100vh;
  width: 100%;
}

.fons-clip {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

#costellazione {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0.45;
}

/* Cada constel·lació flota amb la seva pròpia deriva */
#costellazione g.flota {
  transform-box: fill-box;
  transform-origin: center;
  animation: flota var(--fd, 12s) ease-in-out var(--fdel, 0s) infinite alternate;
}

@keyframes flota {
  from { transform: translate(0, 0) rotate(0deg); }
  to   { transform: translate(var(--fx, 10px), var(--fy, -12px)) rotate(0.6deg); }
}

/* Estrelles soltes que parpellegen */
#costellazione .brilla {
  animation: brilla var(--bd, 3s) ease-in-out var(--bdel, 0s) infinite alternate;
}

@keyframes brilla {
  from { opacity: 1; }
  to   { opacity: 0.15; }
}

@media (prefers-reduced-motion: reduce) {
  #costellazione g.flota,
  #costellazione .brilla { animation: none; }
}

/* ── FOC ─────────────────────────────────────────────── */
#foc {
  position: absolute;
  bottom: 10vh; /* mateixa línia de terra que les portes */
  left: 50%;
  transform: translateX(-50%);
  width: clamp(130px, 16vw, 260px);
  pointer-events: none;
  transition: opacity 0.7s ease;
}

#foc img {
  width: 100%;
  height: auto;
  display: block;
  filter: invert(1);
}

/* ── FUM ─────────────────────────────────────────────── */
#fum {
  position: absolute;
  bottom: 98%;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(60px, 10vw, 140px);
  height: clamp(180px, 30vw, 420px);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.fum-p {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(200,195,188,0.55) 0%, rgba(160,155,148,0) 70%);
  filter: blur(clamp(8px, 1.2vw, 16px));
  animation: puja-fum var(--dur) var(--delay) ease-in infinite;
}

.fum-p:nth-child(1) { --dur:3.2s; --delay:0.0s; --dx:-18px; width:55%; height:55%; left:22%; }
.fum-p:nth-child(2) { --dur:2.8s; --delay:0.7s; --dx: 22px; width:70%; height:70%; left:15%; }
.fum-p:nth-child(3) { --dur:3.6s; --delay:1.3s; --dx:-10px; width:45%; height:45%; left:27%; }
.fum-p:nth-child(4) { --dur:2.5s; --delay:2.0s; --dx: 14px; width:60%; height:60%; left:20%; }
.fum-p:nth-child(5) { --dur:3.9s; --delay:0.4s; --dx:-25px; width:50%; height:50%; left:25%; }

@keyframes puja-fum {
  0%   { transform: translateY(0)     translateX(0)          scale(0.3); opacity: 0; }
  12%  { opacity: 0.65; }
  60%  { opacity: 0.30; }
  100% { transform: translateY(-110%) translateX(var(--dx))  scale(2.8); opacity: 0; }
}

/* ── TÍTOL ───────────────────────────────────────────── */
#titol {
  position: absolute;
  top: 28%;
  left: 50%;
  text-align: center;
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

#titol h1 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(2.2rem, 5.5vw, 5rem);
  line-height: 0.90;
  color: var(--text);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#titol p {
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.65rem, 1.1vw, 0.85rem);
  color: var(--oro);
  margin-top: 1.1em;
  letter-spacing: 0.26em;
  text-transform: uppercase;
}

/* ── PORTES ──────────────────────────────────────────── */
.porta {
  position: absolute;
  bottom: 10vh;
  width: clamp(110px, 13vw, 190px);
  aspect-ratio: 700 / 1542;
  perspective: 900px;
  z-index: 3;
  display: block;
  text-decoration: none;
}

.porta-sx { left: 10vw; }
.porta-dx { right: 10vw; }

/* Interior il·luminat (es veu quan s'obre) */
.porta-interno {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 65%, #FFB347 0%, #8A3400 50%, #16130F 85%);
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* Fulla de la porta (imatge) */
.porta-anta {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: bottom;
  transition: transform 0.8s cubic-bezier(0.35, 0, 0.2, 1);
  backface-visibility: hidden;
  transform-style: preserve-3d;
}

.porta-sx .porta-anta { transform-origin: left center; }
.porta-dx .porta-anta { transform-origin: right center; }

.porta-sx:hover .porta-anta,
.porta-sx:focus-visible .porta-anta { transform: rotateY(-55deg); }
.porta-dx:hover .porta-anta,
.porta-dx:focus-visible .porta-anta { transform: rotateY(55deg); }

.porta:hover .porta-interno,
.porta:focus-visible .porta-interno { opacity: 1; }

/* Nom de la porta */
.porta-nome {
  position: absolute;
  top: -3.6em;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.85rem, 1.3vw, 1.05rem);
  color: var(--oro);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 1;
}

@media (max-width: 720px) {
  .porta { bottom: 18vh; }
  .porta-sx { left: 6vw; }
  .porta-dx { right: 6vw; }
  #foc { bottom: 18vh; }
}

/* Pista d'invitació: entreobert subtil quan l'usuari no interactua */
.porta-sx.porta-invito .porta-anta { animation: invito-sx 2.2s ease-in-out; }
.porta-dx.porta-invito .porta-anta { animation: invito-dx 2.2s ease-in-out; }
.porta-invito .porta-interno { animation: invito-glow 2.2s ease-in-out; }

@keyframes invito-sx {
  0%, 100% { transform: rotateY(0deg); }
  35%, 65% { transform: rotateY(-16deg); }
}
@keyframes invito-dx {
  0%, 100% { transform: rotateY(0deg); }
  35%, 65% { transform: rotateY(16deg); }
}
@keyframes invito-glow {
  0%, 100% { opacity: 0; }
  35%, 65% { opacity: 0.7; }
}

/* Porta oberta del tot (en clicar) */
.porta-sx.porta-aperta .porta-anta { transform: rotateY(-88deg); }
.porta-dx.porta-aperta .porta-anta { transform: rotateY(88deg); }
.porta-aperta .porta-interno { opacity: 1; }
.porta-aperta .porta-nome { opacity: 1; }

/* Zoom d'entrada a la porta */
.capa.zoom-porta {
  transition: transform 1.05s cubic-bezier(0.55, 0, 0.85, 1);
  transform: scale(11);
}

/* ── VEL DE TRANSICIÓ ────────────────────────────────── */
#velo-porta {
  position: fixed;
  inset: 0;
  background: #0D0B08;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: opacity 0.45s ease;
}

#velo-porta.actiu {
  opacity: 1;
  pointer-events: all;
}

/* ── GALLERIA OPERE ──────────────────────────────────── */
.galleria {
  display: flex;
  flex-direction: column;
  background: var(--grigio);
  overflow: hidden;
  padding: clamp(60px, 7vw, 90px) clamp(80px, 10vw, 180px) clamp(40px, 5vw, 64px);
  gap: clamp(24px, 3vw, 36px);
}

.galleria + .galleria {
  border-top: 1px solid #2A2723;
  background: var(--fons);
}

.galleria-header .etichetta-sezione {
  margin-bottom: 0.6em;
}

.galleria-header h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(3.8rem, 8vw, 7.5rem);
  color: var(--text);
  line-height: 1;
  letter-spacing: 0.04em;
}

.galleria-cols {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.galleria-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
  will-change: transform;
}

.galleria-col:nth-child(2) { margin-top: 40px; }
.galleria-col:nth-child(3) { margin-top: 20px; }

/* Fila d'obres horitzontals, a sota de les columnes verticals */
.galleria-orizzontale {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 38%;
  margin: 0 auto;
}

@media (max-width: 720px) {
  .galleria-orizzontale { display: none; }
}

.opera-item {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #211F1B;
}

.opera-item img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.7s ease;
  filter: grayscale(8%);
}

.opera-item:hover img {
  transform: scale(1.04);
  filter: grayscale(0%);
}

/* Degradat oro de dreta a esquerra en hover */
.opera-item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to left, rgba(20, 16, 10, 0.88) 0%, rgba(191, 144, 64, 0.55) 45%, rgba(14, 12, 10, 0) 78%);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.opera-item:hover::after { opacity: 1; }

.opera-nom {
  position: absolute;
  right: 0;
  bottom: 0;
  max-width: 68%;
  padding: clamp(12px, 1.2vw, 20px);
  color: #f5f0e8;
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.6rem, 0.85vw, 0.75rem);
  line-height: 1.6;
  text-align: right;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.45s ease;
  pointer-events: none;
}

.opera-item:hover .opera-nom { opacity: 1; }

/* ── CARRUSEL D'OBRES (mòbil) ─────────────────────────── */
.galleria-slider { display: none; }

@media (max-width: 720px) {
  .galleria { padding: clamp(80px, 9vw, 130px) 0 clamp(48px, 8vw, 70px); }
  .galleria-header { padding: 0 clamp(24px, 6vw, 40px); }
  .galleria-cols { display: none; }
  .galleria-slider { display: block; }
}

.slider-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  gap: 0;
  padding: 0 0 clamp(20px, 5vw, 32px);
}

.slider-track::-webkit-scrollbar { display: none; }

.slide-item {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: center;
  padding: 0 clamp(24px, 6vw, 40px);
  display: flex;
  flex-direction: column;
}

.slide-item img {
  width: 100%;
  height: clamp(320px, 78vw, 480px);
  display: block;
  background: #211F1B;
  object-fit: contain;
  object-position: center;
}

.slide-nom {
  margin-top: 0.9em;
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.72rem, 3vw, 0.85rem);
  color: var(--text);
  line-height: 1.6;
}

.slide-nom em {
  font-style: italic;
  color: #9B9488;
}

.slider-dots {
  display: flex;
  justify-content: center;
  gap: 9px;
  padding-bottom: clamp(48px, 9vw, 80px);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3A3733;
  transition: background 0.25s ease, transform 0.25s ease;
}

.dot.attivo {
  background: var(--oro);
  transform: scale(1.3);
}

/* ── CHI SONO ────────────────────────────────────────── */
.presentazione {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
  background: var(--grigio);
}

.foto-riccardo {
  width: 45%;
  min-height: 100vh;
  overflow: hidden;
  flex-shrink: 0;
  background: #1F1D1A;
}

.foto-riccardo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(20%) contrast(1.05) brightness(0.92);
}

.foto-riccardo .placeholder-foto {
  width: 100%;
  height: 100%;
  min-height: 100vh;
  background: linear-gradient(160deg, #211F1B 0%, #1A1815 60%, #100F0D 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.foto-riccardo .placeholder-foto span {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(0.75rem, 1.2vw, 1rem);
  color: var(--oro);
  opacity: 0.4;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.testo-presentazione {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(48px, 7vw, 100px);
}

.testo-presentazione h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(2rem, 3.8vw, 3.4rem);
  line-height: 0.95;
  margin-bottom: 1em;
  color: var(--text);
  letter-spacing: 0.04em;
  min-height: 2.85em; /* reserva l'alçada de les 3 línies mentre s'escriu */
}

/* Cursor de màquina d'escriure */
.cursore {
  display: inline-block;
  width: clamp(2px, 0.3vw, 4px);
  height: 0.78em;
  background: var(--oro);
  margin-left: 0.12em;
  animation: lampeggia 1.1s steps(2, start) infinite;
}

@keyframes lampeggia {
  50% { opacity: 0; }
}

/* Contactes integrats a la presentació */
.contatti-inline {
  margin-top: clamp(2rem, 4vh, 3.2rem);
}

.contatti-inline .etichetta-sezione {
  margin-bottom: 1.2em;
}

.testo-presentazione p {
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.78rem, 1.1vw, 0.88rem);
  line-height: 1.95;
  color: #9B9488;
  max-width: 440px;
  margin-bottom: 1.2em;
}

@media (max-width: 720px) {
  .presentazione { flex-direction: column; }
  .foto-riccardo { width: 100%; min-height: 55vw; }
  .foto-riccardo .placeholder-foto { min-height: 55vw; }
}

/* ── CONTATTI ────────────────────────────────────────── */
.contatti {
  min-height: 100vh;
  background: var(--fons);
  display: flex;
  align-items: stretch;
}

.contatti-testo {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(60px, 8vw, 120px);
}

.contatti-testo h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(3.5rem, 8vw, 7.5rem);
  line-height: 0.92;
  color: var(--text);
  margin-bottom: 1.2em;
  letter-spacing: 0.04em;
}

.contatti-links {
  display: flex;
  flex-direction: column;
  gap: 0.7em;
}

.contatti-links a {
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.78rem, 1.1vw, 0.9rem);
  color: var(--oro-clar);
  text-decoration: none;
  letter-spacing: 0.06em;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s, color 0.2s;
  width: fit-content;
}

.contatti-links a:hover {
  color: #9B9488;
  border-bottom-color: #9B9488;
}

.contatti-opera {
  width: 40%;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.contatti-opera img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(20%) brightness(0.9);
}

.contatti-opera::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, var(--fons) 0%, transparent 40%);
  pointer-events: none;
}

@media (max-width: 720px) {
  .contatti { flex-direction: column-reverse; }
  .contatti-opera { width: 100%; min-height: 50vw; }
}

/* ── SELECTOR D'IDIOMA ───────────────────────────────── */
.lang-switch {
  position: fixed;
  top: clamp(16px, 2.4vw, 28px);
  right: clamp(20px, 4vw, 40px);
  z-index: 101;
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.68rem, 1vw, 0.8rem);
  letter-spacing: 0.15em;
}

.lang-switch a {
  color: var(--oro);
  text-decoration: none;
  opacity: 0.55;
  transition: opacity 0.25s;
}

.lang-switch a:hover { opacity: 1; }

/* Idioma activament seleccionat (no clicable) */
.lang-corrente {
  color: var(--oro);
  opacity: 1;
  border-bottom: 1px solid var(--oro);
  padding-bottom: 2px;
}

/* Dins la barra de navegació de les subpàgines */
.nav-links .lang-sep {
  color: var(--oro);
  opacity: 0.35;
  margin: 0 -6px;
}

/* ── FOOTER / COPYRIGHT ──────────────────────────────── */
.footer-copy {
  text-align: center;
  padding: clamp(20px, 3vw, 32px) clamp(24px, 6vw, 40px);
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.62rem, 1vw, 0.72rem);
  letter-spacing: 0.08em;
  color: #9a948a;
  background: var(--fons);
}

body.entrada .footer-copy {
  position: absolute;
  bottom: clamp(16px, 2.5vw, 28px);
  left: 0;
  right: 0;
  background: transparent;
  z-index: 1;
  padding-bottom: 0;
}

@media (max-width: 720px) {
  body.entrada .footer-copy {
    bottom: 8px;
    font-size: 0.58rem;
    padding: 0 12px;
  }
}
