/* ==========================================================================
   ELEVATION — the opening of property_details.html, "Lights on".
   The night photograph of Beam Skyline dissolves into the page's night
   ground. It arrives dark; a gold beam then rises from the ground to the
   crown and the building lights up behind it, floor by floor, while a
   counter on the dimension line beside the tower counts the floors.
   The key figures sit on a gold datum at the foot; pointing at one (or
   tapping it) shows where it lives on the building.

   The photograph's box keeps the image's own proportions (1756 × 896), so
   the drawing over it, the dimension line and the beam are placed in the
   image's own pixels as percentages and stay on the building at any size.
   Image landmarks: crown 72, podium top 652, ground 815.

   js/elevation.js runs the counter, the figures and the parallax. Without
   it (or with motion reduced) the building is lit and everything shows.
   ========================================================================== */

.elev {
  --night: #071324;
  --cx: 68%;                                   /* where the tower stands */
  --rise: 3.2s;                                /* the lighting, ground to crown */
  --rise-at: .7s;                              /* after the dark building fades in */
  /* the photograph's landmarks, in its own pixels (1756 x 896): crown, ground, the ruler's x and
     the beam's span. A page with its own photograph sets its own on the section. */
  --crown: 72; --ground: 815; --rx: 1262; --bl: 470; --br: 1336;
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: max(640px, 100vh);
  min-height: max(640px, 100svh);
  overflow: hidden;
  background: var(--night);
  color: var(--c-ivory);
}

/* --- the night ---------------------------------------------------------------- */
.elev__sky {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(52% 58% at var(--cx) 64%, #10274a 0%, transparent 72%),
    linear-gradient(180deg, #08101f 0%, #0a1629 34%, var(--night) 74%);
}
/* the blueprint grid, strongest behind the words */
.elev__sky::before {
  content: "";
  position: absolute;
  inset: -20px;
  background-image:
    linear-gradient(rgb(208 173 103 / .06) 1px, transparent 1px),
    linear-gradient(90deg, rgb(208 173 103 / .06) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(65% 75% at 22% 52%, #000 0%, transparent 78%);
  mask-image: radial-gradient(65% 75% at 22% 52%, #000 0%, transparent 78%);
  translate: calc(var(--mx, 0) * 6px) calc(var(--my, 0) * 4px);
}
/* the warmth the lit building throws on the night */
.elev__sky::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(34% 46% at var(--cx) 52%, rgb(208 173 103 / .16), transparent 72%);
}
.js .elev__sky::after { opacity: 0; }
.page-in .elev__sky::after { animation: elev-warm 2.4s ease-out calc(var(--rise-at) + var(--rise) * .55) both; }
@keyframes elev-warm { from { opacity: 0; } to { opacity: 1; } }

/* a gold hairline closing the scene, as on every night section */
.elev::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(208 173 103 / .55) 30%, rgb(208 173 103 / .55) 70%, transparent);
  pointer-events: none;
}


/* --- the stage: photograph, drawing, dimension line, beam --------------------- */
.elev__stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.elev__plate {
  --ph: min(78svh, 50vw);
  position: absolute;
  left: var(--cx);
  top: clamp(40px, 7svh, 76px);
  height: var(--ph);
  aspect-ratio: 1756 / 896;
  translate: calc(-50% + var(--mx, 0) * -14px) calc(var(--my, 0) * -9px);
}

/* the photograph melts into the night on every side */
.elev__photo {
  position: absolute;
  inset: 0;
  -webkit-mask-image:
    linear-gradient(90deg, transparent 0%, #000 28%, #000 77%, transparent 100%),
    linear-gradient(180deg, transparent 0%, #000 6.5%, #000 89%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(90deg, transparent 0%, #000 28%, #000 77%, transparent 100%),
    linear-gradient(180deg, transparent 0%, #000 6.5%, #000 89%, transparent 100%);
  mask-composite: intersect;
}
.js .elev__photo { opacity: 0; }
.page-in .elev__photo { animation: elev-arrive 1.6s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes elev-arrive {
  from { opacity: 0; transform: scale(1.035); }
  to   { opacity: 1; transform: none; }
}

.elev__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
}
/* the building before its lights come on */
.elev__img--dim { filter: brightness(.3) saturate(.35) contrast(1.06); }
/* the lit building, uncovered from the ground up through a soft edge that
   rides the beam. --lit is measured from the bottom: the ground is
   81/896 = 9.04% up, the crown 824/896 = 91.96%. */
@property --lit {
  syntax: "<percentage>";
  inherits: false;
  initial-value: 112%;
}
.elev__img--lit {
  -webkit-mask-image: linear-gradient(to top, #000 calc(var(--lit) - 5%), transparent calc(var(--lit) + 3%));
  mask-image: linear-gradient(to top, #000 calc(var(--lit) - 5%), transparent calc(var(--lit) + 3%));
}
.js .elev__img--lit { --lit: 9.04%; }
.page-in .elev__img--lit { animation: elev-lit var(--rise) var(--rise-at) both; }
@keyframes elev-lit {
  0%   { --lit: 9.04%;  animation-timing-function: cubic-bezier(.55, 0, .25, 1); }
  82%  { --lit: 91.96%; animation-timing-function: cubic-bezier(.3, 0, .2, 1); }
  100% { --lit: 112%; }
}

/* the drawing over the photograph: a veil with a window cut where a figure
   lives, and that place drawn in gold */
.elev__marks {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.elev__marks g { opacity: 0; transition: opacity .5s var(--ease-css); }
.elev__marks .veil { fill: rgb(4 11 22 / .62); fill-rule: evenodd; }
.elev__marks .edge {
  fill: none;
  stroke: var(--c-gold);
  stroke-width: 1.6;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 6px rgb(208 173 103 / .7));
  transition: stroke-dashoffset 1s cubic-bezier(.65, 0, .35, 1);
}
.elev__marks .fill { fill: rgb(240 205 130 / .2); }
.elev__marks .dim { fill: none; stroke: var(--c-gold); stroke-width: 1.2; vector-effect: non-scaling-stroke; }
.elev[data-mark="residences"] [data-mk="residences"],
.elev[data-mark="bedrooms"] [data-mk="bedrooms"],
.elev[data-mark="size"] [data-mk="size"],
.elev[data-mark="land"] [data-mk="land"] { opacity: 1; }
.elev[data-mark="residences"] [data-mk="residences"] .edge,
.elev[data-mark="bedrooms"] [data-mk="bedrooms"] .edge,
.elev[data-mark="size"] [data-mk="size"] .edge,
.elev[data-mark="land"] [data-mk="land"] .edge { stroke-dashoffset: 0; }

/* the dimension line: the floors (--floors on the section, 12 by default), ground to crown, x = 1262 */
.elev__ruler {
  position: absolute;
  left: calc(var(--rx) / 1756 * 100%);
  top: calc(var(--crown) / 896 * 100%);
  bottom: calc((896 - var(--ground)) / 896 * 100%);
  width: 1px;
  background: linear-gradient(to top, rgb(208 173 103 / .75), rgb(208 173 103 / .45));
  transition: box-shadow .4s var(--ease-css);
}
.elev__ruler::before,
.elev__ruler::after {                         /* architectural end ticks */
  content: "";
  position: absolute;
  left: -7px;
  width: 15px;
  height: 1px;
  background: var(--c-gold);
  rotate: -45deg;
}
.elev__ruler::before { top: 0; }
.elev__ruler::after { bottom: 0; }
.elev__ruler i {
  position: absolute;
  left: -4px;
  bottom: calc(var(--i) / var(--floors, 12) * 100%);
  width: 9px;
  height: 1px;
  background: rgb(208 173 103 / .45);
  transition: background-color .3s, box-shadow .3s, width .3s, left .3s;
}
.elev__ruler i.is-on { background: #f3dfae; box-shadow: 0 0 8px rgb(243 223 174 / .9); }
.elev__ruler i::after {                       /* floor numbers, shown with "Floors" */
  content: attr(data-n);
  position: absolute;
  right: 16px;
  top: -.55em;
  font-size: 10px;
  font-weight: var(--fw-semi);
  letter-spacing: .08em;
  color: var(--c-gold);
  opacity: 0;
  transition: opacity .3s;
  transition-delay: calc(var(--i) * 30ms);
}
.elev[data-mark="floors"] .elev__ruler { box-shadow: 0 0 12px rgb(208 173 103 / .8); }
.elev[data-mark="floors"] .elev__ruler i { left: -7px; width: 15px; background: #f3dfae; }
.elev[data-mark="floors"] .elev__ruler i:not(:last-child)::after { opacity: 1; }
.js .elev__ruler { clip-path: inset(100% -80px -12px -80px); }
.page-in .elev__ruler { animation: elev-ruler var(--rise) var(--rise-at) both; }
@keyframes elev-ruler {
  0%       { clip-path: inset(100% -80px -12px -80px); animation-timing-function: cubic-bezier(.55, 0, .25, 1); }
  82%, 100% { clip-path: inset(-12px -80px -12px -80px); }
}

/* the beam and the counter riding it, over the same span as the ruler */
.elev__rise {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(var(--crown) / 896 * 100%);
  bottom: calc((896 - var(--ground)) / 896 * 100%);
  transform: translateY(-100%);              /* no script / reduced: at the crown */
}
.js .elev__rise { transform: none; }
.page-in .elev__rise { animation: elev-rise var(--rise) var(--rise-at) both; }
@keyframes elev-rise {
  0%       { transform: translateY(0); animation-timing-function: cubic-bezier(.55, 0, .25, 1); }
  82%, 100% { transform: translateY(-100%); }
}
.elev__beam {
  position: absolute;
  left: calc(var(--bl) / 1756 * 100%);
  right: calc((1756 - var(--br)) / 1756 * 100%);
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--c-gold) 16%, #f8e6b8 50%, var(--c-gold) 84%, transparent);
  box-shadow: 0 0 16px 1px rgb(240 200 120 / .6);
  opacity: 0;
}
.elev__beam::after {                          /* the light spilling into the lit floors */
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 1px;
  height: 90px;
  background: linear-gradient(rgb(246 214 150 / .26), transparent);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent);
}
.page-in .elev__beam { animation: elev-beam var(--rise) var(--rise-at) both; }
@keyframes elev-beam {
  0%       { opacity: 0; }
  5%, 76%  { opacity: 1; }
  88%, 100% { opacity: 0; }
}
.elev__count {
  position: absolute;
  left: calc(var(--rx) / 1756 * 100% + 18px);
  bottom: 0;
  translate: 0 50%;
  display: grid;
  gap: 4px;
  line-height: 1;
  white-space: nowrap;
}
.elev__count b {
  font-family: var(--font-display);
  font-size: clamp(30px, 2.7vw, 46px);
  font-weight: var(--fw-medium);
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--c-gold);
  text-shadow: 0 0 22px rgb(208 173 103 / .45);
}
.elev__count i {
  font-size: 10px;
  font-style: normal;
  font-weight: var(--fw-semi);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--c-mist);
}
.js .elev:not(.is-enhanced) .elev__count { opacity: 0; }


/* --- the words --------------------------------------------------------------- */
.elev__in {
  align-self: center;
  display: grid;
  justify-items: start;
  align-content: center;
  gap: max(12px, min(var(--sp-sm), 2.4svh));
  padding-block: clamp(96px, 13.5svh, 160px) clamp(12px, 3svh, 48px);
}
.elev__in > :not(.elev__stage) { position: relative; z-index: 2; }

.elev .crumbs__list { gap: 10px; color: var(--c-mist); }
.elev .crumbs__list li + li::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 1px;
  margin-inline-end: 10px;
  vertical-align: middle;
  background: var(--c-gold);
}
.elev .crumbs__link { color: var(--c-ivory); }
.elev .crumbs__link:hover { color: var(--c-gold); }
.elev [aria-current="page"] { color: var(--c-gold); }

.elev__tag {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: var(--fs-label);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-label);
  text-transform: uppercase;
  color: var(--c-mist);
}
.elev__status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 15px 7px 12px;
  border: 1px solid rgb(208 173 103 / .5);
  border-radius: var(--r-pill);
  background: rgb(208 173 103 / .08);
  color: var(--c-gold);
}
.elev__status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c-gold);
  box-shadow: 0 0 0 0 rgb(208 173 103 / .6);
  animation: elev-live 2.4s ease-out infinite;
}
@keyframes elev-live {
  0%   { box-shadow: 0 0 0 0 rgb(208 173 103 / .6); }
  70%, 100% { box-shadow: 0 0 0 9px rgb(208 173 103 / 0); }
}

.elev__h {
  margin-block: 4px 2px;
  font-family: var(--font-display);
  font-size: clamp(60px, min(8.6vw, 13.6svh), 172px);
  font-weight: var(--fw-medium);
  line-height: .9;
  letter-spacing: -.025em;
  color: var(--c-ivory);
  text-shadow: 0 6px 40px rgb(4 11 22 / .55);
}
.elev__line {
  display: block;
  overflow: hidden;
  padding: .05em .14em .17em 0;
  margin-block: -.05em -.17em;
}
.elev__line > * { display: inline-block; }
.elev__line--2 { padding-inline-start: .86em; }
.elev__h em { font-style: italic; color: var(--c-gold); }

.elev__rule {
  width: min(340px, 60%);
  height: 1px;
  background: linear-gradient(90deg, var(--c-gold), transparent);
  box-shadow: 0 0 14px rgb(208 173 103 / .5);
  transform-origin: left center;
}
.elev__lead {
  max-width: 42ch;
  text-wrap: pretty;
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--c-mist);
}
.elev__lead b { font-weight: var(--fw-semi); color: var(--c-ivory); }
.elev__actions { display: flex; flex-wrap: wrap; gap: var(--sp-sm); margin-block-start: var(--sp-2xs); }

/* the words arrive with the page */
.js:not(.page-in) .elev [data-in] { opacity: 0; }
.page-in .elev [data-in] { animation: phero-rise 1.1s var(--ease-css) both; }
.page-in .elev [data-in="2"] { animation-delay: .12s; }
.page-in .elev [data-in="4"] { animation-delay: .62s; }
.page-in .elev [data-in="5"] { animation-delay: .76s; }
.page-in .elev [data-in="6"] { animation-delay: .9s; }
.js:not(.page-in) .elev__line > * { transform: translateY(110%); }
.page-in .elev__line > * { animation: elev-word 1.3s cubic-bezier(.2, .8, .2, 1) .22s both; }
.page-in .elev__line--2 > * { animation-delay: .36s; }
@keyframes elev-word { from { transform: translateY(110%); } to { transform: none; } }
.js:not(.page-in) .elev__rule { transform: scaleX(0); }
.page-in .elev__rule { animation: phero-line 1.4s cubic-bezier(.65, 0, .35, 1) .5s both; }


/* --- the figures on their datum ---------------------------------------------- */
.elev__foot {
  position: relative;
  z-index: 2;
  padding-block-end: clamp(24px, 4.5svh, 48px);
}
.elev__note {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 1.6em;
  margin-block-end: 16px;
  font-size: var(--fs-small);
  color: var(--c-mist);
  text-shadow: 0 2px 14px rgb(4 11 22 / .8);
  transition: color .3s;
}
.elev__note::before {
  content: "";
  flex: none;
  width: 22px;
  height: 1px;
  background: var(--c-gold);
}
.elev__note.is-note { color: var(--c-ivory); }
.elev__note.is-swap { animation: elev-note .45s var(--ease-css) both; }
@keyframes elev-note { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.elev:not(.is-enhanced) .elev__note { visibility: hidden; }

.elev__ledger {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1.5fr 1fr;
  padding-block-start: 20px;
}
/* the datum: a gold hairline with end ticks */
.elev__ledger::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--c-gold), rgb(208 173 103 / .4) 70%, rgb(208 173 103 / .15));
  transform-origin: left center;
}
.elev__ledger::after {
  content: "";
  position: absolute;
  top: -7px;
  right: 0;
  width: 1px;
  height: 15px;
  background: rgb(208 173 103 / .4);
}
.elev__spec {
  position: relative;
  padding-inline-end: 16px;
  cursor: default;
  -webkit-tap-highlight-color: transparent;
}
.elev__spec::before {                         /* each figure's tick on the datum */
  content: "";
  position: absolute;
  top: -27px;
  left: 0;
  width: 1px;
  height: 15px;
  background: var(--c-gold);
  transition: height .35s var(--ease-css), top .35s var(--ease-css), box-shadow .35s;
}
.elev__spec dt {
  font-size: 11px;
  font-weight: var(--fw-semi);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--c-gold);
  transition: color .3s;
}
.elev__spec dd {
  margin-block-start: 8px;
  font-family: var(--font-display);
  font-size: clamp(30px, 2.7vw, 46px);
  font-weight: var(--fw-medium);
  font-variant-numeric: lining-nums tabular-nums;
  line-height: 1;
  color: var(--c-ivory);
  transition: color .3s;
}
.elev__spec small {
  margin-inline-start: 5px;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: var(--fw-semi);
  letter-spacing: .04em;
  color: var(--c-mist);
}
.elev.is-enhanced .elev__spec { cursor: pointer; }
.elev__spec.is-on::before { top: -33px; height: 27px; box-shadow: 0 0 10px rgb(208 173 103 / .8); }
.elev__spec.is-on dt { color: var(--c-ivory); }
.elev__spec.is-on dd { color: var(--c-gold); }
.elev[data-mark] .elev__spec:not(.is-on) { opacity: .55; }
.elev__spec { transition: opacity .3s; }

.js:not(.page-in) .elev__ledger::before { transform: scaleX(0); }
.page-in .elev__ledger::before { animation: phero-line 1.6s cubic-bezier(.65, 0, .35, 1) .8s both; }
.js:not(.page-in) .elev__spec { opacity: 0; }
.page-in .elev__spec { animation: phero-rise 1s var(--ease-css) both; }
.page-in .elev__spec:nth-child(1) { animation-delay: 1s; }
.page-in .elev__spec:nth-child(2) { animation-delay: 1.08s; }
.page-in .elev__spec:nth-child(3) { animation-delay: 1.16s; }
.page-in .elev__spec:nth-child(4) { animation-delay: 1.24s; }
.page-in .elev__spec:nth-child(5) { animation-delay: 1.32s; }


/* --- mid-size screens ----------------------------------------------------------- */
@media (max-width: 1199px) {
  .elev__count b { font-size: 30px; }
  .elev__ledger { grid-template-columns: 1fr 1fr 1fr 1.6fr 1fr; }
}


/* --- phones and portrait tablets: the building above the words ------------------ */
@media (max-width: 899px), (max-aspect-ratio: 4/5) {
  .elev { --cx: 46%; display: block; min-height: 0; }
  .elev__in {
    gap: 14px;
    padding-block: 92px 0;
  }
  .elev__stage {
    --ph: min(76vw, 50svh);
    position: relative;
    inset: auto;
    width: 100vw;
    height: var(--ph);
    margin-inline: calc(50% - 50vw);
    margin-block: 4px -26px;
    overflow: hidden;
  }
  .elev__plate { --ph: inherit; top: 0; }
  .elev__sky::after { background: radial-gradient(60% 34% at var(--cx) 32%, rgb(208 173 103 / .16), transparent 72%); }
  .elev__h { font-size: clamp(52px, 15vw, 104px); }
  .elev__line--2 { padding-inline-start: .7em; }
  .elev__lead { max-width: 36ch; }
  .elev__foot { padding-block: var(--sp-md) 36px; }
  /* the figures are a plain table here: the building is above, out of view */
  .elev__note { display: none; }
  .elev__ledger { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 30px; padding-block-start: 0; }
  .elev__ledger::before,
  .elev__ledger::after { display: none; }
  .elev__spec { padding-block-start: 16px; border-top: 1px solid rgb(208 173 103 / .4); }
  .elev__spec::before { top: -8px; }
  .elev.is-enhanced .elev__spec { cursor: default; }
  .elev__spec:nth-child(4) { grid-column: span 2; }
  .elev__count b { font-size: 26px; }
  .elev__count i { font-size: 9px; letter-spacing: .14em; }
}

@media (max-width: 559px) {
  .elev__actions { flex-direction: column; align-items: stretch; width: 100%; }
  .elev__actions > a { justify-content: space-between; }
  .elev__spec dd { font-size: 30px; }
}


/* --- motion reduced: lit, drawn and still ---------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .page-in .elev__photo,
  .page-in .elev__img--lit,
  .page-in .elev__ruler,
  .page-in .elev__rise,
  .page-in .elev__beam,
  .page-in .elev__sky::after,
  .page-in .elev [data-in],
  .page-in .elev__line > *,
  .page-in .elev__rule,
  .page-in .elev__ledger::before,
  .page-in .elev__spec,
  .elev__status::before { animation: none; }
  .js .elev__photo,
  .js:not(.page-in) .elev [data-in],
  .js:not(.page-in) .elev__spec,
  .js .elev__sky::after { opacity: 1; }
  .js .elev__img--lit { --lit: 112%; }
  .js .elev__ruler { clip-path: none; }
  .js .elev__rise { transform: translateY(-100%); }
  .js:not(.page-in) .elev__line > *,
  .js:not(.page-in) .elev__rule,
  .js:not(.page-in) .elev__ledger::before { transform: none; }
  .elev__marks .edge { transition: none; }
}
