/* ==========================================================================
   TARJETA DE PROPIEDAD CON GIRO (portada, Venta, Alquiler, Locales y la
   página de prueba tarjeta-giro.html). El HTML lo pinta assets/js/tarjetas.js.
   Por delante: foto, precio, tipo, título y barrio. Al pasar el ratón da media
   vuelta en 3D y enseña por detrás los metros, habitaciones y baños, lo más
   destacado y el botón "Reservar visita". Las capas de cada cara están a
   distinta profundidad SOLO durante el giro (--pop sube de 0 a 1 y vuelve a 0),
   así la foto y los textos "flotan" por separado mientras gira y, al terminar,
   todo queda plano y nítido. Giro lento y suave (1,1 s, entra y sale despacio).
   Un clic en cualquier parte lleva a la ficha de la casa.
   En móvil se gira tocando "Toca para ver más"; con teclado, con el tabulador.
   ========================================================================== */

/* --- Página de prueba ----------------------------------------------------- */
.fc-page { padding: clamp(120px, 14vw, 170px) 0 clamp(80px, 10vw, 140px); }
.fc-head { max-width: 760px; margin: 0 auto clamp(40px, 6vw, 72px); padding: 0 24px; text-align: center; }
.fc-kicker { margin: 0 0 14px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--encina); }
.fc-head h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: clamp(34px, 4.6vw, 56px); line-height: 1.04; letter-spacing: -.02em; color: var(--tinta); }
.fc-head p { margin: 18px auto 0; max-width: 34em; font-size: 17px; line-height: 1.5; color: rgba(28, 30, 27, .62); }
.fc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: clamp(20px, 2.4vw, 32px);
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}
.fc-grid > .col { padding: 0; margin: 0; width: auto; }

/* --- Tarjeta ------------------------------------------------------------- */
.fc {
  position: relative;
  aspect-ratio: .7;
  max-width: 420px;
  margin: 0 auto;
  perspective: 1200px;
  cursor: pointer;
}
.fc__tilt,
.fc__inner { position: absolute; inset: 0; transform-style: preserve-3d; }
/* Profundidad de las capas: 0 en reposo, 1 a mitad del giro */
@property --pop { syntax: "<number>"; inherits: true; initial-value: 0; }
.fc { --pop: 0; --flip-t: 1.1s; --flip-ease: cubic-bezier(.65, .05, .36, 1); }
.fc__inner { transition: transform var(--flip-t) var(--flip-ease); }
@media (hover: hover) and (pointer: fine) {
  .fc:hover .fc__inner { transform: rotateY(180deg); }
  .fc:hover { animation: fc-pop-in var(--flip-t) var(--flip-ease); }
}
.fc.is-flipped { animation: fc-pop-in var(--flip-t) var(--flip-ease); }
/* Al volver (solo después de haberla girado, para que no salte al cargar) */
.fc.is-armed:not(:hover):not(.is-flipped) { animation: fc-pop-out var(--flip-t) var(--flip-ease); }
@keyframes fc-pop-in  { 0% { --pop: 0; } 50% { --pop: 1; } 100% { --pop: 0; } }
@keyframes fc-pop-out { 0% { --pop: 0; } 50% { --pop: 1; } 100% { --pop: 0; } }
.fc.is-flipped .fc__inner,
.fc:has(.fc__hint:focus-visible) .fc__inner,
.fc:has(.fc__back :focus-visible) .fc__inner { transform: rotateY(180deg); }

/* Caras: misma caja, la de atrás ya girada */
.fc__face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 7px;
  border-radius: 22px;
  color: #fff;
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(180deg, #232622 0%, #1A1C19 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), 0 24px 48px -26px rgba(0, 0, 0, .55);
  transform-style: preserve-3d;
}
/* Cada capa esconde su reverso (con 3D, no basta con ocultar el de la cara) */
.fc__face,
.fc__face > * { -webkit-backface-visibility: hidden; backface-visibility: hidden; }

/* --- Delante -------------------------------------------------------------- */
.fc__photo {
  position: relative;
  flex: 1 1 auto;                 /* la foto ocupa todo el alto que sobra */
  min-height: 0;
  border-radius: 16px;
  background: #2B2E2A center / cover no-repeat;
  box-shadow: 0 10px 22px -12px rgba(0, 0, 0, .6);
  transform: translateZ(calc(var(--pop) * 46px));
}
.fc__chip {
  position: absolute;
  left: 10px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px 5px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  color: #fff;
  background: rgba(16, 18, 16, .62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14);
}
.fc__chip i { width: 7px; height: 7px; border-radius: 50%; background: #3FD38A; box-shadow: 0 0 0 3px rgba(63, 211, 138, .22); }
.fc__chip.is-rent i { background: #F2C14E; box-shadow: 0 0 0 3px rgba(242, 193, 78, .22); }
.fc__chip.is-closed i { background: #9AA09A; box-shadow: none; }

.fc__body { flex: none; padding: 16px 10px 0; transform: translateZ(calc(var(--pop) * 28px)); }
.fc__type { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font-size: 12px; font-weight: 700; color: rgba(255, 255, 255, .72); }
.fc__type svg { width: 14px; height: 14px; color: #8FE0B4; }
.fc__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 21px;
  line-height: 1.12;
  letter-spacing: -.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fc__title a { color: inherit !important; text-decoration: none !important; font: inherit; }
.fc__loc { display: flex; align-items: center; gap: 6px; margin: 10px 0 0; font-size: 13px; color: rgba(255, 255, 255, .58); }
.fc__loc svg { flex: none; width: 14px; height: 14px; }

.fc__hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  margin: 18px 10px 10px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, .5);
  cursor: pointer;
  transform: translateZ(calc(var(--pop) * 18px));
}
.fc__hint .t-mouse, .fc__hint .t-touch { color: rgba(255, 255, 255, .55); }
/* Flecha de girar: círculo verde iluminado (en móvil, con un pulso suave) */
.fc__flip {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 15px;
  line-height: 1;
  color: #fff;
  background: var(--encina);
  box-shadow: 0 0 0 1px rgba(143, 224, 180, .35), 0 0 14px rgba(63, 211, 138, .45);
  transition: transform .3s cubic-bezier(.23, 1, .32, 1);
}
.fc:hover .fc__flip { transform: translateX(3px); }
@media (hover: none) {
  .fc__hint .t-touch { color: #fff; }
  .fc__flip { animation: fc-flip-glow 2.4s ease-in-out infinite; }
}
@keyframes fc-flip-glow {
  0%, 100% { box-shadow: 0 0 0 1px rgba(143, 224, 180, .35), 0 0 10px rgba(63, 211, 138, .35), 0 0 0 0 rgba(63, 211, 138, .45); }
  50%      { box-shadow: 0 0 0 1px rgba(143, 224, 180, .5), 0 0 18px rgba(63, 211, 138, .6), 0 0 0 7px rgba(63, 211, 138, 0); }
}
.fc__hint .t-touch { display: none; }
@media (hover: none) { .fc__hint .t-mouse { display: none; } .fc__hint .t-touch { display: inline; } }

/* --- Detrás (como la referencia: todo centrado y compacto) ----------------- */
.fc__back {
  transform: rotateY(180deg);
  justify-content: center;
  padding: 22px 18px;
}
.fc__tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; padding: 0; list-style: none; transform: translateZ(calc(var(--pop) * 52px)); }
.fc__tiles li {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 4px 15px;
  border-radius: 16px;
  background: #262925;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07), 0 12px 22px -14px rgba(0, 0, 0, .75);
  text-align: center;
}
.fc__ico {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: #151714;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .07);
}
.fc__ico svg { width: 20px; height: 20px; color: #fff; }
.fc__tiles b { font-size: 13px; font-weight: 700; line-height: 1.2; }

.fc__about { margin-top: 30px; text-align: center; transform: translateZ(calc(var(--pop) * 30px)); }
.fc__about h4 { margin: 0 0 12px; font-family: var(--font-display); font-weight: 400; font-size: 24px; line-height: 1.1; letter-spacing: -.01em; color: #fff; }
.fc__about p {
  margin: 0 auto;
  max-width: 26em;
  font-size: 13.5px;
  line-height: 1.55;
  color: rgba(255, 255, 255, .62);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.fc__actions { display: flex; flex-direction: column; align-items: center; gap: 14px; margin-top: 24px; transform: translateZ(calc(var(--pop) * 38px)); }
.fc__more { font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, .72); text-decoration: none !important; }
.fc__more span { display: inline-block; transition: transform .3s cubic-bezier(.23, 1, .32, 1); }
.fc__more:hover { color: #fff; }
.fc__more:hover span { transform: translateX(3px); }
html body .fc .fc__book { width: 76% !important; justify-content: center; }

/* Botón sobre la tarjeta oscura: cápsula blanca que se rellena de verde */
html body .fc .lnk-cta.btn-primary {
  --b-bg: #fff;
  --b-fg: var(--tinta);
  --b-border: rgba(255, 255, 255, .9);
  --flow-fill: var(--encina);
  --flow-ink: #fff;
}

@media (prefers-reduced-motion: reduce) {
  .fc__flip { animation: none !important; }
  .fc, .fc:hover, .fc.is-flipped, .fc.is-armed:not(:hover):not(.is-flipped) { animation: none; }
  .fc__inner { transition: transform .01s linear .15s; }
}
