/**
 * Building map — the renderer (theme component building-map).
 *
 * Every color/size routes through a --deka-map-* custom property so a theme can
 * reskin without touching markup. Defaults match the DEKA house style.
 */

.deka-map-app {
  --deka-map-maroon: #5d1520;
  --deka-map-maroon-soft: rgba(93, 21, 32, 0.25);
  --deka-map-maroon-fill: rgba(93, 21, 32, 0.55);
  --deka-map-hover-entry: rgba(93, 21, 32, 0.2);
  --deka-map-teal: #7acbc1;
  --deka-map-teal-fill: rgba(122, 203, 193, 0.5);
  --deka-map-page-bg: #f7f5f2;
  --deka-map-card-bg: #ffffff;
  --deka-map-ink: #1f1b18;
  --deka-map-muted: #8a8480;
  --deka-map-line: #e6e2dd;
  --deka-map-rail-bg: #efedea;
  --deka-map-rail-disabled: #e3e1de;
  --deka-map-rail-disabled-ink: #b3aeaa;
  --deka-map-rail-sold-bg: rgba(93, 21, 32, 0.12);
  --deka-map-rail-sold-ink: #a05560;
  --deka-map-radius: 8px;
  --deka-map-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 */
  --deka-map-shade: rgba(20, 17, 16, 0.55);
  --deka-map-entry-hover-fill: rgba(255, 255, 255, 0.08);
  --deka-map-entry-hover-stroke: #ffffff;
  /* info card */
  --deka-map-tip-bg: #ffffff;
  --deka-map-tip-ink: var(--deka-map-ink);
  --deka-map-tip-muted: var(--deka-map-muted);
  --deka-map-tip-accent: var(--deka-map-maroon);
  --deka-map-tip-track: rgba(31, 27, 24, 0.12);
  --deka-map-tip-sold: #a05560;

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

  /* Themes with a fixed header that do not already offset their content can
     set --deka-map-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(--deka-map-header-offset, 0px);
}

.deka-map-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. */

.deka-map-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(--deka-map-card-bg);
  border-bottom: 1px solid var(--deka-map-line);
  font-size: 0.92rem;
}

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

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

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

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

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

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

.deka-map-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. */

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

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

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

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

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

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

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

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

/* zones */

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

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

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

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

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

.deka-map-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 */

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

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

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

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

.is-spotlit .deka-map-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. */

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

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

.deka-map-tooltip__card {
  min-width: 11.5rem;
  max-width: 17rem;
  padding: 0.85rem 1rem 0.9rem;
  border-radius: var(--deka-map-radius);
  background: var(--deka-map-tip-bg);
  color: var(--deka-map-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(--deka-map-ease), transform 0.32s var(--deka-map-ease);
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.deka-map-rail [data-floor] {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border: 1px solid transparent;
  border-radius: var(--deka-map-radius);
  background: var(--deka-map-rail-bg);
  color: var(--deka-map-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;
}

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

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

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

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

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

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

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

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

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

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

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

.deka-map-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). */
.deka-map-entry__canvas {
  position: relative;
  transform-origin: 0 0;
  transition: transform 0.9s var(--deka-map-ease);
  will-change: transform;
}

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

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

.deka-map-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 ---------- */

.deka-map-js .deka-map-fallback { display: none; }

.deka-map-fallback { padding: 1.6rem 2rem; }
.deka-map-fallback details { margin: 0.5rem 0; }
.deka-map-fallback summary { cursor: pointer; font-weight: 600; }
.deka-map-fallback .deka-map-floor--sold-out summary { color: var(--deka-map-rail-sold-ink); }
.deka-map-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 */
  .deka-map-crumbs { grid-template-columns: auto auto; justify-content: space-between; }
  .deka-map-crumbs__back { padding: 0.75rem 1rem; }
  .deka-map-crumbs__filter { order: 2; justify-content: flex-start; gap: 0.5rem; padding: 0.75rem 1rem; border-left: 0; }
  .deka-map-crumbs__trail { order: 3; grid-column: 1 / -1; padding: 0.6rem 1rem; border-left: 0; border-top: 1px solid var(--deka-map-line); }

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

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

  .deka-map-tooltip__bar i { animation: none; }
}
