/* ==========================================================================
   The Tameer Properties — main.css
   Design tokens, base styles, utilities, animations.
   Theme: light premium — off-white base, deep royal purple, luxury gold,
   dark charcoal text.
   ========================================================================== */

:root {
  /* Brand palette */
  --purple-950: #1E0A38;
  --purple-900: #2A0F4A;
  --purple-800: #371563;
  --purple-700: #451B7B;
  --purple-600: #5A27A3;
  --purple-500: #7440C4;
  --purple-300: #A78BFA;
  --purple-100: #E9DFF7;
  --purple-50:  #F6F1FC;

  /* Replaced Gold with Sleek Royal Violet & Lavender */
  --gold-700: #3E166F;
  --gold-600: #55219C;
  --gold-500: #6D28D9;
  --gold-400: #8B5CF6;
  --gold-300: #C4B5FD;
  --gold-100: #EDE9FE;
  --gold-50:  #FAF5FF;

  --charcoal-900: #201E28;
  --charcoal-700: #37343F;
  --charcoal-500: #55515F;
  --charcoal-400: #6E6A7A;

  /* Surfaces */
  --bg: #FBFAF7;
  --surface: #FFFFFF;
  --surface-alt: #F6F2EC;
  --surface-warm: #FAF6EF;
  --border: #E9E3D9;
  --border-strong: #D8D0C2;

  /* Feedback */
  --green-600: #1E7A4F;
  --red-600: #C0392B;

  /* Gradients */
  --gold-gradient: linear-gradient(135deg, #451B7B 0%, #5A27A3 50%, #7C3AED 100%);
  --purple-gradient: linear-gradient(135deg, #2A0F4A 0%, #451B7B 55%, #5A27A3 100%);
  --purple-gradient-soft: linear-gradient(160deg, #F6F1FC 0%, #FBF8F2 100%);

  /* Text */
  --text: var(--charcoal-700);
  --text-strong: var(--charcoal-900);
  --text-muted: var(--charcoal-400);
  --text-on-dark: #F4F1FA;
  --text-on-dark-muted: rgba(244, 241, 250, 0.72);

  /* Typography */
  --font-head: 'Playfair Display', 'Georgia', 'Times New Roman', serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Layout */
  --container: 1240px;
  --header-h: 78px;
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 26px;

  /* Shadows (purple-tinted) */
  --shadow-sm: 0 4px 14px rgba(42, 15, 74, 0.06);
  --shadow-md: 0 10px 30px rgba(42, 15, 74, 0.10);
  --shadow-lg: 0 22px 48px rgba(42, 15, 74, 0.16);
  --shadow-gold: 0 12px 30px rgba(90, 39, 163, 0.35);

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur: 0.35s;
}

/* --------------------------------------------------------------------------
   Reset & base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

.listing-search {
  margin-top: 50px;
}

/* Sticky footer: main grows, injected footer sits at the bottom */
.site-main { flex: 1 0 auto; display: block; width: 100%; }

img, svg, video { max-width: 100%; height: auto; display: block; }
img { user-select: none; }

a { color: var(--purple-700); text-decoration: none; transition: color var(--dur) var(--ease); }
a:hover { color: var(--purple-500); }

ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

h1, h2, h3, h4, h5 {
  font-family: var(--font-head);
  color: var(--text-strong);
  line-height: 1.18;
  margin: 0 0 0.5em;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); }
h2 { font-size: clamp(1.7rem, 3.2vw, 2.5rem); }
h3 { font-size: clamp(1.15rem, 1.8vw, 1.4rem); }
h4 { font-size: 1.05rem; font-family: var(--font-body); font-weight: 600; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

::selection { background: #7C3AED; color: #ffffff; }

:focus-visible {
  outline: 2px solid #7C3AED;
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--surface-alt); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--purple-600), var(--purple-800));
  border-radius: 8px;
  border: 2px solid var(--surface-alt);
}
::-webkit-scrollbar-thumb:hover { background: var(--purple-500); }

.noscript-note {
  position: fixed; inset: auto 0 0 0; z-index: 9999;
  background: var(--purple-900); color: #fff; text-align: center;
  padding: 12px 16px; font-size: 14px;
}

/* --------------------------------------------------------------------------
   Layout helpers
   -------------------------------------------------------------------------- */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 20px; }

.section { padding: 88px 0; position: relative; }
.section--alt { background: var(--surface-alt); }
.section--purple { background: var(--purple-gradient); }
.section--tight { padding: 56px 0; }

.section-head { max-width: 680px; margin: 0 auto 52px; text-align: center; }
.section-head--left { margin-inline: 0; text-align: left; }
.section-head p { color: var(--text-muted); font-size: 1.02rem; margin: 0; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--purple-700);
  margin-bottom: 14px;
}
.eyebrow::before, .eyebrow::after {
  content: ""; width: 26px; height: 2px; border-radius: 2px;
  background: linear-gradient(135deg, #451B7B 0%, #7C3AED 100%);
}
.section-head--left .eyebrow::before { display: none; }

.section-title-accent { color: var(--purple-700); font-style: italic; }

.grid { display: grid; gap: 26px; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.text-gold { color: var(--purple-600); }
.text-purple { color: var(--purple-700); }
.text-center { text-align: center; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px 26px;
  border-radius: 12px;
  font-size: 0.94rem; font-weight: 600; line-height: 1.2;
  letter-spacing: 0.01em;
  border: 1.5px solid transparent;
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease),
              background-color var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn--primary { background: var(--purple-700); color: #fff; box-shadow: 0 8px 20px rgba(69, 27, 123, 0.28); }
.btn--primary:hover { background: var(--purple-800); color: #fff; box-shadow: 0 14px 28px rgba(69, 27, 123, 0.36); }

.btn--gold {
  background: var(--purple-gradient);
  color: #ffffff !important;
  box-shadow: 0 10px 24px rgba(69, 27, 123, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.btn--gold:hover {
  filter: brightness(1.12);
  color: #ffffff !important;
  box-shadow: 0 16px 34px rgba(90, 39, 163, 0.45);
}

.btn--outline { background: transparent; color: var(--purple-700); border-color: var(--purple-600); }
.btn--outline:hover { background: var(--purple-50); color: var(--purple-800); border-color: var(--purple-700); }

.btn--light { background: #fff; color: var(--purple-800); box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18); }
.btn--light:hover { color: var(--purple-600); }

.btn--ghost-light { background: rgba(255, 255, 255, 0.08); color: #fff; border-color: rgba(255, 255, 255, 0.4); backdrop-filter: blur(4px); }
.btn--ghost-light:hover { background: rgba(255, 255, 255, 0.16); color: #fff; border-color: rgba(255, 255, 255, 0.7); }

.btn--whatsapp { background: #1FAF5E; color: #fff; box-shadow: 0 8px 20px rgba(31, 175, 94, 0.3); }
.btn--whatsapp:hover { background: #18934F; color: #fff; }

.btn--sm { padding: 9px 18px; font-size: 0.85rem; border-radius: 10px; }
.btn--sm svg { width: 15px; height: 15px; }
.btn--lg { padding: 16px 34px; font-size: 1rem; border-radius: 14px; }
.btn--block { width: 100%; }

.btn--icon {
  width: 42px; height: 42px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
}

.link-more {
  display: inline-flex; align-items: center; gap: 7px;
  font-weight: 600; font-size: 0.92rem; color: var(--purple-700);
}
.link-more svg { width: 16px; height: 16px; transition: transform var(--dur) var(--ease); }
.link-more:hover svg { transform: translateX(4px); }

/* --------------------------------------------------------------------------
   Badges & chips
   -------------------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; line-height: 1.3;
}
.badge--sale { background: var(--purple-gradient); color: #fff; }
.badge--rent { background: linear-gradient(135deg, #4A1E8A 0%, #6D28D9 100%); color: #ffffff; }
.badge--type { background: rgba(255, 255, 255, 0.92); color: var(--purple-800); backdrop-filter: blur(6px); }
.badge--glass { background: rgba(30, 10, 56, 0.55); color: #fff; backdrop-filter: blur(6px); border: 1px solid rgba(255,255,255,0.25); }
.badge--offplan { background: linear-gradient(135deg, #371563 0%, #5A27A3 100%); color: #ffffff; }
.badge--construction { background: var(--purple-gradient); color: #fff; }
.badge--ready { background: #0F766E; color: #fff; }
.badge--soft { background: var(--purple-50); color: var(--purple-700); border: 1px solid var(--purple-100); }
.badge--green { background: #E7F5EE; color: var(--green-600); }

.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 16px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--border);
  font-size: 0.85rem; font-weight: 600; color: var(--text-muted);
  cursor: pointer; user-select: none;
  transition: all var(--dur) var(--ease);
}
.chip:hover { border-color: var(--purple-300); color: var(--purple-700); }
.chip.is-active {
  background: var(--purple-700); border-color: var(--purple-700); color: #fff;
  box-shadow: 0 8px 18px rgba(69, 27, 123, 0.3);
}
.chip-row { display: flex; flex-wrap: wrap; gap: 10px; }

/* --------------------------------------------------------------------------
   Forms
   -------------------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 7px; }
.field label {
  font-size: 0.82rem; font-weight: 600; color: var(--charcoal-500);
  letter-spacing: 0.02em;
}
.field label .req { color: var(--red-600); }

.input, .select, .textarea {
  width: 100%;
  padding: 12px 15px;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 11px;
  font-size: 0.93rem;
  color: var(--text-strong);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background-color var(--dur) var(--ease);
  appearance: none;
}
.textarea { resize: vertical; min-height: 120px; }
.input::placeholder, .textarea::placeholder { color: #A9A4B3; }

.input:hover, .select:hover, .textarea:hover { border-color: var(--purple-300); }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--purple-600);
  box-shadow: 0 0 0 4px rgba(90, 39, 163, 0.12);
}

.select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236E6A7A' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.field.has-error .input, .field.has-error .select, .field.has-error .textarea {
  border-color: var(--red-600);
  box-shadow: 0 0 0 4px rgba(192, 57, 43, 0.1);
}
.field-error { font-size: 0.78rem; color: var(--red-600); display: none; }
.field.has-error .field-error { display: block; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-grid .field--full { grid-column: 1 / -1; }

.form-note { font-size: 0.8rem; color: var(--text-muted); }

.form-success {
  text-align: center; padding: 38px 24px;
  background: var(--purple-50); border: 1.5px solid var(--purple-100);
  border-radius: var(--radius-lg);
}
.form-success__icon {
  width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--purple-gradient); color: #ffffff;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(90, 39, 163, 0.35);
}
.form-success__icon svg { width: 30px; height: 30px; }
.form-success h3 { margin-bottom: 8px; }
.form-success p { color: var(--text-muted); font-size: 0.92rem; }
.form-success__actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 22px; }

/* --------------------------------------------------------------------------
   Cards (generic shell)
   -------------------------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

/* --------------------------------------------------------------------------
   Reveal animations
   -------------------------------------------------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: var(--reveal-delay, 0s);
  will-change: opacity, transform;
}
[data-reveal].in-view { opacity: 1; transform: none; }
[data-reveal="left"] { transform: translateX(-30px); }
[data-reveal="right"] { transform: translateX(30px); }
[data-reveal="zoom"] { transform: scale(0.94); }
[data-reveal].in-view[data-reveal] { transform: none; }

@keyframes tp-fade-up { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes tp-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes tp-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes tp-pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(31, 175, 94, 0.45); }
  70% { box-shadow: 0 0 0 16px rgba(31, 175, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 175, 94, 0); }
}
@keyframes tp-shine {
  from { background-position: 200% center; }
  to { background-position: -200% center; }
}
@keyframes tp-marquee { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.anim-fade-up { animation: tp-fade-up 0.8s var(--ease) both; }
.anim-fade-in { animation: tp-fade-in 1s var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */
.toast-stack {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9600; display: flex; flex-direction: column; gap: 10px;
  width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--purple-950); color: #fff;
  border-radius: 12px; padding: 14px 18px;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem; line-height: 1.45;
  animation: tp-fade-up 0.4s var(--ease) both;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.toast svg { width: 20px; height: 20px; flex: none; margin-top: 1px; color: #C4B5FD; }
.toast--error svg { color: #F19A8E; }
.toast--hide { opacity: 0; transform: translateY(10px); transition: all 0.3s ease; }

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed; inset: 0; z-index: 9700;
  background: rgba(20, 8, 40, 0.94);
  display: none; align-items: center; justify-content: center;
  padding: 40px;
  backdrop-filter: blur(6px);
}
.lightbox.is-open { display: flex; animation: tp-fade-in 0.25s ease both; }
.lightbox img {
  max-width: min(1100px, 100%); max-height: 84vh;
  border-radius: 12px; box-shadow: var(--shadow-lg);
  object-fit: contain;
}
.lightbox__btn {
  position: absolute; width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.1); color: #fff;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.25);
  transition: background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.lightbox__btn:hover { background: var(--purple-700); color: #fff; transform: scale(1.06); }
.lightbox__btn svg { width: 22px; height: 22px; }
.lightbox__close { top: 26px; right: 26px; }
.lightbox__prev { left: 26px; }
.lightbox__next { right: 26px; }
.lightbox__count {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  color: rgba(255,255,255,0.85); font-size: 0.85rem; letter-spacing: 0.08em;
  background: rgba(30,10,56,0.6); padding: 6px 16px; border-radius: 999px;
}

/* --------------------------------------------------------------------------
   Floating actions (WhatsApp + back to top) — injected by components.js
   -------------------------------------------------------------------------- */
.fab-stack { position: fixed; right: 22px; bottom: 22px; z-index: 9500; display: flex; flex-direction: column; gap: 12px; }
.fab {
  width: 54px; height: 54px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 14px 30px rgba(30, 10, 56, 0.35);
  transition: transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  position: relative;
}
.fab:hover { transform: translateY(-4px) scale(1.04); }
.fab svg { width: 26px; height: 26px; }
.fab--whatsapp { background: #1FAF5E; color: #fff; animation: tp-pulse-ring 2.6s infinite; }
.fab--top {
  background: var(--purple-gradient); color: #C4B5FD;
  opacity: 0; pointer-events: none; transform: translateY(12px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.fab--top.is-visible { opacity: 1; pointer-events: auto; transform: none; }
.fab__tooltip {
  position: absolute; right: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--purple-950); color: #fff; font-size: 0.75rem; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity var(--dur) var(--ease);
}
.fab:hover .fab__tooltip { opacity: 1; }

/* --------------------------------------------------------------------------
   Breadcrumbs (shared)
   -------------------------------------------------------------------------- */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 0.85rem; }
.breadcrumb a { color: rgba(255, 255, 255, 0.75); font-weight: 500; }
.breadcrumb a:hover { color: #C4B5FD; }
.breadcrumb span { color: rgba(255, 255, 255, 0.5); }
.breadcrumb strong { color: #ffffff; font-weight: 600; }
.breadcrumb svg { width: 13px; height: 13px; opacity: 0.6; }

/* --------------------------------------------------------------------------
   Responsive helpers & Breakpoint System
   -------------------------------------------------------------------------- */
@media (max-width: 1080px) {
  .grid--4 { grid-template-columns: repeat(3, 1fr); }
  .section { padding: 68px 0; }
}

@media (max-width: 900px) {
  .grid--3, .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .section { padding: 60px 0; }
  .section-head { margin-bottom: 38px; }
}

@media (max-width: 640px) {
  :root { --header-h: 64px; }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .section { padding: 48px 0; }
  .section--tight { padding: 36px 0; }
  .section-head { margin-bottom: 28px; }
  .section-head p { font-size: 0.94rem; }
  .container { padding-inline: 16px; }
  .fab-stack { right: 14px; bottom: 14px; gap: 8px; }
  .fab { width: 48px; height: 48px; }
  .fab svg { width: 22px; height: 22px; }
  .toast-stack { width: calc(100vw - 24px); bottom: 16px; }
  h1 { font-size: clamp(1.85rem, 6.2vw, 2.6rem); }
  h2 { font-size: clamp(1.48rem, 5vw, 2rem); }
  h3 { font-size: clamp(1.1rem, 3.8vw, 1.35rem); }
  .btn--lg { padding: 13px 24px; font-size: 0.94rem; }
  .form-success { padding: 28px 16px; }
  .form-success__actions { flex-direction: column; width: 100%; }
  .form-success__actions .btn { width: 100%; }
}

@media (max-width: 380px) {
  .container { padding-inline: 12px; }
  .btn { padding: 11px 18px; font-size: 0.88rem; }
  .chip { padding: 6px 12px; font-size: 0.8rem; }
  .eyebrow { font-size: 0.72rem; letter-spacing: 0.16em; }
  .eyebrow::before, .eyebrow::after { width: 16px; }
}
