/* Halaman Gallery. Token, header, tombol, dan footer ada di /overview/site.css. */

/* Hero */
.gallery-hero {
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.gallery-hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  align-items: center;
  gap: 56px;
  min-height: min(640px, calc(100dvh - var(--header)));
  padding-block: 56px;
}

.gallery-hero-copy h1 {
  margin-top: 18px;
  font-size: clamp(38px, 4.6vw, 62px);
}

.gallery-hero-copy h1 span {
  display: block;
  color: var(--subtle);
}

.lead {
  max-width: 560px;
  margin-top: 22px;
  color: var(--muted);
  font-size: clamp(17px, 1.4vw, 19px);
}

.lead strong {
  color: var(--ink);
  font-weight: 600;
}

.gallery-search {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  height: 56px;
  margin-top: 32px;
  padding: 0 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--pill);
  background: var(--paper);
  box-shadow: var(--shadow);
  transition: border-color 160ms ease;
}

.gallery-search:focus-within {
  border-color: var(--accent);
}

.gallery-search svg {
  width: 20px;
  height: 20px;
  flex: none;
  color: var(--subtle);
}

.gallery-search input {
  width: 100%;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 16px;
}

.gallery-search input::placeholder {
  color: var(--subtle);
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 28px 40px;
  margin: 36px 0 0;
  padding: 0;
  list-style: none;
}

.hero-stats li {
  display: grid;
  gap: 2px;
}

.hero-stats strong {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.hero-stats span {
  color: var(--muted);
  font-size: 14px;
}

/* Mosaik unggulan yang bergerak pelan. Kolom diisi ganda oleh app.js supaya
   geraknya bersambung tanpa lompatan. */
.hero-mosaic {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  height: 560px;
  overflow: hidden;
}

.mosaic-col {
  display: grid;
  align-content: start;
  gap: 14px;
  animation: mosaic-rise 70s linear infinite;
}

.mosaic-col:nth-child(2) {
  animation-duration: 84s;
  animation-direction: reverse;
}

.mosaic-col:nth-child(3) {
  animation-duration: 76s;
}

.mosaic-col img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--canvas);
}

.hero-mosaic:hover .mosaic-col {
  animation-play-state: paused;
}

@keyframes mosaic-rise {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(calc(-50% - 7px));
  }
}

/* Toolbar lengket */
.gallery-toolbar {
  position: sticky;
  z-index: 40;
  top: var(--header);
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--line);
}

.gallery-toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.chips {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding-block: 12px;
}

.chips::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--paper);
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.chip:hover {
  border-color: var(--line-strong);
}

.chip small {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 500;
}

.chip[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.chip[aria-pressed="true"] small {
  color: rgba(255, 255, 255, 0.64);
}

.toolbar-end {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
}

.result-count {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--canvas);
}

.segmented button {
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--pill);
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.segmented button[aria-pressed="true"] {
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(13, 12, 17, 0.1);
}

/* Masonry per kolom: kartu tidak berpindah kolom saat gambarnya selesai dimuat. */
.gallery-section {
  padding-bottom: 80px;
}

.masonry {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding-top: 28px;
}

.masonry-col {
  display: grid;
  flex: 1 1 0;
  gap: 16px;
  min-width: 0;
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  min-height: 160px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius);
  background: var(--canvas);
  cursor: zoom-in;
  text-align: left;
}

.tile img {
  width: 100%;
  height: auto;
  opacity: 0;
  transition: opacity 400ms ease, transform 600ms var(--ease);
}

.tile.is-loaded {
  min-height: 0;
}

.tile.is-loaded img {
  opacity: 1;
}

.tile.is-missing {
  display: none;
}

.tile-overlay {
  position: absolute;
  inset: auto 10px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px 10px 14px;
  border-radius: var(--radius-sm);
  background: rgba(13, 12, 17, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #ffffff;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 220ms ease, transform 220ms var(--ease);
}

.tile-meta {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tile-meta strong {
  font-size: 14px;
  font-weight: 600;
}

.tile-meta span {
  overflow: hidden;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-cta {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  flex: none;
  border-radius: var(--pill);
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.tile:hover img,
.tile:focus-visible img {
  transform: scale(1.03);
}

.tile:hover .tile-overlay,
.tile:focus-visible .tile-overlay {
  opacity: 1;
  transform: none;
}

.load-more {
  display: flex;
  justify-content: center;
  margin-top: 40px;
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 80px 20px;
  text-align: center;
}

.empty-state strong {
  font-size: 22px;
  font-weight: 600;
}

.empty-state p {
  margin-bottom: 12px;
  color: var(--muted);
}

/* Pita ajakan */
.cta-band {
  padding-block: 96px;
  background: var(--night);
  color: var(--night-text);
}

.cta-band-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: center;
  gap: 64px;
}

.eyebrow-light {
  color: #cbb9e6;
}

.eyebrow-light::before {
  background: #cbb9e6;
}

.cta-copy h2 {
  margin-top: 16px;
  font-size: clamp(32px, 3.8vw, 52px);
}

.cta-copy > p {
  max-width: 540px;
  margin-top: 20px;
  color: var(--night-muted);
  font-size: 18px;
}

.cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.cta-steps {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cta-steps li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 18px;
  padding: 22px 24px;
  border: 1px solid var(--night-line);
  border-radius: var(--radius);
  background: var(--night-2);
}

.cta-steps span {
  grid-row: span 2;
  color: #cbb9e6;
  font-size: 14px;
  font-weight: 600;
}

.cta-steps strong {
  font-size: 18px;
  font-weight: 600;
}

.cta-steps p {
  color: var(--night-muted);
  font-size: 15px;
}

/* Dialog detail */
.detail {
  width: min(1180px, calc(100vw - 48px));
  max-width: none;
  height: min(820px, calc(100dvh - 48px));
  max-height: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--paper);
  color: var(--ink);
}

.detail[open] {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 1fr);
  animation: detail-in 260ms var(--ease);
}

.detail::backdrop {
  background: rgba(13, 12, 17, 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

@keyframes detail-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
}

.detail-media {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  overflow: hidden;
  background: var(--night);
}

.detail-media img {
  width: 100%;
  height: 100%;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
}

.detail-nav {
  position: absolute;
  top: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--pill);
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  cursor: pointer;
  transform: translateY(-50%);
}

.detail-nav svg {
  width: 20px;
  height: 20px;
}

.detail-prev {
  left: 16px;
}

.detail-next {
  right: 16px;
}

.detail-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: 24px 28px 28px;
  overflow-y: auto;
}

/* Panel bisa digulir; isinya tidak boleh menyusut. Tanpa ini, di ponsel tombol
   "Buat versi saya di Eline" dan kotak prompt tergencet tinggal belasan piksel. */
.detail-panel > * {
  flex: none;
}

.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-category {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border-radius: var(--pill);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 600;
}

.detail-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--paper);
  cursor: pointer;
}

.detail-close svg {
  width: 18px;
  height: 18px;
}

.detail-panel h2 {
  font-size: 24px;
  line-height: 1.2;
}

.detail-credit {
  color: var(--muted);
  font-size: 14px;
}

.detail-credit a {
  color: var(--ink-2);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
}

.prompt-box {
  display: grid;
  min-height: 120px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--canvas);
}

.prompt-box-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 0 16px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.copy-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--paper);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.copy-button svg {
  width: 14px;
  height: 14px;
}

.detail-prompt {
  max-height: 260px;
  padding: 10px 16px 16px;
  overflow-y: auto;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-use {
  width: 100%;
}

.detail-note {
  margin-top: -6px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.detail-note a {
  color: var(--accent-deep);
  font-weight: 600;
}

.related {
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.related-title {
  margin-bottom: 10px;
  font-size: 14px;
  font-weight: 600;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.related-grid button {
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--canvas);
  cursor: pointer;
}

.related-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  transition: transform 300ms var(--ease);
}

.related-grid button:hover img {
  transform: scale(1.05);
}

@media (max-width: 1080px) {
  .gallery-hero-inner {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
  }

  .hero-mosaic {
    height: 300px;
  }

  .cta-band-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .detail[open] {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(200px, 42dvh) minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .gallery-hero-inner {
    gap: 32px;
    padding-block: 36px 28px;
  }

  .hero-mosaic {
    display: none;
  }

  .hero-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-top: 28px;
  }

  .hero-stats strong {
    font-size: 20px;
  }

  .hero-stats span {
    font-size: 13px;
    line-height: 1.35;
  }

  .gallery-toolbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-inline: 0;
  }

  .chips {
    padding-inline: var(--gutter);
    padding-block: 10px 6px;
  }

  .toolbar-end {
    justify-content: space-between;
    padding: 0 var(--gutter) 10px;
  }

  .masonry,
  .masonry-col {
    gap: 10px;
  }

  .masonry {
    padding-top: 16px;
  }

  .tile {
    border-radius: var(--radius-sm);
  }

  .tile-overlay {
    display: none;
  }

  .cta-band {
    padding-block: 64px;
  }

  .detail {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .detail-panel {
    padding: 18px 20px 24px;
  }

  .detail-nav {
    width: 38px;
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mosaic-col {
    animation: none;
  }
}
