/* ============================================
   BOTONES — pill plano (Cofounder)
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 13px 24px;
  border-radius: var(--radius-pill);
  font-weight: 500;
  font-size: 0.94rem;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), background 0.2s, color 0.2s;
  text-decoration: none;
  user-select: none;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn--primary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--paper-2);
  box-shadow: 0 6px 18px rgba(15, 25, 18, 0.25);
}
.btn--primary:hover { background: var(--paper-3); color: var(--ink); transform: translateY(-1px); }
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
  background: rgba(15, 25, 18, 0.55);
  color: var(--on-dark);
  border-color: rgba(245, 235, 205, 0.18);
  backdrop-filter: blur(14px);
}
.btn--ghost:hover { background: rgba(15, 25, 18, 0.75); color: var(--on-dark); }

.btn--gold {
  background: linear-gradient(180deg, var(--gold-soft), var(--gold));
  color: var(--ink);
  border-color: var(--gold-2);
  box-shadow: 0 8px 22px rgba(184, 146, 74, 0.4);
}
.btn--gold:hover { background: linear-gradient(180deg, var(--gold), var(--gold-2)); }

.btn--wa {
  background: #128c4b;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: 0 8px 22px rgba(18, 140, 75, 0.35);
}
.btn--wa:hover {
  background: #0e6c39;
  color: #fff;
  transform: translateY(-1px);
}

.btn--solid {
  background: var(--navy);
  color: var(--on-dark);
  border-color: var(--navy);
}
.btn--solid:hover { background: var(--navy-2); }

.btn--full { width: 100%; }

/* ============================================
   MINI-CARDS FLOTANTES (sobre la ilustración hero)
   Estilo "tarjeta de visita vintage": papel cream translúcido,
   ribete dorado sutil (tono lámpara del escritorio), retrato con
   anillo de oro, tipografía serif a juego con el wordmark.
   ============================================ */
.float-card {
  background:
    linear-gradient(155deg, rgba(245, 235, 205, 0.70) 0%, rgba(236, 221, 182, 0.63) 100%);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border: 1px solid rgba(184, 146, 74, 0.35);
  border-radius: var(--radius-md);
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  width: 320px;
  max-width: 88vw;
  box-shadow:
    /* Doble borde (eco del marco del .ms-main): anillo verde interior +
       anillo crema exterior, siguiendo el radio. */
    0 0 0 1px var(--emerald-2),
    0 0 0 2.5px rgba(245, 235, 205, 0.82),
    0 20px 44px rgba(15, 25, 18, 0.42),
    0 2px 6px rgba(15, 25, 18, 0.18),
    inset 0 1px 0 rgba(255, 252, 240, 0.55);
  text-decoration: none;
}

.float-card__avatar {
  width: 180px;
  height: 92px;
  flex-shrink: 0;
  position: relative;
  background-position: center bottom 3px;
  background-repeat: no-repeat;
  background-size: contain;
}
/* Línea inferior delgada y elegante sobre la que se posa la foto.
   Más ancha que la figura para que asome como repisa a ambos lados. */
.float-card__avatar::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  height: 1.5px;
  border-radius: 1px;
  background: linear-gradient(90deg, transparent 0%, var(--emerald) 16%, var(--emerald) 84%, transparent 100%);
}
.float-card__avatar--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(31, 77, 42, 0.45);
}
.float-card__avatar--empty svg { width: 28px; height: 28px; }

.float-card__body { min-width: 0; flex: 1; text-align: center; }
.float-card__name {
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.08rem;
  line-height: 1.15;
  color: var(--ink);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.float-card__loc {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  margin-top: 4px;
  max-width: 100%;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.3;
}
.float-card__loc > span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.float-card__pin {
  flex-shrink: 0;
  display: inline-flex;
  color: #d32f2f;
}
.float-card__pin svg { width: 11px; height: 11px; display: block; }
.float-card__spec {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  color: var(--emerald);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.35;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.float-card__spec::before {
  content: "";
  flex-shrink: 0;
  width: 6px; height: 6px;
  background: var(--emerald);
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(31, 77, 42, 0.55);
  /* Compensa el centro óptico de las mayúsculas (sin descendentes):
     sube el punto ~1px para alinearlo con el texto. */
  transform: translateY(-1px);
}

/* ============================================
   TARJETA DE ABOGADO — estilo plano para grid
   ============================================ */
.card {
  width: 100%;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid rgba(245, 235, 205, 0.45);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(15, 25, 18, 0.36), 0 2px 6px rgba(15, 25, 18, 0.18);
  transition: transform 0.25s var(--ease-out), box-shadow 0.25s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(15, 25, 18, 0.45), 0 2px 6px rgba(15, 25, 18, 0.22);
}

.card__photo {
  width: 100%;
  height: clamp(180px, 22vw, 240px);
  padding-top: 18px;
  /* Backdrop tono footer: degradado de verde-oscuro profundo a casi-negro,
     con un foco cálido arriba-centro. Continuidad visual con el footer y
     la atmósfera de biblioteca en penumbra. */
  background:
    radial-gradient(ellipse 70% 50% at 50% 18%, rgba(224, 196, 128, 0.22), transparent 65%),
    linear-gradient(170deg, #1a2e22 0%, #0a140e 100%);
  position: relative;
  overflow: hidden;
}
/* contain + bottom: para fotos con fondo transparente, el busto queda
   "sentado" sobre el chip de especialidad. El gradiente verde se ve
   alrededor como halo. */
.card__photo img {
  width: 100%; height: 100%;
  object-fit: contain;
  object-position: center bottom;
  display: block;
  -webkit-user-drag: none;
  user-select: none;
  pointer-events: none;
}
.card__photo--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(245, 235, 205, 0.45);
}
.card__photo--empty svg { width: 56px; height: 56px; stroke-width: 1.2; }

.card__body {
  padding: var(--space-4) var(--space-5) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.card__especialidad {
  align-self: center;
  max-width: 100%;
  text-align: center;
  color: var(--emerald);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  line-height: 1.5;
}

.card__name {
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  letter-spacing: -0.015em;
  margin-top: 2px;
  text-align: center;
}

.card__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.86rem;
  color: var(--ink-3);
}
.card__meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.card__meta-row .icon { color: var(--emerald-3); flex-shrink: 0; }
.card__meta-row .icon svg { width: 14px; height: 14px; }

.card__actions {
  padding: 0 var(--space-5) var(--space-5);
  display: flex;
  align-items: stretch;
  gap: var(--space-2);
}

.card__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 10px 14px;
  border-radius: var(--radius-pill);
  background: rgba(15, 25, 18, 0.06);
  border: 1px solid rgba(15, 25, 18, 0.1);
  color: var(--emerald);
  font-weight: 500;
  font-size: 0.82rem;
  text-decoration: none;
  transition: background 0.18s, color 0.18s, transform 0.18s, border-color 0.18s;
}
.card__action:hover {
  background: var(--emerald);
  color: var(--paper);
  border-color: var(--emerald);
  transform: translateY(-1px);
}

/* Botones solo-ícono cuadrados a los lados */
.card__action--icon {
  flex: 0 0 auto;
  width: 48px;
  padding: 10px;
}
.card__action--icon svg { width: 20px; height: 20px; }

.card__action--wa {
  background: #128c4b;
  color: #fff;
  border-color: transparent;
}
.card__action--wa:hover { background: #0e6c39; color: #fff; border-color: transparent; }
.card__action--perfil {
  flex: 1;
  background: var(--emerald);
  color: var(--paper);
  border-color: var(--emerald-2);
  /* Doble borde: eco del marco del .ms-main de la plantilla
     (anillo verde + anillo crema), invertido para fondo esmeralda:
     borde verde profundo exterior + anillo crema interior. */
  box-shadow: inset 0 0 0 2px rgba(236, 221, 182, 0.6);
}
.card__action--perfil:hover { background: var(--emerald-2); color: var(--paper); border-color: var(--emerald-2); }

/* ============================================
   FILTROS / BÚSQUEDA
   ============================================ */
.filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-3);
  padding: var(--space-4) clamp(1rem, 3vw, 2.5rem);
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
}
@media (min-width: 760px) {
  .filters { grid-template-columns: 1fr 1fr 1fr 1.4fr; align-items: end; }
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.filter-field label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--on-dark);
  margin-left: var(--space-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.filter-control {
  position: relative;
  display: flex;
  align-items: center;
}
.filter-control .icon {
  position: absolute;
  left: 14px;
  color: var(--gold-soft);
  pointer-events: none;
}

.filter-field input,
.filter-field select,
.filter-field .cselect__btn {
  width: 100%;
  padding: 12px 16px 12px 40px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(245, 235, 205, 0.16);
  background: rgba(15, 25, 18, 0.55);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  font-size: 0.95rem;
  color: var(--on-dark);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  appearance: none;
  box-shadow: 0 6px 18px rgba(15, 25, 18, 0.25);
}
.filter-field input:focus,
.filter-field select:focus,
.filter-field .cselect__btn:focus,
.filter-field .cselect.is-open .cselect__btn {
  border-color: var(--gold-soft);
  box-shadow: 0 0 0 3px rgba(224, 196, 128, 0.22), 0 6px 18px rgba(15, 25, 18, 0.3);
  background: rgba(15, 25, 18, 0.78);
}
.filter-field input::placeholder { color: rgba(245, 235, 205, 0.5); }

.filter-field select,
.filter-field .cselect__btn {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23E0C480' d='M5 6 0 0h10z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 18px center;
  padding-right: 40px;
}
.filter-field select:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---- Dropdown personalizado (reemplaza el menú nativo del SO) ---- */
.filter-control select.cselect-native {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  margin: 0;
}
.cselect {
  position: relative;
  width: 100%;
}
.cselect__btn {
  display: flex;
  align-items: center;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}
.cselect__btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.cselect.is-open .cselect__btn {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23E0C480' d='M0 6 5 0l5 6z'/></svg>");
}
.cselect__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cselect__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: rgba(10, 22, 14, 0.97);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid rgba(201, 161, 88, 0.35);
  border-radius: var(--radius-md);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
  max-height: 264px;
  overflow-y: auto;
}
.cselect__opt {
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  color: var(--on-dark-2);
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.14s, color 0.14s;
}
.cselect__opt.is-active,
.cselect__opt:hover {
  background: rgba(201, 161, 88, 0.16);
  color: var(--on-dark);
}
.cselect__opt.is-selected {
  background: var(--emerald);
  color: var(--paper);
  font-weight: 600;
}

/* ---- Botón limpiar del filtro por nombre ---- */
#fQ {
  padding-right: 38px;
}
#fQ::-webkit-search-cancel-button {
  display: none;
}
.filter-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 50%;
  background: rgba(245, 235, 205, 0.12);
  color: var(--on-dark);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.16s;
}
.filter-clear:hover {
  background: rgba(201, 161, 88, 0.35);
}
.filter-clear[hidden] {
  display: none;
}

/* Grid de resultados — 1 col móvil, 2 col en pantallas estándar.
   Las tarjetas se topan en ~440px para que la foto retrato no se infle. */
.results {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  padding: var(--space-3) clamp(1rem, 3vw, 2.5rem) var(--space-7);
  max-width: var(--page-max);
  width: 100%;
  margin: 0 auto;
  justify-content: center;
}
@media (min-width: 720px) {
  .results { grid-template-columns: repeat(2, minmax(0, 440px)); }
}

.results__empty,
.results__loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--space-6);
  color: var(--on-dark);
  font-weight: 500;
  font-size: 0.95rem;
}

.results__count {
  grid-column: 1 / -1;
  color: var(--on-dark-2);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding-left: var(--space-3);
}

/* Pie "cargar más" (paginación) — full-width sobre el fondo oscuro. */
.results__more {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: var(--space-4) 0 var(--space-3);
}
.results__more-btn {
  padding: 11px 26px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(201, 161, 88, 0.5);
  background: rgba(245, 235, 205, 0.06);
  color: var(--on-dark);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.05s;
}
.results__more-btn:hover {
  background: rgba(201, 161, 88, 0.18);
  border-color: var(--gold);
}
.results__more-btn:active { transform: translateY(1px); }

.results__error {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
  padding: var(--space-6);
  color: var(--on-dark);
}
.results__error-title { font-weight: 600; font-size: 1rem; }
.results__error-msg { color: var(--on-dark-2); font-size: 0.88rem; max-width: 38ch; }
.results__retry {
  margin-top: var(--space-2);
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-pill);
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.18s, transform 0.18s;
}
.results__retry:hover { background: var(--paper-3); transform: translateY(-1px); }
