/* =============================================
   PASTE — Poster Archive
   Diary / Collage aesthetic
   ============================================= */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* NEW */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400..900;1,400..900&family=Caveat:wght@400;500;600&family=Lato:ital,wght@0,300;0,400;1,300&display=swap');
:root {
  --bg-base:        #fdf6ee;
  --bg-surface:     #fef9f4;
  --bg-card:        #fffdf9;
  --bg-modal:       #fef8f0;

  --border:         #e8d8c8;
  --border-hover:   #c9a98a;
  --border-accent:  #c87d5a;

  --text-primary:   #3a2a1e;
  --text-secondary: #7a5c48;
  --text-muted:     #b8997e;
  --text-accent:    #c87d5a;

  --accent:         #d4846a;
  --accent-light:   #f5c8b8;
  --accent-subtle:  #faeae4;

  --chip-active-bg: #d4846a;
  --chip-active-txt:#fff8f5;

  --red:            #c85a5a;
  --green:          #7aab78;

--font-display: 'Playfair Display', serif;
--font-body:    'Playfair Display', serif;  /* was 'Lato' */
  --font-hand:   'Playfair Display', serif;

  --radius-sm:      6px;
  --radius-md:      12px;
  --radius-lg:      18px;
  --radius-xl:      24px;

  --header-h:       70px;
  --filter-h:       54px;
  --transition:     180ms ease;

  --tape-1: rgba(255, 220, 180, 0.78);
  --tape-2: rgba(190, 225, 205, 0.78);
  --tape-3: rgba(210, 200, 240, 0.78);
  --tape-4: rgba(250, 210, 200, 0.78);
}

html { scroll-behavior: smooth; }

/* ============ BACKGROUND IMAGE ============ */
body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  position: relative;
}

/* The background.png — kept subtle at 18% opacity so it doesn't fight the gallery */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: url('background.png');
  background-size: cover;
  background-position: center;
  background-repeat: repeat;
  background-attachment: fixed;
  opacity: 0.20;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f5ebe0; }
::-webkit-scrollbar-thumb { background: #d4b89a; border-radius: 3px; }

/* ============ HEADER ============ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgba(253, 246, 238, 0.9);
  border-bottom: 1.5px solid var(--border);
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1600px;
  margin: 0 auto;
  height: 100%;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: baseline;
  cursor: default;
  user-select: none;
}

.logo-mark {
  font-family: var(--font-hand);
  font-size: 2.7rem;
  color: var(--accent);
  line-height: 1;
  font-weight: 600;
}

.logo-text {
  font-family: var(--font-hand);
  font-size: 2.7rem;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: 1px;
  font-weight: 600;
}

.logo-tagline {
  font-family: var(--font-hand);
  font-size: 1rem;
  color: var(--text-muted);
  margin-left: 12px;
  align-self: center;
  font-style: italic;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.post-count {
  font-family: var(--font-hand);
  font-size: 1rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ============ BUTTONS ============ */
.btn-upload {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 1.3rem;
  height: 40px;
  background: var(--accent);
  color: #fff8f5;
  border: none;
  border-radius: 100px;
  font-family: var(--font-hand);
  font-size: 1.05rem;
  cursor: pointer;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 2px 3px 0px rgba(180, 90, 60, 0.3);
}

.btn-upload:hover {
  background: #c06850;
  box-shadow: 3px 4px 0px rgba(180, 90, 60, 0.35);
}
.btn-upload:active { transform: scale(0.97); }

.btn-icon { font-size: 1.2rem; font-weight: 400; line-height: 1; }

/* ============ FILTER BAR ============ */
.filter-bar {
  position: sticky;
  top: var(--header-h);
  z-index: 90;
  background: rgba(253, 246, 238, 0.9);
  border-bottom: 1.5px solid var(--border);
  height: var(--filter-h);
  backdrop-filter: blur(8px);
}

.filter-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}

.filter-inner::-webkit-scrollbar { display: none; }

.filter-chip {
  flex-shrink: 0;
  padding: 4px 16px;
  height: 30px;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-hand);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
}

.filter-chip:hover {
  border-color: var(--border-accent);
  color: var(--text-accent);
  background: var(--accent-subtle);
}

.filter-chip.active {
  background: var(--chip-active-bg);
  border-color: var(--chip-active-bg);
  color: var(--chip-active-txt);
  box-shadow: 1px 2px 0px rgba(180, 90, 60, 0.2);
}

.filter-divider {
  flex-shrink: 0;
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.sort-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.sort-label {
  font-family: var(--font-hand);
  font-size: 0.95rem;
  color: var(--text-muted);
  font-style: italic;
}

.sort-select {
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-family: var(--font-hand);
  font-size: 0.95rem;
  cursor: pointer;
  outline: none;
  transition: border-color var(--transition);
}

.sort-select:hover { border-color: var(--border-hover); color: var(--text-primary); }
.sort-select option { background: var(--bg-card); color: var(--text-primary); }

/* ============ GALLERY ============ */
.gallery-container {
  max-width: 1600px;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
}

.masonry-grid {
  columns: 6;
  column-gap: 18px;
}

@media (max-width: 1400px) { .masonry-grid { columns: 5; } }
@media (max-width: 1100px) { .masonry-grid { columns: 4; } }
@media (max-width: 800px)  { .masonry-grid { columns: 3; } }
@media (max-width: 560px)  { .masonry-grid { columns: 2; } }

/* ============ POSTER CARD — collage/pinned ============ */
.poster-card {
  break-inside: avoid;
  margin-bottom: 18px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  overflow: visible;
  cursor: pointer;
  display: block;
  position: relative;
  transition: transform 220ms ease, box-shadow 220ms ease;
  box-shadow:
    2px 3px 0px rgba(160, 100, 70, 0.12),
    3px 6px 18px rgba(100, 60, 40, 0.09);
}

/* Gentle tilt per card */
.poster-card:nth-child(3n+1) { transform: rotate(-0.9deg); }
.poster-card:nth-child(3n+2) { transform: rotate(0.6deg); }
.poster-card:nth-child(3n)   { transform: rotate(-0.4deg); }

.poster-card:hover {
  transform: rotate(0deg) translateY(-5px) scale(1.018) !important;
  box-shadow:
    3px 5px 0px rgba(160, 100, 70, 0.15),
    8px 16px 32px rgba(100, 60, 40, 0.2);
  z-index: 10;
}

/* Washi tape on each card */
.poster-card::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 50%;
  width: 54px;
  height: 22px;
  border-radius: 3px;
  z-index: 2;
}

.poster-card:nth-child(4n+1)::before { background: var(--tape-1); transform: translateX(-50%) rotate(-2.5deg); }
.poster-card:nth-child(4n+2)::before { background: var(--tape-2); transform: translateX(-50%) rotate(1.5deg); }
.poster-card:nth-child(4n+3)::before { background: var(--tape-3); transform: translateX(-50%) rotate(-1.2deg); }
.poster-card:nth-child(4n)::before   { background: var(--tape-4); transform: translateX(-50%) rotate(2.2deg); }

.poster-img-wrap {
  width: 100%;
  display: block;
  overflow: hidden;
  background: #f5ede2;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border: 1.5px solid var(--border);
  border-bottom: none;
}

.poster-img-wrap img {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 300ms ease;
}

.poster-card:hover .poster-img-wrap img { transform: scale(1.03); }

.card-overlay {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border-radius: var(--radius-md);
  background: linear-gradient(to top, rgba(58,42,30,0.4) 0%, transparent 52%);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}

.poster-card:hover .card-overlay { opacity: 1; }

.card-body {
  padding: 13px 18px 18px;
  border: 1.5px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: var(--bg-card);
}

.card-category {
  font-family: var(--font-hand);
  font-size: 1rem;
  color: var(--text-accent);
  margin-bottom: 4px;
  font-style: italic;
}

.card-title {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 5px;
  font-weight: 700;
}

.card-meta {
  font-size: 0.92rem;
  color: var(--text-muted);
  font-family: var(--font-hand);
}

.card-meta span + span::before { content: ' · '; }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 6rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.empty-icon { font-size: 3.5rem; color: var(--text-muted); line-height: 1; }

.empty-title {
  font-family: var(--font-hand);
  font-size: 2.2rem;
  color: var(--text-secondary);
}

.empty-sub {
  font-size: 0.92rem;
  color: var(--text-muted);
  max-width: 280px;
  line-height: 1.7;
  font-style: italic;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(58, 42, 30, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  backdrop-filter: blur(5px);
}

.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-modal);
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.2rem;
  transform: translateY(20px) scale(0.98);
  transition: transform 220ms ease;
  box-shadow: 5px 7px 0px rgba(160, 100, 70, 0.15), 0 24px 60px rgba(80, 40, 20, 0.22);
}

.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-close {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  background: var(--accent-subtle);
  border: 1.5px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover {
  border-color: var(--border-accent);
  color: var(--text-accent);
  background: var(--accent-light);
}

.modal-title {
  font-family: var(--font-hand);
  font-size: 2.1rem;
  color: var(--text-primary);
  margin-bottom: 1.5rem;
  font-weight: 600;
}

/* ============ DROP ZONE ============ */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  transition: border-color var(--transition), background var(--transition);
  overflow: hidden;
  cursor: pointer;
}

.upload-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-subtle);
}

.upload-prompt { text-align: center; padding: 2rem; }
.upload-icon { font-size: 2rem; color: var(--text-muted); margin-bottom: 0.75rem; }

.upload-main {
  font-family: var(--font-hand);
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.upload-sub { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 0.5rem; }

.file-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.upload-formats {
  font-family: var(--font-hand);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.upload-preview { width: 100%; position: relative; }

.upload-preview img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  display: block;
}

.preview-remove {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(253, 246, 238, 0.9);
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  padding: 4px 12px;
  font-size: 0.82rem;
  cursor: pointer;
  font-family: var(--font-hand);
  transition: all var(--transition);
}

.preview-remove:hover { color: var(--red); border-color: var(--red); }

/* ============ FORM FIELDS ============ */
.form-fields { display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.5rem; }
.form-row { display: flex; flex-direction: column; gap: 5px; }

.form-label {
  font-family: var(--font-hand);
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
}

.optional { color: var(--text-muted); font-size: 0.82rem; }

.form-input,
.form-select,
.form-textarea {
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
  resize: vertical;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-muted); font-style: italic; }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-select option { background: var(--bg-card); }

/* ============ MODAL ACTIONS ============ */
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

.btn-cancel {
  padding: 0 1.2rem;
  height: 40px;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-hand);
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-cancel:hover { border-color: var(--border-hover); color: var(--text-primary); }

.btn-submit {
  padding: 0 1.5rem;
  height: 40px;
  background: var(--accent);
  color: #fff8f5;
  border: none;
  border-radius: 100px;
  font-family: var(--font-hand);
  font-size: 1rem;
  cursor: pointer;
  transition: background var(--transition), box-shadow var(--transition);
  box-shadow: 2px 3px 0px rgba(180, 90, 60, 0.28);
}

.btn-submit:hover {
  background: #c06850;
  box-shadow: 3px 4px 0px rgba(180, 90, 60, 0.35);
}

.btn-submit:disabled { opacity: 0.45; cursor: not-allowed; box-shadow: none; }

.upload-error {
  margin-top: 1rem;
  padding: 10px 14px;
  background: rgba(200, 90, 90, 0.08);
  border: 1.5px solid rgba(200, 90, 90, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--red);
  font-style: italic;
}

/* ============ LIGHTBOX ============ */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(40, 25, 15, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  backdrop-filter: blur(10px);
}

.lightbox-overlay.open { opacity: 1; pointer-events: all; }

.lightbox-close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(253, 246, 238, 0.12);
  border: 1.5px solid rgba(253, 246, 238, 0.25);
  color: rgba(253, 246, 238, 0.75);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 310;
  transition: all var(--transition);
}

.lightbox-close:hover {
  color: #fdf6ee;
  background: rgba(253, 246, 238, 0.22);
  border-color: rgba(253, 246, 238, 0.45);
}

.lightbox-inner {
  display: flex;
  gap: 2.5rem;
  align-items: flex-start;
  max-width: 1100px;
  width: 100%;
  max-height: calc(100vh - 4rem);
}

.lightbox-img-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  max-height: calc(100vh - 4rem);
}

.lightbox-img-wrap img {
  max-width: 100%;
  max-height: calc(100vh - 4rem);
  object-fit: contain;
  border-radius: var(--radius-md);
  display: block;
  box-shadow: 0 8px 40px rgba(0,0,0,0.55);
}

.lightbox-meta { width: 260px; flex-shrink: 0; padding-top: 0.5rem; }

.lbm-category {
  font-family: var(--font-hand);
  font-size: 1rem;
  color: var(--accent-light);
  margin-bottom: 8px;
  font-style: italic;
}

.lbm-title {
  font-family: var(--font-display);
  font-size: 1.9rem;
  color: #fdf6ee;
  line-height: 1.15;
  margin-bottom: 18px;
  font-weight: 700;
}

.lbm-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid rgba(253, 246, 238, 0.1);
  gap: 1rem;
}

.lbm-row:last-child { border-bottom: none; }

.lbm-key {
  font-family: var(--font-hand);
  font-size: 0.85rem;
  color: rgba(253, 246, 238, 0.4);
  flex-shrink: 0;
  font-style: italic;
}

.lbm-value { font-size: 0.85rem; color: rgba(253, 246, 238, 0.75); text-align: right; }

.lbm-notes {
  margin-top: 18px;
  font-family: var(--font-hand);
  font-size: 1rem;
  color: rgba(253, 246, 238, 0.58);
  line-height: 1.75;
  font-style: italic;
}

.lbm-date-added {
  margin-top: 18px;
  font-family: var(--font-hand);
  font-size: 0.82rem;
  color: rgba(253, 246, 238, 0.28);
  font-style: italic;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .lightbox-inner { flex-direction: column; }
  .lightbox-meta { width: 100%; }
  .header-inner { padding: 0 1rem; }
  .gallery-container { padding: 1.5rem 1rem 3rem; }
  .filter-inner { padding: 0 1rem; }
  .logo-tagline { display: none; }
}

/* ============ ENTRANCE ANIMATIONS ============ */
@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(20px) rotate(-1.5deg) scale(0.96);
  }
  to {
    opacity: 1;
  }
}

.poster-card {
  animation: floatIn 340ms ease both;
}

/* ADD THESE RULES TO THE BOTTOM OF YOUR style.css */
 
/* Shimmer placeholder shown while image is off-screen */
.img-skeleton {
  background: linear-gradient(
    90deg,
    #f5ede2 25%,
    #eeddd0 50%,
    #f5ede2 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite linear;
  min-height: 160px;
}
 
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
 
/* Once loaded, stop shimmer and fade image in */
.poster-img-wrap img.img-loaded {
  animation: imgFadeIn 300ms ease both;
}
 
/* Remove shimmer background once image is in the DOM */
.poster-img-wrap:not(.img-skeleton) {
  background: #f5ede2;
  animation: none;
}
 
@keyframes imgFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}