/*
 * Agromilk — animações. Só transform e opacidade (leves para o celular).
 * Cada aba, ao abrir, monta seus blocos de novo: eles sobem em sequência.
 * Quem pede menos movimento no aparelho recebe tudo parado (fim do arquivo).
 */
@keyframes am-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes am-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes am-pop { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes am-grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes am-slide-left { from { transform: translateX(-24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes am-toast { from { opacity: 0; transform: translate(-50%, 18px) scale(0.96); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes am-cart { from { opacity: 0; transform: translateY(24px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes am-breathe { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.97); opacity: 0.8; } }
@keyframes am-pulse { 0% { box-shadow: 0 0 0 0 rgba(133, 183, 68, 0.55); } 100% { box-shadow: 0 0 0 7px rgba(133, 183, 68, 0); } }

/* ---------- Entradas em sequência ---------- */
.content > *:not(.page-heading):not(.mobile-brand-logo):not(.footer),
.shop-shell > *:not(.shop-cart),
.access-gate section,
.page-heading > div:first-child {
  animation: am-rise 520ms var(--ease-out) both;
}
.content > *:nth-child(4) { animation-delay: 60ms; }
.content > *:nth-child(5) { animation-delay: 120ms; }
.content > *:nth-child(6) { animation-delay: 180ms; }
.content > *:nth-child(7) { animation-delay: 240ms; }
.shop-shell > *:nth-child(2) { animation-delay: 70ms; }
.shop-shell > *:nth-child(3) { animation-delay: 140ms; }
.shop-shell > *:nth-child(4) { animation-delay: 200ms; }
.shop-shell > *:nth-child(5) { animation-delay: 260ms; }

.stat, .overview-grid > *, .service-grid > *, .product-grid > *, .stock-row, .summary-row, .checklist > div {
  animation: am-rise 480ms var(--ease-out) both;
}
.stat:nth-child(2), .overview-grid > :nth-child(2), .service-grid > :nth-child(2), .product-grid > :nth-child(2) { animation-delay: 70ms; }
.stat:nth-child(3), .overview-grid > :nth-child(3), .service-grid > :nth-child(3), .product-grid > :nth-child(3) { animation-delay: 140ms; }
.stat:nth-child(4), .overview-grid > :nth-child(4), .service-grid > :nth-child(4), .product-grid > :nth-child(4) { animation-delay: 210ms; }
.service-grid > :nth-child(5), .product-grid > :nth-child(5) { animation-delay: 260ms; }
.service-grid > :nth-child(6), .product-grid > :nth-child(6) { animation-delay: 310ms; }
.service-grid > :nth-child(n + 7), .product-grid > :nth-child(n + 7) { animation-delay: 360ms; }
.stock-row:nth-child(3), .summary-row:nth-child(2), .checklist > div:nth-child(2) { animation-delay: 80ms; }
.stock-row:nth-child(4), .summary-row:nth-child(3), .checklist > div:nth-child(3) { animation-delay: 140ms; }
.stock-row:nth-child(n + 5), .summary-row:nth-child(n + 4), .checklist > div:nth-child(n + 4) { animation-delay: 200ms; }

tbody tr { animation: am-fade 420ms var(--ease-out) both; }
tbody tr:nth-child(2) { animation-delay: 30ms; }
tbody tr:nth-child(3) { animation-delay: 60ms; }
tbody tr:nth-child(4) { animation-delay: 90ms; }
tbody tr:nth-child(5) { animation-delay: 120ms; }
tbody tr:nth-child(6) { animation-delay: 150ms; }
tbody tr:nth-child(7) { animation-delay: 180ms; }
tbody tr:nth-child(n + 8) { animation-delay: 210ms; }

/* Gráfico: as barras crescem de baixo para cima, um dia de cada vez. */
.bar-track div { transform-origin: bottom; animation: am-grow 800ms var(--ease-out) both; }
.chart-col:nth-child(2) .bar-track div { animation-delay: 60ms; }
.chart-col:nth-child(3) .bar-track div { animation-delay: 120ms; }
.chart-col:nth-child(4) .bar-track div { animation-delay: 180ms; }
.chart-col:nth-child(5) .bar-track div { animation-delay: 240ms; }
.chart-col:nth-child(6) .bar-track div { animation-delay: 300ms; }
.chart-col:nth-child(7) .bar-track div { animation-delay: 360ms; }

/* ---------- Resposta ao toque e ao mouse ---------- */
button, .btn, nav button, input, select, textarea, .search, .tag, .tabs button, .dropzone {
  transition: background-color var(--fast) ease, border-color var(--fast) ease, color var(--fast) ease,
    box-shadow var(--normal) ease, transform var(--fast) var(--ease-press);
}
button:active:not(:disabled), .btn:active { transform: scale(0.97); }
nav button svg, .quick-card button svg:last-child, .text-button svg, .breadcrumbs svg { transition: transform var(--normal) var(--ease-out); }
nav button:hover svg { transform: translateX(2px); }
.quick-card button:hover svg:last-child, .text-button:hover svg { transform: translateX(4px); }

.card, .stat, .service-card, .shop-product, .quick-card, .product-gallery a, .shop-photo img, .product-thumb img {
  transition: transform var(--normal) var(--ease-out), box-shadow var(--normal) ease, border-color var(--fast) ease;
}
.service-card:hover, .shop-product:hover, .quick-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: #d5ddd0; }
.shop-product:hover .shop-photo img { transform: scale(1.05); }
.product-gallery a:hover { transform: translateY(-2px); }
tbody tr:hover .product-thumb img { transform: scale(1.08); }
td { transition: background-color var(--fast) ease; }

.connection:not(.offline) i { animation: am-pulse 1.8s ease-out infinite; }
nav button em { animation: am-pop 360ms var(--ease-out) both; }

/* ---------- Janelas, avisos e menu ---------- */
dialog[open] .modal { animation: am-pop 280ms var(--ease-out) both; }
dialog[open]::backdrop { animation: am-fade 220ms ease both; }
.toast { animation: am-toast 380ms var(--ease-out) both; }
.alert { animation: am-rise 360ms var(--ease-out) both; }
.shop-cart { animation: am-cart 420ms var(--ease-out) both; }
.sidebar.mobile-open { animation: am-slide-left 300ms var(--ease-out) both; }
.menu-backdrop { animation: am-fade 240ms ease both; }
details[open] > :not(summary) { animation: am-rise 320ms var(--ease-out) both; }
.loading .loading-logo, .loading > svg { animation: am-breathe 1.8s ease-in-out infinite; }
.sidebar .brand-logo { animation: am-fade 600ms ease both; }


/* Celular: painéis e janelas sobem de baixo, a aba tocada dá um leve pulo. */
@keyframes am-sheet { from { transform: translateY(100%); } to { transform: none; } }
@keyframes am-tab { 0% { transform: scale(0.6); opacity: 0; } 100% { transform: translateX(-50%) scale(1); opacity: 1; } }
@media (max-width: 700px) {
  .sidebar.mobile-open { animation: am-sheet 320ms var(--ease-out) both; }
  dialog[open] .modal { animation: none; }
  dialog[open] { animation: am-sheet 340ms var(--ease-out) both; }
  .sidebar:not(.mobile-open) nav button.active::before { animation: am-tab 260ms var(--ease-out) both; }
  .page-heading .heading-actions > .primary { animation: am-pop 360ms var(--ease-out) 120ms both; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
  .service-card:hover, .shop-product:hover, .quick-card:hover, .product-gallery a:hover { transform: none; }
}
