/* ==========================================================================
   gallery-preview.css
   Full-size photo preview + journey viewer used by gallery.php.
   Loads AFTER css/gallery.css. Everything is prefixed .jv- / .gp- so it
   can't clash with existing styles. Uses your --anti-lime variable when it
   exists and falls back to #c6f24e.
   ========================================================================== */

:root {
  --gp-ink:   #0e2318;
  --gp-lime:  var(--anti-lime, #c6f24e);
  --gp-paper: #f6f8f0;
  --gp-muted: #4b5d51;
  --gp-line:  rgba(14, 35, 24, .14);
}

/* ---------- Buttons in the gallery header ---------- */
.gp-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .6rem;
  margin-top: 1.4rem;
}
.gp-btn-outline {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1.4rem;
  border: 1.5px solid var(--gp-ink);
  border-radius: 999px;
  color: var(--gp-ink);
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.gp-btn-outline:hover { background: var(--gp-ink); color: var(--gp-lime); }
.gp-btn-outline:focus-visible { outline: 3px solid var(--gp-lime); outline-offset: 2px; box-shadow: 0 0 0 5px var(--gp-ink); }

/* ---------- Viewer shell ---------- */
html.jv-lock { overflow: hidden; }

.jv {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  align-items: center;
  justify-content: center;
  padding: clamp(0px, 2.4vw, 28px);
}
.jv.is-open { display: flex; animation: jv-in .22s ease-out; }

.jv-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 12, 8, .88);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.jv-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(1240px, 100%);
  height: min(100%, 800px);
  background: var(--gp-ink);
  color: #eef4e6;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}

/* ---------- Top bar ---------- */
.jv-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px 10px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.jv-counter {
  font-size: .86rem;
  color: rgba(238, 244, 230, .7);
  font-variant-numeric: tabular-nums;
}
.jv-counter strong { color: #fff; font-size: 1rem; }
.jv-top-actions { display: flex; align-items: center; gap: 8px; }

.jv-chip,
.jv-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  height: 40px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: .86rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.jv-chip { padding: 0 1rem; }
.jv-icon-btn { width: 40px; }
.jv-chip:hover,
.jv-icon-btn:hover { background: var(--gp-lime); border-color: var(--gp-lime); color: var(--gp-ink); }
.jv-chip .ico-pause { display: none; }
.jv.is-playing .jv-chip { background: var(--gp-lime); border-color: var(--gp-lime); color: var(--gp-ink); }
.jv.is-playing .jv-chip .ico-play { display: none; }
.jv.is-playing .jv-chip .ico-pause { display: block; }

.jv button:focus-visible,
.jv a:focus-visible {
  outline: 3px solid var(--gp-lime);
  outline-offset: 2px;
}
.jv-detail button:focus-visible,
.jv-detail a:focus-visible { outline-color: var(--gp-ink); }

/* ---------- Body: photo + details ---------- */
.jv-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(330px, 1fr);
}

/* Photo side */
.jv-media {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #08150e;
}
.jv-figure {
  position: relative;
  flex: 1;
  min-height: 0;
}
.jv-figure > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity .25s ease;
}
.jv-figure > img.is-swapping { opacity: 0; }

.jv-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  background: rgba(10, 26, 17, .72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  color: #fff;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.jv-arrow:hover { background: var(--gp-lime); border-color: var(--gp-lime); color: var(--gp-ink); }
.jv-prev { left: 14px; }
.jv-next { right: 14px; }

/* Slideshow progress bar */
.jv-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 3px;
  background: var(--gp-lime);
  transform: scaleX(0);
  transform-origin: left;
}
.jv-timer.run { animation: jv-timer var(--jv-dur, 10s) linear forwards; }

.jv-credit {
  margin: 0;
  padding: 8px 20px 4px;
  font-size: .72rem;
  color: rgba(238, 244, 230, .55);
}

/* Thumbnail filmstrip */
.jv-thumbs {
  position: relative;
  display: flex;
  gap: 8px;
  padding: 6px 20px 16px;
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .25) transparent;
}
.jv-thumb {
  position: relative;
  flex: 0 0 auto;
  width: 88px;
  height: 58px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  background: #123222;
  overflow: hidden;
  opacity: .55;
  cursor: pointer;
  transition: opacity .15s, border-color .15s;
}
.jv-thumb:hover { opacity: .9; }
.jv-thumb[aria-current="true"] { opacity: 1; border-color: var(--gp-lime); }
.jv-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.jv-thumb-n {
  position: absolute;
  left: 4px;
  top: 3px;
  padding: 0 5px;
  border-radius: 6px;
  background: rgba(10, 26, 17, .78);
  color: #fff;
  font-size: .64rem;
  font-weight: 700;
  line-height: 1.5;
}

/* Detail side */
.jv-detail {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--gp-paper);
  color: var(--gp-ink);
}
.jv-detail-scroll {
  flex: 1;
  min-height: 0;
  padding: 28px 30px 14px;
  overflow-y: auto;
}
.jv-role { font-size: .8rem; font-weight: 600; color: var(--gp-muted); }
.jv-detail h3 {
  margin: .35rem 0 .3rem;
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--gp-ink);
}
.jv-org { margin-bottom: 1rem; font-size: .9rem; color: var(--gp-muted); }
.jv-lead { margin: 0 0 1rem; font-size: 1.02rem; font-weight: 500; line-height: 1.55; color: var(--gp-ink); }
.jv-copy p { max-width: 62ch; margin: 0 0 .9rem; font-size: .94rem; line-height: 1.65; color: #2c3d33; }

.jv-facts { margin: 1.2rem 0 .4rem; padding: 0; border-top: 1px solid var(--gp-line); }
.jv-facts > div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: .6rem 0;
  border-bottom: 1px solid var(--gp-line);
  font-size: .88rem;
}
.jv-facts dt { font-weight: 600; color: var(--gp-muted); }
.jv-facts dd { margin: 0; text-align: right; color: var(--gp-ink); }

/* Footer: links + step buttons */
.jv-footer {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 14px 30px 20px;
  border-top: 1px solid var(--gp-line);
  background: var(--gp-paper);
}
/* soft fade so it's clear the text above can scroll */
.jv-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -29px;
  height: 28px;
  background: linear-gradient(to bottom, rgba(246, 248, 240, 0), var(--gp-paper));
  pointer-events: none;
}
.jv-links { display: flex; flex-wrap: wrap; gap: 8px; }
.jv-links-inline { display: none; margin-top: 1.4rem; }

.jv-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border: 1.5px solid var(--gp-ink);
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 600;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.jv-btn-dark { background: var(--gp-ink); color: var(--gp-lime); }
.jv-btn-dark:hover { background: #17402b; color: var(--gp-lime); }
.jv-btn-line { background: transparent; color: var(--gp-ink); }
.jv-btn-line:hover { background: rgba(14, 35, 24, .08); color: var(--gp-ink); }

.jv-step-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.jv-step {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: .55rem .8rem;
  border: 1px solid var(--gp-line);
  border-radius: 14px;
  background: #fff;
  color: var(--gp-ink);
  text-align: left;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.jv-step:hover { border-color: var(--gp-ink); background: #fff; }
.jv-step[data-jv-next] { flex-direction: row-reverse; text-align: right; }
.jv-step .txt { flex: 1; min-width: 0; }
.jv-step small { display: block; font-size: .7rem; color: var(--gp-muted); }
.jv-step strong { display: block; overflow: hidden; font-size: .86rem; text-overflow: ellipsis; white-space: nowrap; }
.jv-step svg { flex: 0 0 auto; }

/* ---------- Small screens: full-screen, image on top, text below ---------- */
@media (max-width: 899.98px) {
  .jv.is-open { padding: 0; }
  .jv-shell { height: 100%; border-radius: 0; }
  .jv-topbar { padding: 8px 10px 8px 16px; }
  .jv-chip span { display: none; }
  .jv-chip { width: 40px; padding: 0; }

  .jv-body { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .jv-figure { flex: none; height: min(62vw, 360px); }
  .jv-arrow { width: 40px; height: 40px; }
  .jv-prev { left: 10px; }
  .jv-next { right: 10px; }
  .jv-thumb { width: 72px; height: 48px; }
  .jv-thumbs { padding: 6px 16px 12px; }

  .jv-detail { display: block; }
  .jv-detail-scroll { padding: 20px 18px 8px; overflow: visible; }
  .jv-links-inline { display: flex; }
  .jv-links-footer { display: none; }
  .jv-footer {
    position: sticky;
    bottom: 0;
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -10px 24px rgba(14, 35, 24, .1);
  }
}

/* ---------- Motion ---------- */
@keyframes jv-in    { from { opacity: 0; } to { opacity: 1; } }
@keyframes jv-timer { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (prefers-reduced-motion: reduce) {
  .jv.is-open { animation: none; }
  .jv-figure > img { transition: none; }
}
