/* =====================================================================
   BOSTON FLOWERS — GALLERY PAGE — gallery.css
   ===================================================================== */

#gal-hero { height: auto; }

.scroll-progress { position: fixed; top: 0; left: 0; width: 0%; height: 2px; background: var(--rose); z-index: 600; pointer-events: none; transition: width .08s linear; }

.wa-float { position: fixed; bottom: 24px; right: 20px; z-index: 400; width: 52px; height: 52px; border-radius: 50%; background: var(--wine); display: flex; align-items: center; justify-content: center; text-decoration: none; box-shadow: 0 4px 20px rgba(110,31,50,.45); opacity: 0; transform: translateY(16px); transition: opacity .4s ease, transform .4s ease, background .3s; pointer-events: none; }
.wa-float.visible { opacity: 1; transform: translateY(0); pointer-events: all; animation: waFloat 3s ease-in-out 1s infinite; }
.wa-float:hover { background: #8B2640; animation: none; }
.wa-float svg { width: 24px; height: 24px; fill: #fff; }

.hero-bf { position: absolute; right: 15%; top: 50%; transform: translateY(-50%); font-family: 'Cormorant Garamond', serif; font-size: clamp(200px, 26vw, 380px); font-weight: 300; line-height: 1; letter-spacing: -.04em; color: var(--t1); opacity: .055; filter: blur(1.5px); pointer-events: none; user-select: none; z-index: 1; white-space: nowrap; }

#gal-hero { position: relative; min-height: 100svh; display: flex; align-items: center; overflow: hidden; }
#gal-hero .hero-bg { position: absolute; inset: 0; background: linear-gradient(135deg, #0a1410 0%, #162018 30%, #1e1018 65%, #0e1510 100%); background-size: 400% 400%; animation: gradDrift 14s ease-in-out infinite; will-change: background-position; }
#gal-hero .hero-bg::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(17,19,21,.97) 0%, rgba(17,19,21,.2) 55%, transparent 100%); }
#gal-hero .glow-r { position: absolute; right: -60px; top: 40%; transform: translateY(-50%); width: 60%; height: 120%; background: radial-gradient(ellipse at center, rgba(200,155,147,.18) 0%, transparent 65%); filter: blur(80px); animation: glowPulse 8s ease-in-out infinite; }
#gal-hero .glow-l { position: absolute; left: 5%; top: 15%; width: 350px; height: 350px; background: radial-gradient(ellipse at center, rgba(110,31,50,.15) 0%, transparent 70%); filter: blur(60px); animation: glowPulse 12s ease-in-out 3s infinite; }

.gal-hero-inner { position: relative; z-index: 2; max-width: 1280px; margin: 0 auto; padding: 160px 48px 100px; width: 100%; }
.gal-hero-eyebrow { display: flex; align-items: center; gap: 16px; margin-bottom: 32px; opacity: 0; animation: fadeUp 1s ease .3s forwards; }
.gal-hero-h1 { font-family: 'Cormorant Garamond', serif; font-size: clamp(52px, 7.5vw, 108px); font-weight: 300; line-height: 1.04; letter-spacing: -.01em; color: var(--t1); margin-bottom: 28px; opacity: 0; animation: fadeUp 1s ease .5s forwards; }
.gal-hero-h1 em { font-style: italic; color: var(--rose); }
.gal-hero-sub { font-size: 17px; color: var(--t2); line-height: 1.75; max-width: 540px; margin-bottom: 44px; opacity: 0; animation: fadeUp 1s ease .7s forwards; }
.gal-hero-meta { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; opacity: 0; animation: fadeUp 1s ease .9s forwards; }
.gal-hero-stat { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--t2); }
.gal-hero-stat strong { color: var(--rose); font-weight: 500; }
.gal-hero-divider { display: block; width: 1px; height: 16px; background: var(--bd); }

#gal-filters { background: var(--ink); border-bottom: 1px solid var(--bd); position: sticky; top: 72px; z-index: 10; }
.gal-filter-row { display: flex; align-items: center; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.gal-filter-row::-webkit-scrollbar { display: none; }
.gal-filter-btn { flex-shrink: 0; background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--t2); font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; padding: 20px 24px; cursor: pointer; transition: color .25s, border-color .25s; white-space: nowrap; }
.gal-filter-btn:hover { color: var(--t1); }
.gal-filter-btn.is-active { color: var(--rose); border-bottom-color: var(--rose); }

/* ================================================================
   GRID DESKTOP — 6 колонок
   18 видимых карточек / 6 = ровно 3 ряда без остатка
   dense заполняет все пробелы автоматически
   ================================================================ */
#gal-grid-section { background: var(--olive-dim); padding: 3px 0 0; }

.gal-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-rows: clamp(140px, 12vw, 200px);
  grid-auto-flow: dense;
  gap: 4px;
}

/* Паттерн разных размеров — каждая 6я tall, каждая 9я wide */
.gal-item:nth-child(6n+1) { grid-row: span 2; }
.gal-item:nth-child(9n+4) { grid-column: span 2; }

.gal-item { overflow: hidden; position: relative; cursor: pointer; min-width: 0; min-height: 0; transition: opacity .4s ease; }

.gal-ph { position: absolute; inset: 0; background: linear-gradient(135deg, var(--olive-dim) 0%, var(--olive) 60%, #0f1a10 100%); background-size: 200% 200%; animation: gradDrift 18s ease infinite; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; transition: transform .7s ease; }
.gal-item:hover .gal-ph { transform: scale(1.04); }
.gal-photo { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .7s ease; }
.gal-item:hover .gal-photo { transform: scale(1.04); }
.gal-ph-num { font-family: 'Cormorant Garamond', serif; font-size: 36px; font-weight: 300; color: rgba(200,155,147,.18); line-height: 1; }
.gal-ph-label { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: rgba(200,155,147,.28); text-align: center; padding: 0 12px; line-height: 1.5; }

.gal-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(17,19,21,.92) 0%, rgba(17,19,21,.3) 50%, transparent 100%); display: flex; flex-direction: column; justify-content: flex-end; padding: 20px; opacity: 0; transition: opacity .3s ease; }
.gal-item:hover .gal-overlay { opacity: 1; }
.gal-overlay-cat { margin-bottom: 4px; display: block; }
.gal-overlay-title { font-family: 'Cormorant Garamond', serif; font-size: clamp(14px, 1.5vw, 20px); font-weight: 300; color: var(--t1); line-height: 1.2; margin-bottom: 8px; }
.gal-overlay-title em { color: var(--rose); font-style: italic; }
.gal-overlay-link { font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--rose); }

.gal-hidden { display: none; }

.gal-load-wrap { background: var(--olive-dim); display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 24px 64px; border-top: 1px solid rgba(200,155,147,.08); }
.gal-load-btn { display: inline-flex; align-items: center; gap: 10px; background: transparent; border: 1px solid var(--rose); color: var(--rose); font-family: 'DM Sans', sans-serif; font-size: 11px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; padding: 14px 32px; cursor: pointer; transition: background .25s, color .25s; }
.gal-load-btn:hover { background: var(--rose); color: var(--ink); }
.gal-load-count { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--t2); margin: 0; }

#gal-break { background: var(--ivory); padding: 96px 0; }
.gal-break-inner { display: grid; grid-template-columns: 1fr 1fr; gap: 80px; align-items: center; }
.gal-break-eyebrow { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.gal-break-h { font-family: 'Cormorant Garamond', serif; font-size: clamp(32px, 4vw, 52px); font-weight: 300; color: var(--ink); line-height: 1.1; margin-bottom: 20px; }
.gal-break-h em { font-style: italic; color: var(--wine); }
.gal-break-txt { font-size: 15px; color: rgba(17,19,21,.65); line-height: 1.75; margin-bottom: 40px; max-width: 420px; }
.gal-break-stats { display: flex; gap: 32px; flex-wrap: wrap; }
.gal-break-stat { display: flex; flex-direction: column; gap: 4px; }
.gal-break-num { font-family: 'Cormorant Garamond', serif; font-size: 40px; font-weight: 300; color: var(--wine); line-height: 1; }
.gal-break-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(17,19,21,.5); }
.gal-break-quote { background: var(--ivory-dim); border-left: 3px solid var(--wine); padding: 32px 36px; margin: 0 0 32px; }
.gal-break-quote-txt { font-family: 'Cormorant Garamond', serif; font-size: clamp(18px, 2vw, 24px); font-weight: 300; font-style: italic; color: var(--ink); line-height: 1.5; margin-bottom: 16px; }
.gal-break-quote-by { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: rgba(17,19,21,.5); font-style: normal; display: block; }
.gal-break-cta { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.btn-wine-dark { display: inline-block; font-family: 'DM Sans', sans-serif; font-size: 13px; font-weight: 500; letter-spacing: .15em; text-transform: uppercase; text-decoration: none; padding: 15px 34px; background: var(--wine); color: var(--ivory); transition: background .3s; }
.btn-wine-dark:hover { background: #8B2640; }

#gal-cta { position: relative; overflow: hidden; padding: 100px 0; text-align: center; }
.gal-cta-bg { position: absolute; inset: 0; background: linear-gradient(135deg, #1a0810 0%, #3d0f1c 30%, #6E1F32 55%, #4a1520 75%, #1a0810 100%); background-size: 400% 400%; animation: gradDrift 14s ease infinite; }
.gal-cta-bg::after { content: ''; position: absolute; inset: 0; background: rgba(0,0,0,.3); }
.gal-cta-inner { position: relative; z-index: 2; max-width: 640px; margin: 0 auto; padding: 0 48px; }
.gal-cta-eyebrow { display: block; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: rgba(243,238,231,.5); margin-bottom: 28px; }
.gal-cta-addr { font-family: 'Cormorant Garamond', serif; font-size: clamp(36px, 5vw, 62px); font-weight: 300; color: var(--ivory); line-height: 1.1; margin-bottom: 20px; }
.gal-cta-addr em { color: rgba(200,155,147,.85); font-style: italic; }
.gal-cta-sub { font-size: 15px; color: rgba(243,238,231,.6); line-height: 1.7; margin-bottom: 40px; }
.gal-cta-btns { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

.gal-lightbox { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 24px 80px; opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.gal-lightbox.is-open { opacity: 1; pointer-events: auto; }
.gal-lb-backdrop { position: fixed; inset: 0; background: rgba(11,14,12,.97); z-index: 999; opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.gal-lb-backdrop.is-open { opacity: 1; pointer-events: auto; }
.gal-lb-content { position: relative; z-index: 1001; display: flex; flex-direction: column; align-items: center; gap: 20px; max-width: 800px; width: 100%; }
.gal-lb-img-wrap { width: 100%; aspect-ratio: 4/5; max-height: 70vh; overflow: hidden; position: relative; }
.gal-lb-img-wrap .gal-ph { position: absolute; inset: 0; height: 100%; }
.gal-lb-cat { display: block; margin-bottom: 8px; }
.gal-lb-title { font-family: 'Cormorant Garamond', serif; font-size: 24px; font-weight: 300; color: var(--t1); line-height: 1.2; margin: 0; text-align: center; }
.gal-lb-close { position: fixed; top: 24px; right: 24px; background: transparent; border: 1px solid rgba(200,155,147,.25); color: var(--t2); font-size: 22px; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: color .2s, border-color .2s; z-index: 1002; }
.gal-lb-close:hover { color: var(--t1); border-color: var(--rose); }
.gal-lb-prev, .gal-lb-next { position: fixed; top: 50%; transform: translateY(-50%); background: transparent; border: 1px solid rgba(200,155,147,.2); color: var(--t2); font-size: 18px; width: 48px; height: 64px; display: flex; align-items: center; justify-content: center; cursor: pointer; transition: color .2s, border-color .2s; z-index: 1002; }
.gal-lb-prev { left: 20px; }
.gal-lb-next { right: 20px; }
.gal-lb-prev:hover, .gal-lb-next:hover { color: var(--t1); border-color: var(--rose); }

.r { opacity: 0; transform: translateY(20px); transition: opacity .7s ease, transform .7s ease; }
.r.d1 { transition-delay: .1s; }
.r.d2 { transition-delay: .2s; }
.r.d3 { transition-delay: .3s; }
.r.on { opacity: 1; transform: none; }

/* ================================================================
   TABLET — 1024px: 3 колонки
   18 / 3 = 6 рядов ровно, паттерн 3n+1 tall
   ================================================================ */
@media (max-width: 1024px) {
  .gal-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: clamp(140px, 18vw, 220px);
    grid-auto-flow: dense;
  }
  .gal-item:nth-child(6n+1) { grid-row: span 1; }
  .gal-item:nth-child(9n+4) { grid-column: span 1; }
  .gal-item:nth-child(4n+1) { grid-row: span 2; }
}

/* ================================================================
   MOBILE — 640px: 2 колонки
   18 / 2 = 9 рядов ровно, паттерн 6n+1 tall без дыр
   44я карточка — широкая (занимает 2 колонки)
   ================================================================ */
@media (max-width: 640px) {
  .gal-hero-inner { padding: max(140px, calc(var(--nav-h) + 60px)) max(20px, env(safe-area-inset-left)) 80px; }
  #gal-filters { top: 60px; }

  .gal-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: clamp(130px, 34vw, 170px);
    grid-auto-flow: dense;
  }

  .gal-item:nth-child(6n+1) { grid-row: span 1; }
  .gal-item:nth-child(9n+4) { grid-column: span 1; }
  .gal-item:nth-child(4n+1) { grid-row: span 2; }
  .gal-item:nth-child(44) { grid-column: span 2; grid-row: span 1; }

  .gal-overlay { opacity: 1; background: linear-gradient(to top, rgba(17,19,21,.88) 0%, rgba(17,19,21,.2) 60%, transparent 100%); }
  .gal-break-inner { grid-template-columns: 1fr; gap: 40px; }
  .gal-break-txt { max-width: 100%; }
  .gal-break-cta { justify-content: center; flex-direction: column; align-items: center; }
  .btn-wine-dark { width: 100%; text-align: center; }
  .gal-cta-inner { padding: 0 max(20px, env(safe-area-inset-left)); }
  .gal-lightbox { padding: 16px 56px; }
  .gal-lb-img-wrap { max-height: 55vh; }
  .hero-bf { display: none; }
  .wa-float { bottom: 20px; right: 16px; width: 48px; height: 48px; }
}

/* ================================================================
   LANDSCAPE — 4 колонки
   ================================================================ */
@media (max-width: 1100px) and (orientation: landscape) and (min-width: 640px) {
  #gal-hero { min-height: 0 !important; height: auto !important; }
  .gal-hero-inner { padding-top: calc(var(--nav-h) + 48px) !important; padding-bottom: 80px !important; }
  .gal-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-auto-rows: clamp(120px, 15vw, 180px);
    grid-auto-flow: dense;
  }
  .gal-item:nth-child(6n+1) { grid-row: span 1; }
  .gal-item:nth-child(9n+4) { grid-column: span 1; }
  .gal-item:nth-child(5n+1) { grid-row: span 2; }
  .hero-bf { display: none; }
}

/* FINAL HERO FRONT-PAGE RHYTHM + NO OBSERVER JITTER */
#gal-hero .gal-hero-eyebrow{margin-bottom:32px;opacity:0;animation:fadeUp 1s ease .3s forwards;}
#gal-hero .gal-hero-h1{margin-bottom:28px;opacity:0;animation:fadeUp 1s ease .5s forwards;}
#gal-hero .gal-hero-sub{margin-bottom:48px;opacity:0;animation:fadeUp 1s ease .7s forwards;}
#gal-hero .gal-hero-meta{gap:24px;opacity:0;animation:fadeUp 1s ease .9s forwards;}
@media(max-width:640px){
  #gal-hero .gal-hero-eyebrow{margin-bottom:22px;}
  #gal-hero .gal-hero-h1{margin-bottom:24px;}
  #gal-hero .gal-hero-sub{margin-bottom:34px;}
}
