/* ==========================================================================
   Photos Portfolio — jameskanka.com/photos/
   ========================================================================== */

/* The full-bleed hero + horizontally scrollable album tabs must never spill
   onto the document and shift the page. `clip` (unlike `hidden`) keeps
   position: sticky working on the filter bar. */
body.photos-page {
  overflow-x: clip;
}

/* ── Cinematic hero ───────────────────────────────────────────────────────── */
.photos-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  height: clamp(360px, 58vh, 640px);
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-bottom: 1px solid var(--border-subtle);
  isolation: isolate;
  background: linear-gradient(135deg, #1b2436, #0a0e17);
}

.photos-hero-slides {
  position: absolute;
  inset: 0;
  z-index: -2;
}

.photos-hero-slide {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: var(--focus, 50% 50%);
  opacity: 0;
  transform: scale(1.05);
  transition: opacity 1.8s ease;
  will-change: opacity, transform;
}

/* Opacity (crossfade) and the Ken Burns zoom are controlled by separate
   classes so the outgoing frame keeps drifting while it fades instead of
   snapping back to base scale. */
.photos-hero-slide.is-visible {
  opacity: 1;
}

.photos-hero-slide.is-active {
  animation: heroKenBurns 17s linear forwards;
}

@keyframes heroKenBurns {
  from {
    transform: scale(1.05);
  }
  to {
    transform: scale(1.16);
  }
}

/* Legibility scrim over the photo */
.photos-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    to top,
    rgba(2, 4, 10, 0.85) 0%,
    rgba(2, 4, 10, 0.32) 42%,
    rgba(2, 4, 10, 0.12) 68%,
    rgba(2, 4, 10, 0.4) 100%
  );
}

.photos-hero-inner {
  position: relative;
  width: 100%;
  padding-top: 2rem;
  padding-bottom: 2.35rem;
}

.photos-hero-title {
  margin: 0 0 0.55rem;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
}

.photos-hero-kicker {
  display: block;
  margin-bottom: 0.5rem;
  font:
    600 0.72rem/1.4 "JetBrains Mono",
    monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.photos-hero-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.78);
  font-family: "JetBrains Mono", monospace;
}

.photos-sep {
  opacity: 0.4;
}

.photos-hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 0.9rem;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.7);
  animation: heroScrollHint 2.2s ease-in-out infinite;
}

@keyframes heroScrollHint {
  0%,
  100% {
    transform: translate(-50%, 0);
    opacity: 0.35;
  }
  50% {
    transform: translate(-50%, 6px);
    opacity: 0.9;
  }
}

@media (prefers-reduced-motion: reduce) {
  .photos-hero-slide.is-active {
    animation: none;
  }
  .photos-hero-slide {
    transition: opacity 0.3s linear;
  }
  .photos-hero-scroll {
    animation: none;
  }
}

@media (max-width: 600px) {
  .photos-hero {
    height: clamp(320px, 62vh, 460px);
  }
}

/* ── Album Filter Tabs ────────────────────────────────────────────────────── */
.photos-filter-bar {
  position: sticky;
  top: 64px;
  z-index: 100;
  background: var(--bg-primary, #ffffff);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0;
}

body.if-active .photos-filter-bar {
  background: var(--bg-primary, #060911);
}

.photos-filter-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0;
}

.photos-filter-tabs::-webkit-scrollbar {
  display: none;
}

.photos-filter-tab {
  flex-shrink: 0;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: "Plus Jakarta Sans", sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 1rem 1.25rem;
  cursor: pointer;
  transition:
    color 0.2s,
    border-color 0.2s;
  white-space: nowrap;
}

.photos-filter-tab:hover {
  color: var(--text-primary);
}

.photos-filter-tab.active {
  color: var(--text-accent, #38bdf8);
  border-bottom-color: var(--text-accent, #38bdf8);
  font-weight: 600;
}

/* Album opening note — an editorial bridge between navigation and photographs */
.album-editorial-wrap {
  border-bottom: 1px solid var(--border-subtle);
}
.album-editorial-wrap[hidden] {
  display: none;
}
.album-editorial {
  max-width: 850px;
  padding: clamp(3rem, 7vw, 6rem) 0 clamp(2.5rem, 6vw, 5rem);
}
.album-editorial-kicker {
  margin: 0 0 1.15rem;
  color: var(--text-accent, #38bdf8);
  font:
    600 0.72rem/1.4 "JetBrains Mono",
    monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.album-editorial h2 {
  margin: 0 0 1.25rem;
  color: var(--text-primary);
  font-size: clamp(2.1rem, 5vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.045em;
}
#albumEditorialDescription {
  max-width: 720px;
  margin: 0;
  color: var(--text-secondary);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.12rem, 2.1vw, 1.45rem);
  line-height: 1.7;
}
#albumEditorialDescription p {
  margin: 0 0 1rem;
}
#albumEditorialDescription p:last-child {
  margin-bottom: 0;
}
#albumEditorialDescription a {
  color: var(--text-accent, #38bdf8);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Album feature video(s) under the editorial note */
.album-editorial-media {
  max-width: 850px;
  margin: 2.25rem 0 0;
  display: grid;
  gap: 1.5rem;
}
.album-editorial-media[hidden] {
  display: none;
}
.album-editorial-video {
  margin: 0;
}
.album-editorial-video figcaption {
  margin-top: 0.6rem;
  color: var(--text-muted);
  font:
    0.8rem/1.5 "JetBrains Mono",
    monospace;
}
.album-video-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}
.album-video-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.album-video-el {
  width: 100%;
  border-radius: 10px;
  background: #000;
  display: block;
}
.album-editorial-rule {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 2rem;
  color: var(--text-muted);
  font:
    600 0.62rem "JetBrains Mono",
    monospace;
  letter-spacing: 0.1em;
}
.album-editorial-rule::before {
  content: "";
  width: 64px;
  height: 1px;
  background: var(--border-subtle);
}

/* ── Gallery Grid ─────────────────────────────────────────────────────────── */
.photos-gallery {
  padding: 2.5rem 0 5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  grid-auto-rows: 260px;
}

/* Featured cards span 2 columns and 2 rows */
.photo-card.is-featured {
  grid-column: span 2;
  grid-row: span 2;
}

/* First featured card in a set is always top-left */
.photo-card.is-featured:first-child {
  grid-column: 1 / span 2;
}

/* ── Photo Card ───────────────────────────────────────────────────────────── */
.photo-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: var(--bg-secondary, #f1f5f9);
  transform: translateZ(0);
  transition:
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.photo-card:hover {
  transform: scale(1.015);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.22);
  z-index: 2;
}

.photo-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform;
}

.photo-card:hover .photo-card-img {
  transform: scale(1.04);
}

/* Caption overlay — slides up on hover */
.photo-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(2, 4, 10, 0.88) 0%,
    rgba(2, 4, 10, 0.45) 45%,
    transparent 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 1.25rem;
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.28s ease,
    transform 0.28s ease;
}

/* Caption overlay — slides up on hover for all cards */
.photo-card:hover .photo-card-overlay {
  opacity: 1;
  transform: translateY(0);
}

.photo-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.25rem;
  line-height: 1.3;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}

.photo-card.is-featured .photo-card-title {
  font-size: 1.25rem;
}

.photo-card-location {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.72);
  font-family: "JetBrains Mono", monospace;
}

.photo-card-location svg {
  flex-shrink: 0;
  opacity: 0.8;
}

/* Album label badge on featured cards */
.photo-card-album-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  background: rgba(56, 189, 248, 0.18);
  border: 1px solid rgba(56, 189, 248, 0.35);
  color: #38bdf8;
  font-size: 0.68rem;
  font-weight: 600;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.25rem 0.6rem;
  border-radius: 100px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Lazy-load placeholder shimmer */
.photo-card-img[data-src]:not([src]) {
  background: var(--bg-tertiary, #e2e8f0);
}

.photo-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.photo-card.is-loading::before {
  opacity: 1;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }
  100% {
    background-position: 200% 0;
  }
}

/* ── Empty state ──────────────────────────────────────────────────────────── */
.photos-empty {
  text-align: center;
  padding: 5rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Gallery entry animation ──────────────────────────────────────────────── */
.photo-card {
  animation: photoFadeIn 0.4s ease both;
}

@keyframes photoFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Stagger delay for natural feel */
.photo-card:nth-child(1) {
  animation-delay: 0s;
}
.photo-card:nth-child(2) {
  animation-delay: 0.05s;
}
.photo-card:nth-child(3) {
  animation-delay: 0.1s;
}
.photo-card:nth-child(4) {
  animation-delay: 0.15s;
}
.photo-card:nth-child(5) {
  animation-delay: 0.2s;
}
.photo-card:nth-child(6) {
  animation-delay: 0.25s;
}
.photo-card:nth-child(7) {
  animation-delay: 0.3s;
}
.photo-card:nth-child(8) {
  animation-delay: 0.35s;
}
.photo-card:nth-child(n + 9) {
  animation-delay: 0.38s;
}

/* ── Lightbox ─────────────────────────────────────────────────────────────── */
.photos-lightbox {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photos-lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 4, 10, 0.96);
  cursor: pointer;
}

.photos-lightbox-inner {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(92vw, 1080px);
  width: 100%;
  gap: 1rem;
}

.photos-lightbox-img-wrap {
  position: relative;
  width: 100%;
  max-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photos-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
  transition: opacity 0.25s ease;
}

.photos-lightbox-img.is-loading {
  opacity: 0;
}

.photos-lightbox-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.photos-lightbox-loader::after {
  content: "";
  width: 32px;
  height: 32px;
  border: 2.5px solid rgba(255, 255, 255, 0.12);
  border-top-color: rgba(56, 189, 248, 0.8);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  opacity: 0;
  transition: opacity 0.2s;
}

.photos-lightbox-img.is-loading ~ .photos-lightbox-loader::after {
  opacity: 1;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.photos-lightbox-info {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0 0.5rem;
}

.photos-lightbox-header-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
}

.photos-lightbox-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.3;
}

.photos-lightbox-counter {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.4);
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.photos-lightbox-location {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.55);
  font-family: "JetBrains Mono", monospace;
}

.photos-lightbox-caption {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.75);
  line-height: 1.6;
  font-style: italic;
  margin-top: 0.2rem;
}

/* Close button */
.photos-lightbox-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.7);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    color 0.2s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.photos-lightbox-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

/* Prev/Next navigation */
.photos-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.7);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s,
    color 0.2s,
    opacity 0.2s;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.photos-lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.photos-lightbox-nav:disabled {
  opacity: 0.2;
  cursor: default;
}

.photos-lightbox-prev {
  left: 1.25rem;
}
.photos-lightbox-next {
  right: 1.25rem;
}

/* Lightbox open animation */
.photos-lightbox[data-open] .photos-lightbox-inner {
  animation: lightboxIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes lightboxIn {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ── Video cards in the grid ──────────────────────────────────────────────── */
.photo-card.is-video-blank {
  background:
    radial-gradient(
      circle at 50% 45%,
      rgba(56, 189, 248, 0.14),
      transparent 60%
    ),
    var(--bg-secondary, #0f172a);
}
.photo-card-play {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  pointer-events: none;
}
.photo-card-play svg {
  width: 58px;
  height: 58px;
  padding: 14px;
  border-radius: 50%;
  background: rgba(2, 4, 10, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}
.photo-card.is-video:hover .photo-card-play svg {
  transform: scale(1.08);
  background: rgba(56, 189, 248, 0.32);
}

/* ── Lightbox video + zoom ────────────────────────────────────────────────── */
.photos-lightbox-media {
  width: min(92vw, 1080px);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
}
.photos-lightbox-media[hidden] {
  display: none;
}
.photos-lightbox-media iframe,
.photos-lightbox-media video {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.photos-lightbox-img {
  cursor: zoom-in;
}
.photos-lightbox-img.is-zoomed {
  transform: scale(1.9);
  cursor: zoom-out;
  max-height: none;
}

[inert] {
  pointer-events: none;
  user-select: none;
}

/* Fade affordance on the scrollable album tab strip */
.photos-filter-bar .container {
  position: relative;
}
.photos-filter-tabs {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  mask-image: linear-gradient(
    to right,
    transparent 0,
    #000 20px,
    #000 calc(100% - 24px),
    transparent 100%
  );
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .photos-gallery {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 220px;
  }

  .photo-card.is-featured {
    grid-column: span 2;
    grid-row: span 1;
  }
}

@media (max-width: 600px) {
  .photos-gallery {
    grid-template-columns: 1fr;
    grid-auto-rows: 240px;
    gap: 0.75rem;
  }

  .photo-card.is-featured {
    grid-column: span 1;
    grid-row: span 1;
  }

  .photos-lightbox-prev {
    left: 0.5rem;
  }
  .photos-lightbox-next {
    right: 0.5rem;
  }

  .photos-lightbox-nav {
    width: 40px;
    height: 40px;
  }

  .photo-card-overlay {
    opacity: 1;
    transform: none;
  }
}
