/* ==========================================================================
   BUILDING FEATURES — "The building, in section", on property_details.html.
   All 22 features, in five groups, beside a cross-section of the tower drawn
   in gold on navy. Choosing a group, or pointing at a feature, lights the
   part of the building it belongs to; the residential windows switch on
   when the floors are lit. The drawing draws itself in when first seen and
   is held in view on wide screens while the list scrolls past.

   js/building-features.js adds .is-enhanced and .bx--armed; without it every
   group is listed and the drawing simply shows.
   ========================================================================== */

.bx { grid-column: 1 / -1; margin-block-start: clamp(56px, 6vw, 104px); }


/* --- the head --------------------------------------------------------------------- */
.bx__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--sp-lg) var(--sp-xl);
  padding-block-end: clamp(24px, 2.6vw, 40px);
  border-bottom: 1px solid var(--rule);
}
.bx__title-wrap { display: grid; gap: var(--sp-sm); }
.bx__h {
  font-family: var(--font-display);
  font-size: clamp(40px, 4.4vw, 76px);
  font-weight: var(--fw-medium);
  line-height: 1.02;
  letter-spacing: -.02em;
  color: var(--c-navy);
}
.bx__h em { font-style: italic; color: var(--c-gold-ink); }

.bx__totals { display: flex; }
.bx__totals > div { padding-inline: clamp(18px, 2vw, 34px); }
.bx__totals > div:last-child { padding-inline-end: 0; }
.bx__totals > div + div { border-inline-start: 1px solid rgb(127 95 40 / .3); }
.bx__totals dt {
  font-family: var(--font-display);
  font-size: clamp(40px, 3.6vw, 60px);
  font-weight: var(--fw-medium);
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1;
  color: var(--c-navy);
}
.bx__totals dd {
  margin-block-start: 6px;
  font-size: 11px;
  font-weight: var(--fw-semi);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--c-slate);
}


/* --- the body ----------------------------------------------------------------------- */
.bx__body {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, .92fr);
  align-items: start;
  gap: clamp(32px, 4vw, 72px);
  margin-block-start: clamp(28px, 3vw, 48px);
}

.bx__chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bx__chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 8px 0 16px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-pill);
  font-size: var(--fs-small);
  font-weight: var(--fw-semi);
  white-space: nowrap;
  color: var(--c-navy);
  transition: background-color var(--dur-fast) var(--ease-css), border-color var(--dur-fast) var(--ease-css), color var(--dur-fast) var(--ease-css);
}
.bx__chip b {
  display: grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  padding-inline: 6px;
  border-radius: var(--r-pill);
  background: rgb(255 255 255 / .6);
  font-size: 12px;
  font-weight: var(--fw-bold);
}
.bx__chip:hover { border-color: var(--c-navy); }
.bx__chip.is-active { border-color: var(--c-navy); background: var(--c-navy); color: var(--c-ivory); }
.bx__chip.is-active b { background: var(--c-gold); color: var(--c-navy); }

/* groups */
.bx__group { margin-block-start: clamp(24px, 2.4vw, 36px); }
.bx.is-enhanced:not(.is-all) .bx__group:not(.is-active) { display: none; }
.bx.is-enhanced .bx__group.is-active,
.bx.is-all .bx__group { animation: bx-in .55s var(--ease-css) both; }
@keyframes bx-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.bx__group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-block-end: 10px; }
.bx__group-h {
  font-family: var(--font-display);
  font-size: clamp(26px, 2.2vw, 34px);
  font-weight: var(--fw-medium);
  line-height: 1.1;
  color: var(--c-navy);
}
.bx__group-lead { font-size: var(--fs-small); color: var(--c-slate); }

.bx__list { display: grid; }
.bx__item {
  position: relative;
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 12px 14px 12px 10px;
  border-bottom: 1px solid var(--rule);
  border-radius: 12px;
  cursor: default;
  transition: background-color .35s var(--ease-css), box-shadow .35s var(--ease-css), border-color .35s var(--ease-css);
}
.bx__item:focus-visible { outline: 2px solid var(--c-gold); outline-offset: 2px; }
.bx__item:hover,
.bx__item:focus-visible,
.bx__item.is-hot {
  border-color: transparent;
  background: var(--c-ivory);
  box-shadow: 0 2px 6px rgb(var(--scrim) / .05), 0 18px 40px -24px rgb(var(--scrim) / .35);
}

.bx__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgb(127 95 40 / .3);
  border-radius: 50%;
  background: rgb(255 255 255 / .55);
  transition: background-color .35s var(--ease-css), border-color .35s var(--ease-css);
}
.bx__icon-svg { width: 26px; height: 26px; fill: var(--c-gold-ink); transition: fill .35s var(--ease-css); }
.bx__item:hover .bx__icon,
.bx__item:focus-visible .bx__icon,
.bx__item.is-hot .bx__icon { border-color: var(--c-navy); background: var(--c-navy); }
.bx__item:hover .bx__icon-svg,
.bx__item:focus-visible .bx__icon-svg,
.bx__item.is-hot .bx__icon-svg { fill: var(--c-gold); }

.bx__text { display: grid; gap: 2px; min-width: 0; }
.bx__num { font-size: 10px; font-weight: var(--fw-bold); letter-spacing: .16em; color: var(--c-gold-ink); }
.bx__title { font-size: var(--fs-text); font-weight: var(--fw-semi); line-height: 1.4; color: var(--c-ink); }

.bx__tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: var(--fw-semi);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--c-slate);
}
.bx__tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c-gold); }


/* --- the section drawing -------------------------------------------------------------- */
.bx__fig {
  position: sticky;
  top: 104px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: min(calc(100vh - 136px), 820px);
  min-height: 560px;
  margin: 0;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(rgb(208 173 103 / .06) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, rgb(208 173 103 / .06) 1px, transparent 1px) 0 0 / 24px 24px,
    radial-gradient(120% 90% at 50% 40%, #0f2740 0%, #0a1a2c 55%, #071324 100%);
  color: var(--c-ivory);
  box-shadow: 0 2px 6px rgb(var(--scrim) / .08), 0 60px 100px -50px rgb(var(--scrim) / .6);
}
.bx__fig::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 1px solid rgb(248 245 239 / .1);
  border-radius: 8px;
  pointer-events: none;
}

.bx__fig-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-sm);
  padding: 24px 28px 0;
}
.bx__fig-k { font-size: 11px; font-weight: var(--fw-semi); letter-spacing: .14em; text-transform: uppercase; color: var(--c-mist); }
.bx__fig-now {
  font-family: var(--font-display);
  font-size: clamp(20px, 1.6vw, 26px);
  font-weight: var(--fw-medium);
  font-style: italic;
  color: var(--c-gold);
}

.bx__fig-art { min-height: 0; padding: 10px 18px; }
.bx__svg { display: block; width: 100%; height: 100%; overflow: visible; }

.bx__fig-cap {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 28px 24px;
  font-size: var(--fs-small);
  font-weight: var(--fw-semi);
  color: var(--c-ivory);
}
.bx__fig-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--c-gold); box-shadow: 0 0 10px var(--c-gold); }

/* the drawing's inks */
.bx__svg .ln { fill: none; stroke: var(--c-gold); stroke-linecap: round; stroke-linejoin: round; }
.bx__svg .o { stroke-width: 1.5; }
.bx__svg .f { stroke-width: 1; stroke-opacity: .7; }
.bx__svg .m { stroke-width: .8; stroke-opacity: .45; }
.bx__svg .g { stroke-width: 1; stroke-opacity: .4; }
.bx__svg .hatch { stroke: var(--c-gold); stroke-width: .7; stroke-opacity: .22; }
.bx__svg .win { fill: rgb(255 196 122 / 0); stroke: rgb(208 173 103 / .35); stroke-width: .6; transition: fill .6s var(--ease-css), stroke .6s var(--ease-css); }
.bx__svg .car { fill: rgb(208 173 103 / .35); }
.bx__svg .wheel { fill: var(--c-gold); opacity: .7; }
.bx__svg .lvl { font-family: var(--font-body); font-size: 9px; font-weight: 700; letter-spacing: .12em; fill: var(--c-mist); opacity: .75; }
.bx__svg .dim { font-size: 8px; letter-spacing: .16em; fill: var(--c-gold); opacity: .8; }

/* lit zones; the windows switch on with their floors */
.bx__svg .bx-z { fill: rgb(208 173 103 / 0); stroke: rgb(208 173 103 / 0); stroke-width: 1; transition: fill .45s var(--ease-css), stroke .45s var(--ease-css); }
.bx__svg .bx-z.is-on { fill: rgb(208 173 103 / .12); stroke: rgb(208 173 103 / .5); }
.bx__svg .bx-z.is-hot { fill: rgb(208 173 103 / .26); stroke: var(--c-gold); animation: bx-pulse 1.8s ease-in-out infinite; }
@keyframes bx-pulse { 50% { fill: rgb(208 173 103 / .14); } }
.bx[data-lit~="floors"] .bx__svg .win:not(.win--lounge) { fill: rgb(255 196 122 / .72); stroke: rgb(255 196 122 / .9); }
.bx[data-lit~="lounge"] .bx__svg .win--lounge { fill: rgb(255 196 122 / .72); stroke: rgb(255 196 122 / .9); }
.bx[data-lit~="whole"] .bx__svg .win { fill: rgb(255 196 122 / .45); }

/* the draw-in: structure first, then floors, then the details */
.bx--armed:not(.is-drawn) .bx__svg .ln { stroke-dasharray: 1; stroke-dashoffset: 1; }
.bx--armed:not(.is-drawn) .bx__svg .win,
.bx--armed:not(.is-drawn) .bx__svg .car,
.bx--armed:not(.is-drawn) .bx__svg .wheel,
.bx--armed:not(.is-drawn) .bx__svg .hatch,
.bx--armed:not(.is-drawn) .bx__svg .lvl,
.bx--armed:not(.is-drawn) .bx__zones { opacity: 0; }
.bx--armed .bx__svg .ln { stroke-dasharray: 1; transition: stroke-dashoffset 1.6s cubic-bezier(.65, 0, .35, 1); }
.bx--armed .bx__svg .f { transition-delay: .35s; }
.bx--armed .bx__svg .m { transition-delay: .8s; transition-duration: 1.2s; }
.bx--armed .bx__svg .car,
.bx--armed .bx__svg .wheel,
.bx--armed .bx__svg .hatch,
.bx--armed .bx__svg .lvl { transition: opacity .8s var(--ease-css) 1.2s; }
.bx--armed .bx__zones { transition: opacity .8s var(--ease-css) 1.6s; }
.bx--armed .bx__svg .win { transition: opacity .8s var(--ease-css) 1.3s, fill .6s var(--ease-css), stroke .6s var(--ease-css); }


/* --- narrow --------------------------------------------------------------------------- */
@media (max-width: 1099px) {
  .bx__body { grid-template-columns: minmax(0, 1fr); }
  .bx__fig { order: -1; position: relative; top: auto; height: clamp(520px, 92vw, 760px); min-height: 0; }
}

@media (max-width: 759px) {
  .bx__head { grid-template-columns: minmax(0, 1fr); }
  .bx__totals > div:first-child { padding-inline-start: 0; }
  .bx__fig { height: clamp(440px, 130vw, 600px); }
  .bx__fig-bar { padding: 20px 20px 0; flex-wrap: wrap; gap: 4px 12px; }
  .bx__fig-cap { padding: 0 20px 20px; }
  .bx__chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: calc((100vw - var(--container)) / -2);
    padding-inline: calc((100vw - var(--container)) / 2);
    scrollbar-width: none;
  }
  .bx__chips::-webkit-scrollbar { display: none; }
  .bx__chip { flex: none; }
  .bx__item { grid-template-columns: 44px minmax(0, 1fr); gap: 14px; padding-inline: 6px; }
  .bx__icon { width: 44px; height: 44px; }
  .bx__icon-svg { width: 22px; height: 22px; }
  .bx__tag { grid-column: 2; margin-block-start: -4px; }
}


@media (prefers-reduced-motion: reduce) {
  .bx__group.is-active,
  .bx.is-all .bx__group,
  .bx__svg .bx-z.is-hot { animation: none; }
  .bx__item, .bx__icon, .bx__icon-svg, .bx__svg .win, .bx__svg .bx-z { transition: none; }
}
