:root {
  --bg: #f7faff;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --blue: #2563eb;
  --blue-100: #dbeafe;
  --ring: rgba(37, 99, 235, 0.3);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif;
}

.site-header {
  max-width: 1100px;
  margin: 24px auto 12px;
  padding: 0 16px;
  display: grid;
  gap: 12px;
}
.flash {
  background: var(--blue-100);
  color: var(--blue);
  padding: 10px 12px;
  border-radius: 8px;
  display: inline-block;
}

.upload {
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--panel);
  padding: 12px;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.05);
}
.upload input[type="file"] {
  padding: 8px;
  border-radius: 8px;
  border: 1px dashed var(--blue);
  background: #fff;
}
.upload button {
  background: var(--blue);
  color: white;
  border: 0;
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--ring);
}
.upload button:hover { filter: brightness(1.05); }

/* Masonry layout for natural image ratios */
.gallery {
  max-width: 1100px;
  margin: 18px auto 48px;
  padding: 0 16px;
  column-width: 260px;
  column-gap: 16px;
}
.tile {
  width: 100%;
  display: inline-block;
  margin: 0 0 16px;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0,0,0,0.06);
  overflow: hidden;
  border: 1px solid #eef2ff;
  break-inside: avoid;
  text-align: center;             /* helps centering inside */
}

.tile-img {
  display: block;
  max-width: 100%;
  max-height: 240px;              /* <-- set sensible max height */
  width: auto;
  height: auto;
  margin: 0 auto;                 /* horizontally center */
  object-fit: contain;            /* keep aspect ratio, no crop */
  background: #eef2ff;            /* subtle placeholder background */
}
.meta {
  padding: 12px;
  font-size: 14px;
  color: var(--muted);
  display: grid;
  gap: 6px;
}
.meta strong {
  color: var(--text);
  font-weight: 600;
  margin-right: 6px;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 24px 16px 48px;
}

/* Lightbox styles */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
}
.lightbox.hidden { display: none; }
.lightbox img {
  max-width: 95vw;
  max-height: 90vh;
  border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 0;
  font-size: 28px;
  line-height: 40px;
  text-align: center;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.2);
}
.lightbox-close:hover { filter: brightness(1.05); }
