/* Etapa 2 — movimento funcional. Apenas transform e opacity são animados. */
:root {
  --motion-micro: var(--duration-instant, 120ms);
  --motion-hover: var(--duration-fast, 180ms);
  --motion-state: var(--duration-base, 280ms);
  --motion-spatial: var(--duration-slow, 480ms);
  --motion-ease: cubic-bezier(.22, 1, .36, 1);
  --motion-press: cubic-bezier(.34, 1.56, .64, 1);
  --theme-x: 92vw;
  --theme-y: 34px;
}

/* Toda ação responde antes de 200 ms; o retorno tem overshoot mínimo. */
button, [role="button"], .nearby-board li {
  -webkit-tap-highlight-color: transparent;
  transform-origin: center;
}
button.motion-press, [role="button"].motion-press { transform: scale(.97); }
.icon-control svg, .chapter-bar svg, .enter-unit > span, .contact-primary svg {
  transition: transform var(--motion-hover) var(--motion-ease);
}
.icon-control:hover svg { transform: rotate(5deg); }
.chapter-bar button:hover svg, .enter-unit:hover > span { transform: translateX(4px); }

/* Loading útil e sem spinner genérico. */
.boot { padding: clamp(28px, 6vw, 88px); justify-items: start; align-content: end; }
.boot-lockup { display: grid; gap: 8px; transform-origin: left bottom; }
.boot-lockup span { color: var(--text-muted); font: 500 10px/1 var(--font-interface); letter-spacing: .16em; text-transform: uppercase; }
.boot .bar { width: min(520px, 78vw); height: 1px; }
.boot .bar i { transform-origin: left center; }
.boot-copy { width: min(520px, 78vw); display: grid; grid-template-columns: 1fr 1.4fr; gap: var(--space-5); align-items: start; }
.boot-copy p, .boot-copy span { margin: 0; font: 400 12px/1.5 var(--font-interface); }
.boot-copy span { color: var(--text-muted); }

/* Prólogo cinematográfico — ocorre uma vez por sessão. */
.cinematic-intro {
  position: fixed; inset: 0; z-index: 58; overflow: hidden; pointer-events: none;
  color: var(--text-inverse); opacity: 0; visibility: hidden;
  background: color-mix(in srgb, var(--surface-inverse) 58%, transparent);
}
.cinematic-intro[data-active="true"], .cinematic-intro[data-exiting="true"] { visibility: visible; pointer-events: none; }
.intro-skip {
  position: absolute; top: max(24px, env(safe-area-inset-top)); right: clamp(20px, 4vw, 64px);
  min-width: 132px; min-height: 44px; padding: 0 14px; border-bottom: 1px solid currentColor;
  color: inherit; font: 500 10px/1 var(--font-interface); letter-spacing: .12em; text-transform: uppercase;
  pointer-events: auto;
}
.intro-rule { position: absolute; top: 0; bottom: 0; left: clamp(20px, 8vw, 128px); width: 1px; background: color-mix(in srgb, currentColor 34%, transparent); transform-origin: top; }
.intro-copy { position: absolute; left: clamp(42px, 12vw, 190px); bottom: clamp(108px, 17vh, 170px); width: min(760px, 76vw); }
.intro-kicker { display: block; margin-bottom: var(--space-4); font: 500 10px/1.2 var(--font-interface); letter-spacing: .18em; text-transform: uppercase; }
.intro-copy h1 { font-size: clamp(48px, 7.2vw, 110px); line-height: .88; letter-spacing: -.045em; }
.intro-copy h1 > span { display: block; overflow: hidden; padding-bottom: .09em; }
.intro-copy h1 i { display: block; font: inherit; font-style: normal; }
.intro-copy p { margin-top: var(--space-5); max-width: 430px; color: color-mix(in srgb, currentColor 76%, transparent); font: 400 15px/1.5 var(--font-interface); }
.intro-index { position: absolute; right: clamp(20px, 4vw, 64px); bottom: clamp(24px, 5vw, 64px); display: flex; align-items: center; gap: 10px; font: 500 9px/1 var(--font-interface); letter-spacing: .12em; text-transform: uppercase; }
.intro-index i { width: 34px; height: 1px; background: currentColor; opacity: .45; transform-origin: left; }

/* Continuidade espacial entre os capítulos. */
.handoff { overflow: hidden; }
.handoff-building, .handoff-floor, .handoff-copy, .handoff-line { will-change: transform, opacity; }
.handoff-building { transform-origin: 50% 64%; }
.handoff-line { transform-origin: center; }
.experience-head h1, .visual-board, .detail-board, .amenity-index, .common-plan-board, .map-board, .nearby-board { will-change: transform, opacity; }
.experience [data-reveal] { opacity: 0; }
.experience [data-reveal][data-visible="true"] { opacity: 1; }
.module-nav button::after, .brand-segment button::after {
  transform-origin: left; transform: scaleX(0); transition: transform var(--motion-state) var(--motion-ease);
}
.module-nav button:hover::after, .module-nav button[aria-current="page"]::after,
.brand-segment button[aria-pressed="true"]::after { transform: scaleX(1); }

/* CTAs magnéticos: deslocamento curto e luz física localizada. */
.chapter-bar button, .enter-unit, .contact-primary, #leadForm button[type="submit"] { position: relative; overflow: hidden; isolation: isolate; will-change: transform; }
.chapter-bar button::after, .enter-unit::after, .contact-primary::after, #leadForm button[type="submit"]::after {
  content: ""; position: absolute; z-index: -1; left: -42px; top: -42px; width: 84px; height: 84px; border-radius: 50%;
  background: color-mix(in srgb, white 25%, transparent); opacity: 0; pointer-events: none;
  transform: translate3d(var(--shine-x, -100px), var(--shine-y, -100px), 0) scale(.7);
  transition: opacity var(--motion-hover) var(--motion-ease), transform var(--motion-hover) var(--motion-ease);
}
.chapter-bar button:hover::after, .enter-unit:hover::after, .contact-primary:hover::after, #leadForm button[type="submit"]:hover::after { opacity: .55; transform: translate3d(var(--shine-x, 0), var(--shine-y, 0), 0) scale(1); }

/* Seleção: o alvo sobe um nível; opções adjacentes recuam sem desaparecer. */
.floor-choice { transition: transform var(--motion-state) var(--motion-ease), opacity var(--motion-state) var(--motion-ease); }
.floor-list:has(.floor-choice.is-active) .floor-choice:not(.is-active) { opacity: .56; }
.floor-choice.is-active { transform: translateX(-4px) scale(1.04); opacity: 1; }
.floor-bubble, .current-floor, .current-unit { will-change: transform, opacity; }
.favorite-toggle {
  grid-column: 1 / -1; min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  border-top: 1px solid var(--border); color: var(--text-muted); font: 500 11px/1 var(--font-interface); text-transform: uppercase; letter-spacing: .1em;
}
.favorite-toggle svg { width: 20px; height: 20px; fill: transparent; stroke: currentColor; stroke-width: 1.4; transition: transform var(--motion-state) var(--motion-press); }
.favorite-toggle[aria-pressed="true"] { color: var(--accent); }
.favorite-toggle[aria-pressed="true"] svg { fill: currentColor; transform: scale(1.12) rotate(-4deg); }

/* Showroom de marca: poucos controles, agrupados por decisão. */
.brand-panel { max-height: calc(100dvh - var(--header-height) - 32px); overflow: auto; }
.brand-live-controls { display: grid; gap: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--border); }
.brand-live-controls label, .brand-live-controls fieldset { min-width: 0; border: 0; }
.brand-live-controls label > span, .brand-live-controls legend { margin-bottom: 8px; color: var(--text-faint); font: 500 10px/1.2 var(--font-interface); letter-spacing: .12em; text-transform: uppercase; }
.accent-control, .logo-control { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.accent-control span, .logo-control span { margin: 0 !important; }
.accent-control input { width: 48px; height: 32px; padding: 2px; border: 1px solid var(--border-strong); background: transparent; border-radius: var(--radius-control); cursor: pointer; }
.logo-control input { width: 150px; min-height: 44px; padding: 0 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: 500 12px/1 var(--font-interface); letter-spacing: .12em; text-transform: uppercase; border-radius: var(--radius-control); }
.brand-segment { display: grid; grid-template-columns: repeat(2, 1fr); border: 1px solid var(--border) !important; }
.brand-segment.rounding-control { grid-template-columns: repeat(3, 1fr); }
.brand-segment legend { padding: 0 6px; }
.brand-segment button { position: relative; min-height: 44px; color: var(--text-muted); border-right: 1px solid var(--border); font: 500 11px/1 var(--font-interface); }
.brand-segment button:last-child { border-right: 0; }
.brand-segment button::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 5px; height: 1px; background: var(--accent); }
.brand-segment button[aria-pressed="true"] { color: var(--text); }
.brand-panel-foot { display: flex; align-items: end; gap: var(--space-3); border-top: 1px solid var(--border); padding-top: var(--space-4); }
.brand-panel-foot p { flex: 1; }
.brand-reset { min-height: 44px; color: var(--text); border-bottom: 1px solid var(--border-strong); font: 500 10px/1 var(--font-interface); text-transform: uppercase; letter-spacing: .1em; }

/* Estado e microcopy de formulário. */
#leadStatus { display: block; min-height: 22px; color: var(--text-muted); }
#leadStatus[data-state="success"] { color: var(--success); }
#leadStatus[data-state="error"] { color: var(--danger); }
#leadForm [aria-invalid="true"] { border-color: var(--danger); }

/* View Transitions: o novo tema nasce do próprio controle. */
::view-transition-old(root) { animation: none; }
::view-transition-new(root) { animation: theme-reveal var(--duration-slow, 480ms) cubic-bezier(.22,1,.36,1); }
@keyframes theme-reveal {
  from { clip-path: circle(0 at var(--theme-x) var(--theme-y)); }
  to { clip-path: circle(150vmax at var(--theme-x) var(--theme-y)); }
}
html[data-theme-fallback="true"] body { opacity: .82; }
body { transition: opacity 250ms var(--motion-ease); }

@media (max-width: 860px) {
  .intro-copy { left: 28px; bottom: 128px; width: calc(100vw - 56px); }
  .intro-copy h1 { font-size: clamp(44px, 14vw, 72px); }
  .intro-rule { left: 16px; }
  .intro-index { left: 28px; right: auto; }
  .boot { padding: 28px; }
  .boot-copy { grid-template-columns: 1fr; gap: 8px; }
  .favorite-toggle { grid-column: auto; padding-left: 12px; }
  .favorite-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
  .cinematic-intro { display: none !important; }
  [data-reveal] { opacity: 1 !important; transform: none !important; }
  .chapter-bar button::after, .enter-unit::after, .contact-primary::after, #leadForm button[type="submit"]::after { display: none; }
}
