/* Project 0 specific styles */

/* Larger variant for selfie gallery (Part 1) */
.gallery.gallery-large img {
  max-width: 360px;
}

/* Extra-wide variant for two-up gallery (Part 2) */
.gallery.gallery-wide img {
  max-width: 420px;
}

@media (max-width: 640px) {
  .gallery.gallery-wide img {
    max-width: 45vw;
  }
}

/* Slightly smaller display for the dolly zoom GIF */
img.dollyzoom {
  max-width: 450px;
  width: 100%;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

/* Labeled directional arrow for Part 1 explanation */
.change-explainer {
  margin: 14px auto 4px;
  max-width: 920px;
}
.change-caption {
  text-align: center;
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 0px;
}
.arrow-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}
.arrow-row .label-left,
.arrow-row .label-right {
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.arrow-row .arrow {
  position: relative;
  height: 0;
  border-top: 2px solid var(--text-muted);
}
.arrow-row .arrow::after {
  content: '';
  position: absolute;
  right: -2px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 8px solid var(--text-muted);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

@media (max-width: 640px) {
  .change-caption { font-size: 0.9rem; }
  .arrow-row { gap: 8px; }
}

/* Reusable discussion card under each part */
.discussion-card {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--discussion-bg);
  border: 1px solid var(--discussion-border);
  border-left: 4px solid var(--discussion-accent);
  border-radius: 10px;
  box-shadow: none;
  font-family: "Times New Roman", Times, serif;
}
.discussion-card h3 {
  margin: 0 0 8px 0;
  font-weight: 700;
  color: var(--discussion-accent);
  font-family: "Times New Roman", Times, serif;
}
.discussion-card p {
  margin: 0;
  line-height: 1.7;
  font-size: 1rem;
}

/* LA trip 3x2 gallery */
.trip-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.trip-gallery figure { margin: 0; }
.trip-gallery img.responsive { width: 100%; height: auto; }

@media (max-width: 820px) {
  .trip-gallery { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .trip-gallery { grid-template-columns: 1fr; }
}

/* MathJax spacing and centering */
.math-block { margin: 10px 0 14px; }
mjx-container[jax="CHTML"][display="true"] { margin: 0.75rem auto; }
mjx-container[jax="CHTML"] { line-height: 1.3; }

/* Hover zoom container */
.gallery > div,
.gallery figure {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
}

/* Zoomable images */
.gallery img.zoomable {
  transition: transform .45s cubic-bezier(.22,.78,.23,.99), filter .45s ease;
  will-change: transform;
  cursor: zoom-in;
  display: block;
  backface-visibility: hidden;
}

.gallery img.zoomable:hover,
.gallery img.zoomable:focus {
  transform: scale(1.075);
  z-index: 2;
  filter: saturate(1.05);
}

/* Lightbox core */
.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1600;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

.lightbox.open { display: flex; }

.lightbox .lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.74);
  backdrop-filter: blur(2px);
  animation: lbFade .25s ease;
}

@keyframes lbFade { from { opacity:0; } to { opacity:1; } }

.lightbox .lb-inner {
  position: relative;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: lbPop .28s cubic-bezier(.22,.78,.23,.99);
}

@keyframes lbPop {
  0% { transform: scale(.94); opacity:0; }
  100% { transform: scale(1); opacity:1; }
}

.lightbox img {
  max-width: 92vw;
  max-height: 82vh;
  border-radius: 8px;
  box-shadow: 0 4px 24px -4px rgba(0,0,0,.55), 0 0 0 1px rgba(255,255,255,.12);
  object-fit: contain;
  background: #111;
}

.lb-caption {
  margin-top: 10px;
  font-size: .9rem;
  color: var(--text-muted);
  text-align: center;
  max-width: 80vw;
  line-height: 1.35;
}

.lb-close {
  position: absolute;
  top: -42px;
  right: -10px;
  background: rgba(255,255,255,.12);
  color: #fff;
  border: 1px solid rgba(255,255,255,.25);
  font-size: 24px;
  width: 40px;
  height: 40px;
  line-height: 36px;
  border-radius: 50%;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background .25s;
}

.lb-close:hover {
  background: rgba(255,255,255,.25);
}

/* Dark theme tweak (if you have theme vars already this may be optional) */
@media (prefers-color-scheme: dark) {
  .lb-close { background: rgba(255,255,255,.1); }
}

/* Allow keyboard focus outline */
.gallery img.zoomable:focus {
  outline: 2px solid var(--discussion-accent);
  outline-offset: 2px;
}
