/* feature-plans/carousel-fullscreen-and-console-view.md: the shared
   full-screen photo viewer (static/js/photo_viewer.js), moved verbatim out of
   workspace.css so the Messages thread and the article image carousel use
   one set of rules. Also holds the article image carousel (.article-gallery,
   moved from home.css) and its "View full screen" button. Loaded by the
   console shell and by home/index.html. */

.hpz-viewer [hidden] {
  display: none;
}

.hpz-viewer {
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(38, 34, 31, .92);
  color: #fffdf8;
}

.hpz-viewer::backdrop {
  background: rgba(38, 34, 31, .92);
}

.hpz-viewer[open] {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 16px;
  box-sizing: border-box;
}

/* Photo alone at full width; Previous / Next live in .hpz-viewer-bottom. */
/* Previous and Next hug the thumbnails (Arthur 2026-10-08), so the group
   is centred and the strip only grows until it has to scroll. */
.hpz-viewer-bottom {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.hpz-viewer-bottom .hpz-viewer-strip {
  flex: 0 1 auto;
  min-width: 0;
}

.hpz-viewer-top {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hpz-viewer-count {
  margin: 0;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .9rem;
  color: rgba(255, 253, 248, .8);
}

/* The message's own text, above the file (Arthur 2026-10-08). */
.hpz-viewer-caption {
  margin: 0 auto;
  max-width: 720px;
  max-height: 22vh;
  overflow-y: auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 253, 248, .10);
  color: #fffdf8;
  font-size: .95rem;
  line-height: 1.45;
  white-space: pre-line;
  text-align: center;
}

.hpz-viewer-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.hpz-viewer-stage {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  touch-action: none; /* we handle pinch / pan / swipe here; the rest of the site keeps page zoom */
}

.hpz-viewer-stage img,
.hpz-viewer-stage video {
  max-width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.hpz-viewer-close,
.hpz-viewer-zoom,
.hpz-viewer-nav {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: none;
  min-width: 56px;
  min-height: 48px;
  padding: 6px 10px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 253, 248, .14);
  color: #fffdf8;
  font: inherit;
  font-size: .78rem;
  cursor: pointer;
}

.hpz-viewer-close:hover,
.hpz-viewer-zoom:hover,
.hpz-viewer-nav:hover {
  background: rgba(255, 253, 248, .26);
}

.hpz-viewer-close:focus-visible,
.hpz-viewer-zoom:focus-visible,
.hpz-viewer-nav:focus-visible,
.hpz-viewer-thumb:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--gold-light);
}

/* Thumbnails of every photo and video in the conversation, below the file. */
.hpz-viewer-strip {
  display: flex;
  gap: 6px;
  justify-content: safe center;
  overflow-x: auto;
  padding: 4px 2px;
}

.hpz-viewer-thumb {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 253, 248, .14);
  color: #fffdf8;
  opacity: .55;
  cursor: pointer;
}

.hpz-viewer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hpz-viewer-thumb .fa-play {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: .8rem;
}

.hpz-viewer-thumb.is-current {
  opacity: 1;
  box-shadow: inset 0 0 0 2px var(--gold-light);
}

@media (max-width: 768px) {
  .hpz-viewer[open] {
    padding: 10px 10px 14px;
  }
  .hpz-viewer-bottom {
    gap: 6px;
  }
  .hpz-viewer-zoom,
  .hpz-viewer-close,
  .hpz-viewer-nav {
    min-width: 48px;
    padding: 6px 4px;
    font-size: .7rem;
  }
  .hpz-viewer-thumb {
    width: 48px;
    height: 48px;
  }
}

/* The article image carousel. */
.article-gallery {
  max-width: 740px;
  margin: 12px 0 28px;
  padding: 20px 18px;
  background: linear-gradient(150deg, #2c2621 0%, #1c1815 100%);
  border-radius: 20px;
  box-shadow: 0 14px 34px -4px rgba(38, 30, 24, 0.28), 0 4px 12px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow: hidden;
  user-select: none;
}

.article-gallery::before {
  content: "";
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 15%, rgba(230, 170, 5, 0.18) 0%, transparent 60%);
  pointer-events: none;
}

.gallery-main {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.25);
  border: none;
  touch-action: pan-y;
  cursor: grab;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.25);
}

.gallery-main.is-dragging {
  cursor: grabbing;
}

.gallery-main-image {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  display: block;
  background: transparent;
  transition: transform .22s cubic-bezier(0.2, 0, 0, 1), opacity .2s ease;
  pointer-events: none;
}

.gallery-counter {
  position: absolute;
  bottom: 14px;
  right: 14px;
  padding: 4px 12px;
  background: rgba(28, 24, 21, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f7ca55;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  border-radius: 999px;
  pointer-events: none;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: opacity .2s ease;
}

.gallery-main .gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
}

.gallery-main .gallery-nav.prev {
  left: 12px;
}

.gallery-main .gallery-nav.next {
  right: 12px;
}

.gallery-nav {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(44, 38, 33, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #f7ca55;
  border: none;
  border-radius: 50%;
  font-size: .9rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: border-color .2s ease, color .2s ease, background-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.gallery-nav:hover {
  background: #f7ca55;
  color: #1e1812;
  transform: translateY(-50%) scale(1.08);
  box-shadow: 0 4px 18px rgba(247, 202, 85, 0.45);
}

.gallery-nav:active {
  transform: translateY(-50%) scale(0.96);
}

.gallery-thumb-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.gallery-thumb {
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.55;
  background: rgba(0, 0, 0, 0.25);
  aspect-ratio: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: opacity .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.gallery-thumb:hover {
  opacity: 0.88;
  transform: translateY(-2px);
}

.gallery-thumb.active {
  opacity: 1;
  border-color: #f7ca55;
  box-shadow: 0 0 0 2px rgba(247, 202, 85, 0.35), 0 4px 12px rgba(0, 0, 0, 0.3);
  transform: translateY(-2px);
}

/* carousel-fullscreen-and-console-view.md: "View full screen" under the thumbnails, captioned (house rule: an icon button carries its words). */
.gallery-fullscreen-btn {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 14px auto 0;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.14);
  color: #fffdf8;
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
}

.article-gallery > .gallery-fullscreen-btn { display: flex; width: max-content; }
.gallery-fullscreen-btn[hidden] { display: none; }
.gallery-fullscreen-btn:hover { background: rgba(255, 253, 248, 0.26); }
.gallery-fullscreen-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px #f7ca55; }
