/* Atba Immobilier: listing page. Loads after site.css and reuses its tokens, buttons, fields, cards and crumbs. */

/* Title block */
.listing-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 32px; padding: 20px 0 28px; }
.listing-status { display: flex; gap: 14px; font-size: .875rem; margin-bottom: 10px; }
.status-disponible, .status-sous_offre { color: var(--cobalt); font-weight: 500; }
.status-vendu, .status-loue { color: var(--muted); font-weight: 500; }
.ref { color: var(--muted); font-variant-numeric: tabular-nums; }
.listing-title { font-size: clamp(2.75rem, 6vw, 5.5rem); font-weight: 500; letter-spacing: -.05em; line-height: .95; margin-inline-start: -.03em; }
.listing-place { margin-top: 10px; font-size: 1.1875rem; color: var(--muted); }
.listing-price { margin-top: 14px; font-size: 1.5rem; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.listing-price span { margin-inline-start: 10px; font-size: 1rem; font-weight: 400; color: var(--muted); letter-spacing: 0; }
.key-facts { display: flex; gap: clamp(20px, 3vw, 40px); padding-bottom: 6px; }
.key-facts li { display: grid; }
.kf-value { font-size: 1.5rem; font-weight: 500; letter-spacing: -.02em; line-height: 1.2; font-variant-numeric: tabular-nums; }
.kf-label { font-size: .875rem; color: var(--muted); }

/* Gallery: lead photo + two on the side; the rest live in the viewer. With two photos the second fills the side; with one, it is alone. */
.gallery { position: relative; }
.gallery-grid {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 8px; height: clamp(360px, 62vh, 660px); margin: 0; padding: 0; list-style: none;
}
.gallery-grid li:first-child { grid-row: 1 / 3; }
.gallery-grid li:nth-child(n + 4) { display: none; }
.gallery-n2 .gallery-grid li:nth-child(2) { grid-row: 1 / 3; }
.gallery-n1 .gallery-grid { grid-template-columns: 1fr; }
.g-item { display: block; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; background: var(--photo-bg); cursor: zoom-in; overflow: hidden; }
.g-item:hover { background: var(--photo-bg); }
.site-main .g-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.g-item:hover img { transform: scale(1.025); }
.gallery-all {
  position: absolute; bottom: 16px; inset-inline-end: 16px;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--ink); border-radius: 0; font-weight: 500; cursor: pointer;
}
.gallery-all:hover { color: var(--cobalt); border-color: var(--cobalt); }

/* Body: content + price card */
.listing-body { display: grid; grid-template-columns: minmax(0, 8fr) minmax(0, 4fr); gap: clamp(40px, 6vw, 96px); padding-top: clamp(48px, 6vw, 80px); align-items: start; }
.listing-main > section + section { margin-top: clamp(72px, 8vw, 112px); }
.listing-main .section-title { margin-bottom: 20px; }
.listing-main .lede { margin-bottom: 28px; }

/* Story */
.pull { font-size: clamp(1.5rem, 2.6vw, 2.125rem); font-weight: 500; letter-spacing: -.025em; line-height: 1.22; max-width: 26ch; margin-bottom: 28px; }
.story-text p { max-width: 62ch; }
.story-text p + p, .story-more p { margin-top: 16px; }
.story.is-collapsed .story-more { display: none; }
.read-more { margin-top: 16px; padding: 0; background: none; border: 0; font-weight: 500; text-decoration: underline; text-underline-offset: .25em; text-decoration-thickness: 1px; cursor: pointer; }
.read-more:hover { color: var(--cobalt); }

/* Facts: three groups, spacing instead of a rule under every row */
.facts-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px; }
.fact-group h3 { font-size: 1.125rem; font-weight: 500; padding-top: 14px; border-top: 2px solid var(--ink); margin-bottom: 8px; }
.fact-group dl { margin: 0; }
.fact-group dl > div { display: grid; gap: 1px; padding: 9px 0; }
.fact-group dt { font-size: .875rem; color: var(--muted); }
.fact-group dd { margin: 0; font-weight: 500; }

/* Map */
.map { position: relative; height: clamp(300px, 34vw, 420px); background: #e3e6e8; z-index: 0; }
.map .leaflet-control-attribution a { color: inherit; }
.map-load {
  position: absolute; inset: 0; margin: auto; width: max-content; height: 48px; padding: 0 22px;
  background: var(--surface); border: 1px solid var(--ink); border-radius: 0; font-weight: 500; cursor: pointer;
}
.map-load:hover { color: var(--cobalt); border-color: var(--cobalt); }
.map .leaflet-tile-pane { filter: grayscale(1) contrast(.92) brightness(1.04); }
.map .leaflet-container { font: inherit; }
.map-note { margin-top: 12px; font-size: .875rem; color: var(--muted); }

/* Visit form */
.visit-form { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.visit-form .field-wide, .visit-form .form-note { grid-column: 1 / -1; }
.visit-form .btn { grid-column: 1 / -1; justify-self: start; margin-top: 8px; }

/* Price card (sticky on desktop) */
.listing-aside { position: sticky; top: calc(var(--header-h) + 24px); display: grid; gap: 16px; }
.price-card, .agent { background: var(--surface); border: 1px solid var(--line); padding: 28px; }
.pc-label { font-size: .875rem; color: var(--muted); }
.pc-price { margin-top: 4px; font-size: clamp(1.75rem, 2.4vw, 2.125rem); font-weight: 500; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.pc-spoken { color: var(--muted); }
.pc-meta { margin: 20px 0 0; }
.pc-meta > div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.pc-meta dt { color: var(--muted); }
.pc-meta dd { margin: 0; font-weight: 500; }
.pc-actions { display: grid; gap: 10px; margin-top: 20px; }
.pc-actions .btn { width: 100%; }
.pc-closed { color: var(--muted); }
.agent-name { margin-top: 4px; font-size: 1.25rem; font-weight: 500; letter-spacing: -.02em; }
.agent-role { color: var(--muted); }

/* Similar */
.similar-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }

/* Phones: action bar appears when the price card has scrolled away */
.action-bar { display: none; }

/* Photo viewer */
/* Availability (holiday lets): June to September, booked nights struck through */
.cal-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px 40px; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; font-variant-numeric: tabular-nums; margin: 0; border: 0; }
.cal caption { text-align: start; font-weight: 500; font-size: 1.125rem; padding-bottom: 10px; }
.cal th, .cal td { border: 0; padding: 0; text-align: center; height: 38px; font-size: .9375rem; }
.cal th { font-size: .8125rem; font-weight: 400; color: var(--muted); }
.cal abbr { text-decoration: none; }
.cal td.is-booked, .cal-key.is-booked { color: var(--muted); text-decoration: line-through; background: var(--theme-palette-color-6); }
.cal td.is-past { color: #9A9EA5; }
.cal-legend { display: flex; align-items: center; gap: 8px; margin-top: 20px !important; font-size: .875rem; color: var(--muted); }
.cal-key { display: inline-grid; place-items: center; width: 32px; height: 28px; border: 1px solid var(--line); color: var(--ink); }
.cal-key + * , .cal-legend .cal-key:not(:first-child) { margin-inline-start: 12px; }

.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: rgba(13, 14, 17, .97); color: #E9EAEC; overflow: hidden;
}
.lightbox::backdrop { background: rgba(13, 14, 17, .97); }
.lb-figure { display: grid; place-items: center; align-content: center; gap: 14px; height: 100%; padding: 64px 80px 24px; }
.lb-img { max-width: min(100%, 1600px); max-height: calc(100dvh - 140px); width: auto; height: auto; object-fit: contain; touch-action: pan-y; user-select: none; }
.lb-caption { display: flex; justify-content: space-between; gap: 24px; width: min(100%, 1100px); font-size: .9375rem; }
.lb-count { color: #A3A6AD; font-variant-numeric: tabular-nums; }
.lb-btn {
  position: absolute; display: inline-flex; align-items: center; justify-content: center; width: 48px; height: 48px;
  background: rgba(255, 255, 255, .08); color: #fff; border: 0; border-radius: 0; cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, .16); }
.lb-btn .icon { width: 22px; height: 22px; }
.lb-prev { top: 50%; inset-inline-start: 16px; transform: translateY(-50%); }
.lb-next { top: 50%; inset-inline-end: 16px; transform: translateY(-50%); }
.lb-close { top: 16px; inset-inline-end: 16px; }
[dir="rtl"] .lb-prev .icon, [dir="rtl"] .lb-next .icon { transform: scaleX(-1); }

[dir="rtl"] .listing-title { letter-spacing: 0; line-height: 1.25; margin-inline-start: 0; font-weight: 600; }
[dir="rtl"] .pull { letter-spacing: 0; line-height: 1.6; }

/* Tablet */
@media (max-width: 1100px) {
  .facts-grid { grid-template-columns: 1fr 1fr; }
  .listing-head { grid-template-columns: 1fr; }
}

/* Phones */
@media (max-width: 860px) {
  .listing-head { gap: 20px; padding-bottom: 20px; }
  .key-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }

  .gallery { width: 100%; max-width: none; }
  .gallery-grid {
    display: flex; height: auto; gap: 8px; overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); padding-inline: var(--gutter); scrollbar-width: none;
  }
  .gallery-grid::-webkit-scrollbar { display: none; }
  .gallery-grid li, .gallery-grid li:nth-child(n + 4) { display: block; flex: 0 0 88%; aspect-ratio: 3 / 2; scroll-snap-align: start; }
  .gallery-all { position: static; margin: 12px var(--gutter) 0; }

  .listing-body { grid-template-columns: 1fr; gap: 0; padding-top: 32px; }
  .listing-aside { position: static; order: -1; margin-bottom: 56px; }
  .listing-price { display: none; } /* the price card follows the gallery on phones */
  .facts-grid, .similar-grid, .cal-grid { grid-template-columns: 1fr; }
  .fact-group dl { display: grid; grid-template-columns: 1fr 1fr; column-gap: 20px; }
  .visit-form { grid-template-columns: 1fr; }
  .visit-form .btn { width: 100%; }
  .similar-grid { gap: 40px; }

  .atba-listing .site-main { padding-bottom: 76px; }
  .action-bar {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 15; display: flex; align-items: center; gap: 8px;
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--line);
    transform: translateY(110%); transition: transform .35s var(--ease);
  }
  .action-bar.is-visible { transform: none; }
  .ab-price { flex: 1; min-width: 0; display: grid; font-weight: 500; font-variant-numeric: tabular-nums; line-height: 1.25; }
  .ab-price span span { color: var(--muted); font-weight: 400; }
  .ab-name { font-size: .8125rem; font-weight: 400; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ab-icon { width: 48px; padding: 0; }

  .lb-figure { padding: 64px 0 88px; }
  .lb-caption { padding-inline: var(--gutter); }
  .lb-prev, .lb-next { top: auto; bottom: 20px; transform: none; }
}
