/**
 * Coldwell Banker Prestige — Landing design system & components
 * Brand: PMS 280 (Coldwell Banker Blue), Bauziet/Outfit, Roboto, Barlow (stats)
 * TODO: Load licensed Bauziet for headings; replace assets (logo, hero, texture).
 */

/* ========== DESIGN TOKENS ========== */
:root {
  /* Brand colors (PMS 280 + palette) */
  --color-brand: #012169;
  --color-brand-light: #1a3a8a;
  --color-brand-dark: #001244;
  --color-accent: #2d5aa0;
  --color-white: #ffffff;
  --color-offwhite: #f8f9fb;
  --color-text: #1a1a1a;
  --color-text-muted: #5c5c5c;
  --color-border: #e2e6eb;
  --color-overlay: rgba(0, 0, 0, 0.45);

  /* Typography */
  /* TODO: Replace --font-display with licensed Bauziet when available */
  --font-display: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-stats: 'Barlow', var(--font-body);

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3rem;
  --text-hero: clamp(2rem, 5vw, 3.5rem);

  --weight-light: 300;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --line-tight: 1.2;
  --line-normal: 1.5;
  --line-relaxed: 1.65;

  /* Spacing (premium, calm) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;
  --section-padding: clamp(3rem, 8vw, 5rem);
  --container-max: 1200px;
  --container-narrow: 720px;

  /* Radius & shadow (premium) */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 24px 48px rgba(0, 0, 0, 0.12);

  /* Logo clearspace (brand: half height of blue box) */
  --logo-clearspace: 0.5em;
}

/* ========== RESET & BASE ========== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--line-normal);
  color: var(--color-text);
  background: var(--color-white);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-brand);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ========== LOGO COMPONENT (clearspace) ========== */
.logo-component {
  display: inline-flex;
  align-items: center;
  padding: var(--logo-clearspace);
  /* No other text/graphic within clearspace */
}

.logo-img {
  width: auto;
  height: 2.5rem;
  object-fit: contain;
}

.logo-footer .logo-img {
  height: 2rem;
}

@media (min-width: 768px) {
  .logo-img { height: 3rem; }
  .logo-footer .logo-img { height: 2.5rem; }
}

/* ========== LAYOUT ========== */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-6);
}

@media (min-width: 768px) {
  .container { padding-inline: var(--space-8); }
}

/* ========== HEADER ========== */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  max-width: var(--container-max);
  margin-inline: auto;
  padding: var(--space-4) var(--space-6);
}

.nav-main {
  display: none;
}

@media (min-width: 768px) {
  .nav-main {
    display: flex;
    gap: var(--space-6);
  }
  .nav-main a {
    color: var(--color-text);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
  }
  .nav-main a:hover { text-decoration: none; color: var(--color-brand); }
}

/* ========== BUTTONS ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.25;
  border: none;
  border-radius: var(--radius-md);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-brand);
  color: var(--color-white);
}

.btn-primary:hover {
  background: var(--color-brand-light);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: transparent;
  color: var(--color-brand);
  border: 1px solid var(--color-brand);
}

.btn-secondary:hover {
  background: var(--color-offwhite);
}

.cta-header {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
}

@media (min-width: 768px) {
  .cta-header { padding: var(--space-3) var(--space-5); font-size: var(--text-sm); }
}

/* ========== HERO ========== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(4rem + 60px) var(--space-6) var(--space-16);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: var(--container-narrow);
  text-align: center;
}

.hero-title {
  font-family: var(--font-display);
  font-size: var(--text-hero);
  font-weight: var(--weight-semibold);
  line-height: var(--line-tight);
  color: var(--color-white);
  margin: 0 0 var(--space-4);
}

.hero-sub {
  font-size: var(--text-lg);
  line-height: var(--line-relaxed);
  color: rgba(255, 255, 255, 0.95);
  margin: 0 0 var(--space-6);
  max-width: 42ch;
  margin-inline: auto;
}

.hero-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: rgba(255, 255, 255, 0.9);
}

.hero-trust span::after {
  content: " · ";
  margin-left: var(--space-2);
  opacity: 0.7;
}

.hero-trust span:last-child::after { display: none; }

.btn-hero {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
}

.hero-micro {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.8);
}

/* ========== SECTIONS ========== */
.section {
  padding-block: var(--section-padding);
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 2.25rem);
  font-weight: var(--weight-semibold);
  line-height: var(--line-tight);
  color: var(--color-text);
  margin: 0 0 var(--space-4);
  max-width: 28ch;
}

.section-intro {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-10);
  max-width: 55ch;
}

.section-cta {
  margin-top: var(--space-10);
  text-align: center;
}

.section-cta .btn { margin-bottom: var(--space-2); }
.cta-micro { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0; }

/* ========== BENEFITS ========== */
.benefits-section {
  background: var(--color-offwhite);
}

.benefit-cards {
  display: grid;
  gap: var(--space-8);
  grid-template-columns: 1fr;
}

@media (min-width: 768px) {
  .benefit-cards { grid-template-columns: repeat(3, 1fr); }
}

.benefit-card {
  background: var(--color-white);
  padding: var(--space-8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.benefit-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.benefit-num {
  display: inline-block;
  font-family: var(--font-stats);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-brand);
  margin-bottom: var(--space-3);
}

.benefit-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-2);
}

.benefit-card p {
  margin: 0;
  font-size: var(--text-base);
  color: var(--color-text-muted);
  line-height: var(--line-relaxed);
}

/* ========== MAP SECTION — Mapa de zonas exclusivas ========== */
.map-section {
  background: #1a1d22; /* dark / neutral background behind map */
}

.map-section .section-title,
.map-section .section-intro {
  color: var(--color-white);
}

.map-section .section-intro {
  color: rgba(255, 255, 255, 0.85);
}

.map-section .cta-micro {
  color: rgba(255, 255, 255, 0.7);
}

.map-zonas-wrap {
  width: 100%;
  margin: var(--space-8) 0;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  position: relative;
  background: #1a1d22;
}

/* Fixed height suitable for landing section (not full screen) */
.map-zonas {
  width: 100%;
  height: 420px;
  min-height: 320px;
  background: #1a1d22;
}

/* Minimal UI: subtle zoom controls (overridden via Leaflet options in JS) */
.map-zonas .leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-md) !important;
}

.map-zonas .leaflet-control-zoom a {
  color: var(--color-text) !important;
  background: var(--color-white) !important;
  font-weight: 600 !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
}

.map-zonas .leaflet-control-zoom a:hover {
  background: var(--color-offwhite) !important;
}

.map-zonas .leaflet-control-attribution {
  font-size: 10px;
  opacity: 0.7;
  background: rgba(255, 255, 255, 0.8) !important;
}

/* District overlay tooltips — clean, editorial */
.map-zonas .map-district-tooltip {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  padding: var(--space-1) var(--space-2);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  color: var(--color-text);
  margin-top: 0;
}
.map-zonas .map-district-tooltip::before {
  border-top-color: rgba(255, 255, 255, 0.96);
}

/* Fallback when JS disabled: use assets/map.jpg as background (see noscript in HTML) */
.map-zonas-fallback {
  width: 100%;
  height: 420px;
  min-height: 320px;
  border-radius: var(--radius-lg);
}

/* ========== CAROUSEL ========== */
.carousel-section {
  background: var(--color-offwhite);
}

.carousel {
  position: relative;
  max-width: 720px;
  margin-inline: auto;
}

.carousel-viewport {
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--color-white);
  box-shadow: var(--shadow-sm);
}

.carousel-track {
  display: flex;
  transition: transform 0.35s ease;
}

.carousel-slide {
  flex: 0 0 100%;
  min-width: 0;
  padding: var(--space-12) var(--space-8);
}

.carousel-quote {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-regular);
  line-height: var(--line-relaxed);
  color: var(--color-text);
}

.carousel-quote footer {
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.carousel-controls {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.carousel-btn {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-white);
  color: var(--color-brand);
  transition: background 0.2s, border-color 0.2s;
}

.carousel-btn:hover,
.carousel-btn:focus-visible {
  background: var(--color-offwhite);
  border-color: var(--color-brand);
}

.carousel-btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

/* ========== VIDEO ========== */
.video-block {
  max-width: 800px;
  margin-inline: auto;
}

.video-poster {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16/9;
  border: none;
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  background: var(--color-brand-dark);
  padding: 0;
}

.video-poster-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.7);
}

.video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: rgba(255, 255, 255, 0.9);
  transition: transform 0.2s ease;
}

.video-poster:hover .video-play {
  transform: scale(1.05);
}

/* ========== STATS ========== */
.stats-section {
  background: var(--color-brand);
  color: var(--color-white);
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-12);
  text-align: center;
  max-width: 640px;
  margin-inline: auto;
}

.stat-number {
  display: block;
  font-family: var(--font-stats);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
  margin-bottom: var(--space-2);
}

.stat-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  opacity: 0.95;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ========== CTA SECTION ========== */
.cta-section {
  background: var(--color-offwhite);
}

.cta-section .section-title { max-width: none; }
.btn-cta-final {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  margin-top: var(--space-4);
}

/* ========== FAQ ========== */
.faq-list {
  max-width: var(--container-narrow);
  margin-inline: auto;
}

.faq-item {
  border-bottom: 1px solid var(--color-border);
}

.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) 0;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  text-align: left;
  background: none;
  border: none;
  color: var(--color-text);
  cursor: pointer;
  transition: color 0.2s;
}

.faq-question:hover,
.faq-question:focus-visible {
  color: var(--color-brand);
  outline: none;
}

.faq-question::after {
  content: "+";
  font-size: 1.25rem;
  font-weight: 300;
  flex-shrink: 0;
  margin-left: var(--space-4);
  transition: transform 0.2s;
}

.faq-question[aria-expanded="true"]::after {
  content: "−";
}

.faq-answer {
  overflow: hidden;
}

.faq-answer[hidden] {
  display: none;
}

.faq-answer p {
  margin: 0 0 var(--space-5);
  padding-bottom: var(--space-5);
  color: var(--color-text-muted);
  line-height: var(--line-relaxed);
}

/* ========== FOOTER ========== */
.site-footer {
  padding: var(--space-12) var(--space-6);
  background: var(--color-text);
  color: var(--color-white);
}

.site-footer .logo-component { margin-bottom: var(--space-6); }
.site-footer .logo-img { filter: brightness(0) invert(1); }

.footer-legal {
  font-size: var(--text-xs);
  color: rgba(255, 255, 255, 0.75);
  max-width: 60ch;
  margin: 0;
}

/* ========== STICKY CTA (mobile) ========== */
.sticky-cta {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  padding: var(--space-3) var(--space-4);
  background: var(--color-white);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

@media (max-width: 767px) {
  .sticky-cta { display: flex; }
  body { padding-bottom: 5rem; }
}

.sticky-cta-btn {
  flex: 1;
  min-width: 180px;
  padding: var(--space-3) var(--space-5);
}

.sticky-cta-micro {
  width: 100%;
  text-align: center;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}

/* ========== MODAL ========== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal[hidden] {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--color-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  padding: var(--space-8);
}

.modal-close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  line-height: 1;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: var(--radius-full);
  transition: background 0.2s, color 0.2s;
}

.modal-close:hover,
.modal-close:focus-visible {
  background: var(--color-offwhite);
  color: var(--color-text);
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-2);
}

.modal-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-6);
}

.modal-content-video {
  max-width: 900px;
}

.video-modal-placeholder {
  aspect-ratio: 16/9;
  background: var(--color-brand-dark);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--text-sm);
}

/* ========== CALCULATOR ========== */
.modal-content-calc {
  max-width: 480px;
}

.calc-progress-wrap {
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-4);
}

.calc-progress-bar {
  height: 100%;
  width: 12.5%;
  background: var(--color-brand);
  border-radius: var(--radius-full);
  transition: width 0.3s ease;
}

.calc-step-indicator {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-6);
}

.calc-steps { margin-bottom: var(--space-6); }

.calc-step { }
.calc-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  margin-bottom: var(--space-2);
}

.calc-input,
.calc-select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  transition: border-color 0.2s;
}

.calc-input:focus,
.calc-select:focus {
  outline: none;
  border-color: var(--color-brand);
}

.calc-options {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.calc-options-check { flex-direction: column; }

.calc-radio,
.calc-check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  cursor: pointer;
}

.calc-error {
  display: block;
  font-size: var(--text-sm);
  color: #c00;
  margin-top: calc(-1 * var(--space-2));
  margin-bottom: var(--space-2);
}

.calc-estimate {
  background: var(--color-offwhite);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
}

.calc-estimate-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  margin: 0 0 var(--space-1);
}

.calc-estimate-range {
  font-family: var(--font-stats);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: var(--color-brand);
  margin: 0 0 var(--space-2);
}

.calc-disclaimer {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin: 0;
}

.calc-contact-note {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  margin: 0 0 var(--space-4);
}

.calc-consent-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  font-size: var(--text-sm);
  margin-bottom: var(--space-4);
}

.calc-consent-label input { margin-top: 0.2em; flex-shrink: 0; }

.calc-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.calc-actions {
  display: flex;
  gap: var(--space-4);
  justify-content: space-between;
}

.calc-actions .btn { flex: 1; }

.calc-success {
  text-align: center;
  padding: var(--space-8) 0;
}

.calc-success-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  margin: 0 0 var(--space-2);
}

.calc-success p:last-child {
  margin: 0;
  color: var(--color-text-muted);
}
