*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  padding-top: 100px;
  color: #212529;
  background: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
body.no-scroll { overflow: hidden; }

/* ---------- header ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 10;
  display: flex; align-items: center; gap: 2rem; flex-wrap: wrap;
  padding: 1rem 2rem;
  background: #fff;
  border-bottom: 1px solid #f1f1f1;
}
.logo { text-decoration: none; }
.logo h3 {
  margin: 0;
  color: #2ca0d9;
  font-family: 'Cinzel', serif;
  font-weight: 300;
  font-size: 30px;
  line-height: 1.3;
}
.logo h3 span {
  display: inline-block;
  padding: 0 16px;
  background: #2ca0d9;
  color: #fff;
  line-height: 1.8;
}
.topbar nav { display: flex; flex: 1; justify-content: space-around; gap: 1rem; }
.topbar nav a {
  color: rgba(0, 0, 0, .5);
  font-size: large;
  font-weight: 700;
  text-decoration: none;
  transition: color .2s;
}
.topbar nav a:hover, .topbar nav a.active { color: rgba(0, 0, 0, .9); }

/* ---------- grid (masonry via CSS columns) ---------- */
main { width: 94%; margin: 1.5rem auto 3rem; }
.grid { column-count: 5; column-gap: 1.25rem; }
@media (max-width: 1199px) { .grid { column-count: 4; } }
@media (max-width: 991px)  { .grid { column-count: 3; } }
@media (max-width: 767px)  { .grid { column-count: 2; } .topbar { padding: .75rem 1rem; } }

.card {
  position: relative;
  break-inside: avoid;
  margin-bottom: .75rem;
}
.card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 5%;
  transition: opacity .2s;
}
.card a:hover img { cursor: zoom-in; opacity: .6; }

.overlay {
  position: absolute; right: 0; bottom: 0;
  padding: 20px;
  opacity: 0;
  transition: opacity .5s ease;
}
.card:hover .overlay, .card:focus-within .overlay { opacity: 1; }
@media (hover: none) { .overlay { opacity: 1; padding: 8px; } .overlay img { width: 90px; } }

.image-share {
  padding: 0; border: 0; background: transparent; cursor: pointer;
}
.image-share img { border-radius: 0; }

/* ---------- single view ---------- */
.single {
  max-width: 608px;
  margin: 20px auto;
  padding: clamp(16px, 5vw, 32px);
  background: #fff;
  box-shadow: 0 1px 8px rgba(0, 0, 0, .08);
}
.single > img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.single-actions {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 16px;
}
.back { color: #1c7adc; text-decoration: none; font-weight: 600; }
.back:hover { text-decoration: underline; }

/* ---------- lightbox ---------- */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .9);
}
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 92vw; max-height: 92vh; object-fit: contain; }
.lb-btn {
  position: absolute;
  border: 0; background: transparent; color: #fff;
  font-size: 48px; line-height: 1; cursor: pointer;
  padding: 12px 18px; opacity: .75;
}
.lb-btn:hover { opacity: 1; }
.lb-close { top: 8px; right: 12px; }
.lb-prev { left: 8px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 8px; top: 50%; transform: translateY(-50%); }

footer {
  border-top: 1px solid #f1f1f1;
  color: #6c757d;
  text-align: center;
  padding: 1rem;
}
