/* ==========================================================================
   components.css — buttons, cards, forms, filters, lightbox, chatbot
   ========================================================================== */

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.9rem 1.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 999px;
  transition: all var(--dur) var(--ease);
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover {
  background: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(107, 122, 90, 0.3);
}
.btn-ghost {
  border-color: var(--ink);
  color: var(--ink);
  background: transparent;
}
.btn-ghost:hover {
  background: var(--ink);
  color: var(--paper);
}
.btn-paper {
  background: var(--paper);
  color: var(--ink);
}
.btn-paper:hover {
  background: var(--accent-soft);
}
.btn .arrow { transition: transform var(--dur) var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

/* Forms */
.form-field { margin-bottom: 1.5rem; }
.form-field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.5rem;
}
.form-field input,
.form-field textarea,
.form-field select {
  width: 100%;
  padding: 0.9rem 1rem;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1rem;
  transition: border-color var(--dur) var(--ease);
  border-radius: 0;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  outline: none;
  border-bottom-color: var(--ink);
}
.form-field textarea { min-height: 140px; resize: vertical; }

/* ========== Gallery grid & cards ========== */

.gallery-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 3rem;
  flex-wrap: wrap;
}
@media (max-width: 720px) {
  .gallery-toolbar { gap: 1rem; padding-block: 1.5rem; }
}
.search-field input { max-width: 100%; }
@media (max-width: 480px) {
  .search-field input { width: 100%; }
  .search-field input:focus { width: 100%; }
  .search-field { flex: 1; min-width: 0; }
  .toolbar-right { width: 100%; }
}

.filter-chips {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.chip {
  padding: 0.5rem 1.1rem;
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.search-field {
  position: relative;
}
.search-field input {
  width: 240px;
  padding: 0.6rem 1rem 0.6rem 2.4rem;
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.875rem;
  transition: all var(--dur) var(--ease);
}
.search-field input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--paper);
  width: 280px;
}
.search-field svg {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--ink-muted);
}

.sort-select {
  padding: 0.6rem 1rem;
  background: rgba(255,255,255,0.5);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.875rem;
  cursor: pointer;
}
.sort-select:focus { outline: none; border-color: var(--ink); }

.filter-summary {
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  color: var(--ink-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.filter-summary button {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: clamp(1.25rem, 2.5vw, 2rem);
}
@media (max-width: 720px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem 0.9rem;
  }
}

.art-card {
  position: relative;
  cursor: pointer;
  animation: cardIn 0.6s var(--ease-out) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .art-card { animation: none; }
}

/* Image frame — uniform square, shimmer skeleton while loading */
.art-card .img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: var(--paper-2);
  border-radius: var(--radius-md);
}
.art-card .img-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    100deg,
    var(--paper-2) 20%,
    var(--paper-warm) 50%,
    var(--paper-2) 80%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  z-index: 0;
}
@keyframes shimmer {
  0%   { background-position: 150% 0; }
  100% { background-position: -50% 0; }
}
.art-card .img-wrap.loaded::before,
.art-card .img-wrap:has(img.loaded)::before {
  display: none;
}
.art-card img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.5s var(--ease-out), transform 1.2s var(--ease-out);
}
.art-card img.loaded {
  opacity: 1;
}
.art-card img.failed {
  opacity: 0.25;
  background: var(--paper-2);
}
.art-card:hover img.loaded { transform: scale(1.05); }
@media (prefers-reduced-motion: reduce) {
  .art-card .img-wrap::before { animation: none; }
  .art-card img { transition: opacity 0.2s; }
  .art-card:hover img { transform: none; }
}

.art-card .overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(0,0,0,0.55) 100%);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
  display: flex;
  align-items: flex-end;
  padding: 1.25rem;
}
.art-card:hover .overlay { opacity: 1; }
.overlay-cta {
  color: var(--paper);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.sold-badge {
  position: absolute;
  top: 1rem;
  left: 1rem;
  padding: 0.35rem 0.75rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-radius: 2px;
  z-index: 2;
}

.art-meta {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-top: 1rem;
}
.art-meta-left { flex: 1; min-width: 0; }
.art-meta h3 {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.25;
  color: var(--ink);
  letter-spacing: 0;
  margin-bottom: 0.2rem;
}
.art-meta .dims {
  font-size: 0.8rem;
  color: var(--ink-muted);
  letter-spacing: 0.02em;
}
.art-meta .price {
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
}
.art-meta .price.sold {
  color: var(--ink-faint);
  text-decoration: line-through;
  font-weight: 400;
}
@media (max-width: 720px) {
  .art-meta { gap: 0.5rem; margin-top: 0.65rem; }
  .art-meta h3 { font-size: 0.95rem; line-height: 1.2; }
  .art-meta .dims { font-size: 0.7rem; }
  .art-meta .price { font-size: 0.85rem; }
  .sold-badge { font-size: 0.55rem; padding: 0.25rem 0.55rem; top: 0.5rem; left: 0.5rem; }
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 5rem 1rem;
  color: var(--ink-muted);
}
.empty-state h3 {
  font-family: var(--font-serif);
  margin-bottom: 0.5rem;
}

/* ========== Lightbox ========== */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(15, 15, 15, 0.85);
  backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 3vw, 2rem);
  overflow-y: auto;
}
.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox-inner {
  position: relative;
  background: var(--paper);
  border-radius: var(--radius-md);
  max-width: 960px;
  width: 100%;
  max-height: min(86vh, 680px);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  transform: translateY(24px);
  transition: transform var(--dur-slow) var(--ease-out);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.lightbox.is-open .lightbox-inner { transform: translateY(0); }

@media (max-width: 820px) {
  .lightbox { padding: 0; align-items: stretch; }
  .lightbox-inner {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    max-height: 100vh;
    max-width: 100%;
    border-radius: 0;
    height: 100vh;
  }
}

.lightbox-img {
  background: #0d0d0d;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  min-height: 0;
  overflow: hidden;
}
.lightbox-img img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}
@media (max-width: 820px) {
  .lightbox-img { min-height: 40vh; max-height: 45vh; }
}

.lightbox-body {
  padding: clamp(1.25rem, 2.5vw, 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow-y: auto;
  min-height: 0;
}
.lightbox-body .eyebrow { margin-bottom: 0; }
.lightbox-body h2 {
  font-family: var(--font-serif);
  font-size: clamp(1.65rem, 2.6vw, 2.15rem);
  font-weight: 300;
  letter-spacing: -0.01em;
  line-height: 1.1;
  margin: 0;
}
.lightbox-body .description {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
}
.lightbox-body .specs {
  list-style: none;
  border-top: 1px solid var(--line);
  padding-top: 0.75rem;
  margin: 0;
}
.lightbox-body .specs li {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.lightbox-body .specs strong {
  font-weight: 500;
  color: var(--ink);
  font-family: var(--font-sans);
}
.lightbox-body .big-price {
  font-family: var(--font-serif);
  font-size: 1.85rem;
  font-weight: 300;
  color: var(--ink);
  line-height: 1;
}
.lightbox-body .big-price.sold {
  color: var(--ink-muted);
  text-decoration: line-through;
}
.sold-notice {
  padding: 0.6rem 0.85rem;
  background: var(--paper-warm);
  border-left: 3px solid var(--accent);
  font-size: 0.8rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* Pin the inquire button at the bottom so it's always visible */
.lightbox-body #lightbox-inquire {
  margin-top: auto;
  align-self: stretch;
  justify-content: center;
  padding: 0.95rem 1.5rem;
  font-size: 0.78rem;
}

.lightbox-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  background: rgba(247, 244, 237, 0.92);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  transition: transform var(--dur) var(--ease);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.lightbox-close:hover { transform: rotate(90deg); }
.lightbox-close svg { width: 16px; height: 16px; }

/* ========== Chatbot ========== */
.chatbot-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 150;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-2);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.chatbot-launcher:hover {
  transform: scale(1.08);
  background: var(--accent);
}
.chatbot-launcher svg { width: 26px; height: 26px; }
.chatbot-launcher .dot-badge {
  position: absolute;
  top: 8px; right: 8px;
  width: 10px; height: 10px;
  background: var(--terracotta);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(181, 104, 74, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(181, 104, 74, 0); }
}

.chatbot-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 160;
  width: min(400px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 48px));
  background: var(--paper);
  border-radius: 20px;
  box-shadow: var(--shadow-3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(0.96);
  opacity: 0;
  visibility: hidden;
  transform-origin: bottom right;
  transition: transform var(--dur) var(--ease-out), opacity var(--dur) var(--ease), visibility var(--dur) var(--ease);
}
.chatbot-panel.is-open {
  transform: translateY(0) scale(1);
  opacity: 1;
  visibility: visible;
}

.chatbot-header {
  padding: 1.25rem 1.25rem 1rem;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.chatbot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--gold) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--paper);
  flex-shrink: 0;
}
.chatbot-header-text { flex: 1; min-width: 0; }
.chatbot-header h4 {
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.2;
}
.chatbot-header .status {
  font-size: 0.75rem;
  color: rgba(247, 244, 237, 0.7);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.chatbot-header .status::before {
  content: "";
  width: 6px; height: 6px;
  background: #8fc28f;
  border-radius: 50%;
}
.chatbot-close {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--paper);
  opacity: 0.7;
  transition: opacity var(--dur) var(--ease);
}
.chatbot-close:hover { opacity: 1; }

.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background:
    radial-gradient(ellipse at top, var(--paper-warm) 0%, transparent 60%),
    var(--paper);
}

.msg {
  max-width: 82%;
  padding: 0.75rem 1rem;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  animation: msgIn 0.4s var(--ease-out);
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.msg.bot {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg.user {
  background: var(--ink);
  color: var(--paper);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.msg a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.msg.user a { color: var(--accent-soft); }

.typing {
  display: inline-flex;
  gap: 4px;
  padding: 0.75rem 1rem;
  align-self: flex-start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
}
.typing span {
  width: 7px; height: 7px;
  background: var(--ink-faint);
  border-radius: 50%;
  animation: typing 1.3s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.chatbot-suggestions {
  padding: 0 1.25rem 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.suggestion-chip {
  font-size: 0.75rem;
  padding: 0.4rem 0.8rem;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  transition: all var(--dur) var(--ease);
}
.suggestion-chip:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.chatbot-input {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.chatbot-input input {
  flex: 1;
  padding: 0.75rem 1rem;
  background: var(--paper-2);
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.9rem;
  transition: border-color var(--dur) var(--ease);
}
.chatbot-input input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--paper);
}
.chatbot-input button {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
  flex-shrink: 0;
}
.chatbot-input button:hover { background: var(--accent); transform: scale(1.05); }
.chatbot-input button svg { width: 18px; height: 18px; }

@media (max-width: 480px) {
  .chatbot-panel {
    bottom: 0;
    right: 0;
    width: 100vw;
    height: 100vh;
    border-radius: 0;
  }
}
