/*
  Modal 06 — Media Gallery Dialog — standalone HTML/CSS/JS.
  No build step, no framework, no external dependency: copy index.html,
  this file, and script.js into any project as-is.
*/

:root {
  --gallery-panel: oklch(0.165 0 0);
  --gallery-stage: oklch(0.11 0 0);
  --gallery-fg: oklch(0.97 0 0);
  --gallery-muted: oklch(0.72 0 0);
  --gallery-line: oklch(1 0 0 / 0.1);
  --gallery-accent: #39ff14;
}

.modal06 {
  position: fixed;
  inset: 0;
  z-index: 50;
  overflow-y: auto;
  overscroll-behavior: contain;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji",
    "Segoe UI Emoji";
}

.modal06[hidden] {
  display: none;
}

.modal06 p,
.modal06 h2 {
  margin: 0;
}

.modal06 svg {
  display: block;
}

/* Nearly black and no blur: nothing should compete with the picture. */
.modal06__backdrop {
  position: fixed;
  inset: 0;
  background-color: oklch(0.08 0 0 / 0.88);
  animation: modal06-fade-in 220ms ease-out both;
}

.modal06[data-state="closing"] .modal06__backdrop {
  animation: modal06-fade-out 160ms ease-in both;
}

.modal06__positioner {
  position: relative;
  display: flex;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Settles in from a touch larger, like a picture coming into focus. */
.modal06__panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: 100%;
  max-width: 55rem;
  overflow: hidden;
  border: 1px solid var(--gallery-line);
  border-radius: 1rem;
  background-color: var(--gallery-panel);
  color: var(--gallery-fg);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, 0.7);
  animation: modal06-settle 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.modal06[data-state="closing"] .modal06__panel {
  animation: modal06-fade-out 160ms ease-in both;
}

.modal06__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
}

.modal06__counter {
  font-size: 0.75rem;
  line-height: 1rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--gallery-muted);
}

.modal06__counter span {
  color: var(--gallery-fg);
}

.modal06__close,
.modal06__arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 9999px;
  padding: 0;
  cursor: pointer;
  outline: none;
  transition:
    background-color 150ms cubic-bezier(0.4, 0, 0.2, 1),
    color 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

.modal06__close {
  width: 2.25rem;
  height: 2.25rem;
  margin-right: -0.375rem;
  background: transparent;
  color: var(--gallery-muted);
}

.modal06__close:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: var(--gallery-fg);
}

.modal06__close svg,
.modal06__arrow svg {
  width: 1rem;
  height: 1rem;
}

.modal06__stage {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background-color: var(--gallery-stage);
}

/* Each new image slides a few pixels in the direction you are moving. */
.modal06__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: modal06-image-in 320ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.modal06__image[data-direction="previous"] {
  animation-name: modal06-image-in-previous;
}

.modal06__arrow {
  position: absolute;
  top: 50%;
  width: 2.5rem;
  height: 2.5rem;
  background-color: rgba(0, 0, 0, 0.45);
  color: #ffffff;
  transform: translateY(-50%);
  backdrop-filter: blur(4px);
}

.modal06__arrow:hover {
  background-color: rgba(0, 0, 0, 0.7);
}

.modal06__arrow--previous {
  left: 0.75rem;
}

.modal06__arrow--next {
  right: 0.75rem;
}

.modal06__close:focus-visible,
.modal06__arrow:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.modal06__body {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 1rem;
}

.modal06__title {
  font-size: 1rem;
  line-height: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.modal06__caption {
  margin-top: 0.375rem !important;
  font-size: 0.875rem;
  line-height: 1.5rem;
  color: var(--gallery-muted);
}

.modal06__meta {
  margin-top: 0.75rem !important;
  font-size: 0.75rem;
  line-height: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--gallery-muted);
}

.modal06__meta[hidden] {
  display: none;
}

.modal06__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  padding: 0;
}

.modal06__thumbs {
  display: flex;
  gap: 0.5rem;
  margin: 1.25rem -0.375rem 0;
  overflow-x: auto;
  padding: 0.375rem;
}

.modal06__thumb {
  position: relative;
  width: 4rem;
  height: 2.75rem;
  flex-shrink: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0.375rem;
  padding: 0;
  background: transparent;
  cursor: pointer;
  opacity: 0.6;
  outline: none;
  transition:
    opacity 150ms ease-out,
    box-shadow 200ms ease-out;
}

.modal06__thumb:hover,
.modal06__thumb:focus-visible,
.modal06__thumb[aria-current="true"] {
  opacity: 1;
}

.modal06__thumb[aria-current="true"] {
  box-shadow:
    0 0 0 2px var(--gallery-panel),
    0 0 0 4px var(--gallery-accent);
}

.modal06__thumb:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 5px;
}

.modal06__thumb img,
.modal06__thumb span {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@keyframes modal06-fade-in {
  from {
    opacity: 0;
  }
}

@keyframes modal06-fade-out {
  to {
    opacity: 0;
  }
}

@keyframes modal06-settle {
  from {
    opacity: 0;
    transform: scale(1.02);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes modal06-image-in {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes modal06-image-in-previous {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (min-width: 40rem) {
  .modal06__panel {
    grid-template-columns: minmax(0, 1fr) 16rem;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .modal06__header {
    grid-column-start: 2;
    grid-row-start: 1;
    padding: 1rem 1.25rem 0;
  }
  .modal06__stage {
    grid-column-start: 1;
    grid-row: 1 / span 2;
    aspect-ratio: 3 / 2;
  }
  .modal06__body {
    grid-column-start: 2;
    grid-row-start: 2;
    padding: 1rem 1.25rem 1.25rem;
  }
  .modal06__thumbs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: auto;
    overflow: visible;
  }
  .modal06__thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .modal06__panel,
  .modal06__image,
  .modal06__image[data-direction="previous"] {
    animation-name: modal06-fade-in;
    animation-duration: 120ms;
  }
  .modal06[data-state="closing"] .modal06__panel {
    animation-name: modal06-fade-out;
  }
  .modal06__thumb {
    transition: none;
  }
}

/*
  Page layout — the canvas this resource is presented on. Adjust or drop it
  when placing the resource inside your own layout.
*/

*,
*::before,
*::after {
  box-sizing: border-box;
}
body {
  margin: 0;
  line-height: 1.5;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(to bottom, #fafafa, #f4f4f5);
}
p {
  margin: 0;
}
.modal06-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem;
}
.modal06-layout__app {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 60rem;
  height: 35rem;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 1rem;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 18px 44px -20px rgba(0, 0, 0, 0.18);
  transform: translateZ(0);
}
.modal06-layout__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid oklch(0.97 0 0);
  padding: 1rem 1.5rem;
}
.modal06-layout__name {
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 600;
  color: oklch(0.205 0 0);
}
.modal06-layout__count {
  font-size: 0.75rem;
  line-height: 1rem;
  color: oklch(0.556 0 0);
}
.modal06-layout__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 1.5rem;
}
.modal06-layout__tile {
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border: 0;
  border-radius: 0.5rem;
  padding: 0;
  background: transparent;
  cursor: pointer;
  outline: none;
}
.modal06-layout__tile:focus-visible {
  outline: 2px solid oklch(0.205 0 0);
  outline-offset: 2px;
}
.modal06-layout__tile span {
  display: block;
  width: 100%;
  height: 100%;
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}
.modal06-layout__tile span:hover {
  transform: scale(1.03);
}
@media (min-width: 40rem) {
  .modal06-layout__app {
    height: 30rem;
  }
  .modal06-layout__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
