/* er-next-level.css
 * Shared styling for the Tier-S/A/B "next level" client-builder elements.
 * Every value resolves through --site-* tokens — never hardcode hex.
 *
 * Elements covered:
 *   .el-ai-concierge          — floating AI chat widget
 *   .el-loan-calculator       — sliders + amortization chart
 *   .el-quiz-funnel           — multi-step quiz
 *   .el-sticky-cta            — floating / bottom-bar CTA
 *   .el-virtual-tour          — sandboxed tour iframe
 *   .el-comparison-picker     — side-by-side compare table
 *   .el-social-proof-feed     — sonner-driven (rendered as portal toast)
 *   .el-geo-block             — geo-conditional wrapper
 *   .el-saved-items           — heart toggle + drawer
 *   .el-recently-viewed       — horizontal strip of last-N items
 *   .el-parallax-section      — scroll parallax bg
 *   .el-tilt-card             — 3D hover tilt
 *   .el-scroll-progress       — top-of-page reading progress bar
 */

/* ── Shared design defaults ─────────────────────────────────────────── */
.el-ai-concierge,
.el-loan-calculator,
.el-quiz-funnel,
.el-sticky-cta,
.el-virtual-tour,
.el-comparison-picker,
.el-saved-items,
.el-recently-viewed,
.el-parallax-section,
.el-tilt-card,
.el-scroll-progress {
  color: var(--site-fg, currentColor);
  font-family: var(--site-body-font, inherit);
}

/* ── AI Concierge ──────────────────────────────────────────────────── */
.el-ai-concierge {
  position: relative;
}
.el-ai-concierge__launcher {
  position: fixed;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.1rem;
  border-radius: 999px;
  background: var(--site-accent, transparent);
  color: var(--site-on-accent, currentColor);
  border: 0;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1;
  transition: transform 160ms ease, box-shadow 160ms ease;
}
.el-ai-concierge__launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px -12px rgba(0, 0, 0, 0.45);
}
.el-ai-concierge--bottom-right .el-ai-concierge__launcher,
.el-ai-concierge--bottom-right .el-ai-concierge__panel {
  right: 1.25rem;
  bottom: 1.25rem;
}
.el-ai-concierge--bottom-left .el-ai-concierge__launcher,
.el-ai-concierge--bottom-left .el-ai-concierge__panel {
  left: 1.25rem;
  bottom: 1.25rem;
}
.el-ai-concierge--inline .el-ai-concierge__launcher {
  position: static;
}
.el-ai-concierge--inline .el-ai-concierge__panel {
  position: static;
  margin-top: 0.75rem;
}
.el-ai-concierge__panel {
  position: fixed;
  z-index: 60;
  width: min(380px, calc(100vw - 2.5rem));
  height: min(560px, calc(100vh - 6rem));
  display: flex;
  flex-direction: column;
  background: var(--site-surface, transparent);
  border-radius: var(--site-radius-lg, 16px);
  box-shadow: 0 24px 64px -20px rgba(0, 0, 0, 0.45);
  border: 1px solid var(--site-border, transparent);
  overflow: hidden;
}
.el-ai-concierge__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--site-border, transparent);
  background: color-mix(in srgb, var(--site-accent, transparent) 8%, transparent);
}
.el-ai-concierge__header h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--site-fg, currentColor);
}
.el-ai-concierge__close {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--site-muted, currentColor);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0;
  /* WCAG 2.5.5 minimum tap target — was rendering ~26×26. */
  min-width: 40px;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.el-ai-concierge__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  background: var(--site-bg, transparent);
}
.el-ai-concierge__msg {
  max-width: 80%;
  padding: 0.6rem 0.85rem;
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
  word-break: break-word;
  overflow-wrap: break-word;
}
.el-ai-concierge__msg--user {
  align-self: flex-end;
  background: var(--site-accent, transparent);
  color: var(--site-on-accent, currentColor);
  border-bottom-right-radius: 4px;
}
.el-ai-concierge__msg--bot {
  align-self: flex-start;
  background: var(--site-surface, transparent);
  color: var(--site-fg, currentColor);
  border: 1px solid var(--site-border, transparent);
  border-bottom-left-radius: 4px;
}
.el-ai-concierge__form {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem;
  border-top: 1px solid var(--site-border, transparent);
  background: var(--site-surface, transparent);
}
.el-ai-concierge__input {
  flex: 1;
  border: 1px solid var(--site-border, transparent);
  border-radius: 10px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  background: var(--site-bg, transparent);
  color: var(--site-fg, currentColor);
}
.el-ai-concierge__send {
  background: var(--site-accent, transparent);
  color: var(--site-on-accent, currentColor);
  border: 0;
  border-radius: 10px;
  padding: 0 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.el-ai-concierge__send:disabled {
  opacity: 0.5;
  cursor: progress;
}

/* ── Loan Calculator ───────────────────────────────────────────────── */
.el-loan-calculator {
  background: var(--site-surface, transparent);
  border: 1px solid var(--site-border, transparent);
  border-radius: var(--site-radius-lg, 16px);
  --el-padding-default: 1.5rem;
  display: grid;
  gap: 1rem;
}
.el-loan-calculator__sliders {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
@container site style(--site-bp: tablet) or style(--site-bp: desktop) {
  .el-loan-calculator__sliders {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (min-width: 768px) {
  .el-loan-calculator__sliders {
    grid-template-columns: repeat(3, 1fr);
  }
}
.el-loan-calculator__slider label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--site-muted, currentColor);
  margin-bottom: 0.4rem;
}
.el-loan-calculator__slider label strong {
  font-size: 1rem;
  color: var(--site-fg, currentColor);
}
.el-loan-calculator__slider input[type="range"] {
  width: 100%;
  accent-color: var(--site-accent, currentColor);
}
.el-loan-calculator__results {
  display: grid;
  gap: 0.5rem;
  grid-template-columns: 1fr 1fr;
  padding: 1rem;
  background: var(--site-bg, transparent);
  border-radius: var(--site-radius-md, 12px);
}
.el-loan-calculator__result-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--site-muted, currentColor);
}
.el-loan-calculator__result-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--site-fg, currentColor);
}
.el-loan-calculator__chart {
  width: 100%;
  height: 220px;
}

/* ── Quiz Funnel ───────────────────────────────────────────────────── */
.el-quiz-funnel {
  background: var(--site-surface, transparent);
  border: 1px solid var(--site-border, transparent);
  border-radius: var(--site-radius-lg, 16px);
  --el-padding-default: 1.75rem;
  max-width: 640px;
  margin-inline: auto;
}
/* Nested quiz-funnel: cap the WRAPPER at the renderer card's max-width
   so the wrapper bg (painted from --el-bg via the .el bridge) doesn't
   extend past the card and appear as a square gutter on either side.
   See the matching .el--form rule in er-content.css for the rationale. */
:where(.el .el).el--quiz-funnel {
  max-width: 640px;
  margin-inline: auto;
}
.el-quiz-funnel__progress {
  height: 6px;
  background: var(--site-border, transparent);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.el-quiz-funnel__progress-fill {
  height: 100%;
  background: var(--site-accent, transparent);
  transition: width 240ms ease;
}
.el-quiz-funnel__prompt {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--site-fg, currentColor);
  word-break: break-word;
  overflow-wrap: break-word;
}
.el-quiz-funnel__options {
  display: grid;
  gap: 0.5rem;
}
.el-quiz-funnel__option {
  text-align: left;
  background: var(--site-bg, transparent);
  border: 1px solid var(--site-border, transparent);
  color: var(--site-fg, currentColor);
  padding: 0.85rem 1rem;
  border-radius: var(--site-radius-md, 12px);
  font: inherit;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.el-quiz-funnel__option:hover {
  border-color: var(--site-accent, transparent);
}
.el-quiz-funnel__option[aria-pressed="true"] {
  border-color: var(--site-accent, transparent);
  background: color-mix(in srgb, var(--site-accent, transparent) 12%, var(--site-bg, transparent));
}
.el-quiz-funnel__nav {
  display: flex;
  justify-content: space-between;
  margin-top: 1.25rem;
  gap: 0.5rem;
}
.el-quiz-funnel__result {
  text-align: center;
  padding-block: 1rem;
}
.el-quiz-funnel__result h3 {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  color: var(--site-fg, currentColor);
}
.el-quiz-funnel__result p {
  color: var(--site-muted, currentColor);
  margin: 0 0 1rem;
}
.el-quiz-funnel__cta {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--site-accent, transparent);
  color: var(--site-on-accent, currentColor);
  border-radius: var(--site-radius-md, 12px);
  text-decoration: none;
  font-weight: 600;
}

/* ── Sticky CTA ─────────────────────────────────────────────────────── */
.el-sticky-cta {
  position: fixed;
  z-index: 55;
  transition: transform 240ms ease, opacity 240ms ease;
}
.el-sticky-cta[data-hidden="true"] {
  opacity: 0;
  transform: translateY(120%);
  pointer-events: none;
}
.el-sticky-cta--bottom-bar {
  left: 0;
  right: 0;
  bottom: 0;
  --el-padding-default: 0.85rem 1rem;
  background: var(--site-surface, transparent);
  border-top: 1px solid var(--site-border, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}
.el-sticky-cta--floating-button {
  right: 1.25rem;
  bottom: 1.25rem;
}
.el-sticky-cta--side-tab {
  right: 0;
  top: 40%;
  writing-mode: vertical-rl;
  transform-origin: 100% 50%;
  --el-padding-default: 0.75rem 0.5rem;
}
.el-sticky-cta__link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--site-accent, transparent);
  color: var(--site-on-accent, currentColor);
  border-radius: 999px;
  padding: 0.7rem 1.4rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.35);
}
.el-sticky-cta__close {
  background: transparent;
  border: 0;
  color: var(--site-muted, currentColor);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0.4rem;
}

/* ── Virtual Tour ──────────────────────────────────────────────────── */
.el-virtual-tour {
  position: relative;
  width: 100%;
  background: var(--el-bg, var(--site-bg, transparent));
  border-radius: var(--el-radius, var(--site-radius-lg, 16px));
  box-shadow: var(--el-shadow, none);
  overflow: hidden;
}
.el-virtual-tour[data-aspect="16:9"] { aspect-ratio: 16 / 9; }
.el-virtual-tour[data-aspect="4:3"] { aspect-ratio: 4 / 3; }
.el-virtual-tour[data-aspect="1:1"] { aspect-ratio: 1 / 1; }
.el-virtual-tour[data-aspect="square"] { aspect-ratio: 1 / 1; }
.el-virtual-tour[data-aspect="tall"] { aspect-ratio: 9 / 16; }
.el-virtual-tour[data-aspect="full-screen"] { aspect-ratio: auto; min-height: 70vh; }
.el-virtual-tour__iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.el-virtual-tour__poster {
  position: absolute;
  inset: 0;
  background-size: var(--el-object-fit, cover);
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.el-virtual-tour__loading {
  color: var(--site-on-accent, currentColor);
  background: color-mix(in srgb, var(--site-bg, transparent) 60%, transparent);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  font-weight: 600;
}

/* ── Comparison Picker ─────────────────────────────────────────────── */
.el-comparison-picker {
  display: grid;
  gap: 1rem;
}
.el-comparison-picker__chooser {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.el-comparison-picker__chip {
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--site-border, transparent);
  background: var(--site-bg, transparent);
  color: var(--site-fg, currentColor);
  cursor: pointer;
}
.el-comparison-picker__chip[aria-pressed="true"] {
  background: var(--site-accent, transparent);
  color: var(--site-on-accent, currentColor);
  border-color: transparent;
}
.el-comparison-picker__table {
  width: 100%;
  border-collapse: collapse;
}
.el-comparison-picker__table th,
.el-comparison-picker__table td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--site-border, transparent);
  font-size: 0.9rem;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: break-word;
}
.el-comparison-picker__table th {
  background: var(--site-bg, transparent);
  color: var(--site-muted, currentColor);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
}
.el-comparison-picker__empty {
  padding: 1.5rem;
  text-align: center;
  color: var(--site-muted, currentColor);
  background: var(--site-bg, transparent);
  border-radius: var(--site-radius-md, 12px);
}

/* ── Geo Block ─────────────────────────────────────────────────────── */
.el-geo-block {
  display: contents;
}
.el-geo-block[data-state="hidden"] {
  display: none;
}

/* ── Saved Items ───────────────────────────────────────────────────── */
.el-saved-items {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}
.el-saved-items__toggle {
  background: transparent;
  border: 0;
  padding: 0.4rem;
  cursor: pointer;
  color: var(--site-muted, currentColor);
  transition: color 160ms ease, transform 160ms ease;
}
.el-saved-items__toggle[aria-pressed="true"] {
  color: var(--site-accent, currentColor);
  transform: scale(1.05);
}
.el-saved-items__drawer {
  position: fixed;
  top: 0;
  bottom: 0;
  width: min(360px, 100vw);
  background: var(--site-surface, transparent);
  z-index: 70;
  box-shadow: -16px 0 48px -16px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  transition: transform 240ms ease;
}
.el-saved-items__drawer[data-side="right"] { right: 0; }
.el-saved-items__drawer[data-side="left"] { left: 0; }
.el-saved-items__drawer[data-open="false"][data-side="right"] { transform: translateX(100%); }
.el-saved-items__drawer[data-open="false"][data-side="left"] { transform: translateX(-100%); }
.el-saved-items__drawer-header {
  padding: 1rem;
  border-bottom: 1px solid var(--site-border, transparent);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.el-saved-items__drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  margin: 0;
  list-style: none;
}
.el-saved-items__drawer-empty {
  padding: 1.25rem;
  text-align: center;
  color: var(--site-muted, currentColor);
}

/* ── Recently Viewed ───────────────────────────────────────────────── */
.el-recently-viewed {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 0.5rem;
}
.el-recently-viewed__item {
  flex: 0 0 200px;
  scroll-snap-align: start;
  background: var(--site-surface, transparent);
  border: 1px solid var(--site-border, transparent);
  border-radius: var(--site-radius-md, 12px);
  overflow: hidden;
  text-decoration: none;
  color: var(--site-fg, currentColor);
  display: flex;
  flex-direction: column;
}
.el-recently-viewed__img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}
.el-recently-viewed__title {
  padding: 0.6rem 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  word-break: break-word;
  overflow-wrap: break-word;
}
.el-recently-viewed__empty {
  padding: 1rem;
  color: var(--site-muted, currentColor);
  font-size: 0.9rem;
}

/* ── Parallax Section ──────────────────────────────────────────────── */
.el-parallax-section {
  position: relative;
  width: 100%;
  overflow: hidden;
  border-radius: var(--site-radius-lg, 16px);
}
.el-parallax-section__bg {
  position: absolute;
  inset: -10% 0;
  background-size: cover;
  background-position: center;
  will-change: transform;
}
.el-parallax-section__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.el-parallax-section__content {
  position: relative;
  z-index: 1;
  padding: clamp(1.5rem, 4vw, 3rem);
}
@media (prefers-reduced-motion: reduce) {
  .el-parallax-section__bg { transform: none !important; }
}

/* ── Tilt Card ─────────────────────────────────────────────────────── */
.el-tilt-card {
  position: relative;
  perspective: 1000px;
  transform-style: preserve-3d;
  transition: transform 200ms ease;
  will-change: transform;
}
.el-tilt-card__inner {
  display: block;
  border-radius: var(--site-radius-lg, 16px);
  background: var(--site-surface, transparent);
  border: 1px solid var(--site-border, transparent);
  padding: 1.25rem;
}
.el-tilt-card__glare {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: radial-gradient(circle at var(--tilt-glare-x, 50%) var(--tilt-glare-y, 50%), rgba(255, 255, 255, var(--tilt-glare-opacity, 0)) 0%, transparent 60%);
  transition: background-position 80ms linear;
}
@media (prefers-reduced-motion: reduce) {
  .el-tilt-card { transform: none !important; }
}

/* ── Scroll Progress ───────────────────────────────────────────────── */
.el-scroll-progress {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 65;
  background: transparent;
  pointer-events: none;
}
.el-scroll-progress[data-position="top"] { top: 0; }
.el-scroll-progress[data-position="bottom"] { bottom: 0; }
.el-scroll-progress__fill {
  height: 100%;
  width: 0%;
  background: var(--site-accent, transparent);
  transition: width 80ms linear;
}
