:root {
  --bg-cream: #fef9f4;
  --bg-blush: #fff0ea;
  --ink: #5a3a4a;
  --ink-light: #8a6a7a;
  --pink: #ff8fb1;
  --red: #ff5c7c;
  --rose: #ffd6e3;
  --teal: #5ec5c5;
  --cream: #fff8f0;
  --glass: rgba(255, 255, 255, 0.65);
  --glass-strong: rgba(255, 255, 255, 0.82);
  --shadow: 0 12px 36px rgba(90, 58, 74, 0.12);
  --shadow-hover: 0 20px 48px rgba(90, 58, 74, 0.2);
  --polaroid: 0 2px 10px rgba(90, 58, 74, 0.1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { min-height: 100%; }

body {
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(900px 600px at 15% 10%, rgba(255, 209, 216, 0.5), transparent 60%),
    radial-gradient(800px 500px at 85% 20%, rgba(194, 234, 234, 0.4), transparent 55%),
    linear-gradient(160deg, var(--bg-cream), var(--bg-blush) 60%, #fde8e0);
  background-attachment: fixed;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* ============ NAV ============ */
.topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  isolation: isolate;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 28px;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.topnav-brand {
  font-family: 'Dancing Script', cursive;
  font-size: 1.25rem;
  font-weight: 700;
  text-decoration: none;
}
.topnav-tabs { display: flex; gap: 6px; }
.topnav-tab {
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  color: rgba(255, 248, 240, 0.7);
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.25s;
}
.topnav-tab:hover { color: var(--cream); border-color: rgba(255, 255, 255, 0.2); }
.topnav-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--pink));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(255, 92, 124, 0.35);
}

/* Light variant for album/admin pages */
.topnav-light {
  background: rgba(254, 249, 244, 0.82);
  border-bottom-color: rgba(90, 58, 74, 0.1);
}
.topnav-light .topnav-brand { color: var(--ink); }
.topnav-light .topnav-tab { color: var(--ink-light); border-color: transparent; }
.topnav-light .topnav-tab:hover { color: var(--ink); border-color: rgba(90, 58, 74, 0.15); }
.topnav-light .topnav-tab.active {
  color: #fff;
  background: linear-gradient(135deg, var(--red), var(--pink));
  border-color: transparent;
  box-shadow: 0 4px 14px rgba(255, 92, 124, 0.35);
}
.topnav-light .topnav-tab.tab-admin {
  background: rgba(90, 58, 74, 0.08);
  border: 1px solid rgba(90, 58, 74, 0.15);
}
.topnav-light .topnav-tab.tab-admin:hover { background: rgba(90, 58, 74, 0.14); }

/* ============ HEARTS ============ */
.hearts-container { position: fixed; inset: 0; pointer-events: none; z-index: 1; overflow: hidden; }
.floating-heart {
  position: absolute; bottom: -40px; opacity: 0;
  animation: floatUp linear infinite;
}
@keyframes floatUp {
  0% { transform: translateY(0) rotate(0deg) scale(0.8); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.5; }
  100% { transform: translateY(-110vh) rotate(35deg) scale(1.1); opacity: 0; }
}

/* ============ HEADER ============ */
header {
  position: relative; z-index: 2;
  text-align: center; padding: 90px 22px 14px;
}
header h1 {
  font-family: 'Dancing Script', cursive;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  color: var(--ink);
  text-shadow: 0 2px 14px rgba(255, 143, 177, 0.25);
}
.subtitle { font-weight: 300; color: var(--ink-light); margin: 6px 0 0; }
.heart-pulse { display: inline-block; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.25); } }

/* ============ MASONRY ============ */
main { position: relative; z-index: 2; max-width: 1100px; margin: 0 auto; padding: 30px 22px 60px; }
.masonry {
  column-count: 4;
  column-gap: 18px;
}
.masonry-loading, .empty {
  text-align: center; padding: 50px 0;
  color: var(--ink-light); font-weight: 300;
}
.a-card {
  break-inside: avoid;
  margin-bottom: 18px;
  background: var(--glass-strong);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--polaroid);
  cursor: pointer;
  transition: transform 0.25s, box-shadow 0.25s;
  opacity: 0;
  transform: translateY(14px);
  animation: cardIn 0.5s ease forwards;
}
@keyframes cardIn { to { opacity: 1; transform: translateY(0); } }
.a-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.a-photo { position: relative; width: 100%; overflow: hidden; }
.a-photo img { width: 100%; display: block; transition: transform 0.4s; }
.a-card:hover .a-photo img { transform: scale(1.04); }

.a-caption {
  padding: 10px 12px 12px;
  text-align: center;
}
.a-caption-title {
  font-family: 'Dancing Script', cursive;
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.35;
}
.a-caption-date {
  font-size: 0.72rem;
  color: var(--ink-light);
  margin-top: 2px;
}

/* ============ LIGHTBOX ============ */
.lightbox { position: fixed; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; padding: 24px; }
.lightbox.open { display: flex; }
.lightbox-backdrop { position: absolute; inset: 0; background: rgba(90, 58, 74, 0.55); backdrop-filter: blur(10px); }
.lightbox-content {
  position: relative; z-index: 2; max-width: 900px; width: 100%;
  border-radius: 14px; overflow: hidden;
  background: #fff; box-shadow: 0 24px 60px rgba(90, 58, 74, 0.3);
  animation: popIn 0.35s cubic-bezier(0.22,1,0.36,1);
  max-height: 90vh; display: flex; flex-direction: column;
}
@keyframes popIn { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.lightbox-content img { width: 100%; max-height: 70vh; object-fit: contain; background: #fafafa; }
.lightbox-details { padding: 16px 22px 20px; }
.lightbox-date { font-size: 0.78rem; color: var(--ink-light); margin-bottom: 4px; }
.lightbox-caption { font-family: 'Dancing Script', cursive; font-size: 1.15rem; color: var(--ink); line-height: 1.6; }

.modal-close {
  position: absolute; top: 12px; right: 12px; z-index: 3;
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: rgba(0,0,0,0.25); color: #fff; font-size: 1rem; cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.modal-close:hover { background: var(--red); transform: rotate(90deg); }

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) { .masonry { column-count: 3; } }
@media (max-width: 640px) {
  .masonry { column-count: 2; column-gap: 12px; }
  .a-card { margin-bottom: 12px; }
  header { padding: 80px 16px 10px; }
}
@media (max-width: 380px) {
  .masonry { column-count: 1; }
}
