/* Residence lead: the posted plan, price, Compare and Save under a residence page's title.
   Written by engine/scripts/residence-lead.mjs. DS3 tokens only.
   Selectors start at .ds3 so they win over the home-list card rules this card reuses. */
.ds3 .fg-residence-lead {
  display: grid; gap: 14px; max-width: 560px; margin: 18px 0 28px; padding: 18px 20px 16px;
  border: 1px solid var(--ds3-hairline, #e8e8e8); border-radius: var(--ds3-radius, 12px);
  background: #fff; box-shadow: 0 6px 18px rgb(0 0 0 / .06);
}
.ds3 .fg-residence-lead .fg-residence-lead-card {
  position: static; display: block; min-height: 0; margin: 0; padding: 0; border: 0; border-radius: 0;
  background: none; box-shadow: none;
}
.ds3 .fg-residence-lead .ds3-card-copy { display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 0; }
.ds3 .fg-residence-lead .ds3-card-copy [data-ds3-plan] {
  order: -1; margin: 0 0 4px; color: var(--ds3-ink, #1f1f1f); font-size: 17px; font-weight: 600; line-height: 1.35;
  text-wrap: pretty;
}
.ds3 .fg-residence-lead .ds3-card-rate { margin: 0; padding: 0; border: 0; gap: 2px; }
.ds3 .fg-residence-lead .ds3-card-rate p, .ds3 .fg-residence-lead .fg-residence-lead-note {
  margin: 0; color: var(--ds3-muted, #6b6b6b); font-size: 14px; line-height: 1.45;
}
.ds3 .fg-residence-lead .ds3-card-rate .ds3-price, .ds3 .fg-residence-lead .fg-residence-lead-price {
  margin: 0 0 2px; color: var(--ds3-ink, #1f1f1f); font-size: 15px;
}
.ds3 .fg-residence-lead .ds3-card-rate .ds3-price strong { font-size: 28px; font-weight: 700; letter-spacing: -.03em; }
.ds3 .fg-residence-lead .fg-residence-lead-price strong { font-size: 18px; font-weight: 600; }
.ds3 .fg-residence-lead .ds3-card-rate .ds3-price.is-unposted { color: var(--ds3-ink, #1f1f1f); font-size: 18px; font-weight: 600; }
.ds3 .fg-residence-lead .ds3-card-rate .ds3-price.is-unposted > span { color: inherit; font: inherit; }
.ds3 .fg-residence-lead.is-unpriced a.fg-residence-lead-button { flex: 1 1 100%; justify-content: flex-start; padding: 10px 18px; text-align: left; line-height: 1.3; white-space: normal; }
.ds3 .fg-residence-lead .fg-residence-lead-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 2px 0 0; }
.ds3 .fg-residence-lead a.fg-residence-lead-button, .ds3 .fg-residence-lead .fg-residence-lead-save {
  order: 0; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px;
  padding: 0 18px; border: 1px solid var(--ds3-ink, #1f1f1f); border-radius: 8px; background: #fff; white-space: nowrap;
  color: var(--ds3-ink, #1f1f1f); font-size: 15px; font-weight: 600; text-decoration: none;
}
.ds3 .fg-residence-lead a.fg-residence-lead-button { background: var(--ds3-ink, #1f1f1f); color: #fff; }
.ds3 .fg-residence-lead a.fg-residence-lead-button:hover { background: #000; }
.ds3 .fg-residence-lead .fg-residence-lead-save:hover { background: var(--ds3-well, #f6f6f4); }
.ds3 .fg-residence-lead .fg-residence-lead-save svg { width: 18px; height: 18px; }
.ds3 .fg-residence-lead .fg-residence-lead-source {
  margin: 0; padding: 0; background: none; color: var(--ds3-muted, #6b6b6b); font-size: 13px;
}
.ds3 .fg-residence-lead .fg-residence-lead-source a { color: inherit; }
.ds3 .fg-residence-lead .fg-residence-lead-next { margin: 0; font-size: 15px; font-weight: 600; }
.ds3 .fg-residence-lead .fg-residence-lead-next a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--ds3-ink, #1f1f1f); text-underline-offset: 3px; }
.ds3 .fg-residence-lead .fg-residence-lead-next a::after { content: "\2197"; font-weight: 400; }
.ds3 .fg-residence-lead .fg-residence-lead-plans { margin: -2px 0 0; font-size: 15px; font-weight: 600; }
.ds3 .fg-residence-lead .fg-residence-lead-plans a { color: var(--ds3-ink, #1f1f1f); text-underline-offset: 3px; }
.ds3 .fg-residence-lead .fg-residence-lead-near { margin: 0; color: var(--ds3-ink, #1f1f1f); font-size: 14px; font-weight: 600; }
.ds3 .fg-residence-lead .fg-residence-lead-near span { color: var(--ds3-muted, #6b6b6b); font-weight: 400; }
.fg-residence-lead-bar { display: none; }
/* A floor plan with no image: its PDF is the one clear action (residence-lead.mjs planLinks). */
.ds3 .gm-plan .gm-plan-links a.gm-plan-open {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 1px solid var(--ds3-ink, #1f1f1f);
  border-radius: 8px; color: var(--ds3-ink, #1f1f1f); font-weight: 600; text-decoration: none;
}
.ds3 .gm-plan .gm-plan-links a.gm-plan-open::after { content: "\2197"; font-weight: 400; }
.ds3 .gm-plan .gm-plan-links a.gm-plan-open:hover { background: var(--ds3-well, #f6f6f4); }
/* One credit for a strip of photos from the same source (residence-lead.mjs oneCredit). */
.ds3 .gm-media .gm-credit-all { margin: 8px 0 0; color: var(--ds3-muted, #6b6b6b); font-size: 13px; }
.ds3 .gm-media .gm-credit-all a { color: inherit; }
/* With the photo viewer ready, "View 20 photos" is the one way in; the inline grid stays for no-script. */
.ds3 .gm-media:has([data-gm-open]:not([hidden])) .gm-all-photos { display: none; }
/* One photo is already shown full width; a "View 1 photo" button would only repeat it. Tapping the photo still enlarges it. */
.ds3 .gm-media:not(:has(.gm-preview figure + figure)) .gm-heading [data-gm-open] { display: none !important; }

/* Residence facts as label and value rows: the same rules Illinois's media.css carries (ada9d550), so every
   newer guide reads alike before that file reaches its line. */
.pilot-property-facts{margin:0;max-width:48rem}
.pilot-property-facts>div{display:grid;grid-template-columns:minmax(10rem,1fr) minmax(0,2fr);gap:1rem;padding:.75rem 0;border-bottom:1px solid var(--fg-line,#e8e8e8)}
.pilot-property-facts dt{font-weight:600}
.pilot-property-facts dd{margin:0;overflow-wrap:anywhere}
.pilot-property-facts .ds3-source-note{display:block;margin-top:.25rem;font-size:.8rem;line-height:1.5}
html.ds3 main .pilot-property-facts .ds3-source-note,.pilot-residence-media .gm-building-shell>.ds3-source-note{background:transparent;padding:0}
@media(max-width:600px){.pilot-property-facts>div{grid-template-columns:1fr;gap:.25rem}}

/* Desktop: the card takes a right-hand column beside the facts, like a booking card, instead of
   leaving the right half of the opening empty. */
@media (min-width: 1024px) {
  .ds3 .pilot-residence-media .gm-building-shell:has(> .fg-residence-lead) {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 380px); column-gap: 48px; align-items: start;
  }
  .ds3 .pilot-residence-media .gm-building-shell:has(> .fg-residence-lead) > * { grid-column: 1; }
  .ds3 .pilot-residence-media .gm-building-shell:has(> .fg-residence-lead) > :first-child { grid-column: 1 / -1; }
  .ds3 .pilot-residence-media .gm-building-shell > .fg-residence-lead {
    grid-column: 2; grid-row: 2 / span 8; max-width: none; margin: 4px 0 0;
  }
}

@media (max-width: 760px) {
  .ds3 .fg-residence-lead { margin: 14px 0 22px; padding: 16px; box-shadow: none; }
  .ds3 .fg-residence-lead .fg-residence-lead-actions > * { flex: 1 1 auto; }
  .ds3 .fg-residence-lead-bar {
    position: fixed; inset: auto 0 0; z-index: 40; display: flex; align-items: center; justify-content: space-between;
    gap: 12px; padding: 10px max(16px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
    border-top: 1px solid var(--ds3-hairline, #e8e8e8); background: #fff; box-shadow: 0 -4px 14px rgb(0 0 0 / .06);
  }
  .ds3 .fg-residence-lead-bar p { display: grid; margin: 0; line-height: 1.25; }
  .ds3 .fg-residence-lead-bar .ds3-price { margin: 0; color: var(--ds3-ink, #1f1f1f); font-size: 13px; }
  .ds3 .fg-residence-lead-bar .ds3-price strong { font-size: 19px; }
  .ds3 .fg-residence-lead-bar small { color: var(--ds3-muted, #6b6b6b); font-size: 13px; }
  .ds3 .fg-residence-lead-bar a {
    display: inline-flex; align-items: center; min-height: 44px; padding: 0 22px; border-radius: 8px;
    background: var(--ds3-ink, #1f1f1f); color: #fff; font-weight: 600; text-decoration: none;
  }
  body:has(.fg-residence-lead-bar) { padding-bottom: 76px; }
  /* residence-lead-bar.mjs: the bar waits below the screen while the card itself is in view. */
  .ds3 .fg-residence-lead-bar { transition: transform .24s cubic-bezier(.2, .7, .2, 1); }
  .ds3 .fg-residence-lead-bar[data-away="false"] {
    transform: translateY(calc(100% + 16px)); visibility: hidden;
    transition: transform .18s ease-in, visibility 0s linear .18s;
  }
}
@media (prefers-reduced-motion: reduce) { .ds3 .fg-residence-lead-bar { transition: none !important; } }
