.genplan {
  position: relative;
  background-color: var(--color-beige);
}

.genplan__head {
  display: grid;
  grid-template-columns: 101.6rem minmax(0, 1fr);
  grid-template-areas:
    "title title"
    "filters legend";
  row-gap: 4.9rem;
  padding: 13.6rem 0 4.4rem 19.9rem;
}

.genplan__title {
  grid-area: title;
}

.genplan__filters {
  grid-area: filters;
}

.genplan__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 1.6rem;
}

.genplan__tab {
  min-width: 16.1rem;
  height: 4.2rem;
  padding: 0 2.8rem;
  font-size: max(2rem, 14px);
  font-weight: 500;
  line-height: 1.05;
  text-align: left;
  color: var(--color-white);
  background-color: var(--color-grey);
  border-radius: 3.3rem;
  transition: background-color var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.genplan__tab.is-active,
.genplan__tab:hover {
  background-color: var(--color-dark);
}

.genplan__statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.6rem;
  margin-top: 3.2rem;
}

/* Smaller than a legend item, so all statuses stay inside the left column
   even after a new one is added */
.genplan__status {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding-top: 0.3rem;
  font-size: max(1.6rem, 13px);
  font-weight: 500;
  line-height: 1.05;
}

.genplan__status::before {
  content: "";
  flex-shrink: 0;
  width: 2.6rem;
  height: 2.4rem;
  margin-top: -0.3rem;
  /* The colour comes straight from PHP (skopino_genplan_status_colors), inline on the element */
  background-color: var(--status-color);
}

.genplan__legend {
  display: grid;
  grid-area: legend;
  grid-template-columns: 31rem auto;
  align-content: start;
  row-gap: 3.7rem;
}

.genplan__legend-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
  font-size: max(2rem, 14px);
  font-weight: 500;
  line-height: 1.05;
}

.genplan__legend-item:nth-child(even) {
  translate: 0 0.6rem;
}

.genplan__legend-label {
  margin-top: 1rem;
}

/* Decorative pointer from the legend to the map */
.genplan__pointer {
  position: absolute;
  top: 26rem;
  left: calc(50% - 4.2rem);
  z-index: 2;
  width: 1.7rem;
  height: 58.9rem;
}

/* Map
   ========================================================================== */

.genplan__map {
  position: relative;
  aspect-ratio: var(--map-ratio, 1920 / 1080);
  overflow: hidden;
}

.genplan__canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* One finger scrolls the page; two fingers are handled by main.js */
  touch-action: pan-y;
}

/* Zoomed in, both axes move the plan itself */
.genplan__map.is-zoomed .genplan__canvas {
  touch-action: none;
}

.genplan__reset {
  position: absolute;
  right: 1.6rem;
  bottom: 1.6rem;
  z-index: 3;
  display: none;
  height: 4rem;
  padding: 0 2rem;
  font-size: max(1.6rem, 13px);
  font-weight: 500;
  color: var(--color-white);
  background-color: var(--color-dark);
  border-radius: 3.3rem;
}

.genplan__map.is-zoomed .genplan__reset {
  display: block;
}

/* Markers sit on top of the canvas at their own coordinates, 0…1 of the picture */
.genplan__marker {
  position: absolute;
  top: calc(var(--y) * 100%);
  left: calc(var(--x) * 100%);
  width: 4.2rem;
  height: 4.2rem;
  translate: -50% -50%;
}

.genplan__tip {
  position: absolute;
  z-index: 3;
  padding: 0.8rem 1.2rem;
  font-size: max(1.6rem, 13px);
  font-weight: 500;
  line-height: 1.05;
  color: var(--color-white);
  pointer-events: none;
  background-color: var(--color-dark);
  border-radius: 0.6rem;
  translate: -50% calc(-100% - 1.2rem);
}

.genplan__tip[hidden] {
  display: none;
}

/* Tablet & mobile
   ========================================================================== */

@media (max-width: 1279.98px) {
  .genplan__head {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 4rem;
    row-gap: 3.2rem;
    padding: var(--section-space) var(--gutter) 4rem;
  }

  .genplan__statuses {
    margin-top: 2.4rem;
  }

  .genplan__legend {
    grid-template-columns: repeat(2, auto);
    gap: 1.6rem 3.2rem;
  }

  .genplan__legend-item:nth-child(even) {
    translate: none;
  }

  .genplan__legend-label {
    margin-top: 1.1rem;
  }

  .genplan__pointer {
    display: none;
  }

  /* The plan fits the screen: details are reached by pinching, not by side scrolling */
  .genplan__marker {
    width: 3.6rem;
    height: 3.6rem;
  }

  .genplan__reset {
    right: 1.2rem;
    bottom: 1.2rem;
    height: 3.6rem;
    padding: 0 1.6rem;
    font-size: max(1.2rem, 13px);
  }
}

@media (max-width: 767.98px) {
  .genplan__head {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "filters"
      "legend";
  }

  .genplan__tab {
    min-width: 0;
    height: 4rem;
    padding-inline: 2rem;
  }

  .genplan__status {
    gap: 1rem;
  }

  .genplan__status::before {
    width: 2.4rem;
    height: 2.2rem;
  }

  .genplan__legend {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.2rem;
  }

  .genplan__legend-item .map-icon {
    width: 3.6rem;
    height: 3.6rem;
  }

  .genplan__legend-label {
    margin-top: 0.8rem;
  }

  .genplan__marker {
    width: 3rem;
    height: 3rem;
    font-size: 1.6rem;
    border-width: 2px;
  }
}
/* Counter and lots
   ========================================================================== */

.genplan__counter {
  margin-top: 2.4rem;
  font-size: max(2.4rem, 16px);
  font-weight: 500;
  line-height: 1.2;
}

.genplan__counter strong {
  font-size: 1.4em;
  color: var(--color-olive);
}

.genplan__lots {
  padding: 8rem 15.8rem 12rem 19.9rem;
}

.genplan__lots-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 2rem 4rem;
}

.genplan__lots-title {
  font-size: max(2.4rem, 22px);
  font-weight: 500;
  line-height: 1.15;
}

.genplan__lots-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  width: 100%;
}

.genplan__select {
  height: 4rem;
  padding: 0 2.4rem 0 1rem;
  font-size: max(1.2rem, 14px);
  font-weight: 500;
  background: transparent url("../../img/icons/select-arrow.svg") right 1.6rem center / 1.4rem no-repeat;
  border: 2px solid var(--color-dark);
  border-radius: 2.4rem;
  appearance: none;
  gap: 5px;
  background-size: 8px;
  background-position-x: 93%;
}

.genplan__check {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  font-size: max(1.2rem, 14px);
  font-weight: 500;
  cursor: pointer;
}

.genplan__check input {
  width: 1.5rem;
  height: 1.5rem;
  accent-color: var(--color-dark);
}

.genplan__lots-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.6rem;
  margin-top: 3.2rem;
}

.lot[hidden] {
  display: none;
}

.lot__btn {
  display: grid;
  gap: 0.6rem;
  width: 100%;
  height: 100%;
  padding: 2rem 2.2rem;
  text-align: left;
  background-color: var(--color-white);
  border: 1px solid rgba(35, 37, 42, 0.12);
  border-radius: 1.6rem;
  transition: border-color var(--transition), transform var(--transition);
}

.lot__btn:hover {
  border-color: var(--color-dark);
  transform: translateY(-0.3rem);
}

.lot__num {
  font-size: max(2.6rem, 18px);
  font-weight: 600;
  line-height: 1.1;
}

.lot__project,
.lot__plot,
.lot__layer {
  font-size: max(1.6rem, 13px);
  font-weight: 400;
  line-height: 1.25;
}

.lot__layer {
  opacity: 0.6;
}

.lot__status {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 0.4rem;
  font-size: max(1.4rem, 12px);
  font-weight: 500;
}

.lot__status::before {
  content: "";
  width: 1.2rem;
  height: 1.2rem;
  /* The colour is set inline on the element, straight from skopino_genplan_status_colors() */
  background-color: var(--dot);
  border-radius: 50%;
}

.genplan__lots-empty {
  margin-top: 3.2rem;
  font-size: max(1.8rem, 14px);
}

/* Lot card */
.lot-modal__dialog {
  width: 56rem;
  max-width: 100%;
  padding: 3rem 5rem 5rem;
  font-size: max(1rem, 8px);
}

.lot-modal__title {
  margin-top: 1rem;
}

.lot-modal__status {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.2rem;
  font-size: max(2rem, 15px);
  font-weight: 500;
}

.lot-modal__status::before {
  content: "";
  width: 1.4rem;
  height: 1.4rem;
  background-color: var(--status-color, var(--color-free));
  border-radius: 50%;
}

/* Lot gallery: card photo, then the project's gallery and floor plans */
.lot-gallery {
  position: relative;
  margin-top: 2.4rem;
}

.lot-gallery[hidden] {
  display: none;
}

.lot-gallery__viewport {
  overflow: hidden;
  aspect-ratio: 4 / 3;
  border-radius: 1.6rem;
  background-color: var(--color-milk);
}

.lot-gallery__track {
  display: flex;
  height: 100%;
  touch-action: pan-y;
  transition: transform 0.35s ease;
}

.lot-gallery__slide {
  flex: 0 0 100%;
  height: 100%;
}

.lot-gallery__slide img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.lot-gallery__arrow {
  position: absolute;
  top: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.4rem;
  height: 4.4rem;
  background-color: var(--color-white);
  border-radius: 50%;
  box-shadow: 0 0.2em 0.6em rgba(35, 37, 42, 0.18);
  translate: 0 -50%;
  transition: background-color var(--transition);
}

.lot-gallery__arrow[hidden] {
  display: none;
}

.lot-gallery__arrow:hover {
  background-color: var(--color-sand);
}

.lot-gallery__arrow img {
  width: 1.4rem;
  height: auto;
}

.lot-gallery__arrow--prev {
  left: 1.2rem;
}

.lot-gallery__arrow--prev img {
  transform: rotate(180deg);
}

.lot-gallery__arrow--next {
  right: 1.2rem;
}

.lot-gallery__dots {
  position: absolute;
  bottom: 1.4rem;
  left: 50%;
  display: flex;
  gap: 0.8rem;
  translate: -50% 0;
}

.lot-gallery__dots[hidden] {
  display: none;
}

.lot-gallery__dot {
  width: 0.8rem;
  height: 0.8rem;
  background-color: rgba(255, 255, 255, 0.55);
  border-radius: 50%;
  transition: background-color var(--transition);
}

.lot-gallery__dot.is-active {
  background-color: var(--color-white);
}

.lot-modal__list {
  margin-top: 2.8rem;
}

.lot-modal__row {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.2rem 0;
  font-size: max(1.8rem, 14px);
  border-top: 1px solid rgba(35, 37, 42, 0.14);
}

.lot-modal__row[hidden] {
  display: none;
}

.lot-modal__row dt {
  font-weight: 300;
}

.lot-modal__row dd {
  font-weight: 500;
  text-align: right;
}

.lot-modal__price {
  margin-top: 2.4rem;
  font-size: max(2.6rem, 18px);
  font-weight: 600;
}

.lot-modal__cta {
  width: 100%;
  margin-top: 2.4rem;
  padding-inline: 2rem;
  font-size: max(1.6rem, 13px);
}

@media (max-width: 1279.98px) {
  .genplan__lots {
    padding: 5rem var(--gutter) var(--section-space);
  }

  .genplan__lots-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 767.98px) {
  .genplan__lots-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .lot-modal__dialog {
    padding: 2rem 2.2rem 3rem;
  }

  .lot-modal__cta {
    font-size: max(1.4rem, 13px);
  }

  .lot-gallery__viewport {
    aspect-ratio: 3 / 3;
  }
}
