/* ==========================================================================
   Componentes reutilizables: botones, tarjetas, formulario, aviso, lightbox
   ========================================================================== */

/* --- Botones ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  min-height: 3rem;
  padding: 0.75rem 1.4rem;
  border: 2px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: var(--step-0);
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.btn:hover {
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn--s {
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  font-size: var(--step--1);
}

.btn--primary {
  background: var(--jpc-azul-oscuro);
  color: #fff;
}

.btn--primary:hover {
  background: var(--jpc-azul-800);
  box-shadow: var(--shadow-m);
}

.btn--accent {
  background: var(--jpc-verde);
  color: var(--jpc-azul-950);
}

.btn--accent:hover {
  background: #a9cf52;
  box-shadow: 0 8px 20px -8px rgb(153 194 60 / 0.7);
}

.btn--outline {
  border-color: var(--jpc-azul-oscuro);
  color: var(--jpc-azul-oscuro);
  background: transparent;
}

.btn--outline:hover {
  background: var(--jpc-azul-50);
}

.btn--ghost {
  border-color: rgb(255 255 255 / 0.55);
  color: #fff;
  background: rgb(255 255 255 / 0.04);
}

.btn--ghost:hover {
  border-color: #fff;
  background: rgb(255 255 255 / 0.12);
}

.btn .icon {
  width: 1.125rem;
  height: 1.125rem;
}

/* --- Tarjeta de servicio ------------------------------------------------ */

.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-s);
  height: 100%;
  padding: var(--space-l);
  background: #fff;
  border: 1px solid var(--c-line);
  border-radius: var(--radius-m);
  transition:
    transform var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.service-card:hover {
  transform: translateY(-3px);
  border-color: var(--jpc-azul-100);
  box-shadow: var(--shadow-m);
}

.service-card__icon {
  display: grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  margin-bottom: var(--space-2xs);
  border-radius: var(--radius-m);
  background: var(--jpc-azul-50);
  color: var(--jpc-azul-oscuro);
}

.service-card__icon .icon {
  width: 1.75rem;
  height: 1.75rem;
}

.service-card h3 {
  font-size: var(--step-2);
}

.service-card p {
  font-size: var(--step-0);
}

.service-card__tag {
  align-self: flex-start;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-pill);
  background: var(--jpc-verde);
  color: var(--jpc-azul-950);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.service-card--featured {
  background: linear-gradient(155deg, var(--jpc-azul-oscuro) 0%, var(--jpc-azul-900) 100%);
  border-color: transparent;
  color: #d9e7f3;
}

.service-card--featured h3 {
  color: #fff;
}

.service-card--featured .service-card__icon {
  background: rgb(255 255 255 / 0.12);
  color: var(--jpc-verde);
}

/* Enlace al final de la tarjeta destacada */
.service-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  align-self: flex-start;
  min-height: 2.75rem;
  margin-top: auto;
  color: var(--jpc-azul-oscuro);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.service-card__link:hover {
  text-decoration: underline;
}

.service-card--featured .service-card__link {
  color: #cfe8a0;
}

/* Lista breve dentro de una tarjeta (chillers, compresores, VRF) */
.service-card__list {
  list-style: none;
  display: grid;
  gap: 0.55rem;
}

.service-card__list li {
  position: relative;
  padding-left: 1.1rem;
  line-height: 1.5;
}

.service-card__list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--jpc-verde), var(--jpc-azul-claro));
}

.service-card__list strong {
  color: var(--jpc-azul-900);
}

/* --- Aviso -------------------------------------------------------------- */

.notice {
  display: flex;
  gap: var(--space-s);
  padding: var(--space-m);
  border-radius: var(--radius-m);
  background: var(--jpc-azul-50);
  border: 1px solid var(--jpc-azul-100);
  color: var(--jpc-azul-900);
  font-size: var(--step--1);
  line-height: 1.5;
}

.notice .icon {
  margin-top: 0.1rem;
  color: var(--jpc-azul-oscuro);
}

.notice strong {
  display: block;
  margin-bottom: 0.15rem;
  font-size: var(--step-0);
}

/* --- Formulario --------------------------------------------------------- */

.form {
  display: grid;
  gap: var(--space-l);
}

.form__row {
  display: grid;
  gap: var(--space-l);
}

@media (min-width: 40rem) {
  .form__row--2 {
    grid-template-columns: 1fr 1fr;
  }
}

.field {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  min-width: 0;
}

.field__label,
.fieldset__legend {
  color: var(--jpc-azul-900);
  font-weight: 600;
  font-size: var(--step--1);
}

.field__optional {
  color: var(--jpc-gris);
  font-weight: 400;
}

.field__req {
  color: var(--c-error);
}

.field__hint {
  font-size: 0.875rem;
  color: var(--jpc-gris);
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 3rem;
  padding: 0.7rem 0.9rem;
  border: 1.5px solid #b9c6d2;
  border-radius: var(--radius-s);
  background: #fff;
  color: var(--jpc-azul-950);
  line-height: 1.4;
  transition:
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.textarea {
  min-height: 8rem;
  resize: vertical;
}

.select {
  appearance: none;
  padding-right: 2.5rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2300498d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1.1rem;
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: #8fa2b4;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--jpc-azul-oscuro);
  box-shadow: 0 0 0 3px rgb(78 183 196 / 0.45);
}

.input[aria-invalid="true"],
.select[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--c-error);
}

.field__error {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--c-error);
  font-size: 0.875rem;
  font-weight: 600;
}

.field__error:empty {
  display: none;
}

.fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.fieldset__legend {
  padding: 0;
  margin-bottom: 0.4rem;
}

.choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s);
}

.choice {
  position: relative;
  display: inline-flex;
}

.choice input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.choice span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border: 1.5px solid #b9c6d2;
  border-radius: var(--radius-pill);
  background: #fff;
  font-weight: 500;
  color: var(--jpc-azul-900);
  transition:
    border-color var(--dur) var(--ease),
    background-color var(--dur) var(--ease);
}

.choice span::before {
  content: "";
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid #8fa2b4;
  background: #fff;
  transition:
    border-color var(--dur) var(--ease),
    box-shadow var(--dur) var(--ease);
}

.choice input:checked + span {
  border-color: var(--jpc-azul-oscuro);
  background: var(--jpc-azul-50);
}

.choice input:checked + span::before {
  border-color: var(--jpc-azul-oscuro);
  box-shadow: inset 0 0 0 3px #fff;
  background: var(--jpc-azul-oscuro);
}

.choice input:focus-visible + span {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}

.fieldset[aria-invalid="true"] .choice span {
  border-color: var(--c-error);
}

/* --- Envío del formulario: Correo / Gmail / Copiar texto ---------------- */

.form__send {
  display: grid;
  gap: var(--space-s);
  padding-top: var(--space-l);
  border-top: 1px solid var(--c-line);
}

.form__send-title {
  color: var(--jpc-azul-900);
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 700;
}

.form__actions {
  display: grid;
  gap: var(--space-s);
}

.form__actions .btn {
  white-space: nowrap;
}

@media (min-width: 30rem) {
  .form__actions {
    grid-template-columns: repeat(3, 1fr);
  }

  .form__actions .btn {
    padding-inline: 0.9rem;
  }
}

/* Región "status": siempre presente (aunque vacía) para que los lectores de pantalla la anuncien. */
.form__status {
  color: var(--c-success);
  font-weight: 600;
  font-size: 0.9375rem;
}

.form__fallback {
  display: grid;
  gap: 0.4rem;
}

.form__fallback[hidden] {
  display: none;
}

.form__fallback .textarea {
  font-size: 0.9375rem;
}

/* --- Lightbox ----------------------------------------------------------- */

.lightbox {
  width: 100%;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}

.lightbox::backdrop {
  background: rgb(2 31 58 / 0.94);
}

.lightbox[open] {
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.lightbox__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-m);
  padding: var(--space-s) var(--gutter);
}

.lightbox__counter {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.08em;
}

.lightbox__stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0 var(--gutter);
}

.lightbox__figure {
  display: grid;
  gap: var(--space-s);
  justify-items: center;
  margin: 0;
  max-height: 100%;
  min-height: 0;
}

.lightbox__media {
  display: grid;
  place-items: center;
  min-height: 0;
}

.lightbox__figure img {
  max-width: min(100%, 72rem);
  max-height: calc(100vh - 11rem);
  max-height: calc(100dvh - 11rem);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: var(--radius-s);
  box-shadow: var(--shadow-l);
}

.lightbox__caption {
  max-width: 48rem;
  text-align: center;
  color: #dbe7f2;
  font-size: var(--step-0);
}

.lightbox__nav {
  display: flex;
  justify-content: center;
  gap: var(--space-m);
  padding: var(--space-s) var(--gutter) var(--space-l);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 1.5px solid rgb(255 255 255 / 0.4);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.06);
  color: #fff;
  transition:
    background-color var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}

.icon-btn:hover {
  background: rgb(255 255 255 / 0.16);
  border-color: #fff;
}
