/**
 * Plugin Name: Tavolo Vivo - Prodotti Interattivi
 * Description: Un unico tavolo con prodotti animati, editor visuale, disposizione automatica e produttori aderenti. Shortcode [tavolo_interattivo].
 * Powered by Micro srl - Lorerbi
 * Version: 4.1.0
 * Requires PHP: 7.4
 */
.tv-app {
  max-width: 1600px;
  margin: 0 auto;
  color: #34271c;
  font-family: inherit;
}

.tv-app * {
  box-sizing: border-box;
}

.tv-head {
  text-align: center;
  padding: 28px 10px;
}

.tv-head small,
.tv-content small {
  letter-spacing: .2em;
  font-size: 11px;
  color: #dd9e1c;
  font-weight: 700;
}

.tv-head h2 {
  font-size: clamp(28px, 4vw, 50px);
  margin: 8px 0;
}

.tv-head p {
  color: #765f4b;
}

.tv-table {
  position: relative;
  isolation: isolate;
  aspect-ratio: 16/10;
  overflow: hidden;
  border-radius: 18px;
  background-color: #764322;
  background-image: var(--tv-bg, linear-gradient(135deg, #28130866, transparent 70%), repeating-linear-gradient(0deg, #543019 0px, #83502c 115px, #432513 120px, #7b4826 130px));
  background-position: center;
  background-size: cover;
  box-shadow: 0 18px 45px #0003;
  animation: tv-fade 1s both;
}

.tv-table:after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 45%, #1e0c0644);
  pointer-events: none;
}

.tv-product {
  position: absolute !important;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  transform: translate(-50%, -50%);
  display: block;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  z-index: 1;
  line-height: 0;
}

.tv-clickable {
  cursor: pointer;
}

.tv-static {
  pointer-events: none;
}

.tv-pop {
  display: block;
  position: relative;
  opacity: 0;
  transform: scale(.04);
  animation: tv-pop var(--tv-pop-duration, .8s) cubic-bezier(.22, 1.5, .38, 1) both;
  animation-delay: calc(.75s + var(--delay));
}

.tv-pop img {
  width: 100%;
  height: auto;
  display: block;
  filter: drop-shadow(4px 10px 7px #0007);
  transition: transform .28s ease, filter .28s ease;
}

.tv-clickable:hover,
.tv-clickable:focus-visible {
  z-index: 5;
}

.tv-clickable:hover img,
.tv-clickable:focus-visible img {
  transform: scale(1.22) translateY(-5%);
  filter: drop-shadow(7px 18px 11px #0009);
}

.tv-tip {
  position: absolute;
  left: 50%;
  bottom: -18px;
  transform: translateX(-50%);
  background: #fff;
  color: #3a281a;
  border-radius: 7px;
  padding: 9px 12px;
  line-height: 1.3;
  white-space: nowrap;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 6px 20px #0003;
}

.tv-clickable:hover .tv-tip,
.tv-clickable:focus-visible .tv-tip {
  opacity: 1;
}

.tv-modal[hidden] {
  display: none;
}

.tv-modal {
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: grid;
  place-items: center;
  padding: 20px;
}

.tv-shade {
  position: absolute;
  inset: 0;
  background: #100d0acc;
  backdrop-filter: blur(5px);
}

.tv-dialog {
  position: relative;
  z-index: 1;
  background: #fff;
  border-radius: 20px;
  max-width: 840px;
  width: 100%;
  max-height: 88vh;
  overflow: auto;
  box-shadow: 0 25px 70px #0006;
  padding: 30px;
  color: #39281a;
}

.tv-dialog-grid {
  display: grid;
  grid-template-columns: 42% 1fr;
  gap: 28px;
  align-items: center;
}

.tv-media {
  background: #f4eee5;
  border-radius: 14px;
  padding: 15px;
}

.tv-photo {
  width: 100%;
  height: 290px;
  object-fit: contain;
}

.tv-content h3 {
  font-size: clamp(23px, 3vw, 34px);
  margin: 8px 0;
}

.tv-content p {
  line-height: 1.65;
}

.tv-producers {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tv-producers a,
.tv-producers span {
  display: block;
  padding: 10px 12px;
  background: #f7f2eb;
  border-radius: 8px;
  color: #633c21;
  text-decoration: none;
}

.tv-more {
  display: inline-block;
  margin-top: 20px;
  background: #dd9e1c;
  color: white !important;
  border-radius: 8px;
  padding: 12px 18px;
  text-decoration: none;
}

.tv-close {
  position: absolute;
  right: 15px;
  top: 10px;
  background: transparent;
  border: 0;
  font-size: 30px;
  cursor: pointer;
  color: #39281a;
}

@keyframes tv-fade {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes tv-pop {
  0% {
    opacity: 0;
    transform: scale(.04);
  }

  65% {
    opacity: 1;
    transform: scale(1.17);
  }

  83% {
    transform: scale(.92);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 650px) {
  .tv-table {
    aspect-ratio: 1/1.1;
  }

  .tv-dialog {
    padding: 22px;
  }

  .tv-dialog-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .tv-photo {
    height: 170px;
  }

  .tv-tip {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tv-table,
  .tv-pop {
    animation: none;
    opacity: 1;
    transform: none;
  }

  .tv-pop img {
    transition: none;
  }
}

@media (min-width: 768px) and (max-width: 1024px) {
  .tv-product {
    left: var(--tablet-x);
    top: var(--tablet-y);
    width: var(--tablet-w);
  }
}

@media (max-width: 767px) {
  .tv-product {
    left: var(--mobile-x);
    top: var(--mobile-y);
    width: var(--mobile-w);
  }
}

/* Layout responsive opzionali: desktop ereditato finché non personalizzato. */
@media (min-width:768px) and (max-width:1024px){.tv-app .tv-table .tv-product{left:var(--tablet-x)!important;top:var(--tablet-y)!important;width:var(--tablet-w)!important}}
@media (max-width:767px){.tv-app .tv-table .tv-product{left:var(--mobile-x)!important;top:var(--mobile-y)!important;width:var(--mobile-w)!important}}

/* Sfondi indipendenti per tablet e smartphone; i colori personalizzati restano invariati. */
@media (min-width:768px) and (max-width:1024px){.tv-app .tv-table{background-image:var(--tv-bg-tablet,var(--tv-bg))!important}}
@media (max-width:767px){.tv-app .tv-table{background-image:var(--tv-bg-mobile,var(--tv-bg))!important}}
