/* Carrossel 3D vertical da trajetória — Lauro Santos
   Tambor (cilindro) que gira no eixo horizontal conforme a rolagem.
   Depende de tokens.css + ds.css do site. Sem JS ou com movimento reduzido: lista vertical simples. */

.tl3d { --tl3d-step: 20deg; --tl3d-face-h: 176px; --tl3d-r: 500px; position: relative; }

/* ---------- Base (sem 3D): lista legível ---------- */
.tl3d-stage { width: min(var(--wrap-max), calc(100% - 2 * var(--wrap-inset))); margin: 0 auto; padding: var(--section-pad-top) 0 var(--section-pad-bottom); display: grid; gap: var(--space-7); }
.tl3d-heading { margin: 0; font-weight: 400; font-size: clamp(48px, 5.9vw, 86px); line-height: 1.12; letter-spacing: -.015em; font-stretch: 88%; color: var(--ink); text-wrap: balance; }
.tl3d-year, .tl3d-count, .tl3d-controls, .tl3d-dots { display: none; }
.tl3d-drum { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }

.tl3d-card {
  height: 100%; padding: 26px 30px; border-radius: var(--radius-xl);
  background: var(--surface-raised); border: 1px solid var(--line); box-shadow: var(--shadow-glass);
  display: flex; flex-direction: column; gap: 8px;
}
.tl3d-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.tl3d-period { font-family: var(--font-serif); font-style: italic; font-size: 22px; color: var(--gold); }
.tl3d-chips { display: inline-flex; gap: 6px; }
.tl3d-title { margin: 2px 0 0; font-size: 21px; font-weight: 500; line-height: 1.3; letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
.tl3d-text { margin: 0; font-size: 15px; font-weight: 300; line-height: 1.5; color: var(--muted); }

/* ---------- 3D (ativado pelo carrossel.js) ---------- */
.tl3d.is-3d .tl3d-track { height: calc(var(--tl3d-n, 16) * 30vh + 100vh); }
.tl3d.is-3d .tl3d-stage {
  position: sticky; top: 0; height: 100vh; height: 100svh; padding: 110px 0 40px;
  grid-template-columns: minmax(280px, 4fr) 7fr; align-items: center; gap: var(--space-7);
}

/* Medição da face: cartões na altura natural por um instante */
.tl3d.is-3d.is-measuring .tl3d-item { bottom: auto; visibility: hidden; }
.tl3d.is-3d.is-measuring .tl3d-card { height: auto; }

/* Lado: título, ano em destaque, posição, setas, pontos */
.tl3d.is-3d .tl3d-aside { display: grid; align-content: center; gap: 18px; }
.tl3d.is-3d .tl3d-year, .tl3d.is-3d .tl3d-count { display: block; margin: 0; }
.tl3d-year { font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: clamp(72px, 9vw, 132px); line-height: .95; color: var(--gold); font-variant-numeric: lining-nums tabular-nums; }
.tl3d-year-num { display: inline-block; transition: opacity .18s ease, transform .3s cubic-bezier(.16,1,.3,1); }
.tl3d-year-num.is-swap { opacity: 0; transform: translateY(var(--tl3d-dir, 12px)); }
.tl3d-count { font-size: 13px; font-weight: 600; letter-spacing: .18em; color: var(--subtle); font-variant-numeric: tabular-nums; }
.tl3d-count-now { color: var(--ink); }

.tl3d.is-3d .tl3d-controls { display: flex; gap: 10px; margin-top: 6px; }
.tl3d-btn {
  width: 52px; height: 52px; border-radius: var(--radius-full); border: 1px solid var(--line-control);
  background: transparent; color: var(--ink); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color .2s ease, color .2s ease;
}
.tl3d-btn svg { width: 20px; height: 20px; }
.tl3d-btn:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.tl3d-btn:disabled { opacity: .35; cursor: default; }
.tl3d-btn:focus-visible, .tl3d-dot:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }

/* Pontos: coluna de 16 marcadores (pontos, não traços) */
.tl3d.is-3d .tl3d-dots { display: grid; grid-template-columns: repeat(8, 28px); gap: 4px 2px; list-style: none; margin: 4px 0 0; padding: 0; }
.tl3d-dot { width: 28px; height: 28px; padding: 0; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.tl3d-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--line-control); transition: background .2s ease, box-shadow .2s ease, transform .2s ease; }
.tl3d-dot:hover::before { background: var(--muted); }
.tl3d-dot[aria-current="true"]::before { background: var(--gold); box-shadow: 0 0 0 5px var(--gold-soft); transform: scale(1.15); }

/* Visor e tambor */
.tl3d.is-3d .tl3d-viewport {
  height: 100%; display: grid; place-items: center; perspective: 1600px; perspective-origin: 50% 50%;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 20%, #000 80%, transparent);
}
.tl3d.is-3d .tl3d-drum {
  display: block; position: relative; width: min(600px, 100%); height: var(--tl3d-face-h);
  transform-style: preserve-3d;
  transform: translateZ(calc(var(--tl3d-r) * -1)) rotateX(calc(var(--tl3d-pos, 0) * var(--tl3d-step)));
}
.tl3d.is-3d .tl3d-item {
  position: absolute; inset: 0;
  transform: rotateX(calc(var(--i) * var(--tl3d-step) * -1)) translateZ(var(--tl3d-r));
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  opacity: var(--fade, 0); visibility: var(--vis, hidden);
}
.tl3d.is-3d .tl3d-card { filter: brightness(var(--lum, .5)); transition: border-color .3s ease, box-shadow .3s ease; }
.tl3d.is-3d .tl3d-item[aria-current="true"] .tl3d-card {
  border-color: color-mix(in srgb, var(--gold) 45%, transparent);
  box-shadow: var(--shadow-featured);
}

/* Celular: título e ano em cima, tambor embaixo */
@media (max-width: 820px) {
  .tl3d { --tl3d-face-h: 200px; }
  .tl3d-stage { width: calc(100% - 40px); }
  .tl3d.is-3d .tl3d-stage { grid-template-columns: 1fr; grid-template-rows: auto 1fr; padding: 92px 0 24px; gap: 8px; align-items: stretch; }
  .tl3d.is-3d .tl3d-aside { grid-template-columns: 1fr auto; align-items: end; gap: 6px 16px; }
  .tl3d-heading { font-size: clamp(30px, 8vw, 44px); grid-column: 1 / -1; }
  .tl3d .tl3d-heading br { display: none; }
  .tl3d-year { font-size: clamp(52px, 15vw, 72px); }
  .tl3d.is-3d .tl3d-count { align-self: center; }
  .tl3d.is-3d .tl3d-controls { grid-column: 2; grid-row: 2 / span 2; align-self: center; margin: 0; }
  .tl3d-btn { width: 48px; height: 48px; }
  .tl3d.is-3d .tl3d-dots { display: none; }
  .tl3d-card { padding: 20px 22px; }
  .tl3d-title { font-size: 18px; }
  .tl3d-text { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) { .tl3d-year-num { transition: none; } }
