/* ============================================================
   LABEL — public widgets (Gilded Noir)
   Scope: .lbl- prefix only. Covers:
   A) "Ask LABEL" concierge chat   B) Push-reminder UI
   C) The Golden Wall (live photo wall)
   Loaded after main.css; relies on its custom properties.
   ============================================================ */

/* ------------------------------------------------------------
   A) ASK LABEL — floating button
   ------------------------------------------------------------ */
.lbl-chat-fab {
  position: fixed;
  right: clamp(1rem, 3vw, 1.8rem);
  bottom: clamp(1rem, 3vh, 1.8rem);
  z-index: 240;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--espresso, #1C1712);
  border: 1px solid var(--gold, #C9A227);
  box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.14), 0 8px 28px rgba(0, 0, 0, 0.55);
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--gold, #C9A227);
  transition: transform 0.3s var(--ease, ease), box-shadow 0.3s var(--ease, ease);
}
.lbl-chat-fab svg { width: 26px; height: 26px; display: block; }
.lbl-chat-fab:hover,
.lbl-chat-fab:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 0 0 5px rgba(201, 162, 39, 0.25), 0 10px 30px rgba(0, 0, 0, 0.6);
}
.lbl-chat-fab:focus-visible { outline: 2px solid var(--champagne, #E8D5A3); outline-offset: 3px; }
.lbl-chat-fab[hidden] { display: none; }

/* ------------------------------------------------------------
   A) ASK LABEL — panel
   ------------------------------------------------------------ */
.lbl-chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 248;
  background: rgba(14, 12, 9, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease, ease);
}
.lbl-chat-overlay.lbl-open { opacity: 1; pointer-events: auto; }

.lbl-chat-panel {
  position: fixed;
  right: clamp(1rem, 3vw, 1.8rem);
  bottom: clamp(1rem, 3vh, 1.8rem);
  z-index: 250;
  width: 380px;
  max-width: calc(100vw - 2rem);
  max-height: min(640px, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  background: var(--noir, #0E0C09);
  border: 1px solid var(--gold-soft, rgba(201, 162, 39, 0.35));
  clip-path: var(--cut, none);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.65);
  transform: translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.35s var(--ease, ease), opacity 0.35s var(--ease, ease);
}
.lbl-chat-panel.lbl-open { transform: none; opacity: 1; pointer-events: auto; }

.lbl-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem 0.9rem;
  border-bottom: 1px solid rgba(201, 162, 39, 0.22);
  background: var(--espresso, #1C1712);
}
.lbl-chat-head h2 {
  font-family: var(--serif, "Fraunces", Georgia, serif);
  font-weight: 400;
  font-size: 1.3rem;
  color: var(--champagne, #E8D5A3);
  margin: 0;
  line-height: 1.2;
}
.lbl-chat-head h2 em { font-style: italic; color: var(--gold, #C9A227); }
.lbl-chat-close {
  background: none;
  border: 1px solid rgba(245, 239, 228, 0.25);
  color: var(--ash, #9A938A);
  width: 36px;
  height: 36px;
  flex: none;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: all 0.3s var(--ease, ease);
}
.lbl-chat-close:hover, .lbl-chat-close:focus-visible { border-color: var(--gold, #C9A227); color: var(--gold, #C9A227); }

.lbl-chat-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 1.1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(201, 162, 39, 0.4) transparent;
  overscroll-behavior: contain;
  min-height: 180px;
}
.lbl-msg {
  max-width: 86%;
  padding: 0.65rem 0.95rem;
  font-size: 0.93rem;
  line-height: 1.55;
  white-space: pre-line;
  overflow-wrap: break-word;
}
.lbl-msg.lbl-bot {
  align-self: flex-start;
  background: var(--espresso, #1C1712);
  border: 1px solid rgba(201, 162, 39, 0.2);
  color: var(--ivory, #F5EFE4);
  clip-path: var(--cut, none);
}
.lbl-msg.lbl-user {
  align-self: flex-end;
  background: rgba(201, 162, 39, 0.16);
  border: 1px solid rgba(201, 162, 39, 0.35);
  color: var(--champagne, #E8D5A3);
}
.lbl-msg.lbl-error {
  border-color: rgba(196, 80, 46, 0.55);
  color: var(--terracotta, #C4502E);
}
.lbl-msg a { color: var(--gold, #C9A227); text-decoration: underline; text-underline-offset: 2px; }
.lbl-msg a:hover { color: var(--champagne, #E8D5A3); }

/* typing indicator — three gold dots */
.lbl-typing { display: inline-flex; gap: 5px; align-items: center; padding: 0.3rem 0.1rem; }
.lbl-typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold, #C9A227);
  animation: lblDot 1.1s ease-in-out infinite;
}
.lbl-typing i:nth-child(2) { animation-delay: 0.18s; }
.lbl-typing i:nth-child(3) { animation-delay: 0.36s; }
@keyframes lblDot { 0%, 60%, 100% { opacity: 0.25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.lbl-chat-form {
  display: flex;
  gap: 0.55rem;
  padding: 0.8rem 1rem 0.45rem;
  border-top: 1px solid rgba(201, 162, 39, 0.22);
}
.lbl-chat-input {
  flex: 1;
  min-width: 0;
  background: var(--espresso, #1C1712);
  border: 1px solid rgba(201, 162, 39, 0.25);
  color: var(--ivory, #F5EFE4);
  font-family: var(--sans, sans-serif);
  font-size: 16px; /* no iOS zoom */
  padding: 0.65rem 0.85rem;
  min-height: 44px;
}
.lbl-chat-input::placeholder { color: var(--ash, #9A938A); }
.lbl-chat-input:focus { outline: none; border-color: var(--gold, #C9A227); }
.lbl-chat-send {
  flex: none;
  width: 46px;
  min-height: 44px;
  background: var(--gold, #C9A227);
  border: 1px solid var(--gold, #C9A227);
  color: var(--noir, #0E0C09);
  display: grid;
  place-items: center;
  cursor: pointer;
  clip-path: var(--cut, none);
  transition: background 0.3s var(--ease, ease);
}
.lbl-chat-send svg { width: 18px; height: 18px; }
.lbl-chat-send:hover, .lbl-chat-send:focus-visible { background: var(--champagne, #E8D5A3); }
.lbl-chat-send:disabled { opacity: 0.45; cursor: default; }

.lbl-chat-note {
  font-size: 0.7rem;
  color: var(--ash, #9A938A);
  padding: 0 1.05rem 0.85rem;
  margin: 0;
  letter-spacing: 0.03em;
  line-height: 1.5;
}
.lbl-chat-note a { color: var(--ash, #9A938A); text-decoration: underline; text-underline-offset: 2px; }
.lbl-chat-note a:hover { color: var(--champagne, #E8D5A3); }

/* Mobile: slide-up sheet sitting above the tab bar */
@media (max-width: 760px) {
  .lbl-chat-fab { bottom: calc(78px + env(safe-area-inset-bottom)); }
  .lbl-chat-panel {
    left: 0.6rem;
    right: 0.6rem;
    width: auto;
    max-width: none;
    bottom: calc(74px + env(safe-area-inset-bottom));
    max-height: min(72vh, calc(100vh - 130px - env(safe-area-inset-bottom)));
    transform: translateY(24px);
  }
}

/* ------------------------------------------------------------
   B) PUSH REMINDERS — button state + iOS install sheet
   ------------------------------------------------------------ */
[data-remind].lbl-remind-on {
  background: var(--gold, #C9A227) !important;
  border-color: var(--gold, #C9A227) !important;
  color: var(--noir, #0E0C09) !important;
}

.lbl-push-sheet {
  position: fixed;
  left: 50%;
  bottom: clamp(1rem, 4vh, 2rem);
  transform: translate(-50%, 14px);
  z-index: 260;
  width: min(420px, calc(100vw - 1.6rem));
  background: var(--espresso, #1C1712);
  border: 1px solid var(--gold-soft, rgba(201, 162, 39, 0.35));
  clip-path: var(--cut, none);
  box-shadow: 0 14px 50px rgba(0, 0, 0, 0.6);
  padding: 1.3rem 1.4rem 1.2rem;
  opacity: 0;
  pointer-events: none;
  transition: all 0.35s var(--ease, ease);
}
.lbl-push-sheet.lbl-open { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.lbl-push-sheet p { color: var(--ivory, #F5EFE4); font-size: 0.95rem; line-height: 1.6; margin: 0 0 1rem; }
.lbl-push-sheet p strong { color: var(--champagne, #E8D5A3); }
.lbl-push-sheet .lbl-sheet-actions { display: flex; justify-content: flex-end; }
@media (max-width: 760px) {
  .lbl-push-sheet { bottom: calc(78px + env(safe-area-inset-bottom)); }
}

/* ------------------------------------------------------------
   C) THE GOLDEN WALL
   ------------------------------------------------------------ */
.lbl-wall-upload {
  background: var(--espresso, #1C1712);
  border: 1px solid rgba(201, 162, 39, 0.25);
  clip-path: var(--cut, none);
  padding: clamp(1.6rem, 4vw, 2.4rem);
  display: grid;
  gap: 1.1rem;
  max-width: 640px;
}
.lbl-wall-upload input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
.lbl-wall-pick {
  justify-content: center;
  width: 100%;
  font-size: 1rem;
  padding: 1.15rem 1.5rem;
  cursor: pointer;
}
/* gold focus ring when the hidden input is keyboard-focused */
.lbl-wall-upload input[type="file"]:focus-visible + .lbl-wall-pick {
  outline: 2px solid var(--champagne, #E8D5A3);
  outline-offset: 3px;
}
.lbl-wall-preview {
  display: none;
  align-items: center;
  gap: 1rem;
}
.lbl-wall-preview.lbl-has-img { display: flex; }
.lbl-wall-preview img {
  width: 84px;
  height: 84px;
  object-fit: cover;
  border: 1px solid var(--gold, #C9A227);
  clip-path: var(--cut, none);
}
.lbl-wall-preview span { font-size: 0.85rem; color: var(--ash, #9A938A); overflow-wrap: anywhere; }
.lbl-wall-name {
  width: 100%;
  background: var(--noir, #0E0C09);
  border: 1px solid rgba(201, 162, 39, 0.25);
  color: var(--ivory, #F5EFE4);
  font-family: var(--sans, sans-serif);
  font-size: 16px;
  padding: 0.85rem 1rem;
  min-height: 48px;
}
.lbl-wall-name::placeholder { color: var(--ash, #9A938A); }
.lbl-wall-name:focus { outline: none; border-color: var(--gold, #C9A227); }
.lbl-wall-consent { font-size: 0.85rem; line-height: 1.55; }
.lbl-wall-consent a { color: var(--champagne, #E8D5A3); text-decoration: underline; text-underline-offset: 2px; }
.lbl-wall-submit { justify-content: center; }
.lbl-wall-submit:disabled { opacity: 0.4; cursor: default; pointer-events: none; }
.lbl-wall-status { font-size: 0.85rem; color: var(--ash, #9A938A); margin: 0; min-height: 1.3em; }

/* mosaic */
.lbl-wall-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-auto-rows: 150px;
  grid-auto-flow: dense;
  gap: 10px;
}
.lbl-tile {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--gold, #C9A227);
  background: var(--espresso, #1C1712);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s var(--ease, ease), transform 0.7s var(--ease, ease);
  margin: 0;
}
.lbl-tile.lbl-in { opacity: 1; transform: none; }
.lbl-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: sepia(0.1) saturate(1.05);
}
.lbl-tile figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1.6rem 0.7rem 0.5rem;
  background: linear-gradient(transparent, rgba(14, 12, 9, 0.85));
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--champagne, #E8D5A3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* varied tile rhythm — every few frames grow */
.lbl-tile:nth-child(6n + 1) { grid-column: span 2; grid-row: span 2; }
.lbl-tile:nth-child(8n + 4) { grid-row: span 2; }
@media (max-width: 480px) {
  .lbl-wall-grid { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 42vw; gap: 8px; }
  .lbl-tile:nth-child(6n + 1) { grid-column: span 2; grid-row: span 1; }
  .lbl-tile:nth-child(8n + 4) { grid-row: span 1; }
}

.lbl-wall-empty {
  border: 1px dashed rgba(201, 162, 39, 0.4);
  padding: clamp(3rem, 9vw, 5rem) 1.5rem;
  text-align: center;
  font-family: var(--serif, "Fraunces", Georgia, serif);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  font-style: italic;
  color: var(--champagne, #E8D5A3);
}

/* wall closed (no API configured) */
.lbl-wall-closed {
  border: 1px solid rgba(201, 162, 39, 0.3);
  background: var(--espresso, #1C1712);
  clip-path: var(--cut, none);
  padding: clamp(2.6rem, 7vw, 4rem) 1.6rem;
  text-align: center;
  max-width: 640px;
}
.lbl-wall-closed h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.2rem);
  color: var(--champagne, #E8D5A3);
  margin-bottom: 0.6rem;
}
.lbl-wall-closed p { color: var(--ash, #9A938A); font-size: 0.98rem; }

/* footer notice */
.lbl-wall-notice {
  font-size: 0.82rem;
  color: var(--ash, #9A938A);
  max-width: 70ch;
  line-height: 1.65;
}
.lbl-wall-notice a { color: var(--champagne, #E8D5A3); text-decoration: underline; text-underline-offset: 2px; }

/* print-friendly QR block (#qr) */
.lbl-wall-qr {
  background: var(--ivory, #F5EFE4);
  color: var(--noir, #0E0C09);
  max-width: 420px;
  padding: 2rem 1.6rem 1.7rem;
  text-align: center;
  clip-path: var(--cut, none);
}
.lbl-wall-qr h2 {
  font-family: var(--serif, "Fraunces", Georgia, serif);
  font-weight: 400;
  font-size: 1.5rem;
  color: var(--noir, #0E0C09);
  margin: 0 0 1.1rem;
}
.lbl-wall-qr canvas {
  width: min(260px, 70vw);
  height: auto;
  image-rendering: pixelated;
  display: block;
  margin: 0 auto;
}
.lbl-wall-qr .lbl-qr-url {
  display: block;
  margin-top: 0.9rem;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: #4a443c;
  overflow-wrap: anywhere;
}
@media print {
  body > *:not(main), .site-header, .site-footer, .tabbar, .lbl-chat-fab, .lbl-chat-panel, .lbl-chat-overlay { display: none !important; }
  main > section:not(.lbl-qr-section) { display: none !important; }
  .lbl-wall-qr { clip-path: none; max-width: none; }
  .lbl-wall-qr h2, .lbl-wall-qr .lbl-qr-url { color: #000; }
}

@media (prefers-reduced-motion: reduce) {
  .lbl-chat-fab, .lbl-chat-panel, .lbl-chat-overlay, .lbl-push-sheet, .lbl-tile {
    transition-duration: 0.01ms !important;
  }
  .lbl-typing i { animation: none; opacity: 0.8; }
}
