/**
 * @file
 * Base styles and reset for Real Estate Elite theme.
 */

/* === Reset === */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--re-font-body);
  font-size: var(--re-text-base);
  line-height: var(--re-leading-normal);
  color: var(--re-black);
  background-color: var(--re-white);
  overflow-x: hidden;
}

body.realestate-body {
  opacity: 0;
  transition: opacity var(--re-duration-slow) var(--re-ease-out);
}

body.realestate-body.re-body-loaded {
  opacity: 1;
}

/* === Typography === */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--re-font-heading);
  font-weight: 700;
  line-height: var(--re-leading-tight);
  letter-spacing: var(--re-tracking-tight);
  color: inherit;
}

h1 { font-weight: 800; }
h2 { font-weight: 700; }
h3 { font-weight: 600; }
h4 { font-weight: 600; }

a {
  color: var(--re-red);
  text-decoration: none;
  transition: color var(--re-duration-fast) var(--re-ease-out);
}

a:hover {
  color: var(--re-red-dark);
}

a:focus-visible {
  outline: 2px solid var(--re-red);
  outline-offset: 3px;
  border-radius: var(--re-radius-sm);
}

p {
  margin-bottom: 1em;
  color: var(--re-gray-500);
}

img, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

ul, ol {
  list-style: none;
}

/* === Selection === */
::selection {
  background-color: var(--re-red);
  color: var(--re-white);
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--re-black);
}

::-webkit-scrollbar-thumb {
  background: var(--re-red);
  border-radius: var(--re-radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--re-red-light);
}

/* === Buttons === */
.re-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--re-font-body);
  font-weight: 600;
  font-size: var(--re-text-sm);
  letter-spacing: var(--re-tracking-wide);
  text-transform: uppercase;
  text-decoration: none;
  padding: 1rem 2.25rem;
  border: none;
  border-radius: var(--re-radius-sm);
  cursor: pointer;
  transition: all var(--re-duration-normal) var(--re-ease-out);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.re-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left var(--re-duration-slow) var(--re-ease-out);
}

.re-btn:hover::before {
  left: 100%;
}

.re-btn--primary {
  background-color: var(--re-red);
  color: var(--re-white);
}

.re-btn--primary:hover {
  background-color: var(--re-red-dark);
  color: var(--re-white);
  transform: translateY(-2px);
  box-shadow: var(--re-shadow-red);
}

.re-btn--outline {
  background-color: transparent;
  color: var(--re-black);
  border: 1.5px solid var(--re-black);
}

.re-btn--outline:hover {
  background-color: var(--re-black);
  color: var(--re-white);
  transform: translateY(-2px);
}

.re-btn--ghost {
  background-color: transparent;
  color: var(--re-white);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.re-btn--ghost:hover {
  border-color: var(--re-white);
  background-color: rgba(255, 255, 255, 0.08);
  color: var(--re-white);
}

.re-btn--white {
  background-color: var(--re-white);
  color: var(--re-black);
}

.re-btn--white:hover {
  background-color: var(--re-off-white);
  transform: translateY(-2px);
  box-shadow: var(--re-shadow-md);
}

.re-btn--sm {
  padding: 0.75rem 1.5rem;
  font-size: var(--re-text-xs);
}

.re-btn--lg {
  padding: 1.125rem 2.75rem;
  font-size: var(--re-text-sm);
}

.re-btn--full {
  width: 100%;
}

/* === Section Helpers === */
.re-section-header {
  text-align: center;
  margin-bottom: var(--re-space-2xl);
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.re-section-header--light .re-section-title,
.re-section-header--light .re-section-subtitle {
  color: var(--re-white);
}

.re-section-header--light .re-section-subtitle {
  color: rgba(255, 255, 255, 0.65);
}

.re-section-tag {
  display: none !important;
}

.re-section-tag::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 1.25rem;
  height: 1px;
  background-color: var(--re-red);
}

.re-section-tag--light {
  color: var(--re-red-light);
}

.re-section-tag--light::before {
  background-color: var(--re-red-light);
}

.re-section-title {
  font-size: var(--re-text-3xl);
  margin-bottom: var(--re-space-md);
  line-height: var(--re-leading-tight);
}

.re-section-subtitle {
  font-size: var(--re-text-base);
  color: var(--re-gray-400);
  line-height: var(--re-leading-relaxed);
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.re-section-cta {
  text-align: center;
  margin-top: var(--re-space-2xl);
}

/* === Form Elements === */
.re-form-label {
  display: block;
  font-family: var(--re-font-body);
  font-size: var(--re-text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--re-tracking-wide);
  color: var(--re-gray-500);
  margin-bottom: 0.5rem;
  line-height: var(--re-leading-snug);
}

.re-form-input {
  width: 100%;
  padding: 0.9375rem 1.125rem;
  font-family: var(--re-font-body);
  font-size: var(--re-text-sm);
  color: var(--re-black);
  background-color: var(--re-white);
  border: 1.5px solid var(--re-gray-100);
  border-radius: var(--re-radius-sm);
  transition: all var(--re-duration-fast) var(--re-ease-out);
  outline: none;
  line-height: var(--re-leading-snug);
}

.re-form-input:focus {
  border-color: var(--re-red);
  box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}

.re-form-input::placeholder {
  color: var(--re-gray-300);
}

.re-form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4L6 8L10 4' stroke='%23585550' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.re-form-textarea {
  resize: vertical;
  min-height: 120px;
}

.re-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--re-space-md);
  margin-bottom: var(--re-space-md);
}

@media (max-width: 640px) {
  .re-form-row {
    grid-template-columns: 1fr;
  }
}

.re-form-group {
  margin-bottom: var(--re-space-md);
}

.re-form-row .re-form-group {
  margin-bottom: 0;
}

/* === Accessibility === */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: var(--re-z-modal);
  padding: 0.75rem 1.5rem;
  background: var(--re-red);
  color: var(--re-white);
  font-weight: 600;
  border-radius: var(--re-radius-sm);
  width: auto;
  height: auto;
  clip: auto;
  white-space: normal;
}

/* === Page Loader === */
.re-page-loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: var(--re-z-loader);
  background-color: var(--re-black);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.re-page-loader.re-page-loader--hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.re-page-loader__inner {
  text-align: center;
}

.re-page-loader__logo {
  width: 80px;
  height: 80px;
  margin: 0 auto 2rem;
  animation: re-loader-pulse 1.5s ease-in-out infinite;
}

.re-page-loader__logo svg {
  width: 100%;
  height: 100%;
}

.re-page-loader__bar {
  width: 120px;
  height: 2px;
  background-color: var(--re-black-lighter);
  border-radius: var(--re-radius-full);
  overflow: hidden;
}

.re-page-loader__bar-fill {
  width: 0%;
  height: 100%;
  background-color: var(--re-red);
  border-radius: var(--re-radius-full);
  animation: re-loader-progress 1.8s var(--re-ease-in-out) forwards;
}

@keyframes re-loader-pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

@keyframes re-loader-progress {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}
