section,
#section {

    article,
    #article{

        padding: 3rem 0;

        @media only screen and (max-width: 980px) {
            padding: 1.5rem 0;
        }
  }  
}


.floor-selector {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 0.5rem;
}

.floor-buttons {
  display: flex;
  flex-direction: row;
  gap: 1.5rem;
}

.floor-btn {
  padding: 0.5rem 0;
  background-color: transparent;
  color: var(--grigio01);
  border: none;
  text-decoration: none;
  font-weight: 500;
  position: relative;
  transition: color .56s;
  white-space: nowrap;
}

.floor-btn.active {
  color: var(--colore01);
}

.floor-btn.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--colore01);
}

.floor-btn:hover {
  color: var(--colore01);
}

/* 
===============================
    FLOOR PLAN CONTAINER
===============================
*/
.floorplan-wrapper {
  position: relative;
  background-color: var(--grigio01);
  /* overflow: hidden; */
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  /* margin-bottom: 2rem; */
}

.floorplan-image-container {
  position: relative;
  display: flex;
  justify-content: center;
  max-height: 600px;
  overflow: hidden;
}

.floorplan-image {
  max-width: 100%;
  width: 100%;
  max-height: 100%;
  object-fit: contain;
      z-index: 2;
    pointer-events: none;
}

.floorplan-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

svg{
  max-width: 100%;
  max-height: 100%;
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center center;
}


/* 
===============================
    APARTMENT OVERLAYS
===============================
*/

.apartment-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  /* The important change: make overlay transparent to pointer events */
  pointer-events: none;
}

.apartment-path {
  fill: transparent;
  stroke: rgba(0, 0, 0, 0);
  stroke-width: 2;
  transition: all .56s;
  
  pointer-events: auto;
  cursor: pointer;
}

.apartment-overlay.available:hover .apartment-path {
  fill: rgba(96, 181, 96, 0.4);
  stroke: rgba(96, 181, 96, 0.8);
  stroke-width: 2;
}

.apartment-overlay.available .apartment-path {
  fill: rgba(96, 181, 96, 0.2);
  stroke: rgba(96, 181, 96, 0.5);
}

.apartment-overlay.sold .apartment-path {
  fill: rgba(220, 53, 69, 0.2);
  stroke: rgba(220, 53, 69, 0.5);
}

.apartment-overlay.sold:hover .apartment-path {
  fill: rgba(220, 53, 69, 0.4);
  stroke: rgba(220, 53, 69, 0.8);
}

/* 
===============================
    APARTMENT TOOLTIP
===============================
*/
.apartment-tooltip {
  position: absolute;
  display: none;
  background-color: var(--grigio06);
  border-radius: 6px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  padding: 1rem;
  min-width: 220px;
  max-width: 280px;
  z-index: 100;
  pointer-events: auto;
  animation: fadeIn 0.2s ease;
  border: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--nero)
}

.apartment-tooltip.show {
  display: block;
}

.tooltip-header {
  display: flex;
  gap: .2rem;
  align-items: center;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding-bottom: 0.5rem;

  font-family: var(--carattere02);
  font-weight: 700;
  font-size: 1rem;
  color: var(--nero);
  text-transform: uppercase;
}

.tooltip-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--colore01scuro);
}

.tooltip-status {
  position: absolute;
  right: 0;
  top: 0;

  font-size: 0.8rem;
  font-weight: 900;
  width: 1.4rem;
  height: 1.4rem;
  display: block;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.tooltip-status.available {
  background-color: rgba(96, 181, 96, 0.2);
  color: rgb(79, 156, 79);
}

.tooltip-status.sold {
  background-color: rgba(220, 53, 69, 0.2);
  color: rgb(187, 56, 69);
}

.tooltip-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.tooltip-detail {
  display: flex;
  align-items: center;
  color: var(--nero);
  font-size: 0.95rem;
}

.detail-icon {
  margin-right: 0.5rem;
  font-style: normal;
  font-size: 0.85rem;
}

.tooltip-footer {
  margin-top: 0.5rem;
}

.tooltip-footer .btn {
  width: 100%;
  font-size: 0.85rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  pointer-events: auto;
}

/* 
===============================
    SIMPLIFIED LEGEND & COUNTER
===============================
*/

.floorplan-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background-color: var(--grigio02);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  margin-top: 1.5rem;
}

.plan-legend {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-indicator {
  width: 16px;
  height: 16px;
  border-radius: 8px;
}

.status-available {
  background-color: rgba(96, 181, 96, 0.8);
}

.status-sold {
  background-color: rgba(220, 53, 69, 0.8);
}

.status-text {
  font-size: 0.9rem;
  color: var(--bianco);
  font-weight: 600;
}

.plan-counter {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--colore01);
  font-weight: 600;
}

.counter-value {
  font-weight: 600;
  color: var(--bianco);
  margin-left: 0.25rem;
  font-size: clamp(1, 3svw, 1.2rem);
}

/* Animation */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 
===============================
    RESPONSIVE ADJUSTMENTS
===============================
*/
@media (max-width: 768px) {
  .floor-selector {
    overflow-x: auto;
    justify-content: flex-start;
    padding-bottom: 0.75rem;
  }
  
  .floor-buttons {
    padding: 0 0.5rem;
  }
  
  .floorplan-info {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  
  .plan-legend {
    width: 100%;
  }
  
  .plan-counter {
    width: 100%;
    justify-content: center;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
  }
  
  .floorplan-image-container {
    max-height: 450px;
  }
}

@media (max-width: 480px) {
  .floor-buttons {
    gap: 1rem;
  }
  
  .plan-legend {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  
  .apartment-tooltip {
    max-width: 90%;
  }
}



/* 
===============================
    VIDEO
===============================
*/

.video-grid {
  display: grid;
  grid-template-columns: repeat(1, 1fr);
  gap: 30px;
  margin-bottom: 20px;
}

.video-item {
  display: flex;
  flex-direction: column;
  background: var(--color-primary);
  border-radius: 4px;
  padding: 22px;
}

.video-content {
  flex-grow: 1;
  margin-bottom: 15px;
  min-height: 100px;
  padding: 2px;
}

.video-item h3 {
  margin: 0 0 8px 0;
  font-size: 1.3rem
}

.video-item p {
  margin: 0;
}

.video-link {
  display: block;
  width: 100%;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
}

.video-link img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
  aspect-ratio: 16 / 9;
}

@media (min-width: 768px) {
  .video-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
  }
}

@media (min-width: 1024px) {
  .video-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
  }
}






/* 
  ===============================
      GALLERY
  ===============================
/* Gallery: 3x2 grid with first image full-height (left) and others 2x2 on the right */

.gallery{
    width: var(--larghezza) !important;
    padding-bottom: 1rem !important;
    max-width: 90% !important;

    @media only screen and (max-width: 1760px) {
        width: 90vw !important; 
        max-width: 100% !important;
    }
}

.gallery-grid{
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 1rem;
    width: 100%;
    /* keeps each cell at 4:3 (3 columns x 2 rows -> overall 2:1) */
    aspect-ratio: 2 / 1;
    align-items: stretch;
}

.gallery-grid .gallery-item{
    position: relative;
    overflow: hidden;
    display: block;
    background: var(--grigio01);
}

.gallery-grid .gallery-item img,
.gallery-grid .gallery-image{
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* first image: occupy left column and both rows */
.gallery-grid .gallery-item:first-child{
    grid-column: 1 / 2;
    grid-row: 1 / 3;
}

/* responsive: on narrow screens stack items and keep 4:3 aspect ratio per item */
@media (max-width: 800px){
    .gallery-grid{
        grid-template-columns: 1fr;
        grid-template-rows: none;
        aspect-ratio: unset;
        gap: .75rem;
    }

    .gallery-grid .gallery-item:first-child{
        grid-column: 1 / -1;
        grid-row: auto;
    }

    .gallery-grid .gallery-item{
        aspect-ratio: 4 / 3;
    }
}







/* CAMBIO ORIENTAMENTO RESPONSIVE */

.floorplan-image-container{
  &:after{
    content: "";
    position: absolute;
    display: block;
    width: 48px;
    height: 48px;
    top: 1rem;
    right: 1rem;
    background-image: url('/css/images/n-up.png');
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    opacity: .8;

    display: none;
  }
}


@media only screen and (max-width: 1000px) {

  .floorplan-image-container{

    max-height: none;
    height: 125svw;

    &:after{
      background-image: url('/css/images/n-dx.png');
    }
    
    .floorplan-image{
      transform: scale(1.3) rotate(90deg);
      aspect-ratio: 1 / 1;
    }

    .floorplan-overlay{
      transform: scale(1.3) rotate(90deg);
      padding-bottom: 100%;

      .apartment-overlay{
        display: flex;
      }
      
    }
  }
  
}