/**
 * vebses-apartments-system — map renderer.
 *
 * Every color/size routes through a --vas-* custom property so a theme can
 * reskin without touching markup. Defaults match the DEKA house style.
 */

.vas-app {
  --vas-maroon: #5d1520;
  --vas-maroon-soft: rgba(93, 21, 32, 0.25);
  --vas-maroon-fill: rgba(93, 21, 32, 0.55);
  --vas-hover-entry: rgba(93, 21, 32, 0.2);
  --vas-teal: #7acbc1;
  --vas-teal-fill: rgba(122, 203, 193, 0.5);
  --vas-page-bg: #f7f5f2;
  --vas-card-bg: #ffffff;
  --vas-ink: #1f1b18;
  --vas-muted: #8a8480;
  --vas-line: #e6e2dd;
  --vas-rail-bg: #efedea;
  --vas-rail-disabled: #e3e1de;
  --vas-rail-disabled-ink: #b3aeaa;
  --vas-rail-sold-bg: rgba(93, 21, 32, 0.12);
  --vas-rail-sold-ink: #a05560;
  --vas-radius: 8px;
  --vas-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  /* entry hover: the shade over everything but the hovered zone, and the zone's own highlight */
  --vas-shade: rgba(20, 17, 16, 0.55);
  --vas-entry-hover-fill: rgba(255, 255, 255, 0.08);
  --vas-entry-hover-stroke: #ffffff;
  /* info card */
  --vas-tip-bg: #ffffff;
  --vas-tip-ink: var(--vas-ink);
  --vas-tip-muted: var(--vas-muted);
  --vas-tip-accent: var(--vas-maroon);
  --vas-tip-track: rgba(31, 27, 24, 0.12);
  --vas-tip-sold: #a05560;

  background: var(--vas-page-bg);
  color: var(--vas-ink);
  min-height: 60vh;

  /* Themes with a fixed header that do not already offset their content can
     set --vas-header-offset (e.g. to their header height) to reserve the band.
     Default 0: deka-theme handles this itself for all interior pages. */
  padding-top: var(--vas-header-offset, 0px);
}

.vas-app * { box-sizing: border-box; }

/* ---------- breadcrumb bar ----------
   Three cells on the floor view's own columns: back | trail | filter, the last
   one above the panel, so the rule between plan and panel runs up through it. */

.vas-crumbs {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) minmax(18rem, 22rem);
  align-items: stretch;
  min-height: 4rem; /* 64, the same band as the apartments list's title row */
  background: var(--vas-card-bg);
  border-bottom: 1px solid var(--vas-line);
  font-size: 0.92rem;
}

.vas-crumbs > * {
  display: flex;
  align-items: center;
  min-width: 0;
}

.vas-crumbs a { color: inherit; text-decoration: none; }
.vas-crumbs a:hover { color: var(--vas-maroon); }
.vas-crumbs a:focus-visible,
.vas-rail [data-floor]:focus-visible { outline: 2px solid var(--vas-maroon); outline-offset: 2px; }

.vas-crumbs__back { padding: 0 1.5rem 0 2rem; font-weight: 600; white-space: nowrap; }
.vas-crumbs__back::before { content: "\2190\00a0\00a0"; }

.vas-crumbs__trail {
  gap: 0.55rem;
  flex-wrap: wrap;
  padding: 0.5rem 1.5rem;
  border-left: 1px solid var(--vas-line);
  color: var(--vas-ink);
}

.vas-crumbs__trail .sep { color: var(--vas-muted); }
.vas-crumbs__trail .is-current { color: var(--vas-maroon); font-weight: 600; }

.vas-crumbs__filter {
  justify-content: space-between;
  gap: 1rem;
  padding: 0 2rem;
  border-left: 1px solid var(--vas-line);
  font-weight: 600;
  white-space: nowrap;
}

.vas-crumbs__filter::after { content: "\2192"; }

/* ---------- floor view layout ----------
   The plan on the left, a panel ruled into sections on the right, split by one
   full-height rule — the apartment page's arrangement. */

.vas-floor-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 22rem);
  align-items: stretch;
  min-height: 70vh;
}

.vas-floor-view__title {
  font-size: clamp(1.5rem, 2.2vw, 2rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0;
  color: var(--vas-ink);
}

/* ---------- plan stage ---------- */

.vas-stage {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 2.5rem clamp(1rem, 2.8vw, 2.5rem);
  background: var(--vas-card-bg);
}

.vas-plan {
  position: relative;
  width: 100%;
  max-width: 1460px;
  margin: 0 auto;
}

.vas-plan img {
  display: block;
  width: 100%;
  height: auto;
}

.vas-plan svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.vas-plan.is-loading { opacity: 0.45; transition: opacity 0.2s ease; }

/* zones */

.vas-app .zone {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1.5;
  transition: fill 0.18s ease, stroke 0.18s ease;
}

.vas-app .zone.is-available { cursor: pointer; }

.vas-app .zone.is-available:hover,
.vas-app .zone.is-available:focus {
  fill: var(--vas-teal-fill);
  stroke: var(--vas-teal);
}

.vas-app .zone.is-sold {
  fill: var(--vas-maroon-fill);
  stroke: var(--vas-maroon);
  cursor: default;
}

.vas-app .zone.is-reserved {
  fill: var(--vas-maroon-soft);
  stroke: var(--vas-maroon);
  cursor: default;
}

.vas-badge {
  fill: #ffffff;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  text-transform: uppercase;
}

/* entry zones: invisible until hovered, then lit while the rest is shaded */

.vas-entry .zone { cursor: pointer; stroke-width: 2; }

.vas-entry .zone:hover,
.vas-entry .zone:focus {
  fill: var(--vas-entry-hover-fill);
  stroke: var(--vas-entry-hover-stroke);
  outline: none;
}

.vas-entry .zone.is-sold-out:hover,
.vas-entry .zone.is-sold-out:focus {
  stroke: var(--vas-tip-sold);
}

.vas-shade {
  fill: var(--vas-shade);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s var(--vas-ease);
}

.is-spotlit .vas-shade { opacity: 1; }

/* ---------- tooltip ----------
   The outer element is positioned by the script (a translate3d eased toward the
   pointer); the card inside animates in and out. */

.vas-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 40;
  pointer-events: none;
  will-change: transform;
}

.vas-tooltip__probe {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: var(--vas-tip-safe-top, 8px);
  visibility: hidden;
  pointer-events: none;
}

.vas-tooltip__card {
  min-width: 11.5rem;
  max-width: 17rem;
  padding: 0.85rem 1rem 0.9rem;
  border-radius: var(--vas-radius);
  background: var(--vas-tip-bg);
  color: var(--vas-tip-ink);
  box-shadow: 0 18px 44px rgba(20, 17, 16, 0.28), 0 2px 6px rgba(20, 17, 16, 0.12);
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transform-origin: 0 100%;
  transition: opacity 0.22s var(--vas-ease), transform 0.32s var(--vas-ease);
}

.vas-tooltip.is-visible .vas-tooltip__card {
  opacity: 1;
  transform: none;
}

.vas-tooltip__eyebrow {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 0.72rem;
  color: var(--vas-tip-accent);
}

.vas-tooltip__title {
  display: block;
  font-size: 1.2rem;
  line-height: 1.15;
  white-space: nowrap;
}

.vas-tooltip__meta {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.8rem;
  color: var(--vas-tip-muted);
  white-space: nowrap;
}

.vas-tooltip__bar {
  display: block;
  height: 3px;
  margin-top: 0.55rem;
  background: var(--vas-tip-track);
  overflow: hidden;
}

.vas-tooltip__bar i {
  display: block;
  height: 100%;
  background: var(--vas-tip-accent);
  transform-origin: 0 50%;
  animation: vas-bar 0.7s var(--vas-ease) both;
}

.vas-tooltip__cta {
  display: block;
  margin-top: 0.7rem;
  font-size: 0.72rem;
  color: var(--vas-tip-ink);
}

.vas-tooltip__cta::after { content: "\00a0\2192"; }

.vas-tooltip__card.is-sold .vas-tooltip__meta { color: var(--vas-tip-sold); }
.vas-tooltip__card.is-sold .vas-tooltip__bar i { background: var(--vas-tip-sold); }

@keyframes vas-bar { from { transform: scaleX(0); } }

/* ---------- panel ---------- */

.vas-panel {
  display: flex;
  flex-direction: column;
  padding: 2rem clamp(1.25rem, 2.2vw, 2rem);
  border-left: 1px solid var(--vas-line);
  background: var(--vas-page-bg);
}

/* Each section ruled off from the one above. */
.vas-panel > * + * {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--vas-line);
}

.vas-panel__eyebrow {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--vas-muted);
}

.vas-panel__figures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1.5rem;
}

.vas-panel__figure {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.vas-panel__caption {
  font-size: 0.75rem;
  color: var(--vas-muted);
}

.vas-panel__value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1.1;
  color: var(--vas-ink);
  font-variant-numeric: tabular-nums;
}

.vas-panel__bar {
  grid-column: 1 / -1;
  display: block;
  height: 3px;
  margin-top: 1rem;
  background: var(--vas-tip-track);
  overflow: hidden;
}

.vas-panel__bar i {
  display: block;
  width: 0;
  height: 100%;
  background: var(--vas-tip-accent);
  transition: width 0.6s var(--vas-ease);
}

/* ---------- floors ---------- */

.vas-rail__label {
  display: block;
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  color: var(--vas-muted);
}

.vas-rail__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.vas-rail [data-floor] {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 1px solid transparent;
  border-radius: var(--vas-radius);
  background: var(--vas-rail-bg);
  color: var(--vas-ink);
  font-weight: 600;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.vas-rail [data-floor]:hover:not([aria-disabled]):not(.is-active) {
  border-color: var(--vas-ink);
}

.vas-rail [data-floor].is-active {
  background: var(--vas-maroon);
  color: #ffffff;
  cursor: default;
}

.vas-rail [data-floor][aria-disabled] { cursor: not-allowed; }

.vas-rail [data-floor].is-empty {
  background: var(--vas-rail-disabled);
  color: var(--vas-rail-disabled-ink);
}

/* fully sold floors: disabled AND red (confirmed decision) */
.vas-rail [data-floor].is-sold-out {
  background: var(--vas-rail-sold-bg);
  color: var(--vas-rail-sold-ink);
}

/* ---------- legend ---------- */

.vas-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.4rem;
  align-items: center;
  font-size: 0.88rem;
  color: var(--vas-ink);
}

.vas-legend span { display: inline-flex; align-items: center; gap: 0.5rem; }

.vas-legend i {
  width: 16px;
  height: 16px;
  border-radius: min(4px, var(--vas-radius));
  display: inline-block;
}

.vas-legend .chip-sold i { background: var(--vas-maroon); }
.vas-legend .chip-reserved i { background: var(--vas-maroon-soft); border: 1px solid var(--vas-maroon); }

/* ---------- entry (block selector) ---------- */

.vas-entry {
  position: relative;
  max-width: 1920px;
  margin: 0 auto;
  overflow: hidden; /* clips the picture while it is zoomed */
}

/* The picture and its zones scale together on hover (see makeSpotlight). */
.vas-entry__canvas {
  position: relative;
  transform-origin: 0 0;
  transition: transform 0.9s var(--vas-ease);
  will-change: transform;
}

.vas-entry img { display: block; width: 100%; height: auto; }

.vas-entry svg { position: absolute; inset: 0; width: 100%; height: 100%; }

.vas-entry__title {
  position: absolute;
  top: 4.5%;
  left: 3.2%;
  z-index: 10;
  color: #ffffff;
  font-size: clamp(1.4rem, 2.6vw, 2.2rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

/* ---------- no-JS fallback ---------- */

.vas-js .vas-fallback { display: none; }

.vas-fallback { padding: 1.6rem 2rem; }
.vas-fallback details { margin: 0.5rem 0; }
.vas-fallback summary { cursor: pointer; font-weight: 600; }
.vas-fallback .vas-floor--sold-out summary { color: var(--vas-rail-sold-ink); }
.vas-fallback ul { margin: 0.4rem 0 0.8rem 1.4rem; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  /* back and filter on one line, the trail on its own line beneath */
  .vas-crumbs { grid-template-columns: auto auto; justify-content: space-between; }
  .vas-crumbs__back { padding: 0.75rem 1rem; }
  .vas-crumbs__filter { order: 2; justify-content: flex-start; gap: 0.5rem; padding: 0.75rem 1rem; border-left: 0; }
  .vas-crumbs__trail { order: 3; grid-column: 1 / -1; padding: 0.6rem 1rem; border-left: 0; border-top: 1px solid var(--vas-line); }

  /* Stacked: the panel (title, figures, floors) above the plan. */
  .vas-floor-view { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .vas-panel { order: -1; padding: 1.25rem 1rem; border-left: 0; border-bottom: 1px solid var(--vas-line); }
  .vas-stage { padding: 1.25rem 1rem; }
  .vas-rail__grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .vas-app .zone,
  .vas-rail [data-floor],
  .vas-plan.is-loading,
  .vas-entry__canvas,
  .vas-shade,
  .vas-tooltip__card { transition: none; }

  .vas-tooltip__bar i { animation: none; }
}
