/* Trip pages (/treks/trips/<slug>/): layout, header, title box and footer
   come from /style.css + treks.css, shared with the treks page. This file
   styles the trip content below the title box: stats, summary, route render,
   gallery and lightbox. Tokens map onto the homepage palette in style.css. */
:root {
  --paper: var(--bg-depth);
  --paper-raised: var(--surface);
  --ink: var(--text);
  --ink-soft: var(--text-soft);
  --accent: var(--text);
  --line: var(--border);
  --line-strong: var(--border-strong);
  --shadow: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-lg: 0 4px 10px rgba(0, 0, 0, .06), 0 16px 32px -20px rgba(0, 0, 0, .15);
}

img, video { max-width: 100%; display: block; }

/* ===== Trip content ===== */
.trip-body { margin-top: 32px; }

.stat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: 12px 20px;
  background: var(--paper-raised);
  border: 1px solid var(--line);
}
/* Same type as the LinkedIn / Github tags. */
.stat-bar .stat {
  position: relative;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1rem;
  color: var(--ink-soft);
  outline: none;
}

/* Label tooltip, styled like the footer's "Copied to clipboard" one. */
.stat-bar .stat::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  width: max-content;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  line-height: 1rem;
  pointer-events: none;
  opacity: 0;
  filter: blur(4px);
  transform: translate(-50%, 6px);
  transition: opacity 0.2s var(--ease-out), filter 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}
.stat-bar .stat:hover::after,
.stat-bar .stat:focus-visible::after {
  opacity: 1;
  filter: blur(0);
  transform: translate(-50%, 0);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.summary {
  max-width: 68ch;
  font-size: 17.5px;
  color: var(--ink-soft);
  padding: 32px 0 8px;
}

.route-section { padding: 24px 0 12px; }
.route-preview {
  display: block;
  position: relative;
  margin-top: 14px;
  width: 100%;
  max-width: 380px;
  aspect-ratio: 16 / 9;
  border: 0;
  padding: 0;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
  box-shadow: var(--shadow-lg);
}
.route-preview img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.route-preview:hover img { transform: scale(1.04); }
.route-preview-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  pointer-events: none;
}
.route-preview-play svg { width: 40px; height: 40px; filter: drop-shadow(0 2px 8px rgba(0, 0, 0, .5)); }

/* ===== Trip gallery: grid / slideshow / lightbox ===== */
.gallery-section { padding: 40px 0 24px; }
.gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
}
.gallery-count {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.gallery-controls-right { display: flex; gap: 8px; }
.gallery-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .04em;
  padding: 7px 13px;
  border-radius: 100px;
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.gallery-view-btn svg { width: 14px; height: 14px; }
.gallery-view-btn:hover { border-color: var(--accent); color: var(--ink); }
.gallery-view-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.gallery-grid[hidden], .slideshow-view[hidden], .lightbox[hidden] { display: none !important; }

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.gallery-item {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 0;
  padding: 0;
  border-radius: 6px;
  overflow: hidden;
  background: var(--line);
  cursor: pointer;
  box-shadow: var(--shadow);
}
.gallery-item-img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s ease; }
.gallery-item:hover .gallery-item-img { transform: scale(1.04); }
.gallery-item-play {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  pointer-events: none;
}
.gallery-item-play svg { width: 34px; height: 34px; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, .5)); }
.gallery-item-badge {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: rgba(10, 16, 14, .65);
  color: #fff;
  padding: 3px 8px;
  border-radius: 100px;
}

.nav-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--paper-raised);
  color: var(--ink);
  cursor: pointer;
}
.nav-btn svg { width: 18px; height: 18px; }
.nav-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Slideshow: inline view that replaces the grid */
.slideshow-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.slideshow-media-wrap {
  position: relative;
  width: 100%;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.slideshow-media { max-width: 100%; max-height: 70vh; width: auto; height: auto; }
.slideshow-side-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, .35);
  border-color: rgba(255, 255, 255, .25);
  color: #fff;
}
.slideshow-side-nav:hover { background: rgba(0, 0, 0, .55); color: #fff; border-color: rgba(255, 255, 255, .5); }
.slideshow-side-prev { left: 16px; }
.slideshow-side-next { right: 16px; }
.slideshow-info { text-align: center; max-width: 68ch; }
.slideshow-date {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.slideshow-caption { margin-top: 6px; font-size: 15px; color: var(--ink-soft); font-style: italic; }
.slideshow-counter { margin-top: 8px; font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); }
.slideshow-nav { display: flex; gap: 12px; }

/* Fullscreen lightbox overlay, shared by grid clicks and slideshow expand */
body.gallery-lightbox-open { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0;
  z-index: 1000;
  background: rgba(8, 12, 10, .96);
  display: flex;
  flex-direction: column;
}
.lightbox-topbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
}
.lightbox-topbar-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.lightbox-trip-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .03em;
  color: rgba(255, 255, 255, .4);
}
.lightbox-counter {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .75);
}
.lightbox-close {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .2);
  background: transparent;
  color: #fff;
  cursor: pointer;
}
.lightbox-close svg { width: 16px; height: 16px; }
.lightbox-close:hover { background: rgba(255, 255, 255, .1); }
.lightbox-media-wrap {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  min-height: 0;
  padding: 0 24px;
}
.lightbox-media { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox-prev, .lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, .35);
  border-color: rgba(255, 255, 255, .25);
  color: #fff;
}
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(0, 0, 0, .55); color: #fff; border-color: rgba(255, 255, 255, .5); }
.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-info {
  padding: 12px 24px 24px;
  text-align: center;
  color: #fff;
}
.lightbox-caption {
  margin-top: 6px;
  font-size: 14.5px;
  font-style: italic;
  color: rgba(255, 255, 255, .85);
  max-width: 68ch;
  margin-left: auto;
  margin-right: auto;
}

.back-link {
  display: inline-block;
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: .04em;
  color: var(--accent);
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }

@media (max-width: 560px) {
  .gallery-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .slideshow-side-prev { left: 8px; }
  .slideshow-side-next { right: 8px; }
}
