/* ========================================
   GLOBAL STYLES & CSS VARIABLES
   ======================================== */

:root {
  /* iOS viewport height fix */
  --vh: 1vh;
  
  /* Color Palette - Premium Real Estate Theme */
  --primary-navy: #1a2332;
  --primary-dark: #0f1419;
  --secondary-charcoal: #2c3e50;
  --accent-gold: #d4a574;
  --accent-orange: #e67e22;
  --light-bg: #f8f9fa;
  --white: #ffffff;
  --gray-100: #f5f5f5;
  --gray-200: #e5e5e5;
  --gray-300: #d4d4d4;
  --gray-400: #a3a3a3;
  --gray-600: #525252;
  --gray-800: #262626;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-light: #ffffff;
  --border-color: #e0e0e0;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.16);
  --success: #27ae60;
  --error: #e74c3c;
  --warning: #f39c12;
  
  /* Typography */
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-secondary: 'Poppins', sans-serif;
  --font-size-xs: 0.75rem;      /* 12px */
  --font-size-sm: 0.875rem;     /* 14px */
  --font-size-base: 1rem;       /* 16px */
  --font-size-lg: 1.125rem;     /* 18px */
  --font-size-xl: 1.25rem;      /* 20px */
  --font-size-2xl: 1.5rem;      /* 24px */
  --font-size-3xl: 1.875rem;    /* 30px */
  --font-size-4xl: 2.25rem;     /* 36px */
  --font-size-5xl: 3rem;        /* 48px */
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --line-height-tight: 1.2;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;
  
  /* Spacing */
  --spacing-xs: 0.5rem;    /* 8px */
  --spacing-sm: 0.75rem;   /* 12px */
  --spacing-md: 1rem;      /* 16px */
  --spacing-lg: 1.5rem;    /* 24px */
  --spacing-xl: 2rem;      /* 32px */
  --spacing-2xl: 3rem;     /* 48px */
  --spacing-3xl: 4rem;     /* 64px */
  --spacing-4xl: 6rem;     /* 96px */
  
  /* Layout */
  --container-max-width: 1280px;
  --container-padding: 1rem;
  --border-radius-sm: 4px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --border-radius-xl: 16px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 350ms ease;
  
  /* Breakpoints (for reference in JS) */
  --breakpoint-mobile: 768px;
  --breakpoint-tablet: 1024px;
  --breakpoint-desktop: 1280px;
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--text-primary);
  background-color: var(--white);
  overflow-x: hidden;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-secondary);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--text-primary);
  margin-bottom: var(--spacing-md);
}

h1 { font-size: clamp(2rem, 5vw, var(--font-size-5xl)); }
h2 { font-size: clamp(1.75rem, 4vw, var(--font-size-4xl)); }
h3 { font-size: clamp(1.5rem, 3vw, var(--font-size-3xl)); }
h4 { font-size: clamp(1.25rem, 2.5vw, var(--font-size-2xl)); }
h5 { font-size: clamp(1.125rem, 2vw, var(--font-size-xl)); }
h6 { font-size: var(--font-size-lg); }

p {
  margin-bottom: var(--spacing-md);
  color: var(--text-secondary);
}

a {
  color: var(--accent-gold);
  text-decoration: none;
  transition: color var(--transition-base);
}

a:hover {
  color: var(--accent-orange);
}

a:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

/* ========================================
   LAYOUT UTILITIES
   ======================================== */

.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin: 0 auto;
  padding: 0 var(--container-padding);
}

@media (min-width: 768px) {
  .container {
    --container-padding: 2rem;
  }
}

@media (min-width: 1024px) {
  .container {
    --container-padding: 3rem;
  }
}

.section {
  padding: var(--spacing-3xl) 0;
}

@media (max-width: 767px) {
  .section {
    padding: var(--spacing-2xl) 0;
  }
}

.section-dark {
  background-color: var(--primary-navy);
  color: var(--text-light);
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4,
.section-dark h5,
.section-dark h6 {
  color: var(--text-light);
}

.section-dark p {
  color: rgba(255, 255, 255, 0.85);
}

.section-light {
  background-color: var(--light-bg);
}

/* Grid System */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

@media (min-width: 768px) {
  .grid { gap: var(--spacing-xl); }
}

/* Flexbox Utilities */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  justify-content: center;
  align-items: center;
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flex-column {
  display: flex;
  flex-direction: column;
}

.flex-wrap {
  flex-wrap: wrap;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 2rem;
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  line-height: 1;
  text-align: center;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--border-radius-md);
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  min-height: 44px; /* Touch-friendly */
  -webkit-tap-highlight-color: transparent;
}

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

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

.btn-primary:hover {
  background-color: var(--accent-orange);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background-color: transparent;
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

.btn-secondary:hover {
  background-color: var(--accent-gold);
  color: var(--white);
}

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

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

.btn-large {
  padding: 1.125rem 2.5rem;
  font-size: var(--font-size-lg);
}

.btn-small {
  padding: 0.625rem 1.5rem;
  font-size: var(--font-size-sm);
  min-height: 38px;
}

.btn-block {
  width: 100%;
}

/* ========================================
   FORMS
   ======================================== */

.form-group {
  margin-bottom: var(--spacing-lg);
}

.form-label {
  display: block;
  margin-bottom: var(--spacing-xs);
  font-weight: var(--font-weight-medium);
  color: var(--text-primary);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: var(--font-primary);
  font-size: var(--font-size-base);
  color: var(--text-primary);
  background-color: var(--white);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
  min-height: 44px; /* Touch-friendly */
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 3px rgba(212, 165, 116, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
}

.form-input::placeholder {
  color: var(--gray-400);
}

/* ========================================
   CARDS
   ======================================== */

.card {
  background-color: var(--white);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-4px);
}

.card-image {
  width: 100%;
  height: 240px;
  object-fit: cover;
  display: block;
}

.card-content {
  padding: var(--spacing-lg);
}

.card-title {
  font-size: var(--font-size-xl);
  margin-bottom: var(--spacing-sm);
}

.card-text {
  color: var(--text-secondary);
  margin-bottom: var(--spacing-md);
}

/* ========================================
   IMAGES
   ======================================== */

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

.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-contain {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Lazy Loading */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity var(--transition-slow);
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-light { color: var(--text-light); }
.text-gold { color: var(--accent-gold); }

.bg-dark { background-color: var(--primary-navy); }
.bg-light { background-color: var(--light-bg); }
.bg-white { background-color: var(--white); }

.mb-xs { margin-bottom: var(--spacing-xs); }
.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }
.mb-xl { margin-bottom: var(--spacing-xl); }
.mb-2xl { margin-bottom: var(--spacing-2xl); }

.mt-xs { margin-top: var(--spacing-xs); }
.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }
.mt-xl { margin-top: var(--spacing-xl); }

.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ========================================
   ANIMATIONS
   ======================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.fade-in {
  animation: fadeIn 0.6s ease-out;
}

.slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

.slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

/* ========================================
   RESPONSIVE VISIBILITY
   ======================================== */

@media (max-width: 767px) {
  .hide-mobile { display: none !important; }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .hide-tablet { display: none !important; }
}

@media (min-width: 1024px) {
  .hide-desktop { display: none !important; }
}

@media (min-width: 768px) {
  .show-mobile { display: none !important; }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

/* Focus styles for keyboard navigation */
*:focus-visible {
  outline: 2px solid var(--accent-gold);
  outline-offset: 2px;
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  *,
  *::before,
  *::after {
    background: transparent !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  a,
  a:visited {
    text-decoration: underline;
  }

  img {
    page-break-inside: avoid;
  }

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
}