/* ============================================================
   Finca — landing.css
   Styles for the full-screen "Where do you want to live?" onboarding
   overlay built by /static/js/landing.js. Poster-flat "Ibiza chic":
   periwinkle wash, a cream hand-drawn island, inked pill labels with
   butter count badges, forest-green selection. Reads finca-tokens.css.
   ============================================================ */

/* ----------------------------------------------------------------
   Overlay shell
   ---------------------------------------------------------------- */
.landing {
  position: fixed;
  inset: 0;
  z-index: 1000;                 /* above the app, drawer, modal and toasts */
  background: var(--blue-wash);
  color: var(--ink);
  display: flex;
  flex-direction: column;        /* scroll region + pinned footer */
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-med) var(--ease-out);
}
.landing.is-open { opacity: 1; pointer-events: auto; }
.landing.is-leaving { opacity: 0; pointer-events: none; }
.landing:focus { outline: none; }

/* Soft butter sun-wash, top-right, for atmosphere (fixed behind the scroll). */
.landing::before {
  content: "";
  position: absolute;
  top: -130px;
  right: -90px;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, var(--butter) 0%, transparent 65%);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
}

/* Only the body scrolls — the CTA footer stays put and never covers the map. */
.landing__scroll {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.landing__panel {
  position: relative;
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: clamp(24px, 4vw, 56px) var(--gutter) clamp(20px, 3vw, 40px);
}

/* ----------------------------------------------------------------
   Header
   ---------------------------------------------------------------- */
.landing__head { max-width: 40ch; }

.landing__eyebrow {
  display: inline-block;
  font-family: var(--font-caps);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-wider);
  color: var(--ink);
  padding: 5px 11px;
  background: var(--butter);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-sm);
}

.landing__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.2rem, 4vw + 0.8rem, 3.6rem);
  line-height: 1.0;
  letter-spacing: var(--track-tight);
  color: var(--forest);
  margin: 10px 0 0;
}
.landing__title .em { color: var(--magenta); font-style: italic; }

.landing__sub {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: clamp(1rem, 0.5vw + 0.95rem, 1.18rem);
  line-height: var(--lh-snug);
  color: var(--ink);
  margin: 12px 0 0;
  max-width: 44ch;
}

/* ----------------------------------------------------------------
   Body: map + filters
   ---------------------------------------------------------------- */
.landing__body {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr);
  gap: clamp(20px, 3vw, 44px);
  align-items: center;
  margin-top: clamp(12px, 2vw, 24px);
}
@media (max-width: 860px) {
  .landing__body { grid-template-columns: 1fr; }
}

/* ----------------------------------------------------------------
   The island map
   ---------------------------------------------------------------- */
.landing-map__canvas { position: relative; }

.landing-map__svg {
  width: 100%;
  height: auto;
  max-height: min(64vh, 540px);
  aspect-ratio: 1000 / 920;
  display: block;
  margin: 0 auto;
  overflow: visible;
}

.landing-map__island,
.landing-map__islet {
  color: var(--bone);                 /* path fill = currentColor */
  filter: drop-shadow(7px 10px 0 rgba(20, 22, 15, 0.14));
}
/* Non-interactive island layers never steal taps from the zones/pills. */
.landing-map__island,
.landing-map__hatch,
.landing-map__outline { pointer-events: none; }

/* Region zones — a Voronoi partition of the island with crisp ink edges.
   Faint distinct tint by default; forest-green wash + thicker border when
   selected. The cell <path> is the tap target. */
.landing-map__zone {
  fill: var(--zone-tint, var(--clay));
  fill-opacity: 0.12;
  stroke: #1E1F1A;
  stroke-width: 2;
  stroke-linejoin: round;
  cursor: pointer;
  outline: none;
  transition: fill-opacity var(--t-fast) ease, fill var(--t-fast) ease, stroke-width var(--t-fast) ease;
}
.landing-map__zone:hover { fill-opacity: 0.24; }
.landing-map__zone:focus-visible { stroke: var(--magenta-deep); stroke-width: 3; }
.landing-map__zone.is-selected {
  fill: var(--status-sale);
  fill-opacity: 0.42;
  stroke-width: 3;
}
.landing-map__zone.is-selected:hover { fill-opacity: 0.5; }

/* Formentera islet doubles as its own tap-zone (cream -> green when chosen). */
.landing-map__islet {
  cursor: pointer;
  outline: none;
  transition: color var(--t-fast) ease, stroke-width var(--t-fast) ease;
}
.landing-map__islet:focus-visible { stroke: var(--magenta-deep); stroke-width: 4; }
.landing-map__islet.is-selected { color: var(--status-sale); stroke-width: 3.5; }

/* Pills (the tappable area labels) */
.landing-map__pin {
  cursor: pointer;
  outline: none;
  transform-box: fill-box;
  transform-origin: center;
  animation: fl-pin-in 460ms var(--ease-spring) both;
  animation-delay: calc(80ms + var(--pin-i, 0) * 60ms);
}
.landing-map__pill {
  fill: var(--bone);
  stroke: var(--ink);
  stroke-width: 3;
  filter: drop-shadow(3px 3px 0 rgba(20, 22, 15, 0.92));
  transform-box: fill-box;
  transform-origin: center;
  transition: fill var(--t-fast) ease, transform var(--t-fast) ease;
}
.landing-map__pill-name {
  font-family: var(--font-caps);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--ink);
  dominant-baseline: middle;
  pointer-events: none;
}
.landing-map__pill-badge {
  fill: var(--butter);
  stroke: var(--ink);
  stroke-width: 2.5;
}
.landing-map__pill-count {
  font-family: var(--font-caps);
  font-weight: 500;
  font-size: 15px;
  fill: var(--ink);
  dominant-baseline: middle;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

/* hover / focus / selected — flip to forest fill, bone label */
.landing-map__pin:hover .landing-map__pill,
.landing-map__pin:focus-visible .landing-map__pill,
.landing-map__pin.is-selected .landing-map__pill {
  fill: var(--forest);
  transform: translateY(-2px);
}
.landing-map__pin:hover .landing-map__pill-name,
.landing-map__pin:focus-visible .landing-map__pill-name,
.landing-map__pin.is-selected .landing-map__pill-name {
  fill: var(--bone);
}
.landing-map__pin:focus-visible .landing-map__pill {
  stroke: var(--magenta-deep);   /* distinct keyboard-focus ring */
  stroke-width: 4;
}

@keyframes fl-pin-in {
  from { opacity: 0; transform: translateY(10px) scale(0.92); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ----------------------------------------------------------------
   Mobile fallback tiles (under the map on small screens)
   ---------------------------------------------------------------- */
.landing-map__tiles {
  list-style: none;
  padding: 0;
  margin: 0;
  display: none;
}
.landing-map__tiles li { display: block; }

@media (max-width: 560px) {
  .landing-map__tiles {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
  }
}
@media (max-width: 360px) {
  .landing-map__tiles { grid-template-columns: 1fr; }
}

.landing-tile {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--bone);
  border: 2px solid var(--ink);
  border-radius: var(--r-pill);
  box-shadow: 3px 3px 0 var(--ink);
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  cursor: pointer;
  transition: transform var(--t-fast) ease, box-shadow var(--t-fast) ease,
              background var(--t-fast) ease, color var(--t-fast) ease;
}
.landing-tile:hover,
.landing-tile:focus-visible {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--ink);
  outline: none;
}
.landing-tile:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.landing-tile.is-selected { background: var(--forest); color: var(--bone); border-color: var(--ink); }

.landing-tile__corner {
  font-size: 0.6rem;
  opacity: 0.55;
  padding-right: 7px;
  border-right: 1.5px solid currentColor;
}
.landing-tile__name { flex: 1 1 auto; text-align: left; }
.landing-tile__count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border-radius: var(--r-pill);
  background: var(--butter);
  color: var(--ink);
  border: 1.5px solid var(--ink);
  font-weight: 600;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
.landing-tile.is-selected .landing-tile__count { border-color: var(--ink); }

/* ----------------------------------------------------------------
   Quick filters
   ---------------------------------------------------------------- */
.landing-filters {
  display: flex;
  flex-direction: column;
  gap: clamp(13px, 1.6vw, 18px);
  background: var(--bone);
  border: var(--bd-ink);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
  padding: clamp(16px, 2.4vw, 26px);
}
@media (max-width: 860px) {
  .landing-filters { box-shadow: none; }
}

.landing-field__label {
  font-family: var(--font-caps);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.landing-field--row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.landing-field--row .landing-field__label { margin-bottom: 0; }

.landing-chips { display: flex; flex-wrap: wrap; gap: 5px; }

/* Compact chips so Property Type (6 chips) fits one row at the card width. */
.landing-chip {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 0.56rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border: 1.5px solid var(--ink);
  border-radius: var(--r-pill);
  padding: 5px 8px;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--t-fast) ease, color var(--t-fast) ease,
              border-color var(--t-fast) ease;
}
.landing-chip:hover { background: var(--butter); }
.landing-chip.is-on {
  background: var(--forest);
  color: var(--bone);
  border-color: var(--forest);
}
.landing-chip.is-on:hover { background: var(--forest-mid); }
.landing-chip:focus-visible { outline: 2px solid var(--magenta-deep); outline-offset: 2px; }

/* Recent searches — lighter "recall" chips showing a ready-made label. */
.landing-recent[hidden] { display: none; }
.landing-recent__chips { gap: 6px; }
.landing-chip--recall {
  display: inline-block;
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.66rem;
  font-weight: 500;
  background: var(--bone);
}
.landing-chip--recall::before { content: "\21BA"; opacity: 0.5; margin-right: 5px; }
.landing-chip--recall:hover { background: var(--butter); }

/* Saved searches — a name button + a ✕ remove button inside one pill (★ glyph). */
.landing-saved[hidden] { display: none; }
.landing-saved__chips { gap: 6px; }
.landing-chip--saved {
  display: inline-flex;
  align-items: center;
  padding: 0;                 /* inner buttons supply the padding */
  max-width: 26ch;
  background: var(--bone);
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.66rem;
  font-weight: 500;
  overflow: hidden;
}
.landing-chip--saved:hover { background: var(--butter); }
.landing-saved__name {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 22ch;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 5px 4px 5px 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.landing-saved__name::before { content: "\2605"; opacity: 0.6; margin-right: 5px; } /* ★ */
.landing-saved__x {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  line-height: 1;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--r-pill);
}
.landing-saved__x:hover { background: var(--magenta-deep); color: var(--bone); }
.landing-saved__name:focus-visible,
.landing-saved__x:focus-visible { outline: 2px solid var(--magenta-deep); outline-offset: 1px; }

/* range sliders (built area / land size) — poster-flat */
.landing-field__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.landing-field__head .landing-field__label { margin-bottom: 0; }
.landing-range__value {
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.landing-range {
  position: relative;
  height: 26px;
  display: flex;
  align-items: center;
}
.landing-range__track {
  position: absolute;
  left: 1px; right: 1px;
  top: 50%;
  transform: translateY(-50%);
  height: 6px;
  background: var(--paper-deep);
  border: 1.5px solid var(--ink);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.landing-range__fill {
  display: block;
  height: 100%;
  background: var(--magenta-deep);
}
.landing-range__input {
  position: relative;
  width: 100%;
  margin: 0;
  height: 26px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.landing-range__input::-webkit-slider-runnable-track { background: transparent; border: 0; }
.landing-range__input::-moz-range-track { background: transparent; border: 0; }
.landing-range__input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px; height: 20px;
  border-radius: var(--r-pill);
  background: var(--bone);
  border: 2px solid var(--ink);
  box-shadow: 1px 1px 0 rgba(20, 22, 15, 0.3);
  cursor: pointer;
}
.landing-range__input::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: var(--r-pill);
  background: var(--bone);
  border: 2px solid var(--ink);
  box-shadow: 1px 1px 0 rgba(20, 22, 15, 0.3);
  cursor: pointer;
}
.landing-range__input:focus-visible { outline: none; }
.landing-range__input:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--magenta-deep); outline-offset: 2px; }
.landing-range__input:focus-visible::-moz-range-thumb { outline: 2px solid var(--magenta-deep); outline-offset: 2px; }

/* Dual-thumb budget slider: two range inputs overlaid on one track. The fill
   sits BETWEEN the thumbs (margin-left + width set inline). The inputs ignore
   pointer events except on their thumbs, so each thumb is independently draggable. */
.landing-range--dual .landing-range__input {
  position: absolute;
  left: 0; right: 0; top: 0;
  width: 100%;
  pointer-events: none;
}
.landing-range--dual .landing-range__input::-webkit-slider-thumb { pointer-events: auto; }
.landing-range--dual .landing-range__input::-moz-range-thumb { pointer-events: auto; }

/* beds stepper */
.landing-stepper {
  display: inline-flex;
  align-items: center;
  border: var(--bd-ink);
  border-radius: var(--r-pill);
  background: var(--bone);
  overflow: hidden;
}
.landing-stepper__btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1;
  width: 42px;
  height: 42px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--t-fast) ease;
}
.landing-stepper__btn:hover:not([disabled]) { background: var(--butter); }
.landing-stepper__btn[disabled] { opacity: 0.32; cursor: not-allowed; }
.landing-stepper__btn:focus-visible { outline: 2px solid var(--magenta-deep); outline-offset: -2px; }
.landing-stepper__value {
  min-width: 66px;
  text-align: center;
  font-family: var(--font-caps);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink);
  border-left: 1.5px solid var(--ink);
  border-right: 1.5px solid var(--ink);
  align-self: stretch;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ----------------------------------------------------------------
   CTA footer (sticky so it's always reachable)
   ---------------------------------------------------------------- */
.landing__cta {
  flex: 0 0 auto;
  z-index: 2;
  background: var(--blue-wash);
  border-top: 2px solid var(--ink);
  box-shadow: 0 -10px 28px -16px rgba(20, 22, 15, 0.4);
  padding: 16px var(--gutter) calc(env(safe-area-inset-bottom, 0px) + clamp(14px, 2.4vw, 22px));
}
.landing__cta-inner {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.landing__cta-btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 1.2vw + 0.9rem, 1.4rem);
  letter-spacing: -0.01em;
  background: var(--magenta-deep);
  color: var(--bone);
  border: var(--bd-ink);
  border-radius: var(--r-pill);
  padding: 15px 40px;
  min-width: min(440px, 86vw);
  box-shadow: 5px 6px 0 rgba(20, 22, 15, 0.2);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease-out), box-shadow var(--t-fast) var(--ease-out);
}
.landing__cta-btn:hover { transform: translate(-1px, -1px); box-shadow: 7px 8px 0 rgba(20, 22, 15, 0.22); }
.landing__cta-btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 rgba(20, 22, 15, 0.22); }
.landing__cta-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.landing__skip {
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--ink-soft);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 4px 8px;
}
.landing__skip:hover { color: var(--magenta-deep); }
.landing__skip:focus-visible { outline: 2px solid var(--magenta-deep); outline-offset: 2px; border-radius: var(--r-sm); }

.landing__signin {
  display: block;
  margin: 10px auto 0;
  font-family: var(--font-caps);
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: none;
  border: 0;
  cursor: pointer;
  padding: 4px 8px;
}
.landing__signin:hover { color: var(--forest); }
.landing__signin:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; border-radius: var(--r-sm); }

/* ----------------------------------------------------------------
   Reduced motion
   ---------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .landing,
  .landing-map__zone,
  .landing-map__islet,
  .landing-map__pill,
  .landing-chip,
  .landing-tile,
  .landing-stepper__btn,
  .landing__cta-btn { transition: none; }
  .landing-map__pin { animation: none; }
}
