/* ==========================================================
   COMPONENTES REUTILIZABLES
   Botones, cards, tags, filtros, chips, campos de formulario,
   botón flotante de WhatsApp y barra CTA mobile.
   ========================================================== */

/* ---------- Botones ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 999px;
  font-weight: 800;
  font-size: var(--fs-sm);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background-color 0.3s, color 0.3s, border-color 0.3s;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--gold {
  color: #141007;
  background: var(--gold-gradient);
  background-size: 200% auto;
  box-shadow: var(--shadow-gold);
}
.btn--gold:hover { background-position: right center; box-shadow: 0 14px 50px -10px rgba(249, 226, 138, 0.6); }

.btn--ghost {
  color: var(--text);
  border: 1.5px solid var(--border-gold);
  background: rgba(255, 255, 255, 0.02);
}
.btn--ghost:hover { border-color: var(--gold-200); color: var(--gold-200); }

.btn--whatsapp { background: var(--whatsapp); color: #062b14; }
.btn--whatsapp:hover { box-shadow: 0 10px 30px -8px rgba(37, 211, 102, 0.6); }

.btn--sm { padding: 10px 18px; font-size: var(--fs-xs); }
.btn--lg { padding: 18px 32px; font-size: var(--fs-base); }
.btn--block { width: 100%; }

/* Spinner del botón de envío */
.btn__spinner {
  display: none;
  width: 20px; height: 20px;
  border: 2.5px solid rgba(0, 0, 0, 0.25);
  border-top-color: #141007;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.btn.is-loading .btn__label { opacity: 0.6; }
.btn.is-loading .btn__spinner { display: inline-block; }

/* ---------- Card ---------- */
.card {
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-alt) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* ---------- Tag ---------- */
.tag {
  display: inline-block;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-200);
  border: 1px solid var(--border-gold);
  border-radius: 999px;
  background: rgba(189, 147, 55, 0.08);
}

/* ---------- Filtros del portfolio ---------- */
.filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 40px;
}
.filter {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 700;
  font-size: var(--fs-sm);
  transition: all 0.3s var(--ease);
}
.filter:hover { color: var(--text); border-color: var(--border-gold); }
.filter.is-active { color: #141007; background: var(--gold-gradient); border-color: transparent; }

/* En celular los filtros se deslizan horizontalmente en una sola fila */
@media (max-width: 760px) {
  .filters {
    flex-wrap: nowrap;
    justify-content: flex-start;
    overflow-x: auto;
    margin-inline: calc(var(--gutter) * -1);
    padding: 4px var(--gutter);
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .filters::-webkit-scrollbar { display: none; }
  .filter { flex: 0 0 auto; white-space: nowrap; }
}

/* ---------- Lightbox (vista ampliada de trabajos) ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  background: rgba(5, 5, 6, 0.94);
  backdrop-filter: blur(10px);
  animation: fadeUp 0.35s var(--ease);
}
.lightbox[hidden] { display: none; }
body.lb-open { overflow: hidden; }

.lightbox__figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: min(720px, 100%);
  max-height: 100%;
}
.lightbox__figure img {
  max-height: calc(100vh - 150px);
  max-height: calc(100dvh - 150px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}
.lightbox__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  width: 100%;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.lightbox__title { display: block; font-family: var(--font-display); font-size: 1.3rem; text-transform: uppercase; }
.lightbox__count { font-size: var(--fs-xs); color: var(--text-muted); }

.lightbox__close,
.lightbox__nav {
  display: grid;
  place-items: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  border: 1px solid var(--border-gold);
  background: rgba(23, 23, 26, 0.85);
  font-size: 1.8rem;
  line-height: 1;
  color: var(--gold-200);
  transition: background-color 0.25s, color 0.25s;
  flex-shrink: 0;
}
.lightbox__close:hover,
.lightbox__nav:hover { background: var(--gold-500); color: #141007; }
.lightbox__close { position: absolute; top: 16px; right: 16px; font-size: 1.1rem; width: 44px; height: 44px; }

@media (max-width: 760px) {
  .lightbox { padding: 64px 12px 16px; }
  /* en celular las flechas flotan sobre la imagen (también se puede deslizar) */
  .lightbox__nav { position: absolute; top: 45%; width: 42px; height: 42px; font-size: 1.4rem; z-index: 2; }
  .lightbox__nav--prev { left: 8px; }
  .lightbox__nav--next { right: 8px; }
  .lightbox__bar { justify-content: center; text-align: center; }
  .lightbox__figure img { max-height: calc(100dvh - 190px); }
}

/* ---------- Formulario ---------- */
.field { display: flex; flex-direction: column; gap: 8px; border: 0; min-width: 0; }
.field label,
.field legend {
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0;
}
.field legend { margin-bottom: 10px; }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.25s, box-shadow 0.25s;
  font-size: 16px; /* evita zoom en iOS */
}
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23bd9337' stroke-width='2'%3E%3Cpath d='m1 1 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}
.field select option { background: var(--surface); }
.field textarea { resize: vertical; min-height: 110px; }
.field input::placeholder,
.field textarea::placeholder { color: var(--text-dim); }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold-500);
  box-shadow: 0 0 0 4px rgba(189, 147, 55, 0.15);
}

.field.has-error input,
.field.has-error textarea { border-color: var(--error); }
.field__error { color: var(--error); font-size: var(--fs-xs); min-height: 0; }
.field__error:empty { display: none; }

/* Chips (checkbox con estilo) */
.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.25s var(--ease);
}
.chip:hover span { border-color: var(--border-gold); color: var(--text); }
.chip input:checked + span {
  color: #141007;
  background: var(--gold-gradient);
  border-color: transparent;
}
.chip input:focus-visible + span { outline: 2px solid var(--gold-200); outline-offset: 2px; }

/* ---------- Botón flotante WhatsApp ---------- */
.wa-float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  width: 58px; height: 58px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--whatsapp);
  box-shadow: 0 10px 30px -6px rgba(37, 211, 102, 0.55);
  transition: transform 0.3s var(--ease);
  animation: pulse 2.6s infinite;
}
.wa-float svg { width: 30px; height: 30px; fill: #fff; }
.wa-float:hover { transform: scale(1.08); }

/* ---------- Barra CTA mobile ---------- */
.mobile-cta {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 80;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(11, 11, 12, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  transform: translateY(110%);
  transition: transform 0.4s var(--ease);
}
.mobile-cta.is-visible { transform: translateY(0); }

@media (max-width: 760px) {
  .mobile-cta { display: block; }
  /* el botón de WhatsApp sube para no tapar la barra */
  .wa-float { bottom: 88px; right: 16px; width: 52px; height: 52px; }
}
