/* Modal de datos del perro. Portado del modal de la marca original (.asbm-*)
   con la paleta de Pet Histories.

   Dos reglas de este archivo no son estéticas:
   1. El blur vive en `.phm-backdrop`, HERMANA del diálogo. Con backdrop-filter
      en un ancestro de un <input>, iOS Safari dibuja el cursor de texto corrido
      respecto del campo.
   2. Los <button> del formulario se pintan en TODOS sus estados con
      especificidad 0,3,0 (`.phm-overlay .phm-form .phm-gbtn`). hello-elementor
      pinta `button` con su propio accent al hover/focus, y ahí el sexo elegido
      se veía como si estuviera seleccionado el otro. */

.phm-overlay {
  --phm-night: #232819;
  --phm-deep: #14180F;
  --phm-cream: #EDE4CE;
  --phm-gold: #C08A3E;
  --phm-gold-hi: #D9A24E;
  --phm-line: rgba(237, 228, 206, 0.12);
  --phm-err: #E89B9B;
  --phm-display: 'Playfair Display', Georgia, serif;
  --phm-body: 'Inter', system-ui, -apple-system, sans-serif;

  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 300ms ease, visibility 300ms ease;
}
.phm-overlay.is-open { opacity: 1; visibility: visible; pointer-events: auto; }
.phm-overlay, .phm-overlay * { box-sizing: border-box; }

.phm-backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: rgba(12, 15, 8, 0.92);
  -webkit-backdrop-filter: blur(16px) saturate(0.72);
  backdrop-filter: blur(16px) saturate(0.72);
}

.phm-modal {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  background:
    radial-gradient(135% 90% at 50% 0%, rgba(192, 138, 62, 0.09), transparent 52%),
    linear-gradient(180deg, #262c1c 0%, var(--phm-deep) 100%);
  border: 1px solid rgba(192, 138, 62, 0.18);
  border-radius: 20px;
  box-shadow: 0 44px 120px -30px rgba(0, 0, 0, 0.92), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
  font-family: var(--phm-body);
  color: var(--phm-cream);
  transform: translateY(14px) scale(0.97);
  transition: transform 460ms cubic-bezier(0.16, 1, 0.3, 1);
  scrollbar-width: thin;
  scrollbar-color: rgba(192, 138, 62, 0.3) transparent;
}
.phm-overlay.is-open .phm-modal { transform: none; }
.phm-modal::before {
  content: "";
  position: absolute;
  top: 0; left: 26px; right: 26px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(192, 138, 62, 0.5), transparent);
}
.phm-modal::-webkit-scrollbar { width: 6px; }
.phm-modal::-webkit-scrollbar-thumb { background: rgba(192, 138, 62, 0.25); border-radius: 3px; }

/* ── cabecera ──────────────────────────────────────────────────────────── */
.phm-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 26px 26px 18px;
  border-bottom: 1px solid rgba(237, 228, 206, 0.08);
}
.phm-head-text { min-width: 0; }
.phm-chip {
  display: block;
  font-size: 10px;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--phm-gold);
  font-weight: 700;
  margin: 0 0 8px;
}
.phm-title {
  font-family: var(--phm-display);
  font-size: 23px;
  font-weight: 600;
  color: var(--phm-cream);
  margin: 0;
  letter-spacing: -0.3px;
  line-height: 1.18;
}
.phm-sub { margin: 9px 0 0; font-size: 13px; line-height: 1.5; color: rgba(237, 228, 206, 0.62); }

.phm-overlay .phm-close,
.phm-overlay .phm-close:hover,
.phm-overlay .phm-close:focus,
.phm-overlay .phm-close:active {
  flex-shrink: 0;
  width: 36px; height: 36px;
  padding: 0;
  margin: -2px -4px 0 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  background: rgba(237, 228, 206, 0.05);
  color: rgba(237, 228, 206, 0.7);
  transition: background 200ms ease, color 200ms ease, transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}
.phm-overlay .phm-close:hover { background: rgba(192, 138, 62, 0.14); color: var(--phm-gold); transform: rotate(90deg); }
.phm-close svg { width: 18px; height: 18px; }

/* ── formulario ────────────────────────────────────────────────────────── */
.phm-form { padding: 20px 26px 26px; }

.phm-notice {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: linear-gradient(180deg, rgba(192, 138, 62, 0.12), rgba(192, 138, 62, 0.04));
  border: 1px solid rgba(192, 138, 62, 0.26);
  border-radius: 13px;
  padding: 13px 15px;
  margin-bottom: 18px;
}
.phm-notice svg { flex-shrink: 0; width: 20px; height: 20px; color: var(--phm-gold); margin-top: 1px; }
.phm-notice p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--phm-cream); }
.phm-notice b { color: var(--phm-gold-hi); font-weight: 700; }

.phm-row { margin-bottom: 16px; }
.phm-row:last-of-type { margin-bottom: 0; }
.phm-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: rgba(237, 228, 206, 0.82);
  margin-bottom: 8px;
}
.phm-req { color: var(--phm-gold); margin-left: 4px; }
.phm-opt { font-weight: 400; font-style: italic; color: rgba(237, 228, 206, 0.5); margin-left: 6px; }
.phm-hint { display: block; margin: 7px 0 0; font-size: 12.5px; line-height: 1.5; color: rgba(237, 228, 206, 0.6); }

/* 16px de font-size no es una decisión de diseño: por debajo, iOS Safari hace
   zoom al enfocar el campo y descuadra el modal entero. */
.phm-input, .phm-textarea {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  background: var(--phm-night);
  border: 1px solid var(--phm-line);
  border-radius: 11px;
  color: var(--phm-cream);
  font-family: var(--phm-body);
  font-size: 16px;
  line-height: 1.3;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 170ms ease, box-shadow 170ms ease;
}
.phm-textarea { display: block; height: auto; min-height: 96px; padding: 12px 14px; line-height: 1.5; resize: vertical; }
.phm-input::placeholder, .phm-textarea::placeholder { color: rgba(237, 228, 206, 0.32); }
.phm-input:focus, .phm-textarea:focus { border-color: var(--phm-gold); box-shadow: 0 0 0 3px rgba(192, 138, 62, 0.15); }
.phm-input.is-err, .phm-textarea.is-err { border-color: var(--phm-err); box-shadow: 0 0 0 3px rgba(232, 155, 155, 0.15); }

/* ── sexo: dos botones, no un select de dos opciones ───────────────────── */
.phm-sexo { display: flex; gap: 8px; }
.phm-overlay .phm-form .phm-gbtn,
.phm-overlay .phm-form .phm-gbtn:hover,
.phm-overlay .phm-form .phm-gbtn:focus,
.phm-overlay .phm-form .phm-gbtn:focus-visible,
.phm-overlay .phm-form .phm-gbtn:active {
  flex: 1;
  height: 48px;
  border-radius: 11px;
  cursor: pointer;
  font-family: var(--phm-body);
  font-size: 15px;
  font-weight: 600;
  background: var(--phm-night);
  border: 1px solid var(--phm-line);
  color: rgba(237, 228, 206, 0.6);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.phm-overlay .phm-form .phm-gbtn:hover { border-color: rgba(192, 138, 62, 0.5); color: var(--phm-cream); }
.phm-overlay .phm-form .phm-gbtn.is-on {
  background: rgba(192, 138, 62, 0.16);
  border-color: var(--phm-gold);
  color: var(--phm-cream);
}
.phm-sexo.is-err .phm-gbtn { border-color: var(--phm-err); }

/* ── raza ──────────────────────────────────────────────────────────────── */
.phm-overlay .phm-form .phm-link,
.phm-overlay .phm-form .phm-link:hover,
.phm-overlay .phm-form .phm-link:focus,
.phm-overlay .phm-form .phm-link:active {
  display: inline-block;
  margin: 10px 0 6px;
  padding: 0;
  background: none;
  border: 0;
  cursor: pointer;
  font-family: var(--phm-body);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--phm-gold);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.phm-overlay .phm-form .phm-link:hover { color: var(--phm-gold-hi); }

.phm-nose {
  border: 1px solid rgba(192, 138, 62, 0.26);
  background: rgba(192, 138, 62, 0.06);
  border-radius: 13px;
  padding: 14px 15px;
}
.phm-nose-t { margin: 0 0 4px; font-size: 13.5px; font-weight: 700; color: var(--phm-cream); }
.phm-nose-s { margin: 0; font-size: 12.5px; line-height: 1.5; color: rgba(237, 228, 206, 0.66); }
.phm-nose.is-err { border-color: var(--phm-err); }

.phm-foto { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.phm-foto-thumb {
  width: 52px; height: 52px; flex-shrink: 0;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(192, 138, 62, 0.4);
}
.phm-overlay .phm-form .phm-foto-btn,
.phm-overlay .phm-form .phm-foto-btn:hover,
.phm-overlay .phm-form .phm-foto-btn:focus,
.phm-overlay .phm-form .phm-foto-btn:active {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  border: 1px solid rgba(192, 138, 62, 0.55);
  color: var(--phm-gold);
  font-family: var(--phm-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.4px;
  transition: background 180ms ease, color 180ms ease;
}
.phm-overlay .phm-form .phm-foto-btn:hover { background: var(--phm-gold); color: var(--phm-deep); }
.phm-foto-btn svg { width: 16px; height: 16px; }
.phm-foto-state { font-size: 12.5px; line-height: 1.4; color: rgba(237, 228, 206, 0.66); }
.phm-foto-state b { color: var(--phm-gold-hi); font-weight: 700; }
.phm-file { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

.phm-count {
  display: block;
  margin-top: 6px;
  text-align: right;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: rgba(237, 228, 206, 0.5);
}
.phm-count.is-max { color: var(--phm-err); }
/* `display:block` de arriba le gana al [hidden] del navegador (regla de autor
   vs regla del user-agent), así que el ocultarse hay que escribirlo. */
.phm-count[hidden] { display: none; }

/* Mensaje de error del formulario, arriba del botón: el que falla en mobile no
   ve el campo marcado si quedó fuera de pantalla. */
.phm-msg {
  margin: 16px 0 0;
  padding: 11px 14px;
  border-radius: 11px;
  border: 1px solid rgba(232, 155, 155, 0.42);
  background: rgba(232, 155, 155, 0.1);
  font-size: 13px;
  line-height: 1.45;
  color: var(--phm-err);
}
.phm-msg[hidden] { display: none; }

/* ── pie ───────────────────────────────────────────────────────────────── */
.phm-overlay .phm-form .phm-submit,
.phm-overlay .phm-form .phm-submit:hover,
.phm-overlay .phm-form .phm-submit:focus,
.phm-overlay .phm-form .phm-submit:active {
  display: block;
  width: 100%;
  margin-top: 22px;
  padding: 16px 24px;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: var(--phm-gold);
  color: var(--phm-deep);
  font-family: var(--phm-body);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  transition: background 220ms ease, transform 220ms ease, box-shadow 220ms ease;
}
.phm-overlay .phm-form .phm-submit:hover {
  background: var(--phm-gold-hi);
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -12px rgba(192, 138, 62, 0.55);
}
.phm-overlay .phm-form .phm-submit.is-busy,
.phm-overlay .phm-form .phm-submit.is-busy:hover {
  opacity: 0.75;
  cursor: progress;
  transform: none;
  box-shadow: none;
}

.phm-guarantee {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid rgba(192, 138, 62, 0.22);
  background: rgba(192, 138, 62, 0.07);
  border-radius: 12px;
}
.phm-g-seal { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex-shrink: 0; color: var(--phm-gold); }
.phm-g-seal svg { width: 26px; height: 26px; }
.phm-g-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.phm-g-txt b { font-size: 13px; font-weight: 700; color: var(--phm-cream); letter-spacing: 0.2px; }
.phm-g-txt span { font-size: 12px; color: rgba(237, 228, 206, 0.62); line-height: 1.45; }

.phm-note { margin: 13px 0 0; text-align: center; font-size: 11.5px; color: rgba(237, 228, 206, 0.45); font-style: italic; }

.phm-overlay :focus-visible { outline: 2px solid var(--phm-gold-hi); outline-offset: 2px; }

/* ── mobile: hoja desde abajo ──────────────────────────────────────────── */
@media (max-width: 640px) {
  .phm-overlay { align-items: flex-end; padding: 0; }
  .phm-modal {
    max-width: 100%;
    max-height: 92vh;
    max-height: 92dvh;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    transform: translateY(100%) scale(1);
    overscroll-behavior: contain;
  }
  .phm-overlay.is-open .phm-modal { transform: none; }
  .phm-modal::before { display: none; }
  /* Cabecera pegada con su "manija": al scrollear el formulario largo, el
     contexto y el botón de cerrar siguen a mano. */
  .phm-head {
    position: sticky;
    top: 0;
    z-index: 3;
    background: linear-gradient(180deg, #262c1c 0%, #262c1c 88%, rgba(38, 44, 28, 0.96));
    padding: 22px 22px 14px;
  }
  .phm-head::before {
    content: "";
    position: absolute;
    top: 8px; left: 50%;
    transform: translateX(-50%);
    width: 38px; height: 4px;
    border-radius: 999px;
    background: rgba(237, 228, 206, 0.2);
  }
  .phm-form { padding: 18px 22px calc(26px + env(safe-area-inset-bottom, 0px)); }
  .phm-input, .phm-overlay .phm-form .phm-gbtn { height: 50px; }
}

@media (prefers-reduced-motion: reduce) {
  .phm-overlay,
  .phm-modal,
  .phm-overlay .phm-close,
  .phm-overlay .phm-form .phm-gbtn,
  .phm-overlay .phm-form .phm-foto-btn,
  .phm-overlay .phm-form .phm-submit {
    transition: none !important;
  }
  .phm-overlay .phm-close:hover,
  .phm-overlay .phm-form .phm-submit:hover { transform: none; }
}

/* ── El selector propio de raza ────────────────────────────────────────────
   Reemplaza al <datalist> nativo, que lo dibujaba el sistema operativo: lista
   blanca, tipografia y scrollbar del OS pegadas a un modal oscuro de marca.
   Mismo patron que el funnel y que el modal de Astral.

   OJO CON LA ESPECIFICIDAD: el tema pinta TODOS los <button> del sitio con su
   acento rosa (`[type="button"], button { border: 1px solid #CC3366 }`) y con
   `width: auto`. Esa regla pesa lo mismo que `.phm-sel-opt` (0,1,0) pero carga
   DESPUES, asi que ganaba: las opciones salian como fichas rosas en fila en vez
   de una lista. Por eso todo va prefijado con `.phm-overlay` (0,2,0) — gana por
   peso, sin !important y sin tocar el tema. Es el mismo arreglo que en Astral. */
.phm-overlay .phm-sel { position: relative; }
.phm-overlay .phm-sel-panel {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 20;
  max-height: 264px; overflow-y: auto; overscroll-behavior: contain;
  background: #1B2015; border: 1px solid rgba(192,138,62,0.34); border-radius: 12px;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,.7);
  padding: 6px;
  scrollbar-width: thin; scrollbar-color: rgba(192,138,62,0.4) transparent;
}
.phm-overlay .phm-sel-opt {
  display: block; width: 100%; text-align: left;
  border: 0; border-radius: 8px; background: transparent; appearance: none;
  color: #EDE4CE; font-family: 'Inter', system-ui, sans-serif; font-size: 15px;
  padding: 11px 13px; cursor: pointer; line-height: 1.35;
}
.phm-overlay .phm-sel-opt:hover,
.phm-overlay .phm-sel-opt.is-act { background: rgba(192,138,62,0.20); color: #E9C084; }
/* "Otra raza": la salida cuando lo escrito no está en el banco. Separada por una
   línea para que no se lea como una raza más de la lista. */
.phm-overlay .phm-sel-otra {
  border-top: 1px solid rgba(237,228,206,0.10);
  margin-top: 4px; padding-top: 11px; border-radius: 0 0 8px 8px;
}
.phm-overlay .phm-sel-otra-t {
  display: block; color: #E9C084; font-weight: 600; font-size: 14.5px;
}
.phm-overlay .phm-sel-otra-s {
  display: block; color: rgba(237,228,206,0.60); font-size: 12px; margin-top: 2px;
}
.phm-overlay .phm-sel-panel::-webkit-scrollbar { width: 8px; }
.phm-overlay .phm-sel-panel::-webkit-scrollbar-thumb {
  background: rgba(192,138,62,0.4); border-radius: 8px;
}
.phm-overlay .phm-sel.phm-sel-arriba .phm-sel-panel { top: auto; bottom: calc(100% + 6px); }

/* ── montaje inline: el overlay deja de ser overlay ────────────────────────
   El JS mueve el `.phm-overlay` ENTERO adentro de la card de precio (no el
   `.phm-modal` solo: las variables de color y medio archivo están scopeados al
   overlay). Acá se le desarma lo que lo hacía una capa flotante.
   Specificity: `.phm-overlay.phm-embed .phm-modal` es 0,3,0 y le gana al bloque
   de mobile (`.phm-modal`, 0,1,0) sin !important. */
.phm-overlay.phm-embed {
  position: static; inset: auto; z-index: auto; display: block;
  padding: 0; opacity: 1; visibility: visible; pointer-events: auto;
  transition: none;
}
.phm-overlay.phm-embed .phm-backdrop { display: none; }
.phm-overlay.phm-embed .phm-modal {
  max-width: none; max-height: none; overflow: visible;
  transform: none; box-shadow: none; border-radius: 16px;
}
/* La card ya trae su título, su sello de garantía y su nota: adentro del
   formulario serían el mismo texto dos veces. */
.phm-overlay.phm-embed .phm-head,
.phm-overlay.phm-embed .phm-guarantee,
.phm-overlay.phm-embed .phm-note { display: none; }
/* El bloque de compra de la card se centra en mobile (`.lnj-pri-buy`) y el
   formulario HEREDA ese text-align: etiquetas, ayudas y contador quedaban
   centrados y se leían como una tarjeta, no como un formulario. */
.phm-overlay.phm-embed .phm-form { padding: 22px 24px 24px; text-align: left; }
@media (max-width: 640px) {
  .phm-overlay.phm-embed { align-items: stretch; }
  .phm-overlay.phm-embed .phm-modal {
    max-width: none; max-height: none; overflow: visible;
    border-radius: 16px; transform: none;
  }
  .phm-overlay.phm-embed .phm-form { padding: 18px 18px 22px; }
}
