/* Porting locale della sezione Piante 3D di Villa Vedano al Lambro. */

#s04 .piante-head {
  max-width: 720px;
}

#s04 .piante-body {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 0.9fr);
  gap: clamp(36px, 5vw, 80px);
  align-items: start;
  margin-top: clamp(40px, 6vh, 72px);
}

#s04 .piante-sticky {
  position: sticky;
  top: 92px;
}

#s04 .piante-tabs {
  display: inline-flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

#s04 .piante-tab {
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--muted);
  font: 600 12px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.35s ease, color 0.35s ease;
}

#s04 .piante-tab:hover {
  color: var(--ink);
}

#s04 .piante-tab.is-active {
  background: rgba(194, 154, 107, 0.18);
  color: var(--bronze-soft);
}

#s04 .piante-stage {
  position: relative;
  width: min(100%, calc((100svh - 300px) * 4 / 3));
  aspect-ratio: 4 / 3;
  overflow: clip;
  border-radius: 4px;
  background: #f7f3ed;
  box-shadow: var(--shadow);
  touch-action: pan-y;
}

#s04 .piante-plan,
#s04 .piante-view {
  position: absolute;
  margin: 0;
}

#s04 .piante-plan {
  top: 0;
  left: 50%;
  height: 100%;
  aspect-ratio: 968 / 1235;
  translate: -50% 0;
}

#s04 .piante-plan:not(.is-on) {
  opacity: 0;
}

#s04 .piante-plan img,
#s04 .piante-view img {
  width: 100%;
  height: 100%;
  mix-blend-mode: multiply;
}

#s04 .piante-plan svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

#s04 .piante-dim {
  fill: rgba(247, 243, 237, 0.42);
  fill-rule: evenodd;
}

#s04 .piante-room {
  fill: rgba(194, 154, 107, 0.12);
  stroke: #9b7651;
  stroke-width: 6;
  stroke-linejoin: round;
}

#s04 .piante-view {
  inset: 0;
  will-change: transform, opacity;
}

#s04 .piante-view img {
  object-fit: contain;
}

#s04 .piante-nav,
#s04 .piante-mode,
#s04 .piante-tab,
#s04 .piante-step {
  -webkit-tap-highlight-color: transparent;
}

#s04 .piante-nav {
  position: absolute;
  bottom: 10px;
  z-index: 2;
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(33, 26, 19, 0.16);
  border-radius: 999px;
  background: rgba(247, 243, 237, 0.92);
  color: #2a2119;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

#s04 .piante-nav.prev {
  right: 52px;
}

#s04 .piante-nav.next {
  right: 10px;
}

#s04 .piante-tag {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(33, 26, 19, 0.88);
  color: var(--ink);
  font: 500 12px/1.2 var(--sans);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
}

#s04 .piante-caption {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 18px 2px 14px;
  border-bottom: 1px solid var(--line);
}

#s04 .piante-num {
  color: var(--bronze);
  font-family: var(--serif);
  font-size: 22px;
}

#s04 .piante-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#s04 .piante-name {
  font-family: var(--serif);
  font-size: clamp(19px, 1.8vw, 24px);
  font-weight: 480;
  line-height: 1.2;
}

#s04 .piante-floor {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

#s04 .piante-area {
  color: var(--bronze-soft);
  font-family: var(--serif);
  font-size: clamp(19px, 1.8vw, 24px);
  white-space: nowrap;
}

#s04 .piante-mode {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 8px 14px;
  border: 1px solid rgba(33, 26, 19, 0.16);
  border-radius: 999px;
  background: rgba(247, 243, 237, 0.92);
  color: #4a3d30;
  font: 500 12px/1 var(--sans);
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
}

#s04 .piante-mode:hover,
#s04 .piante-mode[aria-pressed="true"] {
  border-color: #9b7651;
  color: #2a2119;
}

#s04 .piante-desc {
  display: none;
  margin: 12px 0 0;
  font-size: 15px;
}

#s04 .piante-note {
  max-width: 62ch;
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.55;
}

#s04 .piante-note a {
  color: var(--bronze);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

#s04 .piante-steps {
  padding-bottom: 32vh;
}

#s04 .piante-group {
  margin: 0;
  padding: 28px 0 6px;
  color: var(--bronze);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
}

#s04 .piante-group:first-child {
  padding-top: 18vh;
}

#s04 .piante-step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 16px;
  align-content: center;
  width: 100%;
  min-height: 34vh;
  padding: 20px 0;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  opacity: 0.36;
  transition: opacity 0.5s ease;
}

#s04 .piante-step:hover,
#s04 .piante-step.is-active {
  opacity: 1;
}

#s04 .ps-num {
  grid-row: span 3;
  padding-top: 4px;
  color: var(--bronze);
  font-family: var(--serif);
  font-size: 18px;
}

#s04 .ps-name {
  font-family: var(--serif);
  font-size: clamp(22px, 2.2vw, 30px);
  font-weight: 480;
  line-height: 1.15;
}

#s04 .ps-area {
  color: var(--bronze-soft);
  font-family: var(--serif);
  font-size: 18px;
}

#s04 .ps-desc {
  max-width: 34ch;
  margin-top: 6px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

@media (max-width: 960px) {
  /* telefono: piano, scena, schede delle stanze, poi testo e dicitura */
  #s04 .piante-body {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  #s04 .piante-sticky {
    display: contents;
  }

  #s04 .piante-tabs { order: 1; }
  #s04 .piante-stage { order: 2; }
  #s04 .piante-steps { order: 3; }
  #s04 .piante-caption { order: 4; }
  #s04 .piante-desc { order: 5; }
  #s04 .piante-note { order: 6; }

  #s04 .piante-tabs {
    display: flex;
    width: 100%;
  }

  #s04 .piante-tab {
    flex: 1;
    padding: 10px 6px;
    font-size: 11px;
    letter-spacing: 0.04em;
  }

  #s04 .piante-stage {
    width: 100%;
  }

  #s04 .piante-nav {
    display: block;
  }

  #s04 .piante-desc {
    display: block;
  }

  #s04 .piante-steps {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding: 2px 0 6px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  #s04 .piante-steps::-webkit-scrollbar {
    display: none;
  }

  #s04 .piante-group,
  #s04 .ps-num,
  #s04 .ps-desc,
  #s04 .piante-steps[data-group="pt"] .piante-step:not([data-group="pt"]),
  #s04 .piante-steps[data-group="pp"] .piante-step:not([data-group="pp"]),
  #s04 .piante-steps[data-group="ext"] .piante-step:not([data-group="ext"]) {
    display: none;
  }

  #s04 .piante-step {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: 2px;
    width: auto;
    min-height: 0;
    padding: 10px 16px;
    border: 1px solid var(--line);
    border-radius: 6px;
    opacity: 0.6;
    scroll-snap-align: center;
  }

  #s04 .piante-step.is-active {
    border-color: var(--bronze);
  }

  #s04 .ps-name {
    font-size: 15px;
    white-space: nowrap;
  }

  #s04 .ps-area {
    font-size: 13px;
  }

  #s04 .piante-note {
    margin-top: 16px;
  }
}

/* Raccordo alla base comune e fallback progressivo. */
#s04 { background: var(--bg-2); }
#s04 .mod-inner { max-width: calc(1180px + 2 * var(--gutter)); }
#s04 .piante-body { margin-top: 0; }
#s04 .piante-note { color: var(--muted); }
#s04 .piante-stage { max-width: 100%; }
#s04 .piante-caption,
#s04 .piante-desc,
#s04 .piante-note { max-width: min(100%, calc((100svh - 300px) * 4 / 3)); }
#s04 .piante-view .ai-badge { bottom: 12px; }
#s04 .piante-tag { max-width: calc(100% - 16px); white-space: normal; }
#s04 .piante-nav:disabled { opacity: 0.35; cursor: default; }
#s04 .piante-tab { min-height: 40px; }
#s04 .piante-nav { width: 44px; height: 44px; }
#s04 .piante-nav.prev { right: 62px; }
#s04:not(.is-ready) .piante-tabs,
#s04:not(.is-ready) .piante-mode,
#s04:not(.is-ready) .piante-nav { display: none; }
#s04:not(.is-ready) .piante-step { opacity: 1; cursor: default; }
#s04 .piante-static { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px 32px; margin-top: 48px; }
#s04 .piante-static[hidden] { display: none; }
#s04 .piante-static figure { margin: 0; min-width: 0; }
#s04 .piante-static-media { position: relative; overflow: hidden; background: #f7f3ed; border-radius: 4px; }
#s04 .piante-static-media img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; }
#s04 .piante-static h3 { margin: 18px 0 8px; font: 480 26px/1.2 var(--serif); }
#s04 .piante-static p { margin: 6px 0 0; font-size: 15px; color: var(--muted); }
#s04.is-reduced .piante-body { display: block; }
#s04.is-reduced .piante-sticky { display: block; position: static; }
#s04.is-reduced .piante-tabs,
#s04.is-reduced .piante-mode,
#s04.is-reduced .piante-nav,
#s04.is-reduced .piante-tag,
#s04.is-reduced .piante-caption,
#s04.is-reduced .piante-desc,
#s04.is-reduced .piante-steps { display: none; }
#s04.is-reduced .piante-stage { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; width: 100%; aspect-ratio: auto; background: transparent; box-shadow: none; }
#s04.is-reduced .piante-plan { position: relative; top: auto; left: auto; translate: none; height: auto; width: 100%; opacity: 1 !important; background: #f7f3ed; }
#s04.is-reduced .piante-plan svg,
#s04.is-reduced .piante-view { display: none; }
#s04.is-reduced .piante-note { max-width: 85ch; }

@media (max-width: 960px) {
  #s04 .piante-caption,
  #s04 .piante-desc,
  #s04 .piante-note { max-width: 100%; }
  #s04:not(.is-ready) .piante-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
  #s04:not(.is-ready) .piante-steps[data-group] .piante-step { display: flex; }
  #s04:not(.is-ready) .ps-name { white-space: normal; }
  #s04 .piante-static { grid-template-columns: 1fr; gap: 36px; }
}

@media (max-width: 480px) {
  #s04 .piante-caption { gap: 10px; }
  #s04 .piante-name { font-size: 18px; }
  #s04 .piante-area { font-size: 17px; white-space: normal; text-align: right; }
  #s04 .piante-floor { font-size: 10px; letter-spacing: 0.12em; }
}

@media (prefers-reduced-motion: reduce) {
  #s04 .piante-sticky { position: static; }
  #s04 .piante-step { min-height: 0; padding-block: 22px; opacity: 1; }
  #s04 .piante-steps { padding-bottom: 0; }
  #s04 .piante-group:first-child { padding-top: 20px; }
}
