/*
  Home demo: the app walking itself through search → listing → message → viewing, inside the portal browser frame.
  All HTML/CSS/SVG; demo.js only flips classes on a timeline. Without JS the search scene shows fully, as a still.
  Semantic tokens only, same rules as components.css. Scoped under .demo so the owners page keeps portal.css as is.
*/

@property --v { syntax: "<number>"; inherits: false; initial-value: 0; }

.demo { --demo-ease: cubic-bezier(0.2, 0.7, 0.2, 1); }
.demo-stage { position: relative; height: clamp(440px, calc(100vh - 250px), 640px); overflow: hidden; background: var(--color-bg); transition: opacity 0.4s; }
.demo-stage.fade { opacity: 0; }
.demo .portal { position: relative; height: 100%; padding-bottom: 0; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
/* Rows size to content: a card is overflow:hidden, so an auto row would squash it to nothing when the column is short (seen at phone width) */
.demo .results { max-height: 100%; overflow: hidden; grid-auto-rows: max-content; grid-template-columns: minmax(0, 1fr); }
.demo-live.no-anim, .demo-live.no-anim * { transition: none !important; animation: none !important; }

/* Scenes stack in one stage; only the current one is visible */
.demo-scene { position: absolute; inset: 0; opacity: 1; transition: opacity 0.4s var(--demo-ease), visibility 0s; }
.demo-live .demo-scene { opacity: 0; visibility: hidden; transition-delay: 0s, 0.4s; }
.demo-live[data-scene="search"] .scene-search,
.demo-live[data-scene="listing"] .scene-listing,
.demo-live[data-scene="chat"] .scene-chat,
.demo-live[data-scene="book"] .scene-book,
.demo-live[data-scene="done"] .scene-done { opacity: 1; visibility: visible; transition-delay: 0s, 0s; }
.demo:not(.demo-live) .demo-scene:not(.scene-search) { display: none; }

/* Things that appear as the story moves: hidden until .on while the demo runs */
.demo-live .filters:not(.on), .demo-live .results-n:not(.on), .demo-live .rcard:not(.on),
.demo-live .bubble:not(.on), .demo-live .typing-dots:not(.on), .demo-live .slots-day:not(.on) { opacity: 0; transform: translateY(10px); }
.demo .filters, .demo .results-n, .demo .rcard, .demo .bubble, .demo .typing-dots, .demo .slots-day { transition: opacity 0.45s var(--demo-ease), transform 0.45s var(--demo-ease); }
.demo .rcard { transition-delay: calc(var(--d, 0) * 120ms); }
.demo-live .filters span { transition: opacity 0.3s var(--demo-ease), transform 0.3s var(--demo-ease); transition-delay: calc(var(--i, 0) * 90ms); }
.demo-live .filters:not(.on) span { opacity: 0; transform: scale(0.9); }
.demo .filters { align-items: center; }
.demo .filters .understood { padding: 0; background: none; color: var(--color-text-muted); }

/* Search box: typed text with a caret while the demo types */
.demo .search-box { position: relative; color: var(--color-text); min-height: 2.1em; }
.demo-live .search-box:empty::before { content: attr(data-ph); color: var(--color-text-subtle); }
.demo-live .search-box.typing::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 1px; vertical-align: -0.15em; background: var(--color-brand); animation: demo-blink 1s steps(1) infinite; }
@keyframes demo-blink { 50% { opacity: 0; } }

/* Press feedback on any "button" the hand taps */
.demo .pressable { transition: transform 0.18s var(--demo-ease), opacity 0.18s; }
.demo .pressed { transform: scale(0.95); opacity: 0.85; }
.demo .search-go { white-space: nowrap; }
.demo .rcard-pics img { aspect-ratio: 4 / 3; }

/* Rings and meters grow in */
.demo .ring { --v: var(--to); transition: --v 1.1s var(--demo-ease); }
.demo-live .ring:not(.on) { --v: 0; }
.demo .factors .meter i { width: var(--to); transition: width 0.9s var(--demo-ease); }
.demo-live .why:not(.on) .meter i { width: 0; }

/* The map: a drawn neighbourhood with the homes as prices, as on the real search page */
.map { position: relative; overflow: hidden; border-radius: var(--radius-md); background: var(--color-surface-sunken); box-shadow: var(--shadow-sm); }
.map-art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-art .blocks rect { fill: var(--color-surface); }
.map-art .park { fill: var(--color-success-soft); }
.map-art .water { fill: var(--color-brand-soft); opacity: 0.6; }
.map-art .road { fill: none; stroke: var(--color-surface-sunken); stroke-width: 7; stroke-linecap: round; }
.map-art .metro { fill: none; stroke: var(--color-brand); stroke-width: 2.5; stroke-dasharray: 7 5; opacity: 0.7; }
.map-art .station circle { fill: var(--color-surface); stroke: var(--color-brand); stroke-width: 2; }
.map-art .station text { fill: var(--color-brand); font-size: 8px; font-weight: 700; text-anchor: middle; }
.map-art .place { fill: var(--color-text-muted); font-size: 9px; font-weight: 500; letter-spacing: 0.02em; }
.map-art .place.big { font-size: 13px; font-weight: 600; fill: var(--color-text); opacity: 0.55; }
.pin { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%); padding: 3px 9px; border-radius: var(--radius-pill); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-md); font-size: var(--text-xs); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; white-space: nowrap; transition: opacity 0.35s var(--demo-ease), transform 0.35s var(--demo-ease), background 0.25s, color 0.25s; transition-delay: calc(var(--i, 0) * 70ms); }
.pin.active { background: var(--color-brand-strong); color: var(--color-text-on-brand); transform: translate(-50%, -50%) scale(1.12); z-index: 2; transition-delay: 0s; }
.demo-live .pin:not(.on) { opacity: 0; transform: translate(-50%, -20%) scale(0.8); }
.peek { position: absolute; left: var(--x); top: var(--y); z-index: 3; width: 150px; overflow: hidden; border-radius: var(--radius-sm); background: var(--color-surface); box-shadow: var(--shadow-lg); transform: translate(-50%, calc(-100% - 20px)); pointer-events: none; opacity: 0; transition: opacity 0.3s var(--demo-ease), transform 0.3s var(--demo-ease); }
.peek.on { opacity: 1; }
.demo-live .peek:not(.on) { transform: translate(-50%, calc(-100% - 10px)); }
.demo:not(.demo-live) .peek { display: none; }
.peek img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
.peek p { padding-inline: var(--space-3); line-height: 1.3; }
.peek-price { padding-top: var(--space-2); font-weight: var(--weight-semibold); font-variant-numeric: tabular-nums; }
.peek-title { font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.peek .small { padding-bottom: var(--space-2); font-size: 11px; }
.map-zoom { position: absolute; right: var(--space-3); bottom: var(--space-3); display: grid; border-radius: var(--radius-sm); background: var(--color-surface); box-shadow: var(--shadow-sm); overflow: hidden; }
.map-zoom i { display: grid; place-items: center; width: 26px; height: 26px; font-style: normal; font-size: var(--text-sm); color: var(--color-text-muted); }
.map-zoom i + i { box-shadow: 0 -1px 0 var(--color-surface-sunken); }

/* Listing: the home on its own page, gallery and facts left, owner and match right */
.scene-listing { padding: var(--space-4) var(--space-5); font-size: var(--text-sm); }
.demo .listing { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: var(--space-5); align-items: start; height: 100%; }
.demo .listing-main { display: grid; gap: var(--space-3); align-content: start; }
.demo .listing-side { display: grid; gap: var(--space-3); align-content: start; }
.demo .listing .gallery-main { aspect-ratio: 16 / 9; }
.demo .listing .rcard-tags { margin-top: 0; }
.facts-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-2) var(--space-4); margin: 0; }
.facts-grid div { display: grid; gap: 1px; }
.facts-grid dt { font-size: var(--text-xs); color: var(--color-text-muted); }
.facts-grid dd { margin: 0; font-weight: var(--weight-medium); }
.demo .listing .owner-box, .listing .why { box-shadow: var(--shadow-sm); }
.demo .listing .owner-box { background: var(--color-surface); }
.demo .listing .why { background: var(--color-surface); }
.demo-live .listing > * { opacity: 0; transform: translateY(12px); transition: opacity 0.45s var(--demo-ease), transform 0.45s var(--demo-ease); }
.demo-live[data-scene="listing"] .listing > * { opacity: 1; transform: none; }
.demo-live[data-scene="listing"] .listing-side { transition-delay: 0.15s; }

/* Chat */
.scene-chat, .scene-book, .scene-done { display: grid; justify-items: center; padding: var(--space-4) var(--space-5); font-size: var(--text-sm); }
/* minmax(0, 1fr): a nowrap line (the draft being typed, the query) must never widen the column past the frame (phone, 2026-10-26) */
.chat { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; width: 100%; max-width: 36rem; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: var(--space-3); padding-bottom: var(--space-3); }
.chat-head .chev { display: grid; place-items: center; width: 28px; height: 28px; color: var(--color-text-muted); }
.chat-head .chev svg { width: 16px; height: 16px; }
.chat-head .who { flex: 1; min-width: 0; display: grid; line-height: 1.3; }
.chat-head .who b { font-weight: var(--weight-medium); }
.chat-head .who span { font-size: var(--text-xs); color: var(--color-text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head .btn { font-size: var(--text-xs); padding: var(--space-2) var(--space-3); flex: none; }
.chat-notice { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-sunken); color: var(--color-text-muted); font-size: var(--text-xs); }
.chat-notice svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }
.thread { display: grid; align-content: start; gap: var(--space-3); padding-block: var(--space-4); overflow: hidden; }
.bubble { display: grid; gap: var(--space-1); max-width: 80%; }
.bubble p { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-size: var(--text-md); line-height: 1.4; }
.bubble time { padding-inline: var(--space-1); font-size: var(--text-xs); color: var(--color-text-muted); }
.bubble-me { justify-self: end; justify-items: end; }
.bubble-me p { background: var(--color-brand); color: var(--color-text-on-brand); border-bottom-right-radius: 4px; }
.bubble-them p { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); border-bottom-left-radius: 4px; }
/* The owner's screen on /idioktites/: the same thread after the tenant booked */
.chat-owner { grid-template-rows: auto auto auto 1fr; }
.chat-owner .thread { padding-block: var(--space-3) 0; }
.side-note { justify-self: start; margin-bottom: var(--space-2); padding: 2px 8px; border-radius: var(--radius-pill); background: var(--color-brand); color: var(--color-text-on-brand); font-size: var(--text-xs); font-weight: var(--weight-medium); }
.viewing-line { display: flex; gap: var(--space-2); align-items: center; padding: var(--space-3); border-radius: var(--radius-md); background: color-mix(in srgb, var(--color-brand) 10%, var(--color-surface)); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.viewing-line svg { width: 16px; height: 16px; flex: none; color: var(--color-brand); }
.bubble-sys { justify-self: center; max-width: 92%; text-align: center; font-size: var(--text-xs); color: var(--color-text-muted); }
.demo-live .scene-done .bubble { opacity: 1; transform: none; }
.typing-dots { justify-self: start; display: inline-flex; gap: 5px; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); border-bottom-left-radius: 4px; background: var(--color-surface); box-shadow: var(--shadow-sm); }
.typing-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--color-text-subtle); animation: demo-bounce 1.1s infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
.typing-dots.gone { display: none; }
@keyframes demo-bounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-4px); } }
.composer { display: flex; gap: var(--space-2); align-items: center; padding-top: var(--space-2); }
.composer .draft { flex: 1; min-height: 44px; display: flex; align-items: center; padding: 0 var(--space-5); border-radius: var(--radius-pill); background: var(--color-surface-sunken); font-size: var(--text-md); color: var(--color-text); overflow: hidden; overflow-wrap: anywhere; line-height: 1.3; padding-block: var(--space-2); }
/* The draft wraps like a real composer, so a phone shows the whole message, not its first line (2026-10-26) */
.composer .draft:empty::before { content: attr(data-ph); color: var(--color-text-subtle); }
.composer .draft.typing::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 1px; background: var(--color-brand); animation: demo-blink 1s steps(1) infinite; }
.composer .send { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--color-brand); color: var(--color-text-on-brand); box-shadow: var(--shadow-sm); }
.composer .send svg { width: 18px; height: 18px; }

/* Booking */
.book { display: grid; align-content: start; gap: var(--space-5); width: 100%; max-width: 34rem; padding-top: var(--space-2); }
.book .back { display: flex; align-items: center; gap: var(--space-1); font-size: var(--text-sm); color: var(--color-text-muted); }
.book .back svg { width: 14px; height: 14px; }
.book .h2 { font-size: var(--text-xl); }
.book .hint { margin-top: var(--space-2); color: var(--color-text-muted); }
.pills { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pill { display: inline-flex; align-items: center; min-height: 40px; padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill); background: var(--color-surface-sunken); font-size: var(--text-sm); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; transition: background 0.25s, color 0.25s, transform 0.18s; }
.pill.sel { background: var(--color-brand); color: var(--color-text-on-brand); }
.pill.full { opacity: 0.45; text-decoration: line-through; }
.slots-day { display: grid; gap: var(--space-2); }
.slots-day > b { font-weight: var(--weight-medium); }
.book .btn-lg { justify-self: start; transition: opacity 0.3s, transform 0.18s var(--demo-ease); }
.demo-live .book .btn-lg:not(.on) { opacity: 0.5; }

/* Confirmation */
.done { display: grid; justify-items: start; gap: var(--space-4); width: 100%; max-width: 34rem; margin-top: var(--space-5); padding: var(--space-6); border-radius: var(--radius-lg); background: var(--color-surface); box-shadow: var(--shadow-card); }
.done .check { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--color-success-soft); color: var(--color-success-text); }
.done .check svg { width: 28px; height: 28px; }
.demo-live .scene-done .check { transform: scale(0.4); opacity: 0; transition: transform 0.5s cubic-bezier(0.3, 1.5, 0.5, 1), opacity 0.3s; }
.demo-live[data-scene="done"] .check { transform: scale(1); opacity: 1; transition-delay: 0.15s; }
.done .h2 { font-size: var(--text-xl); }
.done .when { font-size: var(--text-lg); }
.done .addr b { font-weight: var(--weight-medium); }
.done .muted { color: var(--color-text-muted); }
.done .actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.done .actions .btn { font-size: var(--text-sm); }
.done .actions svg { width: 16px; height: 16px; margin-right: var(--space-2); }

/* The hand: a soft tap dot that moves to each thing it presses */
.demo-cursor { position: absolute; z-index: 5; left: 0; top: 0; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: color-mix(in srgb, var(--color-brand) 55%, transparent); box-shadow: 0 0 0 2px var(--color-surface), var(--shadow-md); opacity: 0; pointer-events: none; transition: transform 0.55s var(--demo-ease), opacity 0.3s; }
.demo-cursor.show { opacity: 1; }
.demo-cursor.tap::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid var(--color-brand); animation: demo-tap 0.4s var(--demo-ease) forwards; }
@keyframes demo-tap { from { transform: scale(0.6); opacity: 1; } to { transform: scale(2); opacity: 0; } }
.demo:not(.demo-live) .demo-cursor { display: none; }

/* Step rail under the window: what the demo is doing now, and a way to jump */
.demo-steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-3); margin-top: var(--space-5); counter-reset: step; }
.demo-steps button { --p: 0; position: relative; display: grid; gap: 2px; width: 100%; padding: var(--space-3) var(--space-4) var(--space-4); border: 0; border-radius: var(--radius-md); background: var(--color-surface-sunken); color: var(--color-text-muted); font: inherit; font-size: var(--text-sm); text-align: left; cursor: pointer; overflow: hidden; transition: background 0.3s, color 0.3s; }
.demo-steps button b { display: flex; align-items: center; gap: var(--space-2); font-weight: var(--weight-semibold); color: var(--color-text); }
.demo-steps button b::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--color-surface-strong); font-size: var(--text-xs); }
.demo-steps button[aria-current] { background: var(--color-surface); box-shadow: var(--shadow-sm); color: var(--color-text-muted); }
.demo-steps button[aria-current] b::before { background: var(--color-brand); color: var(--color-text-on-brand); }
.demo-steps button::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 100%; background: var(--color-brand); transform: scaleX(0); transform-origin: left; opacity: 0; }
.demo-live .demo-steps button[aria-current]::after { opacity: 1; animation: demo-fill var(--dur, 6s) linear forwards; }
@keyframes demo-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.demo-steps button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
/* A phone tap on a step must not zoom the page: touch-action drops the double-tap zoom and the 300 ms delay (iPhone, 2026-10-26) */
.demo-steps button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.demo-stage { touch-action: pan-y; }
.demo:not(.demo-live) .demo-steps { display: none; }

@media (max-width: 960px) {
  .demo-stage { height: clamp(520px, calc(100vh - 170px), 700px); }
  .demo .portal { grid-template-columns: minmax(0, 1fr); grid-template-rows: 190px 1fr; }
  .map { order: -1; }
  .map-art { height: 200%; top: -30%; }
  .peek { display: none; }
  .demo .listing { grid-template-columns: minmax(0, 1fr); }
  .demo .listing .why { display: none; }
  .facts-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .demo .rcard { grid-template-columns: 0.95fr 1.05fr; }
  .demo .rcard-pics { grid-template-columns: 1fr; }
  .demo .rcard-pics img + img { display: none; }
  .demo .rcard-pics img { aspect-ratio: 1; }
  .demo .rcard-desc { display: none; }
  .demo .thumbs { grid-template-columns: repeat(5, 1fr); }
  .scene-listing, .scene-chat, .scene-book, .scene-done { padding: var(--space-3); }
  .demo .listing .gallery-main { aspect-ratio: 16 / 10; }
  .facts-grid { display: none; }
  .bubble { max-width: 90%; }
  .done { padding: var(--space-5); }
  /* One phone screen for frame + rail (principal, 2026-10-26): no browser bar or app nav (the phone app has neither), the
     stage takes what the viewport leaves under the sticky header, the rail is one row of titles, and each scene drops
     what it does not need so every tap target stays inside the stage at its 380 px minimum (measured at 500 px wide). */
  .demo .browser-bar, .demo .app-nav { display: none; }
  .demo-stage { height: clamp(400px, calc(100vh - 150px), 560px); height: clamp(400px, calc(100svh - 150px), 560px); }
  .demo .portal { grid-template-rows: 120px 1fr; }
  .demo .filters .understood, .demo .filters .weigh, .demo .results .results-n { display: none; }
  .demo .filters { flex-wrap: nowrap; overflow: hidden; max-height: 32px; }
  .demo .rcard-next, .demo .rcard .specs { display: none; }
  .demo .rcard { grid-template-columns: 110px 1fr; }
  .demo .rcard-body { padding: var(--space-2) var(--space-3) var(--space-3); }
  .demo .rcard-pics img { aspect-ratio: 4 / 3; }
  .demo .listing { grid-template-rows: auto auto; gap: var(--space-3); }
  .demo .listing .rcard-tags, .listing .fair-box, .listing .thumbs, .listing .detail-price, .listing .detail-title { display: none; }
  /* The HTML height attributes win over aspect-ratio unless height is auto; on the desktop the 400 px frame is wanted as is */
  .demo .rcard-pics img, .listing .gallery-main, .demo .thumbs img { height: auto; }
  .demo .listing .gallery-main { aspect-ratio: 2.2; }
  .demo .listing .owner-box { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-2); padding: var(--space-3); }
  .demo .listing .owner-box .owner { grid-column: 1 / -1; }
  .book { gap: var(--space-4); }
  .book .hint { display: none; }
  .done { margin-top: 0; padding: var(--space-4); gap: var(--space-3); }
  .done .actions { display: none; }
  .chat-owner .bubble time { display: none; }
  .demo-steps { grid-template-columns: repeat(3, 1fr); gap: var(--space-2); margin-top: var(--space-3); }
  .demo-steps button { padding: var(--space-2) var(--space-2) var(--space-3); font-size: var(--text-xs); }
  .demo-steps button span { display: none; }
  .demo-steps button b { align-items: flex-start; }
}
/* ── Matching the live search page: icons, chevrons, the save and draw buttons ── */
.demo .search-go { display: inline-flex; align-items: center; gap: 6px; }
.demo .search-go svg { width: 14px; height: 14px; }
.demo .filters .chv::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 7px; border: solid var(--color-text-muted); border-width: 0 1.5px 1.5px 0; transform: translateY(-2px) rotate(45deg); }
.demo .filters .weigh::before { content: "✦"; margin-right: 6px; color: var(--color-brand); }
.demo .results-n { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.demo .save-search { padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--color-surface-sunken); font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap; }
.draw-area { position: absolute; left: var(--space-3); top: var(--space-3); display: inline-flex; align-items: center; gap: 6px; padding: var(--space-2) var(--space-3); border-radius: var(--radius-pill); background: var(--color-brand); color: var(--color-text-on-brand); font-size: var(--text-xs); font-weight: var(--weight-medium); box-shadow: var(--shadow-sm); }
.draw-area svg { width: 13px; height: 13px; }
.map-zoom { top: var(--space-3); bottom: auto; }
.demo .listing .owner-box .btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); }
.demo .listing .owner-box .btn svg { width: 15px; height: 15px; }
.fair-box { padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-surface-sunken); color: var(--color-text); }

/* ── The home in 3D: a dollhouse built from the owner's scan, turned by hand ── */
.media { display: grid; gap: var(--space-3); }
.media-tabs { display: flex; overflow: hidden; gap: var(--space-5); font-size: var(--text-sm); color: var(--color-text-muted); }
.media-tabs .tab { position: relative; padding-bottom: 6px; font-weight: var(--weight-medium); white-space: nowrap; }
.media-tabs .tab i { font-style: normal; font-variant-numeric: tabular-nums; opacity: 0.7; }
.media-tabs .tab.sel, .media.show-3d .tab-3d { color: var(--color-text); }
.media-tabs .tab.sel::after, .media.show-3d .tab-3d::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 2px; background: var(--color-brand); }
.media.show-3d .tab-photos::after { display: none; }
.media.show-3d .tab-photos { color: var(--color-text-muted); }
.media-frame { position: relative; }
.house-view { position: absolute; inset: 0; border-radius: var(--radius-sm); overflow: hidden; opacity: 0; visibility: hidden; transition: opacity 0.5s var(--demo-ease), visibility 0s 0.5s; background: var(--color-surface-sunken); background-image: linear-gradient(var(--color-surface-strong) 1px, transparent 1px), linear-gradient(90deg, var(--color-surface-strong) 1px, transparent 1px); background-size: 28px 28px; background-position: center; }
.media.show-3d .house-view { opacity: 1; visibility: visible; transition-delay: 0s, 0s; }
.media.show-3d .gallery { visibility: hidden; transition: visibility 0s 0.3s; }
.house-view::before { content: ""; position: absolute; inset: 0; background: radial-gradient(ellipse 60% 55% at 50% 60%, var(--color-surface) 0%, transparent 70%); }
.house-tag, .house-hint, .house-size { position: absolute; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--color-surface) 90%, transparent); font-size: var(--text-xs); font-weight: var(--weight-medium); box-shadow: var(--shadow-sm); }
.house-tag { left: var(--space-3); top: var(--space-3); color: var(--color-text); }
.house-tag svg { width: 14px; height: 14px; color: var(--color-brand); }
.house-size { right: var(--space-3); top: var(--space-3); color: var(--color-text-muted); }
.house-hint { left: 50%; bottom: var(--space-3); transform: translateX(-50%); color: var(--color-text-muted); font-weight: var(--weight-regular); }
@media (max-width: 600px) { .house-size, .house-hint { display: none; } .scene3d { perspective: 420px; } .media-tabs { gap: var(--space-4); font-size: var(--text-xs); } }

/* Scene swaps hide and show large blocks; without this Chrome re-anchors the scroll and the page jumps (seen 2026-10-25) */
.demo { overflow-anchor: none; }

/* ── The map is an image asset drawn like OpenStreetMap; the markers and controls sit on top ── */
.map-art { object-fit: cover; object-position: center; }
.map-attrib { position: absolute; right: 6px; bottom: 4px; padding: 1px 5px; border-radius: 3px; background: color-mix(in srgb, var(--color-surface) 75%, transparent); font-size: 9px; color: var(--color-text-muted); white-space: nowrap; }

/* ── The 3D tab: the rendered model on a turntable, 360° hotspots per room, a tap zooms into one ── */
.room-tag { position: absolute; left: 50%; bottom: var(--space-7); z-index: 3; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--color-brand); color: var(--color-text-on-brand); font-size: var(--text-xs); font-weight: var(--weight-medium); box-shadow: var(--shadow-md); opacity: 0; transform: translate(-50%, 10px); transition: opacity 0.4s var(--demo-ease), transform 0.4s var(--demo-ease); }
.plan-view { position: absolute; inset: 0; display: none; place-items: center; padding: var(--space-4); background: var(--color-surface-sunken); border-radius: var(--radius-sm); }
.plan-view img { width: 100%; height: auto; max-height: 100%; object-fit: contain; }

/* ── The fake 3D apartment: planes in one world, the camera is the inverse transform ── */
.scene3d { position: absolute; inset: 0; overflow: hidden; perspective: 900px; perspective-origin: 50% 46%; background: linear-gradient(to bottom, color-mix(in srgb, var(--color-surface-sunken) 60%, #fff) 0%, var(--color-surface-sunken) 55%, var(--color-surface-strong) 100%); }
.world { --cx: 0; --cy: 0; --cz: 0; --yaw: 0deg; --pitch: 0deg; position: absolute; left: 50%; top: 46%; width: 0; height: 0; transform-style: preserve-3d; transform: rotateX(calc(-1 * var(--pitch))) rotateY(calc(-1 * var(--yaw))) translate3d(calc(-1px * var(--cx)), calc(-1px * var(--cy)), calc(-1px * var(--cz))); transition: transform 4.5s cubic-bezier(0.45, 0, 0.15, 1); will-change: transform; }
.demo-live.no-anim .world { transition: none; }
.house3d { position: absolute; left: 0; top: 0; width: 0; height: 0; transform-style: preserve-3d; }
/* The planes only exist while the listing is on screen; the other scenes and the rest of the page never composite them */
.demo-live:not([data-scene="listing"]) .scene3d { display: none; }
.world i { position: absolute; left: 0; top: 0; transform-origin: 0 0; backface-visibility: visible; transition: opacity 0.7s var(--demo-ease); }
.house3d.cut .far { opacity: 0; }
.world .ground2 { background: radial-gradient(ellipse at 50% 0%, rgba(60, 40, 20, 0.28), rgba(60, 40, 20, 0.1) 55%, transparent 72%); box-shadow: none; }
/* Floors */
.world .f { box-shadow: inset 0 0 28px rgba(70, 45, 20, 0.16); }
.world .wood { background: repeating-linear-gradient(90deg, #cfa67c 0 34px, #c49a70 34px 36px, #d6b088 36px 70px, #be9267 70px 72px), #cba478; }
.world .wood2 { background: repeating-linear-gradient(0deg, #d4ae86 0 30px, #c69c72 30px 32px, #dab690 32px 62px, #bf9569 62px 64px); }
.world .tile { background: repeating-conic-gradient(#ece7df 0 25%, #ddd6cb 0 50%) 0 0 / 28px 28px; }
.world .tile2 { background: repeating-conic-gradient(#e2e9eb 0 25%, #cdd8dc 0 50%) 0 0 / 22px 22px; }
.world .deck { background: repeating-linear-gradient(0deg, #b9a58e 0 10px, #a68f73 10px 12px); box-shadow: none; }
.world .rug { background: repeating-linear-gradient(45deg, #d8d0bc 0 14px, #cfc6ae 14px 28px); box-shadow: inset 0 0 0 8px #c3b89b; }
.world .rug2 { background: #e5dece; box-shadow: inset 0 0 0 6px #d0c5ad; }
.world .mat { background: #b7c7c9; border-radius: 8px; box-shadow: none; }
.world .ground { background: radial-gradient(ellipse at 50% 50%, rgba(60, 40, 20, 0.32), rgba(60, 40, 20, 0.12) 55%, transparent 72%); box-shadow: none; }
.world .sh { background: radial-gradient(ellipse at 50% 50%, rgba(50, 35, 20, 0.26), rgba(50, 35, 20, 0.1) 55%, transparent 74%); box-shadow: none; }
.world .pool { background: radial-gradient(ellipse at 50% 0%, rgba(255, 238, 190, 0.55), rgba(255, 238, 190, 0.18) 55%, transparent 75%); box-shadow: none; }
/* Walls: the two orientations are lit differently, the tops are a darker plaster */
.world .w { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04); }
.world .wx { background: linear-gradient(to bottom, #f4ede4 0 93%, #cbbca9 93% 100%); }
.world .wz { background: linear-gradient(to bottom, #e8dfd4 0 93%, #bfae9b 93% 100%); }
.world .lintel { background: #efe7dd; }
.world .cap { background: #d8cdbf; box-shadow: none; }
.world .w b { position: absolute; display: block; border: 4px solid #fbfaf7; background: linear-gradient(165deg, #e4f0f8, #bcd8ec 50%, #edf5fa); box-shadow: 0 0 22px 6px rgba(255, 240, 200, 0.85), inset 0 0 0 1px rgba(0, 0, 0, 0.08); }
.world .w b::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 4px; margin-left: -2px; background: #fbfaf7; }
.world .leaf { background: linear-gradient(90deg, #b58a60, #c69a6e 40%, #b2865c); box-shadow: inset 0 0 0 3px rgba(80, 50, 25, 0.25); }
.world .rail { background: repeating-linear-gradient(90deg, #8a8f94 0 2px, transparent 2px 12px); box-shadow: inset 0 -2px 0 #8a8f94, inset 0 2px 0 #8a8f94; }
/* Furniture: one colour per thing, three shades per box */
.world .b.t { background: color-mix(in srgb, var(--c) 86%, #fff); }
.world .b.s { background: color-mix(in srgb, var(--c) 94%, #000); }
.world .b.e { background: color-mix(in srgb, var(--c) 82%, #000); }
.world .sofa { --c: #9aa0a6; } .world .cush { --c: #e9e4da; } .world .b.wood { --c: #a9794f; } .world .table { --c: #b98b61; } .world .chair { --c: #6f5a47; }
.world .plant { --c: #6f8b57; border-radius: 40%; } .world .shelf { --c: #8c6a4b; } .world .tv { --c: #d9d4cc; } .world .dark { --c: #2b2b2b; }
.world .counter { --c: #efe9e1; } .world .cab { --c: #e6dfd4; } .world .fridge { --c: #e8e8ea; } .world .hob { --c: #2f2f2f; } .world .sink { --c: #f5f5f3; }
.world .bed { --c: #f1ede6; } .world .duvet { --c: #c9d3d6; } .world .wardrobe { --c: #cdb79a; } .world .tub { --c: #ffffff; } .world .wc { --c: #f7f7f7; }
.world .b.counter.t { background: #cfc7bb; } .world .b.sink.t { background: #bfc6c9; } .world .b.hob.t { background: radial-gradient(circle at 25% 50%, #555 7px, transparent 8px), radial-gradient(circle at 75% 50%, #555 7px, transparent 8px), #2f2f2f; }

