/* ─────────────────────────────────────────
   Reset & Base
───────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --font: 'DM Sans', system-ui, sans-serif;
  --black: #0a0a0a;
  --white: #ffffff;
  --mid: #888;
  --gap: 8px;
  --cols: 4;
}

html { font-size: 16px; -webkit-font-smoothing: antialiased; }

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--black);
  min-height: 100dvh;
}

/* ─────────────────────────────────────────
   Navigation
───────────────────────────────────────── */
nav {
  display: flex;
  align-items: baseline;
  gap: 28px;
  padding: 22px 40px;
}

.logo { font-size: 1.4rem; font-weight: 900; letter-spacing: -0.03em; }

.year-nav { display: flex; gap: 20px; }

.year-nav a {
  text-decoration: none;
  color: var(--black);
  font-size: 1rem;
  font-weight: 500;
  opacity: 0.35;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
  transition: opacity 0.2s, border-color 0.2s;
}

.year-nav a:hover  { opacity: 0.65; }
.year-nav a.active { opacity: 1; border-bottom-color: var(--black); }

/* ─────────────────────────────────────────
   Header
───────────────────────────────────────── */
header {
  max-width: 820px;
  margin: 0 auto;
  padding: 52px 24px 72px;
  text-align: center;
}

.message {
  font-size: clamp(1.75rem, 4.5vw, 3.2rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin-bottom: 28px;
}

.signature {
  font-size: clamp(1.3rem, 3vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ─────────────────────────────────────────
   Gallery — manual masonry columns
   Col 0 = rank 1,5,9…  Col 1 = rank 2,6,10…
   Top of every col = its highest-ranked photo
───────────────────────────────────────── */
.gallery {
  display: flex;
  align-items: flex-start;
  gap: var(--gap);
  padding: 0 var(--gap) 80px;
  /* overflow visible so FLIP animations can cross column boundaries */
  overflow: visible;
}

.gallery-message {
  flex: 1;
  text-align: center;
  color: var(--mid);
  font-size: 0.9rem;
  padding: 80px 24px;
}

.gallery-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  overflow: visible; /* let FLIP items escape during animation */
  min-width: 0;
}

/* ─────────────────────────────────────────
   Photo card
───────────────────────────────────────── */
.gallery-item {
  position: relative;
  overflow: hidden;
  background: #f0f0f0;
  border-radius: 2px;
  cursor: pointer;
  touch-action: manipulation;  
  /* Kill ALL browser selection/highlight behavior */
  -webkit-tap-highlight-color: rgba(0,0,0,0);
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  -webkit-user-drag: none;
  draggable: false;
}

.gallery-item img.loaded { opacity: 1; }

/* Hover lift — desktop only */
@media (hover: hover) {
  .gallery-item {
    transition: box-shadow 0.2s ease;
  }
  .gallery-item:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  }
}

/* Click pop */
@keyframes card-pop {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.95); }
  70%  { transform: scale(1.03); }
  100% { transform: scale(1); }
}

.gallery-item.popping {
  animation: card-pop 0.3s cubic-bezier(0.36, 0.07, 0.19, 0.97);
  /* pop must sit above neighbours during animation */
  z-index: 5;
  position: relative;
}

/* ─────────────────────────────────────────
   Heart badge
───────────────────────────────────────── */
.heart-badge {
  position: absolute;
  bottom: 7px;
  right: 7px;
  display: flex;
  align-items: center;
  gap: 3px;
  background: rgba(0,0,0,0.38);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 20px;
  padding: 4px 7px 4px 5px;
  color: #fff;
  font-family: var(--font);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.heart-badge.visible {
  opacity: 1;
  transform: scale(1);
}

.heart-badge-icon { font-size: 0.75rem; color: #ff4d6d; }

/* ─────────────────────────────────────────
   Responsive
───────────────────────────────────────── */
@media (max-width: 640px) {
  nav { padding: 16px 20px; gap: 16px; flex-wrap: wrap; }
  .year-nav { gap: 14px; }
  .year-nav a { font-size: 0.9rem; }
  header { padding: 36px 20px 52px; }
  /* 2 columns on mobile */
  .gallery { --cols: 2; }
}

/* Remove loading text */
.gallery-loading { display: none; }

/* Photos start invisible and slightly below */
.gallery-item {
  opacity: 0;
  transform: translateY(16px);
}

/* Each photo fades+slides up when its image loads */
.gallery-item.loaded {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 1.2s ease, transform 1.2s ease;
}
