/* ============================================================
   GALLERY CSS — save as /assets/css/gallery.css
   ============================================================ */

/* ── IMAGE PROTECTION ────────────────────────────────────── */
.protected-img { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; pointer-events: none; }
.img-guard { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 2; background: transparent; cursor: pointer; }

/* ── MOSAIC ──────────────────────────────────────────────── */

#mosaic { display: none; position: absolute; inset: 0; background: var(--bg); overflow-y: auto; }
#mosaic.active { display: block; }
#mosaic-inner { padding: 10px 20px 30px; }
#mosaic-header { display: flex; align-items: baseline; justify-content: flex-start; padding: 20px 0 20px; }
#mosaic-title { display: none; }

#mosaic-back,
a#mosaic-back {
  background: none; border: none; cursor: pointer;
  font-family: 'Raleway', sans-serif; font-size: 13px;
  color: #a7a7a7; transition: color 0.2s; padding: 0; text-decoration: none;
}
#mosaic-back:hover, a#mosaic-back:hover { color: #555d62; }

#mosaic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 8px; justify-content: start;
}

.mosaic-item { position: relative; cursor: pointer; }
.mosaic-item img {
  display: block; width: 100%; height: auto;
  object-fit: cover; aspect-ratio: 3/2;
  transition: opacity 0.4s ease;
}
.mosaic-caption { display: none; }
.mosaic-filename { display: none; }
.mosaic-placeholder {
  width: 100%; aspect-ratio: 3/2; background: #e8e8e8;
  display: flex; align-items: center; justify-content: center;
}
.mosaic-placeholder svg { width: 24px; height: 24px; stroke: rgba(0,0,0,0.15); stroke-width: 1; fill: none; }
.mosaic-item img.thumb-loading { opacity: 0; }

/* ── VIEWER ──────────────────────────────────────────────── */

#viewer { display: none; position: absolute; inset: 0; overflow: hidden; background: var(--bg); }
#viewer.active { display: flex; flex-direction: column; }
#viewer-inner { padding: 28px 20px 0 20px; display: flex; flex-direction: column; height: 100%; }
.container { display: flex; flex-direction: column; flex: 1; min-height: 0; }

#image-container {
  position: relative; width: 100%;
  display: flex; justify-content: center; align-items: flex-start;
  cursor: pointer; flex: 1; min-height: 0; overflow: hidden;
}
#main-image {
  display: block; max-width: 100%; max-height: 100%;
  width: auto; height: 100%; object-fit: contain;
  opacity: 0; transition: opacity var(--transition);
}
#main-image.loaded { opacity: 1; }
#main-image.fading { opacity: 0; }

/* ── CAPTION BAR (title only, matches counter font) ──────── */

#caption-bar { display: flex; flex-direction: column; align-items: center; padding: 4px 0 0; flex-shrink: 0; width: 100%; }
#caption-bar-inner { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
#title-text {
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: rgba(0,0,0,0.3);
}

/* ── BAR BOTTOM ──────────────────────────────────────────── */

#bar-bottom {
  display: flex; align-items: center; justify-content: center;
  gap: 12px; width: 100%; padding: 2px 0 14px; flex-shrink: 0;
}
#counter {
  font-size: 0.65rem; letter-spacing: 0.15em; color: rgba(0,0,0,0.3);
  flex-shrink: 0; min-width: 48px; text-align: center;
}
#bar-controls { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.nav-btn, .icon-btn {
  width: 38px; height: 38px; background: none; border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0.5; transition: opacity 0.2s; text-decoration: none; padding: 0;
}
.nav-btn:hover, .icon-btn:hover { opacity: 1; }
.nav-btn svg, .icon-btn svg { width: 19px; height: 19px; stroke: #444; stroke-width: 1.5; fill: none; }
#btn-info { opacity: 0.5; }
#btn-info:hover { opacity: 1; }

/* ── INFO VIEW ───────────────────────────────────────────── */

#info-view { display: none; position: absolute; inset: 0; background: var(--bg); overflow-y: auto; }
#info-view.active { display: block; }
#info-inner { padding: 28px 20px 40px; }
#info-topbar { display: flex; justify-content: flex-start; padding: 0 0 20px; }
#info-close {
  background: none; border: none; cursor: pointer;
  font-family: 'Raleway', sans-serif; font-size: 0.62rem;
  letter-spacing: 0.15em; color: #a7a7a7; transition: color 0.2s; padding: 0;
}
#info-close:hover { color: #555d62; }
#info-content { display: flex; gap: 40px; align-items: flex-start; }
#info-meta { flex: 0 0 280px; min-width: 0; }
#info-right { flex: 1; min-width: 0; }
#info-image-wrap { position: relative; }
#info-image-wrap img { display: block; width: 100%; height: auto; object-fit: contain; }

.info-table { width: 100%; border-collapse: collapse; }
.info-table tr { border-bottom: 1px solid rgba(0,0,0,0.06); }
.info-table tr:last-child { border-bottom: none; }
.info-table td {
  font-family: 'Raleway', sans-serif; font-weight: 300; font-size: 0.72rem;
  color: rgba(0,0,0,0.45); padding: 7px 0; vertical-align: top;
}
.info-table td:first-child {
  color: rgba(0,0,0,0.3); letter-spacing: 0.08em;
  font-size: 0.6rem; width: 90px; padding-right: 12px;
}
.info-table td:last-child { color: rgba(0,0,0,0.55); }

#info-bar { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 8px 0 0; }
#info-bar-controls { display: flex; align-items: center; gap: 10px; }
#info-counter {
  font-size: 0.65rem; letter-spacing: 0.15em; color: rgba(0,0,0,0.3);
  min-width: 48px; text-align: center;
}

/* ── PASSWORD GATE ───────────────────────────────────────── */

.password-gate {
  display: flex; align-items: center; justify-content: center; height: 100vh;
}
.password-form { text-align: center; font-family: 'Raleway', sans-serif; }
.password-form label { display: block; font-size: 0.85rem; color: #888; margin-bottom: 16px; }
.password-form input {
  font-family: 'Raleway', sans-serif; font-size: 0.85rem;
  padding: 8px 14px; border: 1px solid #ccc; outline: none; margin-right: 8px;
}
.password-form button {
  font-family: 'Raleway', sans-serif; font-size: 0.85rem;
  padding: 8px 18px; background: #555; color: #fff; border: none; cursor: pointer;
}
.password-form button:hover { background: #333; }

.viewer-footer { display: none; }

/* ── MOBILE ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  #mosaic-inner, .site-footer { padding-left: 56px; padding-right: 20px; }
  #info-inner { padding-left: 56px; padding-right: 20px; }
  #mosaic-grid { justify-content: center; }
  #info-content { flex-direction: column-reverse; gap: 24px; }
  #info-meta { flex: none; width: 100%; }
  #info-right { width: 100%; }

  #viewer-inner {
    padding: 56px 20px 0 20px;
    height: 100%;
    overflow: hidden;
  }
  #image-container {
    flex: 1;
    min-height: 0;
    align-items: center;
  }
  #main-image {
    max-height: 60vh;
    width: auto;
    height: auto;
  }
  #caption-bar { padding: 6px 0 0; }
  #bar-bottom { padding: 4px 0 12px; }
}
