/* ==========================================================================
   Valentin Leconte (val74k) — Photographie Gallery & Lightbox Styles
   Integrated with val74k dark editorial identity.
   ========================================================================== */

@font-face {
  font-family: 'Bodoni Moda';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('assets/portfolio/dist/fonts/bodoni-moda-italic.ttf') format('truetype');
}

@font-face {
  font-family: 'Bodoni Moda';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('assets/portfolio/dist/fonts/bodoni-moda-regular.ttf') format('truetype');
}

:root {
  --serif: "Bodoni Moda", "Bodoni MT", "Didot", "Times New Roman", serif;
  --gallery-bg: #141513;
  --gallery-surface: #1b1c19;
  --gallery-surface-elevated: #232520;
  --gallery-text: #e9e8e1;
  --gallery-muted: #abaea4;
  --gallery-dim: #777c72;
  --gallery-line: #3b3e36;
  --gallery-accent: #bdc9ad;
  --gallery-accent-warm: #c8d4b2;
  --gallery-night: #0c0d0b;
  --gallery-ease: cubic-bezier(.22, 1, .36, 1);
}

/* --------------------------------------------------------------------------
   Collection Section & Sticky Filter Bar
   -------------------------------------------------------------------------- */
.collection {
  position: relative;
  margin-top: 20px;
}

.collection-bar {
  min-height: 64px;
  display: flex;
  justify-content: flex-start;
  gap: 24px;
  align-items: center;
  margin: 0 calc(-1 * var(--gutter)) 32px;
  padding: 0 var(--gutter);
  position: sticky;
  top: var(--header-h, 94px);
  z-index: 35;
  background: rgba(20, 21, 19, 0.88);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--gallery-line);
  transition: background .3s ease, border-color .3s ease;
}

.filters {
  display: flex;
  align-items: center;
  gap: 22px;
  min-width: 0;
  max-width: 78%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 2px;
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  padding: 12px 0;
  font-size: .88rem;
  font-weight: 500;
  white-space: nowrap;
  color: var(--gallery-muted);
  cursor: pointer;
  transition: color .2s var(--gallery-ease);
}

.filter::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  height: 1.5px;
  background: linear-gradient(90deg, var(--gallery-accent), var(--gallery-accent-warm));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .35s var(--gallery-ease);
}

.filter:hover {
  color: var(--gallery-text);
}

.filter.is-active {
  color: var(--gallery-text);
}

.filter.is-active::after,
.filter:hover::after {
  transform: scaleX(1);
}

.filter sup {
  align-self: flex-start;
  font-size: .68rem;
  color: var(--gallery-dim);
  margin-top: -2px;
  font-variant-numeric: tabular-nums;
  transition: color .2s var(--gallery-ease);
}

.filter.is-active sup {
  color: var(--gallery-accent);
  font-weight: 600;
}

.photo-count {
  text-align: right;
  font-size: .78rem;
  color: var(--gallery-dim);
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  white-space: nowrap;
  letter-spacing: .02em;
}

/* --------------------------------------------------------------------------
   Editorial Gallery Grid
   -------------------------------------------------------------------------- */
.gallery {
  transition: opacity .25s ease;
}

.gallery.is-changing {
  opacity: 0;
}

.editorial-pair {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0 clamp(16px, 2.5vw, 36px);
  align-items: start;
  margin-bottom: clamp(65px, 8.5vw, 140px);
}

.photo-card {
  margin: 0;
  min-width: 0;
  position: relative;
  opacity: 1;
}

/* Staggered editorial columns */
.editorial-pair .photo-card:first-child {
  grid-column: 1 / span 7;
}

.editorial-pair .photo-card:nth-child(2) {
  grid-column: 9 / span 4;
  margin-top: 140px;
}

.editorial-pair:nth-child(2n) .photo-card:first-child {
  grid-column: 2 / span 4;
  margin-top: 35px;
}

.editorial-pair:nth-child(2n) .photo-card:nth-child(2) {
  grid-column: 7 / span 6;
  margin-top: 0;
}

.editorial-pair:nth-child(3n) .photo-card:first-child {
  grid-column: 1 / span 6;
}

.editorial-pair:nth-child(3n) .photo-card:nth-child(2) {
  grid-column: 8 / span 5;
  margin-top: 100px;
}

.editorial-pair.is-solo .photo-card:first-child {
  grid-column: 3 / span 8;
  margin-top: 0;
}

@media (min-width: 761px) {
  .editorial-pair[data-layout="portrait-landscape"] .photo-card:first-child,
  .editorial-pair[data-layout="portrait-square"] .photo-card:first-child,
  .editorial-pair[data-layout="portrait-portrait"] .photo-card:first-child {
    grid-column: 2 / span 4;
    margin-top: 0;
  }
  .editorial-pair[data-layout="portrait-landscape"] .photo-card:nth-child(2),
  .editorial-pair[data-layout="portrait-square"] .photo-card:nth-child(2) {
    grid-column: 7 / span 6;
    margin-top: 90px;
  }
  .editorial-pair[data-layout="portrait-portrait"] .photo-card:nth-child(2) {
    grid-column: 8 / span 4;
    margin-top: 110px;
  }
  .editorial-pair.is-solo .photo-card[data-orientation="portrait"] {
    grid-column: 5 / span 4;
  }
}

/* Photo Card & Hover Effect */
.photo-button {
  width: 100%;
  display: block;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0;
  overflow: hidden;
  background: var(--gallery-surface);
  border-radius: 4px;
  text-align: left;
  transition: transform .6s var(--gallery-ease), border-color .3s ease, box-shadow .6s var(--gallery-ease);
  -webkit-user-select: none;
  user-select: none;
  cursor: pointer;
}

.photo-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(12, 13, 11, 0.65) 100%);
  opacity: 0;
  transition: opacity .45s ease;
  z-index: 1;
  pointer-events: none;
}

.photo-button:hover,
.photo-button:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(189, 201, 173, 0.3);
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.5);
}

.photo-button:hover::after,
.photo-button:focus-visible::after {
  opacity: 1;
}

.photo-image {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
  transition: transform .8s var(--gallery-ease);
}

.photo-button:hover .photo-image,
.photo-button:focus-visible .photo-image {
  transform: scale(1.02);
}

.photo-view {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--gallery-text);
  background: rgba(20, 21, 19, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  opacity: 0;
  transform: scale(.8);
  transition: opacity .3s ease, transform .45s var(--gallery-ease), background .2s ease;
  z-index: 2;
}

.photo-view svg {
  width: 18px;
  height: 18px;
}

.photo-button:hover .photo-view,
.photo-button:focus-visible .photo-view {
  opacity: 1;
  transform: scale(1);
}

.photo-button:hover .photo-view:hover {
  background: var(--gallery-accent);
  color: var(--gallery-night);
}

.photo-caption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
}

.photo-category {
  display: block;
  font-size: .78rem;
  color: var(--gallery-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-weight: 500;
}

.photo-number {
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
  color: var(--gallery-dim);
}

.photo-badge-series {
  font-size: .7rem;
  color: var(--gallery-accent);
  margin-left: 8px;
  letter-spacing: .02em;
}

.photo-load-error {
  min-height: 220px;
  display: grid;
  place-items: center;
  color: var(--gallery-dim);
  font-size: .88rem;
  padding: 30px;
  text-align: center;
}

.gallery-state {
  padding: 80px 20px 120px;
  text-align: center;
  color: var(--gallery-muted);
  font-size: .95rem;
}

.loading-line {
  display: block;
  width: 48px;
  height: 1.5px;
  margin: 0 auto 20px;
  background: linear-gradient(90deg, var(--gallery-accent), var(--gallery-accent-warm));
  animation: gallery-loading 1.4s ease-in-out infinite;
}

@keyframes gallery-loading {
  0%, 100% { transform: scaleX(.2); opacity: .2; }
  50% { transform: scaleX(1); opacity: 1; }
}

.editorial-pair:last-child {
  margin-bottom: clamp(32px, 4vw, 56px);
}

.collection-end {
  text-align: center;
  margin: 10px 0 45px;
}

.collection-end a {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  font-size: .82rem;
  color: var(--gallery-muted);
  padding: 10px 22px;
  border: 1px solid var(--gallery-line);
  border-radius: 999px;
  transition: color .2s, border-color .2s, transform .2s;
}

.collection-end a:hover {
  color: var(--gallery-text);
  border-color: var(--gallery-accent);
  transform: translateY(-2px);
}

/* --------------------------------------------------------------------------
   Scroll Reveals & Parallax
   -------------------------------------------------------------------------- */
.motion-ready [data-reveal] {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 1.1s var(--gallery-ease), transform 1.25s var(--gallery-ease);
  transition-delay: var(--reveal-delay, 0ms);
}

.motion-ready [data-reveal].is-revealed {
  opacity: 1;
  transform: none;
}

/* --------------------------------------------------------------------------
   Fullscreen Lightbox Dialog
   -------------------------------------------------------------------------- */
.lightbox {
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  height: 100dvh;
  max-height: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--gallery-text);
  background: var(--gallery-night);
  overflow: hidden;
  color-scheme: dark;
  opacity: 0;
  transition: opacity .3s ease;
  overscroll-behavior: contain;
  outline: none;
  z-index: 1000;
}

.lightbox[open] {
  display: flex;
  flex-direction: column;
}

.lightbox.is-visible {
  opacity: 1;
}

.lightbox::backdrop {
  background: rgba(10, 11, 9, 0.98);
}

.lightbox-top {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 10px var(--gutter);
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.lightbox-wordmark {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -.05em;
  color: var(--gallery-text);
  display: inline-flex;
  align-items: center;
}

.lightbox-wordmark .brand-dot {
  width: 5px;
  height: 5px;
  background: var(--gallery-accent);
  margin: 4px 0 0 5px;
  border-radius: 50%;
}

.lightbox-counter {
  text-align: center;
  font-size: .82rem;
  letter-spacing: .1em;
  font-variant-numeric: tabular-nums;
  color: var(--gallery-muted);
}

.lightbox-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 22px;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--gallery-muted);
}

.zoom-control svg {
  width: 18px;
  height: 18px;
}

#lightbox-zoom-slider {
  width: 86px;
  cursor: pointer;
  accent-color: var(--gallery-accent);
  background: var(--gallery-line);
  height: 4px;
  border-radius: 2px;
}

.icon-button {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 0;
  color: var(--gallery-text);
  background: transparent;
  padding: 8px 0;
  font-size: .85rem;
  cursor: pointer;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  transition: transform .3s ease;
}

#lightbox-close:hover svg {
  transform: rotate(90deg);
  color: var(--gallery-accent);
}

.lightbox-layout {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  justify-content: center;
  flex: 1;
  min-height: 0;
  padding: 10px var(--gutter);
  gap: 36px;
}

.lightbox-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  min-height: 0;
  padding: 0;
  touch-action: none;
  overflow: hidden;
  user-select: none;
}

.lightbox-image-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
  min-width: 0;
  transition: opacity .25s ease, transform .5s var(--gallery-ease);
}

.lightbox-image-wrap.is-switching {
  opacity: 0;
  transform: translateY(16px);
}

.lightbox-image-wrap.is-loading {
  opacity: .25;
}

#lightbox-image {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  -webkit-user-select: none;
  user-select: none;
  transform-origin: center center;
}

/* Custom left/right navigation arrows */
.cursor-prev {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M20 6l-10 10 10 10' fill='none' stroke='%23e9e8e1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 16 16, w-resize !important;
}

.cursor-next {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M12 6l10 10-10 10' fill='none' stroke='%23e9e8e1' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 16 16, e-resize !important;
}

.lightbox-info {
  width: 260px;
  text-align: right;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.lightbox-info h2 {
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -.02em;
  color: var(--gallery-text);
  margin-bottom: 16px;
}

.info-rule {
  display: block;
  width: 32px;
  height: 1px;
  background: var(--gallery-line);
  margin: 0 0 16px auto;
}

.metadata {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 9px;
  margin: 0;
}

.metadata-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  justify-content: flex-end;
}

.metadata dt {
  color: var(--gallery-dim);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin: 0;
}

.metadata dd {
  margin: 0;
  font-size: .8rem;
  color: var(--gallery-muted);
  font-variant-numeric: tabular-nums;
}

.lightbox-credit {
  display: none;
}

.lightbox-image-error {
  padding: 40px;
  font-size: .88rem;
  color: var(--gallery-dim);
  text-align: center;
}

.lightbox-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px var(--gutter) 14px;
  gap: 20px;
  color: var(--gallery-dim);
  font-size: .75rem;
  min-height: 32px;
  flex-shrink: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.lightbox-bottom p span {
  margin: 0 12px;
  color: rgba(255, 255, 255, 0.15);
}

.lightbox-bottom > span {
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gallery-accent);
}

.touch-hint {
  display: none;
}

/* --------------------------------------------------------------------------
   Responsive Layouts
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .photo-count {
    display: none;
  }
  .collection-bar {
    gap: 18px;
  }
  .editorial-pair {
    column-gap: 20px;
  }
  .editorial-pair .photo-card:nth-child(2) {
    margin-top: 80px;
  }
}

@media (max-width: 760px) {
  .collection-bar {
    top: 60px;
    padding: 0 var(--gutter);
    min-height: 52px;
    margin: 0 calc(-1 * var(--gutter)) 20px;
  }
  
  .filters {
    gap: 18px;
    width: 100%;
    max-width: none;
  }
  
  .filter {
    font-size: .82rem;
    padding: 10px 0;
  }
  
  .editorial-pair {
    display: flex;
    flex-direction: column;
    margin-bottom: 50px;
    gap: 50px;
  }
  
  .editorial-pair .photo-card {
    width: 100% !important;
    margin: 0 !important;
  }
  
  .photo-view {
    opacity: 1;
    transform: none;
    width: 40px;
    height: 40px;
    right: 12px;
    bottom: 12px;
  }
  
  .lightbox-top {
    min-height: 50px;
    padding: max(10px, env(safe-area-inset-top)) 16px 10px;
    grid-template-columns: 1fr auto auto;
    gap: 12px;
  }
  
  .lightbox-wordmark {
    font-size: 1rem;
  }
  
  .lightbox-counter {
    font-size: .78rem;
  }
  
  .close-label {
    display: none;
  }
  
  .lightbox-layout {
    padding: 0 12px 10px;
    gap: 14px;
    flex: 1;
    flex-direction: column;
  }
  
  .lightbox-stage {
    height: auto;
    min-height: 0;
    flex: 1;
  }
  
  .lightbox-info {
    padding: 6px 4px;
    width: 100%;
    text-align: center;
  }
  
  .lightbox-info h2,
  .info-rule {
    display: none;
  }
  
  .metadata {
    gap: 6px 14px;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
  }
  
  .metadata-row {
    justify-content: center;
  }
  
  .metadata dd {
    font-size: .74rem;
  }
  
  .lightbox-bottom {
    padding: 8px 16px max(14px, env(safe-area-inset-bottom));
  }
  
  #lightbox-help {
    display: none;
  }
  
  .touch-hint {
    display: block;
    color: var(--gallery-dim);
  }
}

@media (prefers-reduced-motion: reduce) {
  .motion-ready [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  .photo-button,
  .photo-image,
  .photo-view,
  .filter::after {
    transition: none !important;
  }
}
