/* ---------- Protection contre les styles globaux de home.css ---------- */
main.tr {
  display: block;
  position: relative;
  float: none;
  width: 100%;
  max-width: none;
  margin: 0;
  transform: none;
  text-indent: 0;
  text-align: left;
}
main.tr h1, main.tr h2, main.tr p, main.tr ul, main.tr li { margin-left: 0; text-align: left; }
main.tr .tr-empty { text-align: center; }
main.tr .tr-search input,
main.tr .tr-search select { border: 0; background-color: transparent; border-radius: 0; box-shadow: none; height: auto; width: 100%; padding: 0; margin: 0; }
main.tr .tr-search button { width: auto; }
main.tr img { max-width: 100%; height: 100%; }
main.tr .tr-card__media img { width: 100%; height: 100%; }

/* ==========================================================
   Terrains – Côte d'Ivoire
   Palette : vert palmier, orange du drapeau, craie, encre
   ========================================================== */

.tr {
  --forest: #123f2e;
  --forest-2: #1c5b43;
  --orange: #f28c1b;
  --orange-dark: #c96f0a;
  --chalk: #f2f5f0;
  --paper: #ffffff;
  --ink: #15211b;
  --muted: #5d6b63;
  --line: #dde4de;
  --sold: #8b948e;

  --r-lg: 20px;
  --r-md: 12px;
  --r-sm: 8px;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Manrope", "Segoe UI", system-ui, sans-serif;

  font-family: var(--font-body);
  color: var(--ink);
  background: var(--chalk);
  padding-top: 72px; /* laisse la place au header fixe */
  min-height: 100vh;
}

.tr *,
.tr *::before,
.tr *::after { box-sizing: border-box; }

/* ---------- Hero : courbes de niveau (relevé topographique) ---------- */
.tr-hero {
  position: relative;
  background-color: var(--forest);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='400' viewBox='0 0 600 400' fill='none' stroke='%23ffffff' stroke-opacity='.09' stroke-width='1.2'%3E%3Cellipse cx='420' cy='210' rx='40' ry='26'/%3E%3Cellipse cx='420' cy='210' rx='90' ry='60'/%3E%3Cellipse cx='420' cy='210' rx='150' ry='98'/%3E%3Cellipse cx='420' cy='210' rx='215' ry='140'/%3E%3Cellipse cx='420' cy='210' rx='285' ry='185'/%3E%3Cellipse cx='420' cy='210' rx='360' ry='230'/%3E%3Cellipse cx='90' cy='340' rx='30' ry='20'/%3E%3Cellipse cx='90' cy='340' rx='75' ry='48'/%3E%3Cellipse cx='90' cy='340' rx='130' ry='84'/%3E%3C/svg%3E"),
    linear-gradient(135deg, var(--forest) 0%, var(--forest-2) 100%);
  background-size: 600px 400px, cover;
  background-position: right center, center;
  color: #fff;
  padding: clamp(56px, 9vw, 110px) 24px clamp(96px, 12vw, 140px);
}

.tr-hero::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--orange) 0 33.3%, #fff 33.3% 66.6%, #1f9d55 66.6% 100%);
}

.tr-hero__inner {
  max-width: 1180px;
  margin: 0 auto;
}

.tr-hero__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 5.2vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  max-width: 16ch;
  margin: 0;
  color: #fff;
}

.tr-hero__lead {
  margin: 18px 0 0;
  max-width: 52ch;
  font-size: clamp(1rem, 1.6vw, 1.15rem);
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.82);
}

/* ---------- Barre de recherche ---------- */
.tr-search {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: 2fr 1.2fr 1fr auto;
  gap: 8px;
  align-items: stretch;
  max-width: 1180px;
  margin: -44px auto 0;
  padding: 10px;
  width: calc(100% - 32px);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 18px 40px -18px rgba(18, 63, 46, 0.35);
}

.tr-field {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  transition: background 0.15s;
  cursor: text;
}

.tr-field:hover { background: var(--chalk); }
.tr-field:focus-within { background: var(--chalk); outline: 2px solid var(--forest-2); outline-offset: -2px; }

.tr-field__label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.tr-field input,
.tr-field select {
  all: unset;
  font: 600 1rem/1.4 var(--font-body);
  color: var(--ink);
  width: 100%;
  cursor: pointer;
}

.tr-field input { cursor: text; }
.tr-field input::placeholder { color: #9aa59e; font-weight: 500; }

.tr-field select {
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2315211b' stroke-width='2'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 2px center;
  padding-right: 22px;
}

/* ---------- Boutons ---------- */
.tr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 24px;
  min-height: 48px;
  font: 700 0.95rem/1 var(--font-body);
  text-decoration: none;
  border: 0;
  border-radius: var(--r-md);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.tr-btn:focus-visible,
.tr-phone:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.tr-btn--primary { background: var(--orange); color: #1a1206; }
.tr-btn--primary:hover { background: var(--orange-dark); color: #fff; }

.tr-btn--ghost {
  background: transparent;
  color: var(--forest);
  box-shadow: inset 0 0 0 2px var(--forest);
  min-height: 42px;
  padding: 0 18px;
}
.tr-btn--ghost:hover { background: var(--forest); color: #fff; }

.tr-btn--disabled {
  background: var(--chalk);
  color: var(--sold);
  min-height: 42px;
  padding: 0 18px;
  cursor: not-allowed;
}

/* ---------- Résultats ---------- */
.tr-results {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 16px 96px;
}

.tr-count {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--muted);
}

.tr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

/* ---------- Carte terrain ---------- */
.tr-card {
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.tr-card:hover {
  border-color: var(--forest-2);
  box-shadow: 0 20px 40px -24px rgba(18, 63, 46, 0.5);
}

.tr-card[hidden] { display: none; }

.tr-card__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--line);
  overflow: hidden;
}

.tr-card__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease;
}

.tr-card:hover .tr-card__media img { transform: scale(1.04); }

.tr-badge {
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 7px 14px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.tr-badge--free { background: #1f9d55; color: #fff; }
.tr-badge--sold { background: var(--orange); color: #1a1206; }

.tr-card.is-sold .tr-card__media img { filter: grayscale(0.85) brightness(0.9); }
.tr-card.is-sold .tr-card__price { color: var(--sold); text-decoration: line-through; text-decoration-thickness: 2px; }

.tr-card__body {
  padding: 20px 22px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.tr-card__price {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  letter-spacing: -0.01em;
  color: var(--forest);
}

.tr-meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-weight: 600;
  font-size: 0.95rem;
}

.tr-meta li,
.tr-doc,
.tr-phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.tr-card svg {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: var(--forest-2);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tr-card__desc {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  font-size: 0.95rem;
  max-width: 60ch;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tr-doc {
  margin: 0;
  align-self: flex-start;
  padding: 6px 12px;
  background: var(--chalk);
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.tr-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 22px 20px;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.tr-phone {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--r-sm);
}
.tr-phone:hover { color: var(--forest-2); }

/* ---------- État vide ---------- */
.tr-empty {
  text-align: center;
  padding: 72px 16px;
  background: var(--paper);
  border: 2px dashed var(--line);
  border-radius: var(--r-lg);
}
.tr-empty[hidden] { display: none; }
.tr-empty h2 { font-family: var(--font-display); font-size: 1.5rem; margin: 0 0 8px; }
.tr-empty p { color: var(--muted); margin: 0 0 24px; }

/* ---------- Mouvement : une seule entrée, à l'arrivée ---------- */
@media (prefers-reduced-motion: no-preference) {
  .tr-hero__title { animation: tr-rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  @keyframes tr-rise {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: none; }
  }
}

@media (prefers-reduced-motion: reduce) {
  .tr *, .tr *::before, .tr *::after { transition: none !important; animation: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .tr-search { grid-template-columns: 1fr 1fr; }
  .tr-field--grow { grid-column: 1 / -1; }
  .tr-search .tr-btn { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .tr { padding-top: 60px; }
  .tr-search { grid-template-columns: 1fr; margin-top: -32px; }
  .tr-grid { grid-template-columns: 1fr; }
  .tr-card__foot { flex-direction: column; align-items: stretch; }
  .tr-card__foot .tr-btn { width: 100%; }
}