:root{
  --wall-gap:12px;              /* closer thumbnails */
  --polaroid-bg:#fff;
  --shadow:0 14px 20px rgba(0,0,0,0.5);
  --caption:#111;
}

*{box-sizing:border-box}

html,body{
  margin:0;
  padding:0;
  background:#000 url("bg.jpg") center center / cover no-repeat fixed;
  color:#eee;
  font-family:system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

/* Header */
header{
  position:sticky;
  top:0;
  z-index:10;
  background:rgba(0,0,0,.75);
  backdrop-filter:blur(6px);
  padding:16px clamp(12px,4vw,32px);
  box-shadow:0 1px 0 rgba(255,255,255,.1)
}
header h1{margin:0;font-size:clamp(18px,2vw,24px)}
header p{margin:4px 0 0;color:#bbb;font-size:14px}

/* Grid wall */
.wall{
  padding:clamp(12px,3vw,30px);
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(280px,1fr));
  gap:var(--wall-gap);
  align-items:start;
}

/* Polaroid card */
.polaroid{
  background:var(--polaroid-bg);
  box-shadow:var(--shadow);
  border-radius:6px;
  padding:12px 12px 24px;
  transform-origin:center center;
  transition:transform .2s ease, box-shadow .2s ease, filter .2s ease;
  user-select:none;
  position:relative;
}
.polaroid:hover{
  transform:rotate(0deg) scale(1.04);
  z-index:2;
  box-shadow:0 20px 30px rgba(0,0,0,.6);
  filter:saturate(1.08);
}

/* Image frame */
.frame{
  width:100%;
  aspect-ratio:4/5;            /* keep frame shape consistent */
  overflow:hidden;
  border-radius:4px;
  background:#222;
  display:block;
  margin:0 auto 10px;
}
.frame img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

/* Marker-style caption */
.caption{
  text-align:center;
  font-size:16px;
  font-family:'Permanent Marker', cursive;
  color:#111;
  margin-top:6px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* ===== Lightbox overlay ===== */
.lightbox{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.88);
  display:none;
  align-items:center;
  justify-content:center;
  gap:16px;
  padding:24px;
  z-index:999;
}
.lightbox.open{ display:flex; }

.lb-figure{
  max-width:min(92vw, 1600px);
  max-height:86vh;
  margin:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:10px;
}
.lb-figure img{
  max-width:100%;
  max-height:80vh;
  display:block;
  border-radius:8px;
  box-shadow:0 20px 40px rgba(0,0,0,.6);
  background:#111;
}
.lb-figure .caption{
  color:#eee;
  font-family:'Permanent Marker', cursive;
  font-size:18px;
  text-align:center;
  text-shadow:0 1px 2px rgba(0,0,0,.6);
  max-width:90vw;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

/* Controls */
.lb-btn{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  background:rgba(255,255,255,.08);
  color:#fff;
  border:none;
  width:48px;
  height:48px;
  line-height:48px;
  font-size:28px;
  border-radius:999px;
  cursor:pointer;
  user-select:none;
}
.lb-btn:hover{ background:rgba(255,255,255,.18); }
.lb-prev{ left:24px; }
.lb-next{ right:24px; }

.lb-close{
  top:24px;
  right:24px;
  left:auto;
  transform:none;
  width:44px;
  height:44px;
  font-size:26px;
  line-height:44px;
  background:rgba(255,255,255,.12);
}
.lb-close:hover{ background:rgba(255,255,255,.22); }

/* Focus styles for accessibility */
.lb-btn:focus{
  outline:2px solid #fff;
  outline-offset:2px;
}

/* Small screens */
@media (max-width: 640px){
  .wall{ grid-template-columns:repeat(auto-fill, minmax(180px,1fr)); }
  .lb-prev{ left:12px; }
  .lb-next{ right:12px; }
  .lb-btn{ width:40px;height:40px;font-size:24px;line-height:40px; }
}
