/* Cena da rastreabilidade (página Indústria). O movimento principal vem do assets/rastreio.js;
   aqui ficam o palco, os painéis, a linha do tempo e os movimentos de ambiente (esteira, mar,
   fumaça, biruta), que só rodam se a pessoa não pediu para reduzir movimento. */

.rastreio { margin: 56px 0 24px; }
@media (min-width: 900px) {
  .rastreio { width: min(1200px, 100vw - 2 * var(--gutter) - 20px); margin-left: 50%; transform: translateX(-50%); }
}
.rastreio__cab { max-width: 780px; margin: 0 auto 22px; }
.rastreio__cab h2 { margin-top: 0; }
.rastreio__cab h2 em { font-style: normal; color: var(--laranja); }
.rastreio__cab p:last-child { margin: 0; }

.rastreio__palco {
  position: relative; aspect-ratio: 1000 / 420; overflow: hidden;
  border: 1.5px solid var(--tinta); border-radius: 18px; background: #F7F9F8;
  box-shadow: 8px 8px 0 -1px var(--fundo), 8px 8px 0 0 var(--linha-2), var(--sombra-alta);
}
.rastreio__cena { display: block; width: 100%; height: 100%; }

.rastreio__relogio {
  position: absolute; left: 14px; top: 14px; padding: 8px 14px 9px; border-radius: 12px;
  background: var(--tinta); color: #fff; box-shadow: var(--sombra);
}
.rastreio__relogio span { display: block; font: 500 .68rem/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #C6CFCB; }
.rastreio__relogio i { font-style: normal; color: var(--laranja-2); }
.rastreio__relogio b { display: block; font: 700 1.9rem/1 var(--display); letter-spacing: .02em; color: var(--laranja-2); font-variant-numeric: tabular-nums; }

.rastreio__painel {
  position: absolute; right: 14px; top: 14px; width: 272px; padding: 12px 14px 8px;
  background: rgba(255,255,255,.93); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1.5px solid var(--tinta); border-radius: 12px; box-shadow: var(--sombra);
  z-index: 2; transform-origin: center; transition: transform .9s var(--mola), box-shadow .6s;
}
.rastreio__relogio, .rastreio__play { z-index: 2; }
.rastreio__log time small { margin-left: 2px; font-size: .6rem; color: var(--laranja-escuro); vertical-align: super; }

/* Quadro final: a cena escurece e o histórico, completo, vai para o centro (o rastreio.js calcula o caminho). */
.rastreio__palco::after { content: ""; position: absolute; inset: 0; z-index: 1; background: rgba(18,26,24,.55); opacity: 0; pointer-events: none; transition: opacity .7s; }
.rastreio.final .rastreio__palco::after { opacity: 1; }
.rastreio__painel-fim { display: none; margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--linha-2); }
.rastreio__painel-fim b { display: block; font: 700 1.45rem/1.05 var(--display); text-transform: uppercase; color: var(--tinta); }
.rastreio__painel-fim span { display: block; margin-top: 4px; font: 500 .68rem/1.3 var(--mono); letter-spacing: .06em; color: var(--laranja-escuro); }
.rastreio.final .rastreio__painel { width: min(470px, calc(100% - 28px)); padding: 16px 20px 12px; box-shadow: var(--sombra-alta), 0 0 0 6px rgba(217,84,30,.2); }
.rastreio.final .rastreio__painel-fim b { font-size: 1.7rem; }
.rastreio.final .rastreio__painel-fim, .rastreio.final .rastreio__painel-tit { display: block; }
/* Botão Rever vídeo: só no quadro final, no pé do histórico. */
.rastreio__rever {
  display: none; order: 9; align-items: center; justify-content: center; gap: 8px; width: 100%; margin: 12px 0 4px; padding: 11px 16px;
  border: 0; border-radius: 10px; cursor: pointer; background: var(--tinta); color: #fff;
  font: 700 1rem/1 var(--display); letter-spacing: .04em; text-transform: uppercase; transition: background .2s, transform .3s var(--mola);
}
.rastreio__rever:hover { background: var(--laranja); transform: translateY(-1px); }
.rastreio__rever svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.rastreio.final .rastreio__painel { display: flex; flex-direction: column; }
.rastreio.final .rastreio__rever { display: flex; animation: rt-entra .5s var(--mola) both; animation-delay: 1.3s; }
.rastreio.final.vivo .rastreio__log li.visivel { display: grid; opacity: 1; transform: none; color: var(--tinta-2); font-weight: 400; }
.rastreio.final.vivo .rastreio__log li time { color: var(--tinta-3); }
.rastreio.final.vivo .rastreio__log li span::before {
  content: "✓"; display: inline-block; width: auto; height: auto; margin-right: 6px; border-radius: 0; background: none;
  color: #1F7A4D; font-weight: 700;
}
.rastreio__painel-tit { margin: 0 0 8px; font: 500 .68rem/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--laranja-escuro); }
.rastreio__log { list-style: none; margin: 0; padding: 0; }
.rastreio__log li { display: grid; grid-template-columns: 52px 1fr; gap: 6px; margin: 0 0 5px; font-size: .78rem; line-height: 1.3; color: var(--tinta-2); }
.rastreio__log time { font: 500 .72rem/1.35 var(--mono); color: var(--tinta-3); }
.vivo .rastreio__log li { opacity: .22; transition: opacity .35s, transform .45s var(--mola); }
.vivo .rastreio__log li.visivel { opacity: 1; }
.vivo .rastreio__log li.atual { color: var(--tinta); font-weight: 600; transform: translateX(-3px); }
.vivo .rastreio__log li.atual time { color: var(--laranja-escuro); }
.vivo .rastreio__log li.atual span::before { content: ""; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--laranja); vertical-align: 1px; }

.rastreio__play {
  position: absolute; left: 14px; bottom: 14px; width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--tinta); color: #fff; box-shadow: var(--sombra); transition: background .2s, transform .3s var(--mola);
}
.rastreio__play:hover { background: var(--laranja); transform: scale(1.08); }
.rastreio__play svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.rastreio__play .rt-i-play { display: none; fill: currentColor; }
.rastreio.pausado .rt-i-play { display: block; }
.rastreio.pausado .rt-i-pausa { display: none; }
.rastreio:not(.vivo) .rastreio__play { display: none; }

/* Linha do tempo: arrastar a caixinha leva o lote para frente e para trás. */
.rastreio__linha { position: relative; margin: 22px 10px 0; }
.rastreio__trilho {
  position: relative; height: 10px; border-radius: 5px; background: var(--linha); cursor: pointer; touch-action: none;
}
.rastreio__trilho:focus-visible { outline: 2px solid var(--laranja); outline-offset: 6px; }
.rastreio__cheio { position: absolute; inset: 0; border-radius: 5px; background: var(--laranja); transform-origin: left; transform: scaleX(.31); }
.rastreio__caixinha {
  position: absolute; top: 50%; left: 31%; width: 30px; height: 24px; transform: translate(-50%, -50%); cursor: grab;
  border: 2px solid var(--tinta); border-radius: 3px; background: #FCEDE6; box-shadow: 0 4px 10px rgba(18,26,24,.18);
}
.rastreio__caixinha::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 6px; transform: translateX(-50%); background: rgba(240,105,47,.55); }
.rastreio__trilho:active .rastreio__caixinha { cursor: grabbing; }
.rastreio:not(.vivo) .rastreio__linha { display: none; }
.rastreio__etapas { position: relative; list-style: none; height: 34px; margin: 12px 0 0; padding: 0; }
.rastreio__etapas li { position: absolute; top: 0; margin: 0; transform: translateX(-50%); }
.rastreio__etapas li:first-child { transform: none; }
.rastreio__etapas button {
  padding: 4px 2px; border: 0; background: none; cursor: pointer; white-space: nowrap;
  font: 500 .72rem/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--tinta-3); transition: color .25s;
}
.rastreio__etapas button::before { content: ""; display: block; width: 2px; height: 8px; margin: -12px auto 6px; background: var(--linha-2); transition: background .25s; }
.rastreio__etapas li:first-child button::before { margin-left: 0; }
.rastreio__etapas button:hover, .rastreio__etapas button.ativa { color: var(--laranja-escuro); }
.rastreio__etapas button.ativa::before { background: var(--laranja); }

/* Telas médias: o histórico mostra só o passo atual e os dois anteriores. */
@media (max-width: 1000px) {
  .vivo .rastreio__log li:not(.atual):not(.perto) { display: none; }
  .rastreio__painel { width: 240px; }
}
/* Celular: palco mais alto e o histórico vira uma legenda embaixo da cena. */
@media (max-width: 700px) {
  .rastreio__palco { aspect-ratio: 4 / 3.4; border-radius: 14px; }
  .rastreio__painel { top: auto; bottom: 10px; left: 64px; right: 10px; width: auto; padding: 8px 10px 4px; }
  .rastreio.final .rastreio__painel { left: 10px; width: auto; padding: 12px 12px 8px; }
  .rastreio.final .rastreio__painel-fim b { font-size: 1.2rem; }
  .rastreio__relogio, .rastreio__play { transition: opacity .4s; }
  .rastreio.final .rastreio__relogio, .rastreio.final .rastreio__play { opacity: 0; pointer-events: none; }
  .rastreio__painel-tit { display: none; }
  .vivo .rastreio__log li:not(.atual) { display: none; }
  .rastreio__relogio { left: 10px; top: 10px; padding: 6px 10px 7px; }
  .rastreio__relogio b { font-size: 1.5rem; }
  .rastreio__play { left: 10px; bottom: 10px; }
  .rastreio__etapas button { font-size: .6rem; letter-spacing: .04em; }
  .rastreio__etapas li:nth-child(even) { top: 16px; }
  .rastreio__etapas li:nth-child(even) button::before { height: 24px; margin-top: -28px; }
  .rastreio__etapas { height: 46px; }
}

@media (prefers-reduced-motion: no-preference) {
  .rastreio .rt-correia { animation: rt-correia .6s linear infinite; }
  .rastreio .rt-onda { animation: rt-onda 3s linear infinite; }
  .rastreio .rt-fumaca circle { transform-box: fill-box; transform-origin: center; animation: rt-fumaca 3.2s ease-out infinite; }
  .rastreio .rt-fumaca circle:nth-child(2) { animation-delay: -1s; }
  .rastreio .rt-fumaca circle:nth-child(3) { animation-delay: -2s; }
  .rastreio .rt-pulso { transform-box: fill-box; transform-origin: center; animation: onda 1.6s ease-out infinite; }
  .rastreio .rt-biruta { transform-box: fill-box; transform-origin: left center; animation: rt-biruta 2.4s ease-in-out infinite; }
  .rastreio .rt-navio { animation: rt-navio 4s ease-in-out infinite; }
  .rastreio .rs-gota { transform-box: fill-box; animation: rs-gota 1.4s ease-in infinite; }
  .rastreio .rs-vento { animation: rs-vento 1.8s ease-in-out infinite; }
  .rastreio.final .rastreio__log li { animation: rt-entra .5s var(--mola) both; animation-delay: calc(var(--n, 0) * 90ms + .35s); }
}
@keyframes rt-correia { to { stroke-dashoffset: -18; } }
@keyframes rt-onda { to { transform: translateX(-40px); } }
@keyframes rt-fumaca { 0% { transform: translateY(8px) scale(.6); opacity: 0; } 30% { opacity: 1; } 100% { transform: translateY(-26px) scale(1.4); opacity: 0; } }
@keyframes rt-biruta { 0%, 100% { transform: rotate(4deg); } 50% { transform: rotate(-6deg); } }
@keyframes rt-navio { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(2px); } }
@keyframes rs-gota { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(60px); opacity: 0; } }
@keyframes rs-vento { 0% { transform: translateY(-6px); opacity: 0; } 40% { opacity: 1; } 100% { transform: translateY(16px); opacity: 0; } }
@keyframes rt-entra { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes onda { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(2.2); opacity: 0; } }
