/* ═══════════════════════════════════════════════════════════════
   PORTVIEW v2 — visual layer (door portal, floor stack, pixel reveal, tilt)
   Loads after style.css; same palette, same type.
   ═══════════════════════════════════════════════════════════════ */

/* ─── Hero: the title is assembled by the particle swarm on load ── */
.hero-title-wrap { position: relative; display: inline-block; }
.hero-swarm { position: absolute; left: 0; top: 0; pointer-events: none; }
.hero-title { transition: opacity 0.35s; }
.hero-title.swarming { opacity: 0; }
.hero-content { z-index: 3; }
.hero-scroll { z-index: 3; }

/* ─── Building: the floor stack (CSS 3D) ──────────────────────── */
.building-layout {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 3rem;
  align-items: center;
  margin-bottom: 4rem;
}
.building-layout .section-header { margin-bottom: 0; }

.tower-wrap {
  position: relative;
  height: 460px;
  perspective: 1400px;
  display: flex;
  align-items: flex-end;        /* the stack grows upward in screen space */
  justify-content: center;
  padding-bottom: 110px;
}
.tower {
  position: relative;
  width: 240px;
  height: 150px;
  transform-style: preserve-3d;
  transform: rotateX(62deg) rotateZ(calc(-36deg + var(--tz, 0deg)));
  transition: transform 0.6s cubic-bezier(.2,.7,.2,1);
  animation: tower-breathe 9s ease-in-out infinite;
}
@keyframes tower-breathe {
  0%, 100% { transform: rotateX(62deg) rotateZ(calc(-36deg + var(--tz, 0deg))); }
  50%      { transform: rotateX(60deg) rotateZ(calc(-30deg + var(--tz, 0deg))); }
}
.slab {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: rgba(11,18,53,0.06);
  border: 1px solid rgba(11,18,53,0.18);
  transform: translateZ(calc(var(--i) * 26px));
  transition: background 0.4s, border-color 0.4s, box-shadow 0.4s;
  box-shadow: 0 1px 0 rgba(11,18,53,0.15);
}
.slab::before {                       /* the slab's side face, faked as a lower copy */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: rgba(11,18,53,0.10);
  transform: translateZ(-12px);
}
.slab.available {
  background: rgba(59,91,219,0.22);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(59,91,219,0.35), 0 0 36px rgba(59,91,219,0.45);
}
.slab.available::before { background: rgba(59,91,219,0.35); }
.slab.roof {
  background: rgba(11,18,53,0.03);
  border-style: dashed;
}
.slab .n {
  position: absolute;
  right: 10px; top: 8px;
  font: 600 0.62rem/1 var(--font-body);
  letter-spacing: 0.1em;
  color: rgba(11,18,53,0.45);
  transform: rotateZ(36deg) rotateX(-62deg); /* face the viewer */
}
.slab.available .n { color: var(--accent); font-weight: 700; }

.tower-legend {
  position: absolute;
  left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  font-size: 0.82rem;
  color: var(--muted-dark);
}
.tower-legend b { color: var(--navy); font-weight: 600; }
.tower-legend i {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 2px;
  margin-right: 0.5rem;
  vertical-align: -1px;
  background: rgba(59,91,219,0.35);
  border: 1px solid var(--accent);
}
.tower-legend i.rest { background: rgba(11,18,53,0.06); border-color: rgba(11,18,53,0.25); }

@media (max-width: 960px) {
  .building-layout { grid-template-columns: 1fr; gap: 1rem; }
  .tower-wrap { height: 380px; margin-top: 140px; padding-bottom: 90px; }
  .tower { width: 200px; height: 125px; }
  .slab { transform: translateZ(calc(var(--i) * 22px)); }
}

/* ─── Gallery: the flock canvas over the whole grid ─────────────── */
.gallery-grid { position: relative; }
.gallery-swarm { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 3; }

/* ─── Gallery: pixel reveal ───────────────────────────────────── */
.gallery-item { position: relative; }
.gallery-item canvas.px {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  image-rendering: pixelated;
  z-index: 2;
}
.gallery-item img { transition: opacity 0.4s; }
.gallery-item img.px-hidden { opacity: 0; transition: none; }

/* ─── Spaces: 3D tilt on the floor cards ──────────────────────── */
.spaces-grid { perspective: 1200px; }
.space-card {
  transform-style: preserve-3d;
  transition: transform 0.35s cubic-bezier(.2,.7,.2,1), box-shadow var(--transition);
  will-change: transform;
}
.space-card:hover { transform: none; }  /* v1 lift replaced by tilt */
.space-card .space-body { transform: translateZ(18px); }
.space-card .space-image { transform: translateZ(6px); }

/* ─── Scroll-reveal fade removed in v2 (motion belongs to objects, not sections) */
.reveal { opacity: 1 !important; transform: none !important; }

/* ─── Building: the 3D model replaces the CSS floor stack ─────── */
.tower-wrap.building3d { display:flex; flex-direction:column; gap:.9rem; padding:0; height:auto; perspective:none; }
#building3d { width:100%; height:440px; border-radius: var(--radius-lg); overflow:hidden;
  background: radial-gradient(ellipse at 50% 70%, rgba(59,91,219,0.10), transparent 60%); cursor: grab; }
#building3d:active { cursor: grabbing; }
#building3d canvas { display:block; width:100% !important; height:100% !important; }
.b3d-hint { position:absolute; right:0; top:0; margin:0; font-size:.72rem; letter-spacing:.08em; text-transform:uppercase; color:var(--muted-dark); }
.tower-wrap.building3d .tower-legend { position:static; flex-direction:row; gap:1.6rem; flex-wrap:wrap; }
@media (max-width: 960px) { #building3d { height: 360px; } .tower-wrap.building3d { margin-top: 1rem; } }

/* ─── Micro-interactions (after the motion.dev / Kokonut reel) ───── */
/* spotlight: a soft light that follows the cursor over cards */
.feature, .space-card, .custom-solutions, .other-floors { position: relative; overflow: hidden; }
.feature::after, .space-card::after, .custom-solutions::after, .other-floors::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(59,91,219,0.16), transparent 60%);
  transition: opacity 0.35s;
}
.feature:hover::after, .space-card:hover::after, .custom-solutions:hover::after, .other-floors:hover::after { opacity: 1; }
.space-card::after { z-index: 2; }
/* magnetic buttons: the button leans toward the cursor */
.btn { transition: transform 0.25s cubic-bezier(.2,.7,.2,1), background var(--transition), border-color var(--transition), color var(--transition); will-change: transform; }
/* counters */
.count { font-variant-numeric: tabular-nums; }
/* draggable carousel */
.imagine-track { cursor: grab; }
.imagine-track.dragging { cursor: grabbing; scroll-snap-type: none; scroll-behavior: auto; user-select: none; }
