/* ---------- 4. apartments: the two layouts, then the walk through the rooms ---------- */

/* still */

.apartments { overflow-x: clip; }

/* The two layouts, each a rounded screen on a dark ground. Standing still they are shown one under
   the other: the 3 BHK, then the 2 BHK. */
.layouts { display: flex; flex-direction: column; gap: 12px; padding: 12px; background: var(--ink); }
.layout { position: relative; --face: var(--face-2bhk); }
.layout[data-layout="3"] { --face: var(--face-3bhk); }
.layout__face { display: flex; flex-direction: column; border-radius: var(--round-screen); overflow: hidden; background: var(--face); }
.layout__art { padding: 16px 16px 0; }
/* The cut-away pictures have a ground of their own; their edges are feathered so no seam shows
   against the screen behind them. */
.layout__art img {
  display: block;
  width: 100%;
  height: auto;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 7%, #000 93%, transparent), linear-gradient(to bottom, transparent, #000 7%, #000 93%, transparent);
  mask-composite: intersect;
}
.layout__text { display: flex; flex-direction: column; gap: 24px; max-width: 520px; padding: 8px 28px 28px; }
.layout__text h3 { font-family: var(--head); font-size: 64px; font-weight: 700; letter-spacing: -0.045em; line-height: 1; }
.layout__count { margin-top: 8px; font-size: 18px; font-weight: 500; }
.facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 13px 0; border-top: 1px solid var(--rule); }
.facts dd { font-weight: 600; text-align: right; white-space: nowrap; }
.layout__text .pill { align-self: flex-start; }

/* These belong to the moving page only: the running name, the progress line and its hint, the
   living room picture that opens from the cut-away, and its twin in the walk-through. */
.layouts__run, .layouts__bar, .layouts__hint, .layout__room, .walk__zoom { display: none; }

/* The walk-through is a third rounded screen, cream, on the same dark ground. */
.hold--walk { background: var(--ink); }
.walk {
  isolation: isolate;
  padding: 50px max(calc(var(--gutter) + 10px), calc((100% - var(--max)) / 2)) 58px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}
.walk::before { content: ""; position: absolute; z-index: -1; inset: 10px; border-radius: var(--round-screen); background: var(--page); }
.walk__top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px 24px; }
.walk__intro { display: flex; flex-direction: column; gap: 10px; max-width: 680px; }
.walk__intro h3 { font-family: var(--head); font-size: 34px; font-weight: 700; letter-spacing: -0.035em; line-height: 1; }
.walk__intro p { font-size: 18px; line-height: 1.4; color: var(--quiet-sm); }

/* The two buttons that choose which apartment is walked. */
.switch { display: flex; gap: 8px; padding: 6px; border-radius: var(--round-pill); background: var(--panel); }
.switch button { min-height: 44px; padding: 0 24px; border: 0; border-radius: var(--round-pill); background: transparent; font-size: 16px; font-weight: 600; }
.switch button[aria-pressed="true"] { background: var(--ink); color: var(--page); }

/* Three columns: the plan, the room's name and size, the room's picture. */
.walk__body { flex: 1 1 auto; min-height: 0; display: flex; gap: 56px; align-items: flex-start; }
.walk__drawing { flex: 0 0 32%; display: flex; justify-content: center; }

/* The plan: one rectangle per room, to scale. Only the chosen apartment's plan shows. */
.plan { display: none; width: auto; height: min(62vh, 620px); max-width: 100%; overflow: visible; }
.walk[data-showing="2"] .plan[data-plan="2"], .walk[data-showing="3"] .plan[data-plan="3"] { display: block; }
.quietroom rect, .room__wall { fill: none; stroke: var(--ink); stroke-width: 2; }
.plan__outer { fill: none; stroke: var(--ink); stroke-width: 5; }
.room__fill { fill: var(--gold); stroke: none; opacity: 0; }
.room__line { fill: none; stroke: var(--gold); stroke-width: 8; stroke-dasharray: 1; stroke-dashoffset: 1; opacity: 0; }
.plan text { font-family: var(--text); font-size: 24px; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
/* The room being read: its outline drawn in gold, softly filled. */
.room.on .room__fill { opacity: 0.3; }
.room.on .room__line { opacity: 1; stroke-dashoffset: 0; }
.room.on text { font-weight: 600; }

/* The read-out: which room, its name, and its size in very large figures. */
.walk__read { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.walk__count { font-size: 15px; font-weight: 500; color: var(--quiet-sm); }
.walk__name { font-family: var(--head); font-size: clamp(26px, 2.5vw, 36px); font-weight: 600; letter-spacing: -0.03em; line-height: 1.05; }
.walk__a {
  margin-top: 10px;
  font-family: var(--head);
  font-size: clamp(84px, min(11vw, 16vh), 168px);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 0.84;
  font-variant-numeric: tabular-nums;
}
.walk__b {
  font-family: var(--head);
  font-size: clamp(38px, min(5vw, 7vh), 72px);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 0.9;
  color: var(--quiet-lg);
  font-variant-numeric: tabular-nums;
}
.roomlist { display: none; margin-top: 16px; font-size: 14px; }
.walk[data-showing="2"] .roomlist[data-list="2"], .walk[data-showing="3"] .roomlist[data-list="3"] { display: block; }
.roomlist li { display: flex; justify-content: space-between; gap: 16px; padding: 5px 0; border-top: 1px solid var(--rule); color: var(--quiet-sm); }
.roomlist li:last-child { border-bottom: 1px solid var(--rule); }
.roomlist li.on { color: var(--ink); font-weight: 600; }

/* The room pictures, stacked in one rounded frame; only the room being read shows. */
.walk__pic { flex: 0 0 30%; max-width: 400px; display: flex; flex-direction: column; gap: 12px; }
.walk__pics { position: relative; width: 100%; aspect-ratio: 4 / 5; max-height: 54vh; border-radius: var(--round-screen); overflow: hidden; background: var(--panel); }
.walk__pics img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.45s ease; }
.walk__pics img.on { opacity: 1; }
/* The work area picture is wide: it is cut a little left of centre, so the washing machine and the
   drying rack both show. */
.walk__pics img[data-key="work"] { object-position: 40% 50%; }
.walk__pic figcaption { display: flex; flex-direction: column; gap: 4px; font-size: 13px; line-height: 1.45; color: var(--quiet-sm); }

/* A short window: the walk-through tightens so the whole of it still fits one screen. */
@media (max-height: 780px) {
  .walk { padding-top: 24px; padding-bottom: 28px; gap: 18px; }
  .walk__intro h3 { font-size: 28px; }
  .walk__intro p { font-size: 16px; }
  .roomlist { margin-top: 10px; font-size: 13px; }
  .roomlist li { padding: 3px 0; }
}

@media (max-width: 1023px) {
  .layout__text h3 { font-size: 52px; }
  /* Standing still on a narrow screen: the plan, the read-out and the picture in one column. */
  html:not(.motion) .walk__body { flex-direction: column; align-items: stretch; gap: 32px; }
  html:not(.motion) .walk__drawing, html:not(.motion) .walk__pic { flex: none; max-width: none; }
  html:not(.motion) .plan { height: auto; width: min(100%, 360px); }
  html:not(.motion) .walk__pics { max-height: none; aspect-ratio: 4 / 3; }
}

/* moving */

/* The two layouts, held for five screens of scroll (js/layouts.js). The name runs across the dark
   screen behind a small picture of the first layout; the picture grows to fill the screen; the
   second layout slides up over the first; then the view moves in on its living room and the living
   room picture opens over it. */
.motion .hold--layouts { height: 600vh; }
.motion .layouts { display: block; padding: 0; }
.motion .layouts__run {
  display: flex;
  position: absolute;
  z-index: 1;
  left: 0;
  top: 50%;
  gap: 0.3em;
  white-space: nowrap;
  font-family: var(--head);
  font-size: 17vw;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  color: var(--page);
  transform: translate3d(0, -50%, 0);
  will-change: transform;
}
/* --col is the width of the column of facts at the left. */
.motion .layout { position: absolute; z-index: 2; inset: 0; --col: clamp(344px, 27vw, 400px); }
.motion .layout + .layout { z-index: 3; transform: translate3d(0, 100%, 0); will-change: transform; }
.motion .layout__face { display: block; position: absolute; inset: 10px; will-change: clip-path, transform; }
.motion .layout__art { position: absolute; left: calc(var(--col) + 88px); right: 32px; top: 32px; bottom: 32px; padding: 0; will-change: transform; }
.motion .layout__art img { width: 100%; height: 100%; object-fit: contain; }
.motion .layout__text { position: absolute; left: 44px; bottom: 44px; width: var(--col); max-width: none; padding: 0; }
.motion .layout__text h3 { font-size: clamp(64px, 6.6vw, 104px); }
.motion .layout__text .pill { padding: 0 22px; font-size: 15px; }
/* The progress line and its hint sit at the upper right, clear of the WhatsApp pill at the lower
   right. Both fade as the zoom begins (--gone). */
.motion .layouts__bar { display: block; position: absolute; z-index: 6; right: 52px; top: 53px; width: 160px; height: 2px; background: rgba(58, 16, 18, 0.18); }
.motion .layouts__bar span { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(var(--bar, 0)); }
.motion .layouts__hint { display: block; position: absolute; z-index: 6; right: 232px; top: 44px; font-size: 14px; font-weight: 500; }
.motion .layouts__bar, .motion .layouts__hint { opacity: calc(1 - var(--gone, 0)); }
/* The living room picture, seen through a window that opens from the living room in the cut-away. */
.motion .layout__room { display: block; position: absolute; z-index: 4; inset: 0; overflow: hidden; clip-path: inset(50%); will-change: clip-path; }
.motion .layout__room img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; will-change: transform; }
.motion .layout__note { position: absolute; left: 34px; bottom: 34px; padding: 8px 14px; border-radius: var(--round-pill); background: rgba(244, 238, 230, 0.88); font-size: 13px; }

/* The walk-through (js/walkthrough.js) starts one screen early, unseen, behind the last screen of
   the zoom. When it has arrived it shows the same living room picture, full size, so the change
   from one held screen to the next cannot be seen; the picture then draws back into its place and
   the plan comes up around it (--in). */
.motion .hold--walk { height: 620vh; margin-top: -100vh; background: linear-gradient(to bottom, transparent 100vh, var(--ink) 100vh); }
.motion .walk { height: 100vh; justify-content: center; }
.motion .walk:not(.arrived) { visibility: hidden; }
.motion .walk.arrived { background: var(--ink); }
.motion .walk > :not(.walk__zoom) { opacity: var(--in, 1); }
.motion .walk__zoom { display: block; position: absolute; z-index: 5; inset: 0; overflow: hidden; will-change: clip-path; }
.motion .walk__zoom img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; }
.motion .walk__body { flex: 0 1 auto; }

/* moving, on a phone */

/* The two layouts: the same held scene, set one above the other. The picture takes the upper part
   of the screen and the facts sit under it. */
.motion.phone .layouts__run { font-size: 30vw; }
.motion.phone .layout__face { display: flex; flex-direction: column; padding: 54px 10px 18px; }
.motion.phone .layout__art { position: relative; left: auto; right: auto; top: auto; bottom: auto; flex: 1 1 0; min-height: 0; }
.motion.phone .layout__text { position: relative; left: auto; bottom: auto; width: auto; flex: none; gap: 14px; padding: 10px 12px 0; }
.motion.phone .layout__text h3 { font-size: 52px; }
.motion.phone .layout__count { margin-top: 4px; font-size: 15px; }
.motion.phone .facts > div { padding: 8px 0; font-size: 14px; }
.motion.phone .layout__text .pill { align-self: stretch; justify-content: center; min-height: 48px; padding: 0 14px; font-size: 14px; }
.motion.phone .layouts__bar { right: 28px; top: 36px; width: 88px; }
.motion.phone .layouts__hint { right: 128px; top: 27px; font-size: 12px; }
.motion.phone .layout__note { left: 20px; top: 20px; bottom: auto; font-size: 11px; }

/* The walk through the rooms, on one tall screen. The picture runs across the top; under it the
   plan stands at the left with the room's name and size beside it, which leaves the lower right
   corner free for the WhatsApp pill. The long list of rooms and the sentence under the heading are
   left off: the plan shows every room. */
.motion.phone .hold--walk { margin-top: -100vh; margin-top: -100dvh; background: linear-gradient(to bottom, transparent 100vh, var(--ink) 100vh); background: linear-gradient(to bottom, transparent 100dvh, var(--ink) 100dvh); }
.motion.phone .walk { padding: 28px 26px 26px; gap: 12px; justify-content: flex-start; }
.motion.phone .walk__top { flex-wrap: nowrap; align-items: center; gap: 12px; }
.motion.phone .walk__intro h3 { font-size: 24px; }
.motion.phone .walk__intro p { display: none; }
.motion.phone .switch { padding: 4px; gap: 4px; }
.motion.phone .switch button { min-height: 36px; padding: 0 14px; font-size: 14px; }
.motion.phone .walk__body { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 50%) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); gap: 12px 16px; align-items: stretch; }
.motion.phone .walk__pic { grid-column: 1 / -1; grid-row: 1; flex: none; max-width: none; gap: 6px; }
.motion.phone .walk__pics { aspect-ratio: auto; height: 24vh; max-height: none; border-radius: 18px; }
.motion.phone .walk__pic figcaption { gap: 0; font-size: 10.5px; line-height: 1.4; }
.motion.phone .walk__drawing { grid-column: 1; grid-row: 2; min-height: 0; justify-content: flex-start; }
.motion.phone .plan { height: 100%; width: 100%; max-width: 100%; }
.motion.phone .walk__read { grid-column: 2; grid-row: 2; align-self: start; gap: 2px; padding-top: 4px; }
.motion.phone .walk__count { font-size: 12px; }
.motion.phone .walk__name { font-size: 20px; }
.motion.phone .walk__a { margin-top: 8px; font-size: 52px; }
.motion.phone .walk__b { font-size: 24px; }
.motion.phone .walk .roomlist { display: none; }
