/**
 * Animated work gallery — vertical marquee of website preview images (img/photo/website*.jpg).
 * Markup: 4 columns (flex) per .mil-animated-gallery__viewport.
 */

.mil-animated-gallery-section {
  overflow-x: clip;
}

.mil-animated-gallery__fullbleed {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

.mil-animated-gallery__viewport {
  display: flex;
  overflow: hidden;
  height: 50vw;
  min-height: 280px;
  max-height: min(85vh, 720px);
  width: 100%;
  background: #e8e8ea;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  box-sizing: border-box;
  pointer-events: none;
  user-select: none;
}

body.mil-theme-dark .mil-animated-gallery__viewport {
  background: #12121a;
  border-top-color: rgba(255, 255, 255, 0.08);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.mil-animated-gallery__viewport img {
  max-width: 100%;
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
  object-fit: cover;
  aspect-ratio: 1 / 1;
}

body.mil-theme-dark .mil-animated-gallery__viewport img {
  border-color: rgba(0, 0, 0, 0.45);
}

.mil-animated-gallery__tile {
  display: block;
  line-height: 0;
}

.mil-animated-gallery__segment {
  display: block;
}

/* CTA row under the marquee — balanced vertical padding */
.mil-animated-gallery__cta {
  padding-top: clamp(2rem, 4.5vw, 3.5rem);
  padding-bottom: clamp(2.5rem, 5.5vw, 4.25rem);
}

@media (min-width: 992px) {
  .mil-animated-gallery__cta {
    padding-top: 3.25rem;
    padding-bottom: 3.75rem;
  }
}

.mil-animated-gallery__column {
  flex: 1 1 0;
  min-width: 0;
  animation: var(--mil-ag-animation, none) 16s infinite linear;
}

.mil-animated-gallery__column:nth-of-type(odd) {
  align-self: flex-end;
  --mil-ag-direction: 50%;
}

@keyframes mil-animated-gallery-slide {
  to {
    transform: translateY(var(--mil-ag-direction, -50%));
  }
}

@media (max-width: 768px) {
  .mil-animated-gallery__viewport {
    height: 70vw;
    min-height: 240px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mil-animated-gallery__column {
    animation: none !important;
  }
}

/* Standalone test page (works-gallery-test.html) */
.mil-ag-test-page {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #0a0a0a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.mil-ag-test-page__back {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 20;
  margin: 0;
}

.mil-ag-test-page__back a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.mil-ag-test-page__back a:hover {
  color: #fff;
  text-decoration: underline;
}

.mil-ag-test-page .mil-animated-gallery-section {
  width: 100%;
  padding: 3rem 0 2rem;
  box-sizing: border-box;
}

.mil-ag-test-page .mil-animated-gallery__fullbleed {
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.mil-ag-test-page .mil-animated-gallery__viewport {
  background: #111;
  border-color: #000;
}

.mil-ag-test-page .mil-animated-gallery__viewport img {
  border-color: #000;
}
