/* ==========================================================================
   Lush Residencies — Gallery page styles
   ==========================================================================

   Contents
     1. Design tokens
     2. Base
     3. SVG sprite
     4. Navigation
     5. Hero
     6. Suite sections
     7. Masonry photo grid
     8. Section divider
     9. Call to action
    10. Footer
    11. Scroll-reveal animation
    12. Gallery tools — toolbar, buttons, selection, toast
    13. Lightbox (full-screen photo viewer)
    14. Responsive overrides

   Naming: component blocks use short prefixes —
     g-*  gallery tools (injected by js/gallery.js)
     lb-* lightbox       (injected by js/gallery.js)
   State classes set by JavaScript: .is-selected, .is-on,
   .has-sel, .select-mode, .placeholder, .visible, .open, .show,
   .zoomed, .dragging, .anim
   ========================================================================== */


/* 1. Design tokens
   ========================================================================== */
:root {
  /* Brand colours */
  --gold: #B8965A;
  --gold-light: #D4B483;
  --gold-pale: #F5EDD9;
  --gold-glow: rgba(184, 150, 90, .15);
  --gold-line: rgba(184, 150, 90, .45);   /* button borders */
  --dark: #141412;
  --dark-card: #1C1C18;
  --dark-mid: #232320;
  --cream: #FBF9F4;
  --cream-dark: #F0ECDF;
  --olive: #3C4A2E;
  --olive-light: #5A7041;

  /* Text & lines */
  --text-body: #6B6758;
  --text-dim: rgba(255, 255, 255, .4);
  --border-light: rgba(0, 0, 0, .06);

  /* Typography */
  --font-serif: 'Playfair Display', serif;
  --font-sans: 'Outfit', sans-serif;

  /* Layout */
  --content-width: 1200px;
  --nav-offset: 78px;          /* sticky toolbar sits just below the fixed nav */

  /* Motion */
  --ease-out: cubic-bezier(.23, 1, .32, 1);

  /* Stacking order */
  --z-toolbar: 50;
  --z-nav: 999;
  --z-lightbox: 2000;
  --z-toast: 3000;
}


/* 2. Base
   ========================================================================== */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--dark);
  overflow-x: hidden;
  font-weight: 300;
}


/* 3. SVG sprite — holds shared <symbol>s; must not be display:none,
      or gradients referenced from it stop rendering in some browsers
   ========================================================================== */
.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}


/* 4. Navigation
   ========================================================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 3.5rem;
  transition: all .4s;
  background: rgba(20, 20, 18, .97);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--gold-glow);
}

.logo {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  color: var(--gold-light);
  text-decoration: none;
  letter-spacing: .06em;
  font-weight: 400;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
}

.logo-mark {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  display: block;
}

.logo i {
  font-style: italic;
  color: #fff;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 2rem;
  align-items: center;
}

.nav-links a {
  color: rgba(255, 255, 255, .6);
  text-decoration: none;
  font-size: .7rem;
  letter-spacing: .2em;
  text-transform: uppercase;
  transition: color .3s;
  font-weight: 300;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--gold-light);
}

.nav-cta {
  border: 1px solid var(--gold) !important;
  color: var(--gold-light) !important;
  padding: .5rem 1.4rem;
  transition: all .3s !important;
}

.nav-cta:hover {
  background: var(--gold) !important;
  color: var(--dark) !important;
}

.mobile-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--gold-light);
  font-size: 1.5rem;
  cursor: pointer;
}


/* 5. Hero
   ========================================================================== */
.g-hero {
  background: var(--dark);
  position: relative;
  padding: 11rem 5rem 5rem;
  text-align: center;
  overflow: hidden;
}

.g-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0F150C 0%, var(--dark) 40%, #1A1812 100%);
}

.g-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 50% 40%, rgba(90, 112, 65, .12), transparent 70%);
}

.g-hero-inner {
  position: relative;
  z-index: 2;
  max-width: 760px;
  margin: 0 auto;
}

.g-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  color: var(--gold);
  font-size: .66rem;
  letter-spacing: .35em;
  text-transform: uppercase;
  margin-bottom: 1.8rem;
}

.g-hero-eyebrow::before,
.g-hero-eyebrow::after {
  content: '';
  width: 2rem;
  height: 1px;
  background: var(--gold);
}

.g-hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  font-weight: 400;
  line-height: 1.1;
  color: #fff;
  margin-bottom: 1.4rem;
}

.g-hero h1 em {
  font-style: italic;
  color: var(--gold-light);
}

.g-hero p {
  color: rgba(255, 255, 255, .45);
  font-size: .92rem;
  line-height: 2;
  font-weight: 200;
  max-width: 52ch;
  margin: 0 auto;
}

.g-hero-jump {
  display: flex;
  gap: .8rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 2.5rem;
}

.g-hero-jump a {
  color: rgba(255, 255, 255, .7);
  text-decoration: none;
  font-size: .66rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  border: 1px solid rgba(184, 150, 90, .3);
  padding: .6rem 1.3rem;
  transition: all .3s;
}

.g-hero-jump a:hover {
  background: var(--gold);
  color: var(--dark);
  border-color: var(--gold);
}


/* 6. Suite sections — backgrounds alternate cream / darker cream
   (nth-of-type counts <section>s only, so adding other elements to <body>
   doesn't flip the pattern)
   ========================================================================== */
.suite {
  padding: 6rem 5rem;
  position: relative;
}

.suite:nth-of-type(odd) {
  background: var(--cream);
}

.suite:nth-of-type(even) {
  background: var(--cream-dark);
}

.suite-head {
  max-width: var(--content-width);
  margin: 0 auto 3rem;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.suite-head-left {
  max-width: 640px;
}

.suite-floor {
  display: block;
  font-size: .65rem;
  letter-spacing: .32em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1rem;
}

.suite-name {
  font-family: var(--font-serif);
  font-size: clamp(1.9rem, 3.4vw, 2.8rem);
  font-weight: 400;
  line-height: 1.12;
}

.suite-name em {
  font-style: italic;
  color: var(--olive-light);
}

.suite-desc {
  color: var(--text-body);
  font-size: .9rem;
  line-height: 1.95;
  font-weight: 200;
  margin-top: 1rem;
}

.suite-specs {
  display: flex;
  gap: 1.8rem;
  flex-shrink: 0;
  padding-bottom: .3rem;
}

.spec {
  display: flex;
  flex-direction: column;
  gap: .2rem;
  text-align: center;
}

.spec-val {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--dark);
  line-height: 1;
}

.spec-key {
  font-size: .56rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--text-body);
}


/* 7. Masonry photo grid — CSS columns keep each photo's natural shape
   ========================================================================== */
.masonry {
  max-width: var(--content-width);
  margin: 0 auto;
  column-count: 3;
  column-gap: 1rem;
}

.masonry figure {
  break-inside: avoid;
  margin: 0 0 1rem;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border-light);
  position: relative;
  cursor: zoom-in;
  outline: 0 solid transparent;
  outline-offset: -3px;
  transition: outline-color .2s;
}

.masonry img {
  width: 100%;
  display: block;
  transition: transform .6s var(--ease-out);
}

.masonry figure:hover img {
  transform: scale(1.05);
}

.masonry figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.6rem 1rem .8rem;
  background: linear-gradient(transparent, rgba(20, 20, 18, .72));
  color: #fff;
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 300;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .4s, transform .4s;
}

.masonry figure:hover figcaption {
  opacity: 1;
  transform: translateY(0);
}

/* Missing photo (figure has data-label, image failed to load):
   shows a labelled tile instead of a broken image */
.masonry figure.placeholder {
  aspect-ratio: 4 / 3;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--cream-dark), #E6E0D0);
  cursor: default;
}

.masonry figure.placeholder img,
.masonry figure.placeholder figcaption,
.masonry figure.placeholder .g-check {
  display: none;
}

.masonry figure.placeholder::after {
  content: attr(data-label);
  color: var(--text-body);
  opacity: .55;
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
}


/* 8. Section divider — small leaf between two hairlines
   ========================================================================== */
.leaf-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  max-width: var(--content-width);
  margin: 4rem auto 0;
}

.leaf-divider::before,
.leaf-divider::after {
  content: '';
  height: 1px;
  background: var(--border-light);
  flex: 1;
}

.leaf-divider svg {
  width: 22px;
  height: 22px;
  opacity: .6;
}

/* The leaf's centre line matches the section background */
.leaf-rib {
  stroke: var(--leaf-rib);
  stroke-opacity: var(--leaf-rib-opacity);
}

.suite:nth-of-type(odd) .leaf-divider {
  --leaf-rib: var(--cream);
  --leaf-rib-opacity: .6;
}

.suite:nth-of-type(even) .leaf-divider {
  --leaf-rib: var(--cream-dark);
  --leaf-rib-opacity: .7;
}


/* 9. Call to action
   ========================================================================== */
.cta {
  background: var(--dark);
  text-align: center;
  padding: 5rem 5rem;
}

.cta h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  color: #fff;
  margin-bottom: 1rem;
}

.cta h2 em {
  font-style: italic;
  color: var(--gold-light);
}

.cta p {
  color: rgba(255, 255, 255, .45);
  font-size: .9rem;
  font-weight: 200;
  max-width: 44ch;
  margin: 0 auto 2rem;
  line-height: 1.9;
}

.btn-gold {
  background: var(--gold);
  color: var(--dark);
  padding: .95rem 2.6rem;
  text-decoration: none;
  font-size: .72rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  font-weight: 500;
  transition: all .3s;
  display: inline-block;
  border: none;
  cursor: pointer;
}

.btn-gold:hover {
  background: var(--gold-light);
  transform: translateY(-2px);
}


/* 10. Footer
   ========================================================================== */
.footer {
  background: var(--dark-mid);
  border-top: 1px solid var(--gold-glow);
  padding: 3rem 5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.f-logo {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--gold-light);
  font-weight: 400;
  letter-spacing: .06em;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
}

.f-logo-mark {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: block;
}

.f-logo i {
  font-style: italic;
}

.f-copy {
  color: rgba(255, 255, 255, .2);
  font-size: .68rem;
  letter-spacing: .08em;
}

.f-links {
  display: flex;
  gap: 2rem;
}

.f-links a {
  color: rgba(255, 255, 255, .3);
  text-decoration: none;
  font-size: .66rem;
  letter-spacing: .15em;
  text-transform: uppercase;
  transition: color .3s;
}

.f-links a:hover {
  color: var(--gold-light);
}


/* 11. Scroll-reveal animation (JS adds .visible when scrolled into view)
   ========================================================================== */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}


/* 12. Gallery tools
   ========================================================================== */

/* 12a. Toolbar — pinned under the nav while scrolling a suite */
.g-toolbar {
  max-width: var(--content-width);
  margin: 0 auto 1.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: .7rem .9rem;
  background: rgba(251, 249, 244, .94);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border-light);
  position: sticky;
  top: var(--nav-offset);
  z-index: var(--z-toolbar);
  transition: box-shadow .3s;
}

.suite:nth-of-type(even) .g-toolbar {
  background: rgba(240, 236, 223, .94);
}

.g-toolbar.has-sel {
  box-shadow: 0 8px 28px rgba(0, 0, 0, .08);
  border-color: var(--gold-line);
}

.g-tb-left {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
  min-width: 0;
}

.g-count {
  font-family: var(--font-serif);
  font-size: 1rem;
  color: var(--dark);
}

.g-hint {
  font-size: .72rem;
  color: var(--text-body);
  letter-spacing: .02em;
}

.g-tb-right {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
}

/* 12b. Toolbar buttons */
.g-btn {
  font-family: var(--font-sans);
  font-size: .64rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 500;
  padding: .55rem .95rem;
  border: 1px solid var(--gold-line);
  background: transparent;
  color: var(--dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: all .25s;
  white-space: nowrap;
}

.g-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.g-btn:hover:not(:disabled) {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--dark);
}

.g-btn:disabled {
  opacity: .35;
  cursor: default;
}

.g-btn.is-on {
  background: var(--dark);
  border-color: var(--dark);
  color: var(--gold-light);
}

.g-btn[hidden] {
  display: none;
}

/* 12c. Photo selection states */
.masonry figure:focus-visible {
  outline: 3px solid var(--gold-light);
}

.suite.select-mode .masonry figure {
  cursor: pointer;
}

.masonry figure.is-selected {
  outline: 3px solid var(--gold);
}

.masonry figure.is-selected img {
  opacity: .82;
}

/* Round tick button in each photo's corner */
.g-check {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 3;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: rgba(20, 20, 18, .28);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  opacity: 0;
  transition: opacity .2s, background .2s;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .25);
}

.g-check svg {
  width: 14px;
  height: 14px;
  opacity: 0;
  transition: opacity .15s;
}

.masonry figure:hover .g-check,
.masonry figure:focus-within .g-check,
.suite.select-mode .g-check,
.masonry figure.is-selected .g-check {
  opacity: 1;
}

.masonry figure.is-selected .g-check {
  background: var(--gold);
  border-color: var(--gold);
}

.masonry figure.is-selected .g-check svg {
  opacity: 1;
}

/* Touch screens have no hover: only show ticks in select mode */
@media (hover: none) {
  .suite:not(.select-mode) .masonry figure:not(.is-selected) .g-check {
    opacity: 0;
    pointer-events: none;
  }
}

/* 12d. Toast notification */
.g-toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  transform: translate(-50%, 20px);
  background: var(--dark);
  color: #fff;
  font-size: .8rem;
  padding: .8rem 1.3rem;
  border: 1px solid var(--gold-glow);
  z-index: var(--z-toast);
  opacity: 0;
  pointer-events: none;
  transition: all .35s;
  max-width: calc(100% - 2rem);
  text-align: center;
}

.g-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}


/* 13. Lightbox (full-screen photo viewer)
   ========================================================================== */
.lb {
  position: fixed;
  inset: 0;
  z-index: var(--z-lightbox);
  background: #0C0C0A;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transition: opacity .25s;
}

.lb[hidden] {
  display: none;
}

.lb.open {
  opacity: 1;
}

/* Top bar: title, counter and tools */
.lb-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .9rem 1.2rem;
  color: #fff;
  flex-shrink: 0;
}

.lb-meta {
  display: flex;
  align-items: baseline;
  gap: .9rem;
  min-width: 0;
}

.lb-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  color: var(--gold-light);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-counter {
  font-size: .7rem;
  letter-spacing: .16em;
  color: rgba(255, 255, 255, .45);
}

.lb-tools {
  display: flex;
  align-items: center;
  gap: .35rem;
}

.lb-btn {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .04);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all .2s;
}

.lb-btn svg {
  width: 17px;
  height: 17px;
}

.lb-btn:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--dark);
}

.lb-zoom {
  min-width: 3.4rem;
  text-align: center;
  font-size: .7rem;
  letter-spacing: .08em;
  color: rgba(255, 255, 255, .6);
}

/* Photo area */
.lb-body {
  flex: 1;
  position: relative;
  min-height: 0;
}

.lb-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;          /* JS handles pinch / pan / swipe */
  cursor: zoom-in;
  user-select: none;
}

.lb-stage.zoomed {
  cursor: grab;
}

.lb-stage.dragging {
  cursor: grabbing;
}

.lb-img {
  max-width: calc(100% - 7rem);  /* leaves room for the side arrows */
  max-height: 100%;
  object-fit: contain;
  transform-origin: center center;
  will-change: transform;
  -webkit-user-drag: none;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.lb-img.anim {
  transition: transform .22s ease;
}

/* Previous / next arrows */
.lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 46px;
  height: 64px;
  border: none;
  background: rgba(255, 255, 255, .06);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s;
}

.lb-nav svg {
  width: 22px;
  height: 22px;
}

.lb-nav:hover {
  background: var(--gold);
  color: var(--dark);
}

.lb-prev {
  left: .8rem;
}

.lb-next {
  right: .8rem;
}

.lb-nav[hidden] {
  display: none;
}

/* Caption */
.lb-caption {
  padding: .8rem 1.2rem 1.1rem;
  text-align: center;
  color: rgba(255, 255, 255, .75);
  font-size: .8rem;
  letter-spacing: .04em;
  flex-shrink: 0;
  min-height: 2.6rem;
}

.lb-caption small {
  display: block;
  margin-top: .3rem;
  font-size: .64rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .3);
}


/* 14. Responsive overrides
   ========================================================================== */

/* Tablet */
@media (max-width: 1024px) {
  .nav      { padding: 1rem 2rem; }
  .g-hero   { padding: 9rem 2rem 4rem; }
  .suite    { padding: 4.5rem 2rem; }
  .masonry  { column-count: 2; }
  .cta      { padding: 4rem 2rem; }
  .footer   { padding: 2.5rem 2rem; }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --nav-offset: 66px;
  }

  /* Nav collapses into a toggled drop-down */
  .nav {
    padding: 1rem 1.5rem;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(20, 20, 18, .98);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    border-bottom: 1px solid var(--gold-glow);
  }

  .nav-links.show { display: flex; }
  .mobile-toggle  { display: block; }

  /* Page sections */
  .g-hero       { padding: 8rem 1.5rem 3.5rem; }
  .suite        { padding: 3.5rem 1.5rem; }
  .suite-head   { flex-direction: column; align-items: flex-start; }
  .suite-specs  { gap: 1.4rem; }
  .masonry      { column-count: 1; }
  .cta          { padding: 3.5rem 1.5rem; }
  .footer {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
    padding: 2.5rem 1.5rem;
  }

  /* Gallery tools */
  .g-toolbar { padding: .6rem .7rem; }
  .g-hint    { display: none; }
  .g-btn     { padding: .5rem .7rem; font-size: .6rem; }
  .g-tb-right [data-action="clear"] { display: none !important; }  /* "Done" clears instead */

  /* Lightbox: full-width photo, compact controls, pinch replaces zoom buttons */
  .lb-img { max-width: 100%; }
  .lb-nav {
    width: 38px;
    height: 52px;
    background: rgba(0, 0, 0, .35);
  }
  .lb-prev { left: .3rem; }
  .lb-next { right: .3rem; }
  .lb-zoom,
  .lb-btn[data-action="zoom-out"],
  .lb-btn[data-action="zoom-in"],
  .lb-caption small {
    display: none;
  }
}
