/* ==========================================================================
   Memory Wall & Gallery Styles
   ========================================================================== */

/* --- 1. Memory Wall Section (Homepage) --- */
.memory-wall-section {
  position: relative;
  padding: clamp(82px, 9vw, 140px) clamp(24px, 7vw, 108px);
  background: var(--navy);
  color: #fff;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.memory-wall__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 36px;
  margin-bottom: 54px;
}

.memory-wall__header-copy {
  max-width: 780px;
}

.memory-wall__header h2 {
  color: #fff;
  margin-top: 6px;
  margin-bottom: 16px;
}

.memory-wall__header p.lead-copy {
  color: #9cb2c8;
  font-size: clamp(15px, 1.15vw, 18px);
  line-height: 1.7;
}

.memory-wall__view-btn {
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.memory-wall__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

/* Individual Memory Card */
.memory-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
              border-color 0.3s ease,
              background-color 0.3s ease,
              box-shadow 0.35s ease;
}

.memory-card:hover,
.memory-card:focus-within {
  transform: translateY(-6px);
  border-color: rgba(8, 166, 160, 0.6);
  background: rgba(8, 166, 160, 0.06);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.35);
}

.memory-card__media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  background: #030e1d;
}

.memory-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 25%;
  display: block;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

.memory-card:hover .memory-card__img {
  transform: scale(1.06);
}

.memory-card__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  padding: 5px 11px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--yellow);
  background: rgba(6, 23, 45, 0.88);
  border: 1px solid rgba(244, 199, 53, 0.4);
  backdrop-filter: blur(8px);
  border-radius: 2px;
}

.memory-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 23, 45, 0.1) 0%, rgba(6, 23, 45, 0.75) 100%);
  opacity: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
  z-index: 1;
}

.memory-card:hover .memory-card__overlay {
  opacity: 1;
}

.memory-card__zoom-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 11px;
  font-weight: 800;
  color: var(--navy);
  background: var(--yellow);
  border-radius: 50px;
  transform: translateY(10px);
  transition: transform 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.memory-card:hover .memory-card__zoom-pill {
  transform: translateY(0);
}

.memory-card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 24px;
}

.memory-card__title {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
  letter-spacing: -0.015em;
  transition: color 0.2s ease;
}

.memory-card:hover .memory-card__title {
  color: var(--yellow);
}

.memory-card__desc {
  color: #9cb2c8;
  font-size: 13px;
  line-height: 1.65;
  margin-bottom: 20px;
  flex: 1;
}

.memory-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 11px;
}

.memory-card__location {
  color: #7d96ac;
  display: flex;
  align-items: center;
  gap: 5px;
}

.memory-card__action {
  color: var(--teal);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.memory-card:hover .memory-card__action {
  color: var(--yellow);
}

/* Bottom CTA Strip */
.memory-cta-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  margin-top: 48px;
  padding: 34px 40px;
  background: linear-gradient(135deg, rgba(8, 166, 160, 0.16) 0%, rgba(6, 23, 45, 0.8) 100%);
  border: 1px solid rgba(8, 166, 160, 0.35);
  border-radius: 4px;
}

.memory-cta-strip__content h3 {
  font-size: 22px;
  color: #fff;
  margin-bottom: 6px;
}

.memory-cta-strip__content p {
  color: #bed0df;
  font-size: 14px;
  line-height: 1.6;
}

.memory-cta-strip__actions {
  flex-shrink: 0;
  display: flex;
  gap: 14px;
}

/* Responsive adjustments for Memory Wall */
@media (max-width: 1080px) {
  .memory-wall__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .memory-wall__header {
    flex-direction: column;
    align-items: flex-start;
  }
  .memory-wall__grid {
    grid-template-columns: 1fr;
  }
  .memory-cta-strip {
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
  }
}

/* Final mobile guard: the homepage archive must never collapse to legacy
   three-column cards on a phone. */
@media (max-width: 760px) {
  #memories.memory-wall-section > .memory-wall__grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100%;
  }
  #memories .memory-card.memory-card--polaroid {
    width: auto;
    min-width: 0;
    max-width: none;
  }
}


/* --- 2. Full Gallery Page (`gallery.html`) --- */
.gallery-page-wrap {
  min-height: calc(100vh - 78px);
  background: var(--navy);
  color: #fff;
  padding-bottom: 90px;
}

.gallery-hero {
  position: relative;
  padding: clamp(60px, 8vw, 100px) clamp(24px, 7vw, 108px) 40px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.gallery-breadcrumb {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 22px;
  transition: color 0.2s ease, transform 0.2s ease;
}

.gallery-breadcrumb:hover {
  color: var(--yellow);
  transform: translateX(-3px);
}

.gallery-hero__title {
  max-width: 860px;
  font-size: clamp(40px, 5vw, 68px);
  font-weight: 760;
  letter-spacing: -0.04em;
  line-height: 1.06;
  margin-bottom: 20px;
}

.gallery-hero__title em {
  font-style: normal;
  color: var(--yellow);
}

.gallery-hero__lead {
  max-width: 720px;
  color: #9cb2c8;
  font-size: clamp(16px, 1.25vw, 20px);
  line-height: 1.7;
  margin-bottom: 34px;
}

/* Category Filter Bar */
.gallery-controls {
  padding: 24px clamp(24px, 7vw, 108px) 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.gallery-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  color: #b9d7dc;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 40px;
  cursor: pointer;
  transition: all 0.22s ease;
}

.filter-btn:hover {
  background: rgba(8, 166, 160, 0.15);
  border-color: var(--teal);
  color: #fff;
}

.filter-btn.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  box-shadow: 0 4px 14px rgba(8, 166, 160, 0.35);
}

.filter-btn .filter-count {
  display: inline-block;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.25);
}

.gallery-count-note {
  color: #7d96ac;
  font-size: 12px;
  font-weight: 600;
}

/* Gallery archive navigation: intentionally vertical, like a compact index. */
.gallery-controls {
  align-items: flex-start;
  max-width: 1320px;
  margin-inline: auto;
}
.gallery-filter-nav {
  width: min(100%, 290px);
  padding: 1.15rem;
  border: 1px solid rgba(163, 204, 222, .16);
  background: linear-gradient(145deg, rgba(13, 44, 68, .44), rgba(4, 20, 39, .48));
  box-shadow: inset 0 1px rgba(255,255,255,.04), 0 14px 30px rgba(0,0,0,.12);
}
.gallery-filter-nav__label {
  margin: 0 0 .8rem;
  color: #82a4b9;
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.gallery-filters { display: grid; gap: .35rem; }
.filter-btn {
  position: relative;
  display: flex;
  width: 100%;
  justify-content: space-between;
  gap: .75rem;
  padding: .78rem .82rem .78rem 1rem;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: #b9d7dc;
  text-align: left;
}
.filter-btn::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 3px;
  height: 0;
  background: var(--yellow);
  transform: translateY(-50%);
  transition: height .25s cubic-bezier(.22,1,.36,1);
}
.filter-btn:hover { background: rgba(8,166,160,.1); border-color: rgba(8,166,160,.2); color: #fff; }
.filter-btn.is-active { background: rgba(8,166,160,.17); border-color: rgba(8,166,160,.4); box-shadow: none; color: #fff; }
.filter-btn.is-active::before { height: 64%; }
.filter-btn .filter-count { margin-left: auto; min-width: 1.65rem; padding: .18rem .38rem; border-radius: 999px; background: rgba(255,255,255,.08); color: #91bdc9; text-align: center; }
.filter-btn.is-active .filter-count { background: var(--teal); color: #fff; }
.gallery-count-note { margin-top: 2.4rem; }

@media (max-width: 760px) {
  .gallery-controls { display: block; padding: 1.25rem 1.25rem .75rem; }
  .gallery-filter-nav { width: 100%; padding: .9rem; }
  .gallery-filters { gap: .22rem; }
  .filter-btn { min-height: 43px; padding-block: .68rem; font-size: .73rem; }
  .gallery-count-note { margin: 1rem 0 0; padding-left: .2rem; }
}

/* Mobile gallery: horizontal category nav and a readable one-card feed. */
@media (max-width: 760px) {
  .gallery-filter-nav { width: calc(100% + 2.5rem); margin-inline: -1.25rem; padding: .85rem 1.25rem 1rem; border-right: 0; border-left: 0; }
  .gallery-filter-nav__label { margin-bottom: .65rem; }
  .gallery-filters { display: flex; flex-wrap: nowrap; gap: .55rem; overflow-x: auto; padding-bottom: .25rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .gallery-filters::-webkit-scrollbar { display: none; }
  .filter-btn { flex: 0 0 auto; width: auto; min-height: 38px; padding: .58rem .8rem; border: 1px solid rgba(163,204,222,.18); border-radius: 999px; font-size: .7rem; white-space: nowrap; }
  .filter-btn::before { display: none; }
  .filter-btn.is-active { border-color: var(--teal); background: var(--teal); }
  .filter-btn .filter-count { min-width: auto; padding: .12rem .32rem; }
  .filter-btn.is-active .filter-count { background: rgba(0,0,0,.18); }
  .gallery-container { padding: 1.35rem 1.25rem 2.5rem; }
  .gallery-grid { grid-template-columns: 1fr; gap: 1.25rem; }
  .gallery-grid .memory-card { min-height: 0; }
  .gallery-grid .memory-card__media { aspect-ratio: 16 / 10; }
  .gallery-grid .memory-card__body { padding: 1.1rem; }
  .gallery-grid .memory-card__title { font-size: 1.18rem; }
  .gallery-grid .memory-card__desc { margin-bottom: 1rem; font-size: .82rem; }
  .gallery-grid .memory-card__footer { padding-top: .8rem; }
}

/* Gallery Grid on Full Page */
.gallery-container {
  padding: 20px clamp(24px, 7vw, 108px) 40px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 28px;
}

.gallery-item {
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.gallery-item.is-hidden {
  display: none;
}


/* --- 3. Lightbox Modal --- */
.lightbox-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-modal.is-active {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 15, 31, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.lightbox-dialog {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1080px;
  max-height: 94vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}

.lightbox-btn:hover {
  background: var(--yellow);
  color: var(--navy);
  border-color: var(--yellow);
  transform: scale(1.08);
}

.lightbox-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 44px;
  height: 44px;
  z-index: 10;
}

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  z-index: 10;
}

.lightbox-prev {
  left: -26px;
}

.lightbox-next {
  right: -26px;
}

.lightbox-content {
  width: 100%;
  background: #06172d;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.6);
}

.lightbox-figure {
  margin: 0;
  display: flex;
  flex-direction: column;
}

.lightbox-image-wrap {
  position: relative;
  width: 100%;
  max-height: 64vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #020b16;
  overflow: hidden;
}

.lightbox-img {
  max-width: 100%;
  max-height: 64vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  transition: opacity 0.25s ease;
}

.lightbox-spinner {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: lb-spin 0.8s linear infinite;
}

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

.lightbox-caption {
  padding: 24px 30px;
  background: #06172d;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.lightbox-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 11px;
}

.lightbox-badge {
  color: var(--yellow);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lightbox-location {
  color: #7d96ac;
}

.lightbox-counter {
  margin-left: auto;
  color: #9cb2c8;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
  padding: 3px 10px;
  border-radius: 12px;
}

.lightbox-title {
  color: #fff;
  font-size: clamp(20px, 2.2vw, 26px);
  font-weight: 700;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.lightbox-desc {
  color: #bbcad6;
  font-size: 14px;
  line-height: 1.65;
  margin: 0;
}

/* Mobile adjustments for lightbox */
@media (max-width: 820px) {
  .lightbox-prev {
    left: 10px;
    top: auto;
    bottom: 20px;
    transform: none;
    width: 44px;
    height: 44px;
  }
  .lightbox-next {
    right: 10px;
    top: auto;
    bottom: 20px;
    transform: none;
    width: 44px;
    height: 44px;
  }
  .lightbox-close {
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
  }
  .lightbox-caption {
    padding: 18px 20px 60px;
  }
  .lightbox-image-wrap {
    max-height: 50vh;
  }
  .lightbox-img {
    max-height: 50vh;
  }
}

/* Homepage: impact archive, styled as a deliberate editorial collage rather
   than a generic memory wall. The full gallery page keeps its card layout. */
.memory-wall-section {
  overflow: hidden;
  background: #030d1a;
  isolation: isolate;
}
.memory-wall-section::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .42;
  background: radial-gradient(circle at 14% 16%, rgba(8,166,160,.18), transparent 25%), radial-gradient(circle at 88% 78%, rgba(244,199,53,.09), transparent 20%), linear-gradient(rgba(168,207,222,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(168,207,222,.045) 1px, transparent 1px);
  background-size: auto, auto, 54px 54px, 54px 54px;
}
.memory-wall__header { max-width: 1120px; margin-inline: auto; }
.memory-wall__header h2 { max-width: 720px; font-family: var(--font-display); font-size: clamp(38px,4.5vw,66px); font-weight: 760; letter-spacing: -.045em; line-height: 1.05; }
.memory-wall__grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: start;
  max-width: 970px;
  margin: 0 auto;
  gap: 1.1rem;
  padding: 1.5rem 1.8rem 2rem;
}
.memory-card.memory-card--polaroid {
  display: block;
  overflow: visible;
  min-width: 0;
  background: #efeee7;
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 0;
  padding: .6rem .6rem .8rem;
  color: #162635;
  box-shadow: 0 14px 27px rgba(0,0,0,.3);
  transform: rotate(var(--tilt, 0deg));
  transition: transform .42s cubic-bezier(.22,1,.36,1), box-shadow .42s ease;
}
.memory-card.memory-card--polaroid:nth-child(1) { --tilt: -4deg; margin-top: 1.8rem; }
.memory-card.memory-card--polaroid:nth-child(2) { --tilt: 3deg; margin-top: .3rem; }
.memory-card.memory-card--polaroid:nth-child(3) { --tilt: -2deg; margin-top: 2.2rem; }
.memory-card.memory-card--polaroid:nth-child(4) { --tilt: 3.5deg; margin-top: -.3rem; }
.memory-card.memory-card--polaroid:nth-child(5) { --tilt: -3deg; margin-top: 1.4rem; }
.memory-card.memory-card--polaroid:nth-child(6) { --tilt: 4deg; margin-top: -.7rem; }
.memory-card.memory-card--polaroid:hover, .memory-card.memory-card--polaroid:focus-visible { z-index: 2; border-color: #fff; background: #fffdf5; transform: rotate(0) translateY(-13px) scale(1.035); box-shadow: 0 28px 48px rgba(0,0,0,.47); outline: none; }
  .memory-card.memory-card--polaroid .memory-card__media { aspect-ratio: 1 / .88; background: #06172d; }
.memory-card.memory-card--polaroid .memory-card__img { object-position: center; }
.memory-card.memory-card--polaroid .memory-card__body { position: relative; display: block; padding: .8rem .3rem .15rem; }
.memory-card.memory-card--polaroid .memory-card__number { position: absolute; top: .86rem; right: .3rem; color: #86919a; font-family: var(--font-body); font-size: .65rem; letter-spacing: .12em; }
.memory-card.memory-card--polaroid .memory-card__badge { position: static; display: block; margin: 0 2.5rem .4rem 0; padding: 0; border: 0; border-radius: 0; background: transparent; color: var(--teal); font-size: .56rem; letter-spacing: .115em; backdrop-filter: none; }
.memory-card.memory-card--polaroid .memory-card__title { margin: 0 0 .45rem; color: #152638; font-family: var(--font-display); font-size: clamp(1rem,1.55vw,1.3rem); line-height: 1.08; }
.memory-card.memory-card--polaroid .memory-card__desc { margin: 0; color: #536575; font-size: .72rem; line-height: 1.5; }
.memory-cta-strip { max-width: 1120px; margin: 4rem auto 0; border-radius: 0; }
.memory-cta-strip .section-index { margin-bottom: .65rem; }

@media (max-width: 760px) {
  .memory-wall-section { padding-inline: 1.25rem; }
  .memory-wall__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; padding: 1.1rem .35rem 1rem; }
  .memory-card.memory-card--polaroid { padding: .42rem .42rem .58rem; }
  .memory-card.memory-card--polaroid .memory-card__media { aspect-ratio: 1 / .94; }
  .memory-card.memory-card--polaroid .memory-card__img { object-position: center 22%; }
  .memory-card.memory-card--polaroid:nth-child(1) { margin-top: .7rem; }
  .memory-card.memory-card--polaroid:nth-child(2) { margin-top: 0; }
  .memory-card.memory-card--polaroid:nth-child(3) { margin-top: 1rem; }
  .memory-card.memory-card--polaroid:nth-child(4) { margin-top: -.15rem; }
  .memory-card.memory-card--polaroid:nth-child(5) { margin-top: .5rem; }
  .memory-card.memory-card--polaroid:nth-child(6) { margin-top: -.25rem; }
  .memory-card.memory-card--polaroid .memory-card__body { padding: .55rem .15rem .05rem; }
  .memory-card.memory-card--polaroid .memory-card__title { font-size: .95rem; }
  .memory-card.memory-card--polaroid .memory-card__desc { display: none; }
  .memory-card.memory-card--polaroid .memory-card__badge { margin-bottom: .25rem; font-size: .48rem; }
  .memory-card.memory-card--polaroid .memory-card__number { top: .57rem; font-size: .52rem; }
  .memory-cta-strip { margin-top: 2.5rem; }
}

@media (max-width: 390px) {
  .memory-wall-section { padding-inline: 1rem; }
  .memory-wall__grid { gap: .65rem; padding-inline: 0; }
  .memory-card.memory-card--polaroid .memory-card__title { font-size: .84rem; }
  .memory-card.memory-card--polaroid .memory-card__badge { font-size: .43rem; letter-spacing: .08em; }
}

