/* CATS 명령 창 이미지: 매뉴얼 상세 그림, 명령 찾기 배지·미리보기, /pro·/seouldream 갤러리, 크게 보기(dialog).
   이미지는 제품 저장소 tests/WebUiShots 렌더 → scripts/import_cats_pro_ui_shots.py, import_cats_seouldream_ui_shots.py */

/* 제품 색. 정하지 않으면 Pro 파랑(--cats-blue)이다. */
.cats-manual-seouldream,
.product-seouldream {
  --ui-shot-accent: #0f766e;
  --ui-shot-tint: #edfdfa;
}

.ui-shot-link,
.ui-gallery-media {
  display: block;
  border-radius: 8px;
  cursor: zoom-in;
}

.ui-shot-link img,
.ui-gallery-media img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--cats-line, #d9e0ea);
  border-radius: 8px;
  background: #f4f6f8;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.ui-shot-link:hover img,
.ui-gallery-media:hover img {
  border-color: var(--ui-shot-accent, var(--cats-blue, #1d4ed8));
}

.command-ui-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--ui-shot-tint, #eef4ff);
  color: var(--ui-shot-accent, var(--cats-blue, #1d4ed8));
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
  vertical-align: middle;
}

/* 매뉴얼 상세 */
.command-ui {
  max-width: 920px;
  margin: 4px 0 26px;
}

.command-ui .detail-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.command-ui-note {
  margin: 0 0 12px;
  color: var(--text-muted, #64748b);
  font-size: 13px;
  line-height: 1.6;
}

.command-ui-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.command-ui-grid.has-help {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
}

.command-ui-shot {
  margin: 0;
}

.command-ui-shot figcaption {
  margin-top: 8px;
  color: var(--text-muted, #64748b);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .command-ui-grid.has-help {
    grid-template-columns: minmax(0, 1fr);
  }

  .command-ui-help {
    max-width: 420px;
  }
}

/* 명령 찾기: 코드 옆 배지와 데스크톱 미리보기 */
.command-code-cell {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
}

.command-ui-preview {
  position: fixed;
  z-index: 60;
  width: 360px;
  padding: 8px;
  border: 1px solid var(--cats-line, #d9e0ea);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.2);
  pointer-events: none;
}

.command-ui-preview[hidden] {
  display: none;
}

.command-ui-preview img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
}

.command-ui-preview p {
  margin: 6px 2px 0;
  color: var(--cats-muted, #64748b);
  font-size: 12px;
  font-weight: 700;
}

/* /pro 갤러리 */
.ui-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.ui-gallery-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--cats-line, #d9e0ea);
  border-radius: 8px;
  background: #fff;
}

.ui-gallery-media {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  padding: 14px;
  border-radius: 0;
  background: var(--cats-soft, #f1f5fb);
}

.ui-gallery-media img {
  width: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
}

.ui-gallery-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
}

.ui-gallery-body h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.ui-gallery-body h3 code {
  margin-right: 4px;
  color: var(--ui-shot-accent, var(--cats-blue, #1d4ed8));
  font-family: Consolas, "SFMono-Regular", monospace;
  font-size: 13px;
}

.ui-gallery-body p {
  flex: 1;
  margin: 0;
  color: var(--cats-muted, #64748b);
  font-size: 13px;
  line-height: 1.6;
}

.ui-gallery-more,
.ui-gallery-all {
  color: var(--ui-shot-accent, var(--cats-blue, #1d4ed8));
  font-size: 13px;
  font-weight: 800;
}

.ui-gallery-all {
  display: inline-block;
  margin-top: 14px;
  font-size: 14px;
}

@media (max-width: 1100px) {
  .ui-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .ui-gallery-grid {
    grid-auto-columns: 86%;
    grid-auto-flow: column;
    grid-template-columns: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    padding-bottom: 8px;
  }

  .ui-gallery-card {
    scroll-snap-align: start;
  }
}

/* 크게 보기 */
html.ui-lightbox-open {
  overflow: hidden;
}

.ui-lightbox {
  max-width: 96vw;
  max-height: 94vh;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: transparent;
  overflow: visible;
}

/* 페이지의 전역 margin 초기화가 dialog 가운데 정렬(margin: auto)을 지우므로 다시 준다. */
.ui-lightbox[open] {
  position: fixed;
  inset: 0;
  margin: auto;
}

.ui-lightbox::backdrop {
  background: rgba(7, 18, 38, 0.72);
}

.ui-lightbox figure {
  margin: 0;
}

.ui-lightbox img {
  display: block;
  max-width: 96vw;
  max-height: calc(94vh - 40px);
  width: auto;
  height: auto;
  border-radius: 8px;
  background: #f4f6f8;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.ui-lightbox figcaption {
  margin-top: 10px;
  color: #f4f8ff;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.ui-lightbox-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.ui-lightbox-close:focus-visible {
  outline: 3px solid #5cc6ff;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: no-preference) {
  .ui-lightbox[open] {
    animation: ui-lightbox-in 140ms ease-out;
  }

  @keyframes ui-lightbox-in {
    from { opacity: 0; transform: scale(0.98); }
    to { opacity: 1; transform: none; }
  }
}
