:root {
  color-scheme: dark;
  --background: #050505;
  --foreground: #f4f4ef;
  --muted: #8d8d88;
  --line: #343432;
  --panel: #0c0c0c;
  --font-ocr: "OCR A Std", "OCR A Extended", "OCR A", "Courier New", monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--background);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  overflow-x: hidden;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-ocr);
  font-synthesis: none;
}

button {
  color: inherit;
  font: inherit;
}

button:focus-visible {
  outline: 2px solid var(--foreground);
  outline-offset: 4px;
}

.entry-loader {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-content: center;
  width: min(100% - 48px, 420px);
  margin: auto;
  background: var(--background);
  text-align: center;
}

.entry-loader[hidden] {
  display: none;
}

.entry-loader p {
  margin: 0 0 24px;
  font-size: clamp(1rem, 3vw, 1.4rem);
}

.entry-loader__line {
  height: 1px;
  overflow: hidden;
  background: var(--line);
}

.entry-loader__line span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--foreground);
  transition: width 120ms linear;
}

.entry-loader small {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.55rem;
  letter-spacing: 0.14em;
}

.view {
  min-height: 100vh;
  min-height: 100svh;
}

.home {
  display: flex;
  padding: clamp(24px, 4vw, 64px);
}

.home__content {
  width: min(100%, 1180px);
  margin: auto;
}

.eyebrow {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.68rem;
  letter-spacing: 0.22em;
}

h1 {
  max-width: 1000px;
  margin: 0 0 clamp(48px, 8vw, 112px);
  font-size: clamp(3.4rem, 10vw, 9rem);
  font-weight: 400;
  line-height: 0.84;
  letter-spacing: -0.08em;
}

.model-prompt {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: clamp(0.7rem, 1.2vw, 0.85rem);
}

.model-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.model-card {
  min-height: 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.model-card:hover {
  background: var(--foreground);
  color: var(--background);
}

.gallery {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: clamp(18px, 3vh, 36px);
  padding: clamp(18px, 3vw, 44px);
}

.gallery[hidden],
.home[hidden] {
  display: none;
}

.gallery__header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
}

.icon-button {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 1.3rem;
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.icon-button:hover {
  border-color: var(--foreground);
  background: var(--foreground);
  color: var(--background);
}

.gallery__identity {
  text-align: center;
}

h2 {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.65rem);
  font-weight: 400;
}

.gallery__counter {
  justify-self: end;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
}

.gallery__stage {
  display: grid;
  min-height: 0;
  place-items: center;
  overflow: hidden;
}

.image-track {
  --frame-width: min(440px, calc(65vh * 2 / 3));
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, var(--frame-width));
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 3vw, 42px);
  width: 100%;
}

.image-frame,
.preview-frame {
  position: relative;
  display: grid;
  width: var(--frame-width);
  aspect-ratio: 2 / 3;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  background-color: var(--panel);
  background-image: linear-gradient(45deg, #111 25%, transparent 25%), linear-gradient(-45deg, #111 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #111 75%), linear-gradient(-45deg, transparent 75%, #111 75%);
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
}

.preview-frame {
  opacity: 0.26;
  transform: scale(0.9);
  transition: opacity 180ms ease;
}

.preview-frame[hidden] {
  visibility: hidden;
}

#gallery-image,
.preview-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.side-button {
  position: absolute;
  z-index: 2;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: max-content;
  max-width: 150px;
  padding: 9px 12px;
  border: 1px solid rgba(244, 244, 239, 0.24);
  background: rgba(5, 5, 5, 0.68);
  color: rgba(244, 244, 239, 0.82);
  font-size: 0.6rem;
  line-height: 1.45;
  letter-spacing: 0.1em;
  text-align: center;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  transform: translateY(-50%);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.side-button--previous {
  right: calc(50% + var(--frame-width) / 2 + 28px);
}

.side-button--next {
  left: calc(50% + var(--frame-width) / 2 + 28px);
}

.side-button:hover {
  background: rgba(5, 5, 5, 0.82);
  color: var(--foreground);
}

.side-button[hidden] {
  display: none;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.14em;
}

.empty-state[hidden] {
  display: none;
}

.empty-state small {
  max-width: 560px;
  color: #5f5f5b;
  font-size: 0.58rem;
  line-height: 1.7;
}

.gallery__controls {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(100%, 620px);
  margin: 0 auto;
}

.control-button {
  display: grid;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  min-height: 0;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: transparent;
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 180ms ease, color 180ms ease;
}

.control-button:hover,
.play-button[aria-pressed="true"] {
  background: var(--foreground);
  color: var(--background);
}

.play-icon {
  font-size: 0.7rem;
}

.gallery__scrubber {
  width: 100%;
  height: 24px;
  margin: 0;
  accent-color: var(--foreground);
  cursor: pointer;
  touch-action: pan-x;
}

@media (max-width: 820px) {
  .model-grid {
    flex-direction: column;
    align-items: center;
    width: 100%;
  }

  .model-card {
    width: auto;
    max-width: 100%;
    padding-inline: 18px;
    text-align: center;
  }

  .image-track {
    --frame-width: min(400px, calc(60vh * 2 / 3));
  }
}

@media (max-width: 520px) {
  .home {
    padding: 22px 18px;
  }

  h1 {
    margin-bottom: 46px;
    font-size: clamp(3rem, 18vw, 5.4rem);
    line-height: 0.88;
  }

  .model-card {
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .gallery {
    grid-template-rows: auto minmax(0, 1fr) auto;
    gap: 10px;
    height: 100svh;
    min-height: 0;
    padding: 12px 10px;
  }

  .gallery__header {
    grid-template-columns: 48px 1fr 58px;
  }

  .gallery__counter {
    margin-top: 18px;
    font-size: 0.58rem;
  }

  .gallery__stage {
    width: 100%;
    min-width: 0;
    overflow: hidden;
  }

  .image-track {
    --frame-width: min(62vw, calc(56svh * 2 / 3));
    display: block;
    width: var(--frame-width);
    height: calc(var(--frame-width) * 3 / 2);
    min-width: 0;
    margin: 0 auto;
  }

  .image-frame {
    position: relative;
    z-index: 1;
  }

  .preview-frame {
    position: absolute;
    top: 0;
    z-index: 0;
  }

  .preview-frame--previous {
    right: calc(100% + 10px);
  }

  .preview-frame--next {
    left: calc(100% + 10px);
  }

  .preview-frame {
    opacity: 0.34;
    transform: scale(0.94);
  }

  .side-button {
    max-width: 92px;
    padding: 9px 7px;
    background: rgba(5, 5, 5, 0.82);
    color: rgba(244, 244, 239, 0.94);
    font-size: 0.52rem;
  }

  .side-button--previous {
    right: calc(100% - 32px);
  }

  .side-button--next {
    left: calc(100% - 32px);
  }

  .control-button {
    flex-basis: 46px;
    width: 46px;
    height: 46px;
    font-size: 0.55rem;
  }
}

@media (max-width: 520px) and (max-height: 700px) {
  .gallery__header .icon-button {
    width: 42px;
    height: 42px;
  }

  .image-track {
    --frame-width: min(56vw, calc(50svh * 2 / 3));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
