/* —— Variables —— */
:root {
  --bg: #fdfdfc;
  --bg-elevated: #f2f1ee;
  --text: #2a2826;
  --text-muted: #5c5955;
  --accent: #9a7b2d;
  --accent-soft: rgba(154, 123, 45, 0.35);
  --border-subtle: rgba(42, 40, 38, 0.1);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Outfit", system-ui, sans-serif;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
  --space-2xl: clamp(4rem, 12vw, 9rem);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 4.25rem;
  --hero-collage-delay: 0.85s;
  --hero-collage-duration: 3s;
  --hero-collage-max-w: min(100%, 92vw, 76rem);
  --hero-collage-max-h: min(88vh, 56rem);
  --hero-slide-crossfade: 1.4s;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-collage {
    opacity: 1;
  }

  .hero-collage-slide {
    transition: none;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 300;
  font-size: clamp(1rem, 2.5vw, 1.0625rem);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

body.nav-open {
  overflow: hidden;
}

body.lightbox-open {
  overflow: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.25s var(--ease-out), opacity 0.25s var(--ease-out);
}

a:hover {
  color: #7a6220;
}

/* —— Header —— */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  min-height: var(--header-h);
  transition: background 0.4s var(--ease-out), backdrop-filter 0.4s var(--ease-out);
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-shrink: 0;
}

.lang-switcher {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.lang-switcher a {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0.35rem 0.45rem;
  border-radius: 2px;
  transition: color 0.25s var(--ease-out), background 0.25s var(--ease-out);
}

.lang-switcher a:hover {
  color: var(--text);
}

.lang-switcher a[aria-current="page"] {
  color: var(--accent);
  pointer-events: none;
}

.site-nav {
  margin-left: auto;
}

.site-header.is-scrolled {
  background: rgba(253, 253, 252, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--border-subtle);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  z-index: 102;
}

.logo:hover {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  position: relative;
  z-index: 102;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text);
  flex-shrink: 0;
}

.nav-toggle-bar {
  display: block;
  width: 1.35rem;
  height: 1px;
  margin: 0.35rem auto;
  background: currentColor;
  transition: transform 0.35s var(--ease-out), opacity 0.25s;
}

.nav-open .nav-toggle-bar:first-child {
  transform: translateY(0.35rem) rotate(45deg);
}

.nav-open .nav-toggle-bar:last-child {
  transform: translateY(-0.35rem) rotate(-45deg);
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
}

.site-nav a {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.site-nav a:hover {
  color: var(--text);
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
    margin-left: auto;
  }

  .site-nav {
    margin-left: 0;
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s var(--ease-out), visibility 0.4s;
  }

  .site-nav.is-open {
    opacity: 1;
    visibility: visible;
  }

  .site-nav ul {
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
  }

  .site-nav a {
    font-size: 1rem;
  }
}

/* —— Sections —— */
.section {
  position: relative;
  padding: var(--space-2xl) var(--space-md);
}

.section-inner {
  max-width: 72rem;
  margin: 0 auto;
}

.section-kicker {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-xs);
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2rem, 5vw, 3.25rem);
  margin: 0 0 var(--space-md);
  line-height: 1.15;
}

.section-lead {
  max-width: 36rem;
  color: var(--text-muted);
  margin: 0;
  font-weight: 300;
}

/* —— Hero —— */
.section--hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-h) + var(--space-lg)) var(--space-md) var(--space-xl);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: -20%;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 70% 20%, rgba(201, 169, 98, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(90, 85, 78, 0.08), transparent 50%),
    linear-gradient(165deg, #f7f6f3 0%, var(--bg) 42%, #f0efeb 100%);
  animation: heroShift 22s ease-in-out infinite alternate;
}

/* Collage: capa que entra en fundido; dentro, diapositivas con crossfade (JS) */
.hero-collage {
  position: absolute;
  inset: 0;
  z-index: 1;
  padding: var(--space-sm);
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--hero-collage-duration) var(--ease-out);
}

.hero-collage.hero-collage--visible {
  opacity: 1;
}

.hero-collage-slides {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-collage-slide {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: auto;
  height: auto;
  max-width: var(--hero-collage-max-w);
  max-height: var(--hero-collage-max-h);
  object-fit: contain;
  object-position: center;
  opacity: 0;
  z-index: 1;
  transition: opacity var(--hero-slide-crossfade) ease-in-out;
}

.hero-collage-slide.is-active {
  opacity: 1;
  z-index: 2;
}

@keyframes heroShift {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(2%, 1%) scale(1.04);
    opacity: 0.95;
  }
}

.hero-inner {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 52rem;
  padding: var(--space-md) var(--space-lg);
  border-radius: 4px;
  background: rgba(253, 253, 252, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 2px 24px rgba(42, 40, 38, 0.06);
}

.hero-label {
  font-size: 0.75rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 var(--space-sm);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.75rem, 10vw, 5.5rem);
  line-height: 1.05;
  margin: 0 0 var(--space-md);
  letter-spacing: -0.02em;
}

.hero-tagline {
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  color: var(--text-muted);
  font-weight: 300;
  margin: 0 0 var(--space-lg);
}

.hero-cta {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  border: 1px solid var(--accent-soft);
  color: var(--accent);
  font-size: 0.8125rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: background 0.35s var(--ease-out), border-color 0.35s var(--ease-out), color 0.35s var(--ease-out);
}

.hero-cta:hover {
  background: rgba(154, 123, 45, 0.1);
  border-color: var(--accent);
  color: #5c4a1a;
}

.hero-scroll {
  position: absolute;
  bottom: var(--space-md);
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  opacity: 0.5;
}

.hero-scroll-line {
  width: 1px;
  height: 3rem;
  background: linear-gradient(to bottom, var(--accent), transparent);
  animation: scrollPulse 2.5s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%,
  100% {
    opacity: 0.4;
    transform: scaleY(0.85);
  }
  50% {
    opacity: 1;
    transform: scaleY(1);
  }
}

/* —— Reveal —— */
.reveal {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.9s var(--ease-out), transform 0.9s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 {
  transition-delay: 0.1s;
}
.reveal-delay-2 {
  transition-delay: 0.2s;
}
.reveal-delay-3 {
  transition-delay: 0.3s;
}

/* —— Work process —— */
.section--process {
  background: var(--bg-elevated);
}

.process-media-wrap,
.materials-media-wrap {
  margin: 0 0 var(--space-xl);
}

.process-media-wrap[hidden],
.materials-media-wrap[hidden] {
  display: none !important;
}

.process-media-inner,
.materials-media-inner {
  position: relative;
  max-width: 56rem;
  margin: 0 auto;
}

.process-media-slides,
.materials-media-slides {
  position: relative;
  aspect-ratio: 16 / 10;
  max-height: min(56vh, 640px);
  margin: 0 auto;
  border-radius: 4px;
  overflow: hidden;
  background: #e2e0dc;
  box-shadow: 0 8px 40px rgba(42, 40, 38, 0.08);
}

.process-media-slide,
.materials-media-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity var(--section-media-crossfade, 1.1s) var(--ease-out);
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.process-media-slide.is-active,
.materials-media-slide.is-active {
  opacity: 1;
  z-index: 2;
}

.process-media-img,
.process-media-video,
.materials-media-img,
.materials-media-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.process-media-video,
.materials-media-video {
  background: #1a1a18;
}

.process-media-dots,
.materials-media-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin-top: var(--space-md);
  padding: 0 var(--space-sm);
}

.process-media-dots:empty,
.materials-media-dots:empty {
  display: none;
}

.process-media-dot,
.materials-media-dot {
  width: 0.45rem;
  height: 0.45rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.35;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.2s, background 0.2s;
}

.process-media-dot:hover,
.process-media-dot:focus-visible,
.materials-media-dot:hover,
.materials-media-dot:focus-visible {
  opacity: 0.65;
  transform: scale(1.15);
}

.process-media-dot.is-active,
.materials-media-dot.is-active {
  opacity: 1;
  background: var(--accent);
  transform: scale(1.2);
}

.process-media-dot:focus-visible,
.materials-media-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.process-steps {
  list-style: none;
  margin: var(--space-lg) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-lg);
}

@media (min-width: 700px) {
  .process-steps {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
  }
}

.process-step {
  padding: var(--space-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  transition: border-color 0.35s var(--ease-out), transform 0.35s var(--ease-out);
  box-shadow: 0 1px 2px rgba(42, 40, 38, 0.04);
}

.process-step:hover {
  border-color: var(--accent-soft);
  transform: translateY(-3px);
}

.process-num {
  font-family: var(--font-display);
  font-size: 2.5rem;
  color: var(--accent);
  opacity: 0.45;
  line-height: 1;
  display: block;
  margin-bottom: var(--space-sm);
}

.process-body h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  margin: 0 0 var(--space-xs);
}

.process-body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* —— Materials (fons blanc, passos tipus procés en fila amb ‹ ›) —— */
.section--materials {
  background: #ffffff;
}

.materials-steps-carousel {
  display: flex;
  align-items: stretch;
  gap: clamp(0.35rem, 2vw, var(--space-md));
  margin-top: var(--space-lg);
  max-width: 100%;
}

.materials-steps-nav {
  flex-shrink: 0;
  align-self: center;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  background: #ffffff;
  color: var(--text);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, color 0.2s, opacity 0.2s;
}

.materials-steps-nav:hover:not(:disabled),
.materials-steps-nav:focus-visible:not(:disabled) {
  border-color: var(--accent-soft);
  color: var(--accent);
}

.materials-steps-nav:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.materials-steps-nav:disabled {
  opacity: 0.22;
  cursor: default;
}

.materials-steps-viewport {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--accent-soft) transparent;
}

.materials-steps-viewport::-webkit-scrollbar {
  height: 6px;
}

.materials-steps-viewport::-webkit-scrollbar-thumb {
  background: var(--accent-soft);
  border-radius: 3px;
}

.materials-steps-track {
  list-style: none;
  margin: 0;
  padding: 0 0 var(--space-xs);
  display: flex;
  gap: var(--space-md);
  width: max-content;
}

.materials-step {
  flex: 0 0 clamp(15.5rem, 72vw, 17.5rem);
  padding: var(--space-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  transition: border-color 0.35s var(--ease-out), transform 0.35s var(--ease-out);
  box-shadow: 0 1px 2px rgba(42, 40, 38, 0.04);
}

.materials-step:hover {
  border-color: var(--accent-soft);
  transform: translateY(-3px);
}

/* —— Gallery —— */
.section--gallery {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-elevated) 100%);
}

.gallery {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

@media (min-width: 550px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }
}

.gallery-card {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  display: block;
}

.gallery-img-wrap {
  display: block;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #e8e6e2;
}

.gallery-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.65s var(--ease-out);
}

.gallery-card:hover .gallery-img-wrap img,
.gallery-card:focus-visible .gallery-img-wrap img {
  transform: scale(1.05);
}

.gallery-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

.gallery-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  padding: 0 0.15rem;
}

.gallery-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
}

.gallery-year {
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  flex-shrink: 0;
}

/* —— Bio —— */
.section-inner--bio {
  display: grid;
  gap: var(--space-xl);
  align-items: center;
}

@media (min-width: 800px) {
  .section-inner--bio {
    grid-template-columns: minmax(240px, 38%) 1fr;
    gap: var(--space-xl);
  }
}

.bio-frame {
  position: relative;
  max-width: 420px;
  margin: 0 auto;
}

.bio-frame::before {
  content: "";
  position: absolute;
  inset: 12px -12px -12px 12px;
  border: 1px solid var(--accent-soft);
  pointer-events: none;
  z-index: 0;
  transition: transform 0.5s var(--ease-out);
}

.bio-visual:hover .bio-frame::before {
  transform: translate(4px, -4px);
}

.bio-photo {
  position: relative;
  z-index: 1;
  width: 100%;
  filter: contrast(1.02) saturate(0.95);
}

.bio-copy .section-kicker {
  margin-bottom: var(--space-xs);
}

.bio-text p {
  margin: 0 0 var(--space-md);
  color: var(--text-muted);
  max-width: 38rem;
}

.bio-text p:last-child {
  margin-bottom: 0;
}

/* —— Footer —— */
.site-footer {
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}

.site-footer p {
  margin: 0 0 var(--space-sm);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.footer-top {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.footer-top:hover {
  color: var(--accent);
}

/* —— Lightbox —— */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(36, 35, 33, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  padding-top: max(var(--space-md), env(safe-area-inset-top, 0px));
  animation: lbIn 0.35s var(--ease-out);
}

@keyframes lbIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.lightbox[hidden] {
  display: none;
}

.lightbox-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(96vw, 1200px);
  width: 100%;
}

.lightbox-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  width: 100%;
}

.lightbox-img {
  max-width: 100%;
  width: auto;
  height: auto;
  max-height: min(72vh, 920px);
  object-fit: contain;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
}

.lightbox-img.is-ready {
  opacity: 1;
}

.lightbox-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-top: var(--space-md);
  padding: 0 var(--space-sm);
  max-width: 100%;
}

.lightbox-dots[hidden] {
  display: none !important;
}

.lightbox-dot {
  width: 0.5rem;
  height: 0.5rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(245, 244, 241, 0.35);
  cursor: pointer;
  transition: transform 0.2s, background 0.2s;
}

.lightbox-dot:hover,
.lightbox-dot:focus-visible {
  background: rgba(245, 244, 241, 0.65);
  transform: scale(1.15);
}

.lightbox-dot.is-active {
  background: #f5f4f1;
  transform: scale(1.2);
}

.lightbox-dot:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(245, 244, 241, 0.25);
  border-radius: 50%;
  background: rgba(36, 35, 33, 0.5);
  color: #f5f4f1;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.75;
  transition: opacity 0.2s, background 0.2s;
}

.lightbox-nav:hover,
.lightbox-nav:focus-visible {
  opacity: 1;
  background: rgba(36, 35, 33, 0.75);
}

.lightbox-nav[hidden] {
  display: none !important;
}

.lightbox-nav--prev {
  left: max(var(--space-sm), env(safe-area-inset-left, 0px));
}

.lightbox-nav--next {
  right: max(var(--space-sm), env(safe-area-inset-right, 0px));
}

@media (min-width: 900px) {
  .lightbox-nav--prev {
    left: var(--space-md);
  }

  .lightbox-nav--next {
    right: var(--space-md);
  }
}

.lightbox-caption {
  margin: var(--space-sm) 0 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  text-align: center;
  color: #f5f4f1;
  opacity: 0.9;
}

.lightbox-caption[hidden] {
  display: none !important;
}

.lightbox-close {
  position: absolute;
  top: max(var(--space-md), env(safe-area-inset-top, 0px));
  right: max(var(--space-md), env(safe-area-inset-right, 0px));
  z-index: 3;
  width: 3rem;
  height: 3rem;
  border: none;
  background: transparent;
  color: #f5f4f1;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.25s;
}

.lightbox-close:hover {
  opacity: 1;
}
