/**
 * ECOPOLIS - Global Stylesheet
 * Consolidated CSS for optimal performance
 * Single file approach for faster loading
 */

/* ==========================================================================
   1. FONTS
   ========================================================================== */

@font-face {
  font-family: 'Assistant';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/assistant_n4.woff2') format('woff2');
}

/* ==========================================================================
   2. CSS VARIABLES
   ========================================================================== */

:root {
  /* ===== TYPOGRAPHY ===== */
  --font-display: 'Crimson Text', serif;
  --font-body: 'Assistant', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-size-base: 1.8rem;
  --line-height-body: 1.6;
  --line-height-heading: 1.2;

  /* Legacy variables (for compatibility) */
  --font-body-family: var(--font-body);
  --font-body-style: normal;
  --font-body-weight: 400;
  --font-body-weight-bold: 700;
  --font-body-scale: 1.0;
  --font-heading-family: var(--font-display);
  --font-heading-style: normal;
  --font-heading-weight: 600;
  --font-heading-scale: 1.0;

  /* ===== COLORS - BRAND ===== */
  --color-green-theme: 165, 183, 149;

  /* ===== COLORS - ACCENTS ===== */
  --color-accent-warm: 157, 119, 91;      /* Warm Taupe */
  --color-accent-light: 205, 198, 191;    /* Warm Greige */

  /* ===== COLORS - BACKGROUNDS ===== */
  --color-background-primary: 255, 255, 255;    /* White */
  --color-background-secondary: 240, 238, 235;  /* Warm Off-White */
  --color-background-tertiary: 247, 247, 247;   /* Soft Neutral */
  --color-background: 255, 255, 255;            /* Legacy */
  --gradient-background: #ffffff;               /* Legacy */

  /* ===== COLORS - TEXT ===== */
  --color-foreground: 18, 18, 18;           /* Primary Text */
  --color-text-secondary: 102, 102, 102;    /* Secondary Text */
  --color-text-tertiary: 140, 140, 140;     /* Tertiary Text */
  --color-text-muted: 179, 179, 179;        /* Disabled/Muted */

  /* ===== COLORS - INTERACTIVE ===== */
  --color-button: 157, 119, 91;             /* Button Background */
  --color-button-text: 255, 255, 255;       /* Button Text */
  --color-link: 157, 119, 91;               /* Link Color */
  --color-link-visited: 140, 140, 140;      /* Visited Link */
  --color-shadow: 18, 18, 18;               /* Legacy */

  /* ===== COLORS - UTILITIES ===== */
  --color-accent: 157, 119, 91;             /* Primary Accent */
  --color-border: 230, 230, 230;            /* Borders and Dividers */

  /* Layout */
  --page-width: 120rem;
  --spacing-sections-desktop: 0px;
  --spacing-sections-mobile: 0px;

  /* Grid spacing (boutique design) */
  --grid-mobile-horizontal-spacing: 12px;
  --grid-mobile-vertical-spacing: 12px;
  --grid-desktop-horizontal-spacing: 24px;
  --grid-desktop-vertical-spacing: 24px;

  /* Border radius */
  --buttons-radius: 0px;
  --inputs-radius: 0px;
  --media-radius: 0px;
  --border-radius: 0px;

  /* Borders */
  --buttons-border-width: 1px;
  --inputs-border-width: 1px;
  --media-border-width: 1px;
  --inputs-border-opacity: 0.55;
  --media-border-opacity: 0.05;

  /* Shadows */
  --buttons-shadow-opacity: 0.0;
  --inputs-shadow-opacity: 0.0;
  --media-shadow-opacity: 0.0;
}

/* ==========================================================================
   3. BASE STYLES & RESET
   ========================================================================== */

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

html {
  font-size: 62.5%;
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-body);
  font-style: var(--font-body-style);
  font-weight: var(--font-body-weight);
  font-size: 1.7rem;
  line-height: var(--line-height-body);
  color: rgb(var(--color-foreground));
  background-color: rgb(var(--color-background));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  width: 100%;
  min-width: 100vw;
  overflow-x: hidden;
}

@media screen and (min-width: 750px) {
  body {
    font-size: var(--font-size-base);
  }
}

p {
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: var(--line-height-body);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin: 0 0 1rem 0;
  font-family: var(--font-display);
  font-style: var(--font-heading-style);
  font-weight: 600;
  line-height: var(--line-height-heading);
  letter-spacing: -0.02em;
  color: rgb(var(--color-foreground));
}

h1 { font-size: calc(var(--font-heading-scale) * 3rem); }
h2 { font-size: calc(var(--font-heading-scale) * 2rem); }
h3 { font-size: calc(var(--font-heading-scale) * 1.7rem); }
h4 { font-size: calc(var(--font-heading-scale) * 1.5rem); }
h5 { font-size: calc(var(--font-heading-scale) * 1.2rem); }

@media screen and (min-width: 750px) {
  h1 { font-size: calc(var(--font-heading-scale) * 4rem); }
  h2 { font-size: calc(var(--font-heading-scale) * 2.4rem); }
  h3 { font-size: calc(var(--font-heading-scale) * 1.8rem); }
}


a {
  color: rgb(var(--color-link));
  text-decoration: none;
  transition: opacity 0.2s ease;
}

a:hover {
  opacity: 0.85;
}

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

/* Lists */
ul, ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

/* Skip Link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: rgb(var(--color-green-theme));
  color: white;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
  font-weight: 600;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid white;
  outline-offset: -3px;
}

/* Focus Indicators */
:focus-visible {
  outline: 3px solid rgb(var(--color-green-theme));
  outline-offset: 2px;
}

/* Dark outline for light backgrounds */
button:focus-visible,
a:not(.skip-link):focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid #333;
  outline-offset: 2px;
}

/* Light outline for dark backgrounds (announcement bar, footer) */
.announcement-bar a:focus-visible,
.footer a:focus-visible,
.site-header-group a:focus-visible {
  outline: 3px solid white;
  outline-offset: 2px;
}

/* Remove outline for mouse users (modern browsers only) */
:focus:not(:focus-visible) {
  outline: none;
}

/* ==========================================================================
   4. LAYOUT
   ========================================================================== */

.page-width {
  max-width: var(--page-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

@media screen and (min-width: 750px) {
  .page-width {
    padding: 0 5rem;
  }
}

/* Section spacing */
.section + .section {
  margin-top: var(--spacing-sections-mobile);
}

@media screen and (min-width: 750px) {
  .section + .section {
    margin-top: var(--spacing-sections-desktop);
  }
}

/* Grid system - Removed flexbox rules that conflict with CSS Grid in property pages */
/* Property grids now use CSS Grid (display: grid) with grid-template-columns */
/* If needed for other pages, add specific classes instead of global .grid rules */

/* ==========================================================================
   5. HEADER & NAVIGATION
   ========================================================================== */

.header-wrapper {
  display: block;
  position: relative;
  background-color: rgb(var(--color-background));
  border-bottom: 0.1rem solid rgba(var(--color-foreground), 0.08);
}

.header {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-areas: "left-icons heading icons";
  align-items: center;
  padding: 1rem 0;
}

@media screen and (min-width: 990px) {
  .header {
    grid-template-columns: 1fr auto 1fr;
  }
}

.header__heading {
  grid-area: heading;
  justify-self: center;
  margin: 0;
  line-height: 0;
}

.header__heading-link {
  display: inline-block;
  padding: 0.75rem;
}

.header__heading-logo {
  height: auto;
  max-width: 100%;
}

.header__icons {
  display: flex;
  grid-area: icons;
  justify-self: end;
  gap: 1rem;
}

.header__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.4rem;
  height: 4.4rem;
  color: rgb(var(--color-foreground));
}

.header__icon .icon {
  width: 2rem;
  height: 2rem;
}

/* Utility Bar (Green top bar with social icons) */
.utility-bar {
  background-color: rgb(var(--color-green-theme));
  color: rgba(18, 18, 18, 0.75);
  height: 100%;
}

.utility-bar__grid {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-areas: "announcements";
  padding: 0.5rem 0;
}

@media screen and (min-width: 990px) {
  .utility-bar__grid {
    grid-template-columns: 3fr 4fr 3fr;
    grid-template-areas: "social-icons announcements language-currency";
  }
}

.utility-bar .list-social {
  display: flex;
  gap: 1.2rem;
  align-items: center;
  grid-area: social-icons;
}

@media screen and (max-width: 989px) {
  .utility-bar .list-social {
    display: none;
  }
}

.list-social__link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 4.4rem;
  height: 4.4rem;
  color: rgba(18, 18, 18, 0.75);
}

.list-social__link:hover {
  opacity: 0.7;
}

.list-social__link .icon {
  width: 2rem;
  height: 2rem;
}

.announcement-bar {
  grid-area: announcements;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.announcement-bar__message {
  padding: 0.5rem 1rem;
  font-size: 1.3rem;
  letter-spacing: 0.1rem;
  color: rgba(18, 18, 18, 0.75);
}

/* ==========================================================================
   6. CARDS (Property Cards)
   ========================================================================== */

.card-wrapper {
  color: inherit;
  height: 100%;
  position: relative;
  text-decoration: none;
}

.card {
  text-decoration: none;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card__inner {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  box-sizing: border-box;
  border-radius: var(--border-radius);
  border: var(--media-border-width) solid rgba(var(--color-foreground), var(--media-border-opacity));
  overflow: hidden;
  background-color: rgb(var(--color-background));
  transition: box-shadow 0.3s ease;
}

.card-wrapper:hover .card__inner {
  box-shadow: 0 0.4rem 1.2rem rgba(var(--color-shadow), 0.08);
}

.card__media {
  position: relative;
  width: 100%;
  overflow: hidden;
}

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

/* Card content */
.card__content {
  padding: 1.5rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card__heading {
  margin: 0;
  font-size: 1.6rem;
  font-weight: var(--font-body-weight);
  line-height: 1.4;
  color: rgb(var(--color-foreground));
}

@media screen and (min-width: 750px) {
  .card__heading {
    font-size: 1.8rem;
  }
}

.card__heading a {
  color: inherit;
  text-decoration: none;
}

.card__heading a:hover {
  text-decoration: underline;
}

.card-information {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.card-information .caption {
  font-size: 1.3rem;
  color: rgba(var(--color-foreground), 0.75);
  letter-spacing: 0.07rem;
}

.price {
  font-size: 1.5rem;
  font-weight: var(--font-body-weight-bold);
  color: rgb(var(--color-foreground));
}

@media screen and (min-width: 750px) {
  .price {
    font-size: 1.6rem;
  }
}

/* Hover effects */
@media screen and (min-width: 990px) {
  .card-wrapper:hover .card__media img {
    transform: scale(1.05);
    transition: transform 0.3s ease;
  }
}

/* ==========================================================================
   7. BUTTONS
   ========================================================================== */

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  padding: 1.2rem 3rem;
  min-height: 4.5rem;
  background-color: rgb(var(--color-button));
  color: rgb(var(--color-button-text));
  border: var(--buttons-border-width) solid rgb(var(--color-button));
  border-radius: var(--buttons-radius);
  font-size: 1.5rem;
  font-family: inherit;
  font-weight: var(--font-body-weight);
  letter-spacing: 0.1rem;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.button:hover {
  opacity: 0.85;
}

.button--secondary {
  background-color: rgb(var(--color-background));
  color: rgb(var(--color-foreground));
  border-color: rgb(var(--color-foreground));
}

/* ==========================================================================
   8. FOOTER
   ========================================================================== */

.footer {
  background-color: rgb(var(--color-green-theme));
  color: rgba(18, 18, 18, 0.75);
  padding: 3rem 0;
  margin-top: 5rem;
}

.footer__content-top {
  background-color: rgb(var(--color-green-theme));
}

.footer a {
  color: rgba(18, 18, 18, 0.75);
}

.footer a:hover {
  opacity: 0.7;
}

/* ==========================================================================
   9. MEDIA & IMAGES
   ========================================================================== */

.media {
  display: block;
  position: relative;
  overflow: hidden;
  background-color: rgba(var(--color-foreground), 0.1);
}

.media img {
  display: block;
  width: 100%;
  height: auto;
}

/* Aspect ratios */
.media--square { padding-bottom: 100%; }
.media--portrait { padding-bottom: 125%; }
.media--landscape { padding-bottom: 66.6%; }
.media--16-9 { padding-bottom: 56.25%; }

.media > img,
.media > svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ==========================================================================
   10. UTILITY CLASSES
   ========================================================================== */

.visually-hidden {
  position: absolute !important;
  overflow: hidden;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  word-wrap: normal !important;
}

.hidden {
  display: none !important;
}

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

.uppercase {
  text-transform: uppercase;
}

/* Responsive utilities */
@media screen and (max-width: 749px) {
  .small-hide {
    display: none !important;
  }
}

@media screen and (min-width: 750px) and (max-width: 989px) {
  .medium-hide {
    display: none !important;
  }
}

@media screen and (min-width: 990px) {
  .large-up-hide {
    display: none !important;
  }
}

/* ==========================================================================
   11. ICON SYSTEM
   ========================================================================== */

.icon {
  width: 2rem;
  height: 2rem;
  display: inline-block;
  fill: currentColor;
}

.svg-wrapper {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
}

.svg-wrapper > svg {
  width: 100%;
  height: 100%;
}

/* ==========================================================================
   11b. FOCUS STATES
   ========================================================================== */

*:focus-visible {
  outline: 0.2rem solid rgba(var(--color-foreground), 0.5);
  outline-offset: 0.3rem;
}

button:focus-visible,
a:focus-visible {
  outline: 0.2rem solid rgba(var(--color-foreground), 0.5);
  outline-offset: 0.3rem;
}

/* ==========================================================================
   12. ANIMATIONS & TRANSITIONS
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
  .card__media img {
    transition: transform 0.3s ease;
  }

  a, .button {
    transition: opacity 0.2s ease;
  }
}

/* ==========================================================================
   13. STICKY HEADER
   ========================================================================== */

.header-wrapper {
  position: relative;
  background-color: rgb(var(--color-background));
}

.site-header-group {
  position: sticky;
  top: 0;
  z-index: 10;
  background-color: rgb(var(--color-background));
}

.section-header {
  position: relative;
  z-index: 3;
}

/* Wrapper for announcement bar + header */
.announcement-bar-wrapper + .header-wrapper {
  border-top: none;
}

/* ==========================================================================
   14. IMAGE LIGHTBOX
   ========================================================================== */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background-color: rgba(0, 0, 0, 0.95);
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.lightbox--active {
  display: flex;
  opacity: 1;
}

.lightbox__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.lightbox__image {
  max-width: 100%;
  max-height: 85vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
}

.lightbox__counter {
  position: absolute;
  bottom: -40px;
  left: 50%;
  transform: translateX(-50%);
  color: white;
  font-family: var(--font-body);
  font-size: 1.6rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  background-color: rgba(0, 0, 0, 0.6);
  border-radius: 4px;
  white-space: nowrap;
}

.lightbox__close {
  position: absolute;
  top: 2rem;
  right: 2rem;
  z-index: 10001;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all 0.2s ease;
  padding: 0;
}

.lightbox__close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.1);
}

.lightbox__close:active {
  transform: scale(0.95);
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10001;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: white;
  transition: all 0.2s ease;
  padding: 0;
}

.lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-50%) scale(1.1);
}

.lightbox__nav:active {
  transform: translateY(-50%) scale(0.95);
}

.lightbox__nav--prev {
  left: 2rem;
}

.lightbox__nav--next {
  right: 2rem;
}

/* Mobile responsive */
@media screen and (max-width: 749px) {
  .lightbox__close {
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
  }

  .lightbox__close svg {
    width: 24px;
    height: 24px;
  }

  .lightbox__nav {
    width: 48px;
    height: 48px;
  }

  .lightbox__nav svg {
    width: 32px;
    height: 32px;
  }

  .lightbox__nav--prev {
    left: 1rem;
  }

  .lightbox__nav--next {
    right: 1rem;
  }

  .lightbox__counter {
    font-size: 1.4rem;
    bottom: -35px;
  }

  .lightbox__image {
    max-height: 80vh;
  }
}

/* Prevent body scroll when lightbox is active */
body:has(.lightbox--active) {
  overflow: hidden;
}

/* ==========================================================================
   END OF GLOBAL STYLES
   ========================================================================== */
