/* Base */
* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.5;
  background: #fafafa;
  color: #111;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Flexbox layout helpers (optional) ===== */
.flex {
  display: flex;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

/* Page layout */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.main {
  flex: 1;
}

/* Header */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header__title {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-header h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.site-header__subtitle {
  margin: 0;

  font-size: 14px;
}

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-header__nav {
  display: flex;
  align-items: center;
  gap: 18px;
}

.site-header__link {
  text-decoration: none;
  color: inherit;
  font-size: 13px;
  font-weight: bold;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  opacity: 0.75;
}

.site-header__link:hover {
  opacity: 1;
}

/* Buttons */
.btn {
  padding: 10px 14px;
  border-radius: 5px;
  border: 1px solid #ddd;
  background: #fff;
  cursor: pointer;
}

.btn:hover {
  background: #f6f6f6;
}

/* Card */
.card {
  border: 1px solid #e5e5e5;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
}

.section {
  padding: 8px 0;
}

.section__title {
  margin: 0 0 6px 0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.8;
}

.section__text {
  margin: 0;
  color: #666;
  font-size: 14px;
}

/* Masonry gallery (CSS columns to avoid flexbox gaps) */
.gallery {
  column-count: 3;
  column-gap: 24px;
  padding: 18px 0;
}

.thumb {
  display: inline-block;
  width: 100%;
  margin: 0 0 24px;
  border-radius: 0;
  overflow: hidden;
  border: 1px solid #e1e1e1;
  background: #fff;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  page-break-inside: avoid;
  position: relative;
}

.thumb img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 0;
}

/* ===== Admin delete overlay (photos) ===== */
.delete-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.18);
  background: rgba(255,255,255,0.92);
  color: #000;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.delete-btn:hover {
  background: #fff;
}

/* Hide admin controls unless admin mode is enabled */
body:not(.is-admin) .delete-btn {
  display: none;
}

/* Tablet */
@media (max-width: 900px) {
  .gallery {
    column-count: 2;
  }
}

/* Footer upload bar */
.footer {
  margin-top: auto; /* pushes footer to bottom on short pages */
  width: 100%;
  padding: 16px 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}

.footer--hidden {
  transform: translateY(110%);
  display: none;
}

.upload-btn {
  padding: 8px 12px;
  font-size: 16px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  background: #8f8f8f;
  color: #fff;
}

.upload-btn:hover {
  background: #333;
}

#msg {
  margin: 0;
  font-size: 13px;
  color: #666;
}

/* Mobile */
@media (max-width: 520px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .gallery {
    column-count: 1;
    column-gap: 18px;
    padding: 12px 0;
  }

  .thumb {
    margin: 0 0 18px;
  }
}

/* ===== Albums page (collapsible like ChatGPT GPTs sidebar) ===== */
.albums-section { padding: 10px 0 32px; }
.muted { opacity: 0.75; }

.albums { display: flex; flex-direction: column; gap: 12px; }

.album {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.03);
}

.album__header {
  width: 100%;
  background: transparent;
  border: 0;
  color: inherit;
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
}

.album__title {
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}

.album__actions {
  display: flex;
  gap: 8px;
}

.album__meta {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.album__actions .btn {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

/* Hide album admin actions unless admin mode is enabled */
body:not(.is-admin) .album__actions {
  display: none;
}

.album__count { opacity: 0.75; font-size: 13px; }

.album__chevron {
  opacity: 0.8;
  transform: rotate(0deg);
  transition: transform 160ms ease;
  font-weight: 900;
}

.album__panel { display: none; padding: 0 14px 14px; }

.album--open .album__panel { display: block; }
.album--open .album__chevron { transform: rotate(90deg); }

/* Album grids reuse your masonry columns, but tighter */
.gallery--album { column-gap: 18px; }
.gallery--album .thumb { margin-bottom: 18px; }

/* ===== Modal ===== */
.modal { position: fixed; inset: 0; display: none; z-index: 50; }
.modal--open { display: block; }

.modal__backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.55); }

.modal__panel {
  position: relative;
  max-width: 520px;
  margin: 10vh auto;
  background: #1c1c1c;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.modal__title {
  margin: 0;
  font-size: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.icon-btn {
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.06);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  cursor: pointer;
}

.icon-btn:hover { background: rgba(255,255,255,0.10); }

.modal__body { padding: 14px; }

.modal__footer {
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.10);
  display: flex;
  justify-content: flex-end;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }

.field__label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.8;
}

.select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  color: #fff;
}

/* Footer button row on albums page */
.footer__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

/* ===== Lightbox (photo viewer) ===== */
.no-scroll {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 1000;
}

.lightbox--open {
  display: block;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
}

.lightbox__img {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  transform: translate(-50%, -50%);
  object-fit: contain;
  border-radius: 0;
}

.lightbox__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-size: 18px;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  width: 52px;
  height: 52px;
  transform: translateY(-50%);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-size: 28px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__prev {
  left: 16px;
}

.lightbox__next {
  right: 16px;
}

.lightbox__close:hover,
.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.14);
}