/* =================================================================
   MAMERI EXPORT — Home showcase
     • Coverflow de materiais (perspectiva invertida: as capas
       laterais trazem a borda externa para frente, abrindo a
       estante na direção do visitante)
     • Obras Realizadas — slider contínuo de imagens (auto-slider),
       uma fileira que desliza em loop sem costura, ritmo calmo.
   Baseline sem JS: puro CSS — nenhum dos dois depende de JS para
   a animação em si; o coverflow usa JS só para arraste/controles.
   ================================================================= */

/* ═══════════════════════════════════════════════════════════════
   COVERFLOW
   ═══════════════════════════════════════════════════════════════ */
.cf {
  margin-top: clamp(36px, 5vw, 60px);
}

/* Baseline (sem JS): trilho rolável horizontalmente */
.cf-stage {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.cf-stage::-webkit-scrollbar { display: none; }

.cf-track {
  display: flex;
  gap: 16px;
  list-style: none;
  margin: 0;
  padding: 0 var(--container-px);
  justify-content: flex-start;
}
.cf-item {
  flex: 0 0 auto;
  width: clamp(180px, 26vw, 260px);
}
.cf-item a { display: block; }
.cf-item img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
}

/* Legenda + controles só fazem sentido com o JS ativo */
.cf-caption,
.cf-controls { display: none; }

/* ── Modo 3D (JS ativo) ─────────────────────────────────────────── */
.cf.is-live .cf-stage {
  overflow: visible;
  perspective: 1500px;
  perspective-origin: 50% 50%;
  height: clamp(240px, 34vw, 420px);
  position: relative;
  cursor: grab;
  touch-action: pan-y;
}
.cf.is-live.is-dragging .cf-stage { cursor: grabbing; }

.cf.is-live .cf-track {
  display: block;
  padding: 0;
  transform-style: preserve-3d;
  height: 100%;
}
.cf.is-live .cf-item {
  position: absolute;
  top: 50%;
  left: 50%;
  width: clamp(200px, 26vw, 320px);
  margin: 0;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  transition: transform 0.62s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 0.62s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.cf.is-live.is-dragging .cf-item { transition: none; }

.cf.is-live .cf-item a {
  position: relative;
  display: block;
  outline-offset: 4px;
}
.cf.is-live .cf-item img {
  box-shadow: 0 24px 54px -26px rgba(0, 0, 0, 0.65);
  -webkit-user-drag: none;
  user-select: none;
}

/* Véu que escurece as capas fora do centro, reforçando a profundidade */
.cf.is-live .cf-item a::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--midnight);
  opacity: var(--cf-veil, 0);
  transition: opacity 0.62s cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
}
.cf.is-live.is-dragging .cf-item a::after { transition: none; }

/* ── Legenda ────────────────────────────────────────────────────── */
.cf.is-live .cf-caption {
  display: block;
  text-align: center;
  margin-top: clamp(22px, 3vw, 34px);
  min-height: 92px;
}
.cf-type {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.cf-name {
  font-size: clamp(1.3rem, 2.6vw, 2rem);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--cream);
  margin-bottom: 10px;
}
.cf-cta { color: var(--gold-light); }
.cf-caption.is-swapping .cf-type,
.cf-caption.is-swapping .cf-name {
  opacity: 0;
  transform: translateY(6px);
}
.cf-type,
.cf-name {
  transition: opacity 0.22s ease, transform 0.22s ease;
}

/* ── Controles ──────────────────────────────────────────────────── */
.cf.is-live .cf-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: clamp(14px, 2vw, 22px);
}
.cf-nav {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.72);
  transition: border-color var(--t-base), color var(--t-base), background var(--t-base);
}
.cf-nav svg { width: 17px; height: 17px; }
.cf-nav:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.cf-nav:disabled { opacity: 0.28; cursor: default; }
.cf-nav:disabled:hover { border-color: rgba(255,255,255,0.22); color: rgba(255,255,255,0.72); }

.cf-dots { display: flex; align-items: center; gap: 8px; }
.cf-dot {
  width: 6px;
  height: 6px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.24);
  transition: background var(--t-base), transform var(--t-base);
}
.cf-dot.is-active {
  background: var(--gold);
  transform: scale(1.5);
}

/* ── Links de categoria abaixo do coverflow ─────────────────────── */
.mat-cat-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(18px, 3vw, 40px);
  margin-top: clamp(34px, 5vw, 56px);
}
.mat-cat-links a {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  padding-bottom: 4px;
  border-bottom: 1px solid transparent;
  transition: color var(--t-base), border-color var(--t-base);
}
.mat-cat-links a:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

@media (max-width: 768px) {
  .materials-section,
  .cf,
  .cf-stage {
    overflow-x: clip !important;
  }
  .cf.is-live .cf-stage { height: clamp(210px, 56vw, 300px); }
  .cf.is-live .cf-item { width: clamp(160px, 46vw, 230px); }
  .cf.is-live .cf-caption { min-height: 84px; }
}

@media (prefers-reduced-motion: reduce) {
  .cf.is-live .cf-item,
  .cf.is-live .cf-item a::after,
  .cf-type,
  .cf-name { transition: none; }
}

/* ═══════════════════════════════════════════════════════════════
   OBRAS REALIZADAS — slider contínuo de imagens (auto-slider)
   Uma fileira desliza em loop sem costura da direita para a
   esquerda, ritmo calmo. O truque do loop: a lista de fotos é
   duplicada uma vez e a track anda exatamente metade da sua
   largura — no instante em que a 1ª cópia sai, a 2ª está no
   mesmo lugar onde a 1ª começou, então a troca é invisível.
   Puro CSS: nenhuma dependência nova, nenhum JS de scroll.
   ═══════════════════════════════════════════════════════════════ */
.obras-slider {
  overflow: hidden;
}

.slider-viewport {
  overflow: hidden;
  margin-top: clamp(32px, 5vw, 52px);
  /* esmaece as duas bordas — a fileira parece emergir do vazio,
     não terminar num corte reto */
  -webkit-mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 min(8vw, 90px),
    #000 calc(100% - min(8vw, 90px)),
    transparent 100%
  );
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 min(8vw, 90px),
    #000 calc(100% - min(8vw, 90px)),
    transparent 100%
  );
}

.slider-track {
  display: flex;
  align-items: stretch;
  gap: clamp(10px, 1.4vw, 20px);
  width: max-content;
  animation: obras-slide 72s linear infinite;
}
.slider-viewport:hover .slider-track { animation-play-state: paused; }

.slider-item {
  flex: 0 0 auto;
  width: clamp(220px, 22vw, 340px);
  aspect-ratio: 4 / 3;
  margin: 0;
  overflow: hidden;
}
.slider-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.9) saturate(0.94);
}

@keyframes obras-slide {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@media (max-width: 768px) {
  .slider-item { width: clamp(170px, 58vw, 230px); }
  .slider-track { animation-duration: 46s; }
  .slider-viewport {
    -webkit-mask-image: linear-gradient(
      to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%
    );
    mask-image: linear-gradient(
      to right, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%
    );
  }
}

@media (prefers-reduced-motion: reduce) {
  .slider-track { animation: none; }
  .slider-viewport { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
