/*
 * Motion layer: additive only.
 * Keeps the original layout, palette and typography untouched, and only adds
 * transform/opacity based feedback. Original style.css stays byte-identical.
 */
:root {
  --ease-out: cubic-bezier(.22,.61,.36,1);
  --dur-fast: .16s;
  --dur-base: .3s;
}

/* ---------- interactive feedback ---------- */
button,
.button,
.text-button,
a {
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease,
    color var(--dur-fast) ease, box-shadow var(--dur-fast) ease,
    transform var(--dur-fast) var(--ease-out);
}

button:not(:disabled):active,
.button:active {
  transform: translateY(1px) scale(.985);
}

.pill {
  transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease,
    color var(--dur-fast) ease;
}

input,
select,
textarea {
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease,
    background-color var(--dur-fast) ease;
}

input:focus,
select:focus,
textarea:focus {
  box-shadow: 0 0 0 4px #2459dc14;
}

.product-card {
  transition: box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out), border-color var(--dur-base) ease;
}

.product-card:hover {
  box-shadow: 0 16px 36px #193b6818;
  transform: translateY(-4px);
  border-color: #c7d6ec;
}

.product-media img,
.detail-image img {
  transition: transform .45s var(--ease-out);
}

.product-card:hover .product-media img {
  transform: scale(1.035);
}

.nav-card {
  transition: border-color var(--dur-fast) ease, box-shadow var(--dur-base) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

.nav-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px #193b6812;
}

@media (hover: hover) {
  tbody tr {
    transition: background-color .18s ease;
  }

  tbody tr:hover {
    background: #f7f9fd;
  }
}

/* ---------- entrance ---------- */
@keyframes cl-rise {
  from { opacity: 0; transform: translateY(9px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cl-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cl-dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cl-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes cl-nav-in {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.heading {
  animation: cl-fade .3s ease backwards;
}

.panel,
.product-card,
.stat,
.empty,
.notice {
  animation: cl-rise .34s var(--ease-out) backwards;
}

/* gentle stagger so stacked content does not pop at the same instant */
.stats > .stat:nth-child(2),
.product-grid > .product-card:nth-child(2),
.stack > .panel:nth-child(2) { animation-delay: .04s; }

.stats > .stat:nth-child(3),
.product-grid > .product-card:nth-child(3),
.stack > .panel:nth-child(3) { animation-delay: .08s; }

.stats > .stat:nth-child(4),
.product-grid > .product-card:nth-child(4),
.stack > .panel:nth-child(4) { animation-delay: .12s; }

.stats > .stat:nth-child(5),
.product-grid > .product-card:nth-child(5),
.stack > .panel:nth-child(5) { animation-delay: .16s; }

.product-grid > .product-card:nth-child(6) { animation-delay: .2s; }
.product-grid > .product-card:nth-child(n+7) { animation-delay: .24s; }

/* dialogs and collapsible blocks */
dialog[open] {
  animation: cl-dialog-in .26s var(--ease-out);
}

dialog::backdrop {
  animation: cl-backdrop-in .24s ease;
}

details[open] > :not(summary) {
  animation: cl-fade .22s ease backwards;
}

/* mobile navigation slide-down */
.topbar.nav-open #primary-navigation {
  animation: cl-nav-in .22s var(--ease-out);
}

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

  .product-card:hover,
  .nav-card:hover,
  button:not(:disabled):active,
  .button:active {
    transform: none;
  }
}
