/* =========================
   Global page behavior
   ========================= */

html, body {
  margin: 0;
  padding: 0;
  height: auto;
  overflow-y: auto;   /* ENABLE PAGE SCROLLING */
  font-family: Arial, sans-serif;
  background: #000;
  color: #fff;
}

/* =========================
   Layout container
   ========================= */

.container {
  display: flex;
  min-height: 100vh;
}

/* =========================
   Sidebar menu
   ========================= */

.sidebar {
  width: 200px;
  background: #111;
  padding: 20px;
  box-sizing: border-box;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
}

.sidebar h2 {
  margin-top: 0;
}

.sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar li {
  margin: 15px 0;
}

.sidebar a {
  color: #fff;
  text-decoration: none;
  transition: color 0.2s;
}

.sidebar a:hover {
  color: #1e90ff;
}

/* =========================
   Main content area
   ========================= */

.main-content {
  margin-left: 220px;       /* space for fixed sidebar */
  padding: 20px;
  box-sizing: border-box;
  min-height: 100vh;
  overflow: visible;        /* allow content to grow */
}

/* =========================
   Gallery grid
   ========================= */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 20px;
}

.gallery-item img {
  width: 100%;
  height: auto;
  cursor: pointer;
  border: 2px solid #444;
  border-radius: 4px;
  transition: transform 0.2s, border-color 0.2s;
}

.gallery-item img:hover {
  transform: scale(1.05);
  border-color: #fff;
}

/* =========================
   Lightbox overlay
   ========================= */

#lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.95);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 1000;

  overflow-y: auto;        /* ENABLE SCROLLING */
  padding: 40px 20px;
}

#lightbox-img {
  max-width: 90%;
  max-height: 65vh;        /* leaves room for text */
  margin-bottom: 15px;
}

/* =========================
   Lightbox caption
   ========================= */

#lightbox-caption {
  font-size: 16px;
  text-align: left;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-width: 90%;
  line-height: 1.5;

  max-height: 25vh;        /* SCROLL ONLY TEXT IF LONG */
  overflow-y: auto;
  padding-right: 10px;
}

/* Title (data-title) */
#lightbox-caption strong {
  color: yellow;
  font-size: 18px;
  display: block;
  margin-bottom: 6px;
}

/* Links inside notes */
#lightbox-caption a {
  color: #1e90ff;
  text-decoration: underline;
}

#lightbox-caption a:hover {
  color: #66b2ff;
}

/* Close button */
#close {
  position: absolute;
  top: 20px;
  right: 40px;
  font-size: 40px;
  cursor: pointer;
}

/* =========================
   Responsive adjustments
   ========================= */

@media (max-width: 768px) {

  .container {
    flex-direction: column;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
  }

  .main-content {
    margin-left: 0;
  }

  #lightbox-img {
    max-height: 55vh;
  }

  #lightbox-caption {
    max-height: 35vh;
  }
}
