/* ========================================
   Pix.Studio Guest Gallery
   ======================================== */

:root {
  --c-text: #1C1917;
  --c-text-soft: #57534E;
  --c-text-muted: #78716C;
  --c-text-faint: #A8A29E;
  --c-border: #E8E4DF;
  --c-bg: #FFFFFF;
  --c-bg-soft: #FAF9F7;
  --c-accent: #8B6E5A;
  --c-accent-hover: #6B5344;
  --content-max: 1280px;
  --row-basis: 240px; /* justified grid target row height */
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body, 'Inter', system-ui, -apple-system, sans-serif);
  font-size: 16px;
  line-height: 1.5;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

.galleryContainer {
  padding-bottom: 48px;
}

/* Constrained content sections (cover stays full-bleed) */
.titleCard,
.galleryMeta,
.photoGrid,
.galleryFooter,
.imagesDeletedNotice {
  width: min(100% - 32px, var(--content-max));
  margin-left: auto;
  margin-right: auto;
}

/* ── Cover ──────────────────────────────────────────────── */

.cover {
  position: relative;
  width: 100%;
}

.cover--photo {
  height: min(58svh, 560px);
  background-size: cover;
  background-position: center;
}

.cover--color {
  height: min(38svh, 360px);
}

/* The cover top holds the photographer name (brand) and the language selector.
   The language selector is pinned to the top-right; the brand is positioned
   across the full width so it can be aligned left/center/right while always
   staying clear of the language selector. */
.coverTop {
  position: relative;
  min-height: 34px;
  padding: 16px 20px;
}

.coverTop .languageSelector {
  position: absolute;
  top: 13px;
  right: 20px;
  z-index: 2;
}

.coverBrand {
  position: absolute;
  top: 18px;
  font-family: var(--brand-font, var(--font-body));
  font-size: var(--brand-size, 13px);
  font-weight: 500;
  letter-spacing: var(--brand-spacing, 0.01em);
  text-transform: var(--brand-transform, none);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Alignment — the right reservation (120px) keeps the name clear of the
   language selector; centered names get symmetric padding so they sit in the
   true middle of the cover, not the middle of the leftover space. */
.gallery--brand-left .coverBrand   { left: 20px; right: 120px; text-align: left; }
.gallery--brand-right .coverBrand  { left: 20px; right: 120px; text-align: right; }
.gallery--brand-center .coverBrand { left: 20px; right: 20px; padding: 0 100px; text-align: center; }

.cover--light .coverBrand { color: rgba(255, 255, 255, 0.95); }
.cover--dark .coverBrand { color: var(--c-text); }

/* Language selector */
.languageSelector {
  appearance: none;
  -webkit-appearance: none;
  font-family: inherit;
  font-size: 13px;
  padding: 5px 24px 5px 10px;
  border-radius: 8px;
  cursor: pointer;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='m1 1 4 4 4-4' stroke='%2378716C' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-color: var(--c-bg);
  border: 1px solid var(--c-border);
  color: var(--c-text);
}

.cover--light .languageSelector {
  background-color: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.4);
  color: #fff;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='m1 1 4 4 4-4' stroke='%23ffffff' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
}

.cover--light .languageSelector option {
  color: var(--c-text);
}

/* ── Title card ─────────────────────────────────────────── */

.titleCard {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--c-bg);
  border: 1px solid var(--c-border);
  border-radius: 14px;
  padding: 22px 26px;
}

.cover + .titleCard {
  margin-top: -56px;
}

.titleCard--plain {
  margin-top: 28px;
  border-top: 3px solid var(--c-accent);
}

.titleInfo h1 {
  font-family: var(--font-heading, 'Fraunces', Georgia, serif);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: var(--heading-spacing, -0.01em);
  text-align: var(--heading-align, left);
  text-transform: var(--heading-transform, none);
  margin: 0;
}

.titleMeta {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--c-text-muted);
  text-align: var(--heading-align, left);
}

.titleMeta .metaDot {
  margin: 0 7px;
  color: var(--c-text-faint);
}

.titleActions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Download all button */
.downloadAllBtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--c-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px 18px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.downloadAllBtn:hover {
  background: var(--c-accent-hover);
}

.downloadAllBtn:active {
  transform: scale(0.98);
}

.downloadAllBtn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

/* ── Sticky bar ─────────────────────────────────────────── */

.stickyBar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--c-border);
  padding: 10px 18px;
  transform: translateY(-100%);
  transition: transform 0.25s ease;
}

.stickyBar.visible {
  transform: translateY(0);
}

.stickyTitle {
  font-family: var(--font-heading, 'Fraunces', Georgia, serif);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stickyDownload {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border: 1px solid var(--c-border);
  border-radius: 8px;
  background: var(--c-bg);
  color: var(--c-text);
  cursor: pointer;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.stickyDownload:hover {
  background: var(--c-bg-soft);
}

/* ── Gallery meta (mobile tip) ──────────────────────────── */

.galleryMeta {
  text-align: center;
}

.mobileDownloadTip {
  margin: 16px auto 0;
  font-size: 13px;
  color: var(--c-text-muted);
  max-width: 420px;
  line-height: 1.5;
}

/* ── Justified photo grid ───────────────────────────────── */

.photoGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 22px;
}

/* Filler keeps the last row left-aligned at natural size */
.photoGrid::after {
  content: "";
  flex-grow: 1000000;
  flex-basis: 0;
}

.photoItem {
  position: relative;
  aspect-ratio: var(--ar, 1.5);
  flex-grow: calc(var(--ar, 1.5) * 100);
  flex-basis: calc(var(--ar, 1.5) * var(--row-basis));
  max-width: 100%;
  border-radius: var(--thumb-radius, 6px);
  overflow: hidden;
  cursor: pointer;
  background: var(--c-bg-soft);
}

.photoItem img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Hover dim + actions */
.photoItem .downloadOverlay {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.18);
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.photoItem:hover .downloadOverlay {
  opacity: 1;
}

.photoItem .downloadBtn {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--c-text);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.15s ease, background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.photoItem .downloadBtn:hover {
  background: #fff;
  transform: scale(1.06);
}

.photoItem .downloadBtn:active {
  transform: scale(0.94);
}

.photoItem .heartBtn {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: var(--c-text);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.photoItem:hover .heartBtn,
.photoItem .heartBtn.active {
  opacity: 1;
}

.photoItem .heartBtn:hover {
  transform: scale(1.06);
}

.photoItem .heartBtn:active {
  transform: scale(0.94);
}

.photoItem .heartBtn.active {
  color: #D4537E;
}

/* Touch devices: actions always visible */
@media (hover: none) {
  .photoItem .downloadOverlay {
    opacity: 0;
  }
  .photoItem .heartBtn {
    opacity: 1;
  }
}

/* ── Images deleted notice ──────────────────────────────── */

.imagesDeletedNotice {
  text-align: center;
  padding: 56px 24px;
  max-width: 520px;
}

.imagesDeletedNotice .noticeIcon {
  color: var(--c-text-faint);
  margin-bottom: 20px;
}

.imagesDeletedNotice h2 {
  font-family: var(--font-heading, 'Fraunces', Georgia, serif);
  font-size: 26px;
  font-weight: 500;
  margin: 0 0 14px;
}

.imagesDeletedNotice p {
  font-size: 16px;
  color: var(--c-text-soft);
  line-height: 1.6;
  margin: 0 0 12px;
}

.imagesDeletedNotice .contactInfo {
  font-size: 14px;
  color: var(--c-text-muted);
  margin-top: 22px;
}

/* ── Favorites bar ──────────────────────────────────────── */

.favoritesBar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: var(--c-text);
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(28, 25, 23, 0.35);
  padding: 16px 24px;
  min-width: 280px;
  max-width: min(480px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: favBarSlideIn 0.25s ease;
}

@keyframes favBarSlideIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.favoritesBar.favBar--submitted,
.favoritesBar.favBar--hint {
  flex-direction: row;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
}

.favoritesBar .favBar-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.favoritesBar .favBar-text {
  flex: 1;
  min-width: 0;
}

.favoritesBar .favBar-title {
  font-size: 15px;
  font-weight: 500;
  margin: 0 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.favoritesBar .favBar-hint {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
  line-height: 1.4;
}

.favoritesBar .favBar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.favoritesBar .favBar-submit {
  background: #fff;
  color: var(--c-text);
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}

.favoritesBar .favBar-submit:hover {
  background: #f0f0f0;
  transform: scale(1.03);
}

.favoritesBar .favBar-submit:active {
  transform: scale(0.97);
}

.favoritesBar .favBar-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.favoritesBar .favBar-edit {
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 6px 14px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.favoritesBar .favBar-edit:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.galleryContainer.hasFavoritesBar {
  padding-bottom: 140px;
}

/* ── Footer ─────────────────────────────────────────────── */

.galleryFooter {
  text-align: center;
  margin-top: 56px;
  padding: 28px 0;
  border-top: 1px solid var(--c-border);
}

.footerPhotographer {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--c-text-soft);
}

.profileLinks {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.profileLink {
  display: inline-flex;
  align-items: center;
  padding: 6px 16px;
  background: var(--c-bg-soft);
  color: var(--c-text-soft);
  text-decoration: none;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--c-border);
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.profileLink:hover {
  background: var(--c-border);
  color: var(--c-text);
  transform: translateY(-1px);
}

.photographerLogo {
  max-width: 200px;
  max-height: 60px;
  object-fit: contain;
}

.poweredBy {
  display: inline-block;
  color: var(--c-text-faint);
  font-size: 13px;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.poweredBy:hover {
  color: var(--c-text);
}

/* ── Lightbox ───────────────────────────────────────────── */

.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(12, 10, 9, 0.96);
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

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

.lightbox.visible {
  opacity: 1;
}

.lightbox-content {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 84px;
  touch-action: pan-y;
}

.lightbox-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
}

.lightbox button {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.lightbox button:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.lightbox-close {
  top: 16px;
  right: 16px;
}

.lightbox-prev {
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-next {
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 14px;
}

.lightbox-counter {
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.lightbox-footer button {
  position: static;
  width: 40px;
  height: 40px;
}

.lightbox-heart {
  font-size: 20px;
  line-height: 1;
}

.lightbox-heart.active {
  color: #D4537E !important;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 700px) {
  /* Single-column feed on phones — justified rows would shrink photos too small */
  .photoItem {
    flex-basis: 100%;
  }

  .cover--photo {
    height: min(46svh, 420px);
  }

  .cover--color {
    height: min(30svh, 260px);
  }

  .titleCard {
    padding: 18px;
    align-items: stretch;
    flex-direction: column;
  }

  .cover + .titleCard {
    margin-top: -42px;
  }

  .titleInfo h1 {
    font-size: 25px;
  }

  .titleMeta {
    font-size: 13px;
  }

  .titleActions {
    justify-content: space-between;
  }

  .downloadAllBtn {
    flex: 1;
    justify-content: center;
  }

  .photoGrid {
    gap: 4px;
    margin-top: 16px;
  }

  .photoItem {
    border-radius: 5px;
  }

  .lightbox-content {
    padding: 56px 8px;
  }

  .lightbox-prev,
  .lightbox-next {
    display: none; /* swipe gestures handle navigation on mobile */
  }
}

/* ── Dark gallery theme overrides ──────────────────────────
   A few elements use hard-coded light surfaces that would clash
   on a dark background; remap them so text stays readable. */
.gallery--dark .stickyBar {
  background: rgba(20, 18, 16, 0.92);
}
.gallery--dark .favoritesBar {
  background: var(--c-bg-soft);
  color: var(--c-text);
  border: 1px solid var(--c-border);
}
.gallery--dark .favoritesBar .favBar-submit {
  background: var(--c-accent);
  color: #fff;
}

/* ── Centered heading layout ───────────────────────────────
   The title card is normally a flex row (title left, actions right),
   so centering the text alone has no visible effect. When the theme
   uses a centered heading, stack the card and center its contents. */
.gallery--center .titleCard {
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.gallery--center .titleInfo {
  width: 100%;
}
.gallery--center .titleActions {
  justify-content: center;
  width: 100%;
}
