/* ===========================================================
   Yacht Scorpio — Photo Gallery
   =========================================================== */

:root {
  --brand-deep:   #0a2540;
  --brand-mid:    #1e5f8c;
  --brand-accent: #c9a227;
  --text-light:   #f5f7fa;
  --bg:           #0b1a2b;
  --panel:        rgba(255, 255, 255, 0.06);
  --border:       rgba(255, 255, 255, 0.12);
  --shadow:       0 8px 30px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  color: var(--text-light);
  background:
    linear-gradient(180deg, var(--brand-deep) 0%, var(--bg) 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.gallery-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(10, 20, 36, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.gallery-header h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  flex: 1;
}
.gallery-header .count {
  font-size: 0.85rem;
  opacity: 0.7;
}
.back-link {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 600;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  transition: background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}
.back-link:hover {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: var(--brand-deep);
}

/* ---------- Grid ---------- */
.gallery-grid {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.9rem;
  padding: 1.25rem 1.5rem 2rem;
}

.thumb {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  padding: 0;
  background: var(--panel);
  aspect-ratio: 4 / 3;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.2s ease;
}
.thumb:hover,
.thumb:focus-visible {
  transform: translateY(-4px);
  border-color: var(--brand-accent);
  outline: none;
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.9rem 0.75rem 0.55rem;
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
}

.empty {
  flex: 1;
  padding: 3rem 1.5rem;
  text-align: center;
  opacity: 0.8;
}
.empty code {
  background: var(--panel);
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(4, 10, 18, 0.92);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.lightbox[hidden] { display: none; }

.lb-figure {
  /* Leave clear space on both sides for the fixed nav arrows so the
     image never slides underneath them, whatever its aspect ratio. */
  max-width: min(1200px, calc(100vw - 9rem));
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}
.lb-figure img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.lb-figure figcaption {
  font-size: 1rem;
  letter-spacing: 0.02em;
  opacity: 0.9;
}

.lb-close,
.lb-nav {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid var(--border);
  color: #fff;
  cursor: pointer;
  border-radius: 50%;
  transition: background 0.2s ease;
}
.lb-close:hover,
.lb-nav:hover {
  background: var(--brand-accent);
  color: var(--brand-deep);
}
.lb-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  width: 44px;
  height: 44px;
  font-size: 1.6rem;
  line-height: 1;
}
/* Nav arrows are pinned to fixed positions at the left/right of the
   frame and vertically centred — they stay put no matter the image size,
   so the mouse never has to chase them between photos. */
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  font-size: 2rem;
  line-height: 1;
  flex-shrink: 0;
}
.lb-prev { left: 1.25rem; }
.lb-next { right: 1.25rem; }

/* Smaller arrows and tighter margins on phones */
@media (max-width: 600px) {
  .lb-nav {
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
  }
  .lb-prev { left: 0.6rem; }
  .lb-next { right: 0.6rem; }
  .lb-figure { max-width: calc(100vw - 6.5rem); }
}

/* ---------- Footer ---------- */
.gallery-footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.8rem;
  opacity: 0.65;
  border-top: 1px solid var(--border);
}
