/* Ad details page. Builds on tokens.css and styles.css (header, cards, buttons, footer). */

/* ---------- shared bits ---------- */
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); }
.btn-secondary:hover { background: var(--pale-2); }
.btn-lg { height: 52px; width: 100%; font-size: 16px; }
.btn[disabled], .btn[aria-disabled="true"] { background: #E8EDF3; color: #6B7A8A; border-color: transparent; cursor: not-allowed; }
.link-btn { border: 0; background: none; color: var(--primary); font-weight: 700; font-size: 15px; padding: 8px 0; border-radius: 6px; }
.link-btn:hover { color: var(--primary-h); text-decoration: underline; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--pale-2); color: var(--ink-2); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; }
.chip .ic { width: 15px; height: 15px; }
a.chip:hover { background: var(--pale); }

/* ---------- breadcrumbs ---------- */
.crumbs { margin: 18px 0 14px; }
.crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 13.5px; color: var(--muted); font-weight: 500; }
.crumbs li { display: flex; align-items: center; gap: 8px; min-width: 0; }
.crumbs li + li::before { content: ''; width: 5px; height: 5px; border-top: 1.5px solid #9AA8B8; border-right: 1.5px solid #9AA8B8; transform: rotate(45deg); margin-right: 2px; }
.crumbs a { padding: 6px 0; border-radius: 4px; }
.crumbs a:hover { color: var(--primary); text-decoration: underline; }
.crumbs [aria-current="page"] { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: min(46ch, 60vw); }

/* ---------- layout ---------- */
.ad-grid { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(320px, 1fr); column-gap: 32px; row-gap: 20px; align-items: start; }
.ad-gallery { grid-column: 1; grid-row: 1; min-width: 0; }
.ad-head { grid-column: 1; grid-row: 2; min-width: 0; }
.ad-body { grid-column: 1; grid-row: 3; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.ad-aside { grid-column: 2; grid-row: 1 / span 3; align-self: stretch; }
.ad-aside-in { position: sticky; top: calc(var(--header-h) + 16px); display: flex; flex-direction: column; gap: 16px; }
.panel, .box { background: #fff; border: 1px solid var(--line); border-radius: 16px; }
.panel { padding: 22px; }
.box { padding: 22px 24px; }
.box h2 { font-size: 20px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 14px; }

/* ---------- gallery ---------- */
.gal { display: flex; flex-direction: column; gap: 12px; }
.gal-stage { position: relative; border-radius: 16px; overflow: hidden; background: #E9EEF4; aspect-ratio: 4 / 3; }
.gal-track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; outline-offset: -3px; }
.gal-track::-webkit-scrollbar { display: none; }
.gal-slide { flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; position: relative; display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(110deg, #E9EEF4 8%, #F4F7FA 18%, #E9EEF4 33%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.gal-slide.loaded, .gal-slide.failed { animation: none; background: #E9EEF4; }
.gal-bg { position: absolute; inset: -24px; width: calc(100% + 48px); height: calc(100% + 48px); object-fit: cover; filter: blur(26px) saturate(1.1); opacity: 0; transition: opacity .3s; pointer-events: none; }
.gal-slide.loaded .gal-bg { opacity: .5; }
.gal-main { position: relative; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .25s; cursor: zoom-in; }
.gal-slide.loaded .gal-main { opacity: 1; }
.gal-fail { display: none; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); font-weight: 600; font-size: 14px; }
.gal-slide.failed .gal-fail { display: flex; }
.gal-fail .ic { width: 40px; height: 40px; stroke-width: 1.3; }
@keyframes shimmer { to { background-position: -200% 0; } }

.gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--ink);
  display: grid; place-items: center; box-shadow: 0 4px 14px rgba(16, 44, 74, .18); opacity: 0; transition: opacity .15s, background .15s; }
.gal-stage:hover .gal-nav, .gal-nav:focus-visible { opacity: 1; }
.gal-nav:hover { background: #fff; }
.gal-nav[disabled] { display: none; }
.gal-prev { left: 12px; }
.gal-next { right: 12px; }
.gal-count { position: absolute; right: 12px; bottom: 12px; background: rgba(16, 44, 74, .78); color: #fff; font-size: 12.5px; font-weight: 700; padding: 5px 11px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.gal-expand { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .92); color: var(--ink); display: grid; place-items: center; box-shadow: 0 4px 14px rgba(16, 44, 74, .14); }
.gal-expand:hover { background: #fff; }
.gal-thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 3px; margin: -3px; scrollbar-width: thin; }
.gal-thumb { flex: 0 0 96px; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; border: 2px solid transparent; padding: 0; background: #E9EEF4; opacity: .75; transition: opacity .15s, border-color .15s; }
.gal-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gal-thumb:hover { opacity: 1; }
.gal-thumb[aria-current="true"] { border-color: var(--primary); opacity: 1; }
.gal-empty { aspect-ratio: 4 / 3; border-radius: 16px; background: var(--pale-2); display: grid; place-content: center; justify-items: center; gap: 10px; color: var(--accent); font-weight: 600; }
.gal-empty .ic { width: 72px; height: 72px; stroke-width: 1.1; }

/* ---------- title block ---------- */
.ad-head-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ad-title { font-size: clamp(22px, 2.2vw, 30px); line-height: 1.2; letter-spacing: -.02em; font-weight: 800; overflow-wrap: anywhere; }
.ad-actions { display: flex; gap: 6px; flex: none; }
.icon-btn { position: relative; width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--ink); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--pale-2); }
.icon-btn[aria-pressed="true"] { color: var(--fav); }
.icon-btn[aria-pressed="true"] .ic { fill: var(--fav); }
[data-tip]::after { content: attr(data-tip); position: absolute; top: calc(100% + 8px); right: 0; z-index: 20; background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px;
  white-space: nowrap; pointer-events: none; opacity: 0; transform: translateY(-2px); transition: opacity .12s, transform .12s; }
@media (hover: hover) { [data-tip]:hover::after { opacity: 1; transform: none; } }
[data-tip]:focus-visible::after { opacity: 1; transform: none; }
.ad-meta { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 2px 0; font-size: 14px; color: var(--muted); font-weight: 500; }
.ad-meta li + li::before { content: '·'; margin: 0 8px; }
.ad-chips { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin: 18px 0 0; }
.fact { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.fact dt { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.fact dd { margin: 2px 0 0; font-size: 16px; font-weight: 700; overflow-wrap: anywhere; }

/* ---------- price + contact ---------- */
.price-big { font-size: clamp(28px, 2.6vw, 34px); font-weight: 800; letter-spacing: -.02em; line-height: 1.15; color: var(--price); overflow-wrap: anywhere; }
.price-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.contact-actions { display: grid; gap: 10px; margin-top: 18px; }
.btn-call { justify-content: center; gap: 10px; flex-wrap: wrap; text-align: center; line-height: 1.2; }
.btn-call .masked { font-weight: 600; opacity: .85; font-variant-numeric: tabular-nums; }
.hint { margin-top: 12px; font-size: 13px; color: var(--muted); line-height: 1.45; }

/* ---------- seller ---------- */
.seller { display: flex; align-items: center; gap: 14px; }
.avatar { width: 52px; height: 52px; flex: none; border-radius: 50%; background: var(--pale); color: var(--ink-2); font-size: 20px; font-weight: 800; display: grid; place-items: center; }
.seller-name { font-size: 17px; font-weight: 800; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.seller-sub { font-size: 13.5px; color: var(--muted); font-weight: 500; margin-top: 2px; }
.badge-ok { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--ink-2); background: var(--pale); padding: 2px 8px; border-radius: 999px; }
.badge-ok .ic { width: 14px; height: 14px; }
.seller-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); font-weight: 700; font-size: 14.5px; color: var(--primary); }
.seller-link:hover { color: var(--primary-h); }
.seller-link .ic { width: 18px; height: 18px; }

/* ---------- description + specs ---------- */
.desc { font-size: 16px; line-height: 1.65; color: #1E2F42; max-width: 70ch; overflow-wrap: anywhere; }
.desc p { margin: 0 0 .9em; }
.desc ul { margin: 0 0 .9em; padding-left: 1.25em; list-style: disc; }
.desc li { margin-bottom: .25em; }
.desc.clamped { max-height: 13em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 65%, transparent); mask-image: linear-gradient(#000 65%, transparent); }
.specs { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; margin: 0; }
.spec { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); min-width: 0; }
.spec dt { color: var(--muted); font-size: 14.5px; font-weight: 500; }
.spec dd { margin: 0; font-weight: 700; font-size: 15px; text-align: right; overflow-wrap: anywhere; }

/* ---------- location ---------- */
.loc-line { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; margin-bottom: 14px; }
.loc-line .ic { color: var(--accent); }
.map { position: relative; border-radius: 14px; overflow: hidden; aspect-ratio: 16 / 6.5; background: #E6EEF6; border: 1px solid var(--line); }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-label { position: absolute; left: 12px; bottom: 12px; background: rgba(255, 255, 255, .92); border-radius: 8px; padding: 5px 10px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.loc-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-top: 14px; }
.loc-foot p { font-size: 13.5px; color: var(--muted); max-width: 52ch; line-height: 1.45; }
.loc-foot .btn { height: 42px; }

/* ---------- safety ---------- */
.safety { background: var(--pale-2); border-color: transparent; }
.safety h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.safety h2 .ic { color: var(--accent); width: 24px; height: 24px; }
.safety ul { display: grid; gap: 8px; margin-bottom: 8px; }
.safety li { display: flex; gap: 10px; font-size: 14.5px; line-height: 1.45; color: #25384D; }
.safety li .ic { width: 18px; height: 18px; color: var(--accent); margin-top: 1px; }

/* ---------- mobile contact bar ---------- */
.contact-bar { display: none; }

/* ---------- dialogs ---------- */
dialog { color: var(--ink); font-family: var(--font); }
dialog::backdrop { background: rgba(16, 44, 74, .55); }
.modal { border: 0; border-radius: 18px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 24px 60px rgba(16, 44, 74, .3); }
.modal form { padding: 24px; }
.modal h2 { font-size: 20px; font-weight: 800; margin-bottom: 8px; letter-spacing: -.01em; }
.modal p { color: var(--muted); line-height: 1.5; font-size: 14.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.reasons { border: 0; padding: 0; margin: 12px 0 0; display: grid; gap: 4px; }
.reasons label { display: flex; align-items: center; gap: 12px; padding: 12px; min-height: 48px; border-radius: 10px; font-weight: 600; font-size: 15px; cursor: pointer; }
.reasons label:hover { background: var(--pale-2); }
.reasons input { width: 18px; height: 18px; accent-color: var(--primary); }

.lightbox { width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 20, 36, .97); color: #fff; }
.lightbox[open] { display: grid; grid-template-columns: 72px minmax(0, 1fr) 72px; align-items: center; }
.lb-stage { height: 100%; display: grid; place-items: center; min-width: 0; padding: 24px 0; touch-action: pan-y; }
.lb-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; border-radius: 6px; }
.lb-nav, .lb-close { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; justify-self: center; }
.lb-nav:hover, .lb-close:hover { background: rgba(255, 255, 255, .22); }
.lb-nav[disabled] { visibility: hidden; }
.lb-close { position: absolute; top: 16px; right: 16px; z-index: 2; }
.lb-count { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); background: rgba(255, 255, 255, .14); padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---------- states ---------- */
.ad-state { max-width: 560px; margin: 48px auto 24px; text-align: center; }
.ad-state .state-ic { width: 84px; height: 84px; border-radius: 50%; background: var(--pale-2); color: var(--accent); display: grid; place-items: center; margin: 0 auto 20px; }
.ad-state .state-ic .ic { width: 40px; height: 40px; stroke-width: 1.4; }
.ad-state h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; }
.ad-state p { margin-top: 10px; color: var(--muted); line-height: 1.55; }
.ad-state .state-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.ad-state .btn { width: auto; }
.skel { background: linear-gradient(110deg, #E9EEF4 8%, #F4F7FA 18%, #E9EEF4 33%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 12px; }
.skel-gal { aspect-ratio: 4 / 3; border-radius: 16px; }
.skel-line { height: 16px; margin-top: 12px; }
.skel-title { height: 30px; width: 78%; margin-top: 4px; }
.skel-panel { height: 250px; border-radius: 16px; }

/* ---------- responsive ---------- */
@media (max-width: 999px) {
  .ad-grid { grid-template-columns: minmax(0, 1fr); row-gap: 16px; }
  .ad-gallery, .ad-head, .ad-aside, .ad-body { grid-column: 1; }
  .ad-aside { grid-row: 3; }
  .ad-body { grid-row: 4; }
  .ad-aside-in { position: static; }
  body.page-ad { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .page-ad .toast { bottom: calc(92px + env(safe-area-inset-bottom)); }
  .contact-bar { display: flex; align-items: center; gap: 10px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: #fff; border-top: 1px solid var(--line);
    padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(16, 44, 74, .08); }
  .cb-price { flex: 1; min-width: 0; font-size: 17px; font-weight: 800; color: var(--price); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
  .cb-price small { display: block; font-size: 12px; font-weight: 600; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
  .contact-bar .btn { height: 48px; padding: 0 18px; }
  .contact-bar .btn-icon { width: 48px; padding: 0; }
  .panel .contact-actions { display: none; } /* the sticky bar takes over */
  .price-panel .hint { display: none; }
}
@media (max-width: 719px) {
  .crumbs { margin: 12px 0 10px; }
  .crumbs ol { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
  .crumbs ol::-webkit-scrollbar { display: none; }
  .gal-stage { border-radius: 0; margin: 0 calc(var(--gutter) * -1); aspect-ratio: 4 / 3.2; }
  .gal-nav { display: none; }
  .gal-thumbs { display: none; }
  .gal-empty { border-radius: 0; margin: 0 calc(var(--gutter) * -1); }
  .box { padding: 18px; }
  .panel { padding: 18px; }
  .specs { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .loc-foot .btn { width: 100%; }
  .map { aspect-ratio: 16 / 8; }
  .lightbox[open] { grid-template-columns: 0 minmax(0, 1fr) 0; }
  .lb-nav { display: none; }
  .lb-stage { padding: 56px 0 56px; }
  .ad-actions .icon-btn { width: 44px; }
  .modal-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .gal-slide, .skel { animation: none; }
  .gal-track { scroll-behavior: auto; }
}

/* ---------- refinements after visual review ---------- */
.btn-call .label { display: inline-flex; align-items: center; gap: 8px; }
.price-panel .btn-call { flex-direction: column; gap: 1px; height: auto; min-height: 56px; padding: 8px 18px; }
.price-panel .btn-call .masked { font-size: 13px; letter-spacing: .02em; }
.gal-thumbs { scrollbar-width: thin; scrollbar-color: #C9D6E4 transparent; padding-bottom: 8px; }
.gal-thumbs::-webkit-scrollbar { height: 6px; }
.gal-thumbs::-webkit-scrollbar-thumb { background: #C9D6E4; border-radius: 3px; }

/* ---------- mobile composition (price first, actions below the title) ---------- */
.price-inline { display: none; }
@media (max-width: 999px) {
  .price-panel { display: none; } /* price + terms are shown inline above the title instead */
  .price-inline { display: block; margin-bottom: 10px; }
  .price-inline .price-tags { margin-top: 8px; }
}
@media (max-width: 719px) {
  .crumbs li { flex: none; }
  .crumbs [aria-current="page"] { max-width: 60vw; display: block; }
  .ad-head-top { flex-direction: column; gap: 12px; }
  .ad-title { font-size: 22px; }
  .ad-actions { width: 100%; }
  .ad-actions .icon-btn { flex: 1; width: auto; }
  .ad-meta { gap: 2px 14px; }
  .ad-meta li + li::before { display: none; }
  .price-inline .price-big { font-size: 30px; }
}
.crumbs ol { margin: 0; padding: 0; list-style: none; }

/* ---------- narrow phones + touch targets ---------- */
@media (max-width: 719px) {
  .link-btn { min-height: 44px; display: inline-flex; align-items: center; }
  .page-ad .seg button { min-height: 44px; min-width: 48px; }
}
@media (max-width: 389px) {
  .cb-price { font-size: 15.5px; }
  .contact-bar { gap: 8px; }
  .contact-bar .btn { padding: 0 14px; }
  .contact-bar .btn-icon { padding: 0; }
  .contact-bar .btn-call .label { gap: 6px; }
}
.loc-foot .btn { height: 44px; }
.gal-expand { width: 44px; height: 44px; }

/* lightbox: keep tall photos fully on screen */
.lightbox[open] { grid-template-rows: minmax(0, 1fr); }
.lb-stage { min-height: 0; padding: 0; }
.lb-stage img { max-width: 100%; max-height: calc(100vh - 72px); max-height: calc(100dvh - 72px); }
@media (max-width: 719px) {
  .lb-stage img { max-height: calc(100vh - 140px); max-height: calc(100dvh - 140px); }
}
.lightbox { background: #081424; }
@media (max-width: 389px) {
  .cb-price { font-size: 15px; }
  .contact-bar .btn { padding: 0 12px; }
  .contact-bar .btn-icon { padding: 0; }
}

/* ---------- size corrections after review: smaller gallery, compact location ---------- */
.ad-grid { grid-template-columns: minmax(0, 1.9fr) minmax(340px, 1fr); }
.gal-stage { max-height: 460px; }            /* height cap: the photo no longer dominates the screen */
.gal-thumb { flex-basis: 84px; }
.loc-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, 300px); gap: 20px; align-items: center; }
.loc-info { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; min-width: 0; }
.loc-info .loc-line { margin: 0; }
.loc-note { font-size: 13.5px; color: var(--muted); line-height: 1.45; max-width: 46ch; }
.map { aspect-ratio: auto; height: 150px; }
@media (max-width: 999px) {
  .ad-grid { grid-template-columns: minmax(0, 1fr); }
  .gal-stage { max-height: 440px; }
}
@media (max-width: 719px) {
  .gal-stage { max-height: none; }
  .loc-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .loc-grid .map { order: -1; height: 120px; aspect-ratio: auto; }
  .loc-info .btn { width: 100%; }
}
.desc.clamped { max-height: calc(16px * 1.65 * 9); }

/* ---------- OpenStreetMap embed ---------- */
.loc-grid { grid-template-columns: minmax(0, 1fr) minmax(240px, 340px); }
.map { height: 170px; }
.map-osm iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; display: block; }
.map-ring { position: absolute; left: 50%; top: 50%; width: 88px; height: 88px; transform: translate(-50%, -50%); border-radius: 50%;
  border: 2px dashed var(--primary); background: rgba(29, 93, 166, .14); pointer-events: none; }
.map-hit { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.map-hit:focus-visible { outline-offset: -4px; }
.map-label { z-index: 2; }
.map-credit { position: absolute; right: 6px; bottom: 6px; z-index: 2; background: rgba(255, 255, 255, .88); border-radius: 6px; padding: 2px 6px; font-size: 11px; font-weight: 600; color: var(--ink-2); }
.map-credit:hover { text-decoration: underline; }
@media (max-width: 719px) { .loc-grid .map { height: 150px; } }
/* crop the embed's own zoom buttons (top) and long attribution bar (bottom); our credit link replaces it */
.map-osm iframe { top: -64px; height: calc(100% + 128px); }
.map-osm:not(.loaded) { background: linear-gradient(110deg, #E4ECF4 8%, #F1F5F9 18%, #E4ECF4 33%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
@media (max-width: 1199px) {
  .loc-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .loc-grid .map { order: -1; height: 160px; }
}
@media (prefers-reduced-motion: reduce) { .map-osm:not(.loaded) { animation: none; } }

/* fullscreen viewer: ad title bottom-left on a faded dark scrim, counter bottom-right */
.lb-caption { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  padding: 56px 20px 18px; background: linear-gradient(to top, rgba(4, 12, 24, .88) 0%, rgba(4, 12, 24, .6) 45%, rgba(4, 12, 24, 0) 100%); pointer-events: none; }
.lb-title { margin: 0; max-width: min(70ch, calc(100% - 96px)); font-size: 15px; font-weight: 700; line-height: 1.35; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .5);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.lb-caption .lb-count { position: static; transform: none; flex: none; margin: 0; background: rgba(255, 255, 255, .16); }
@media (max-width: 719px) { .lb-caption { padding: 48px 16px calc(14px + env(safe-area-inset-bottom)); } .lb-title { font-size: 14px; } }
@media (max-width: 719px) {
  /* side arrows are hidden on phones (swipe instead), so the photo needs the whole width */
  .lightbox[open] { grid-template-columns: minmax(0, 1fr); }
}

/* Google AdSense zone under the seller block */
.ad-zone-aside { justify-self: auto; width: 100%; display: flex; flex-direction: column; align-items: center; }
.ad-zone-aside .ad-zone-label { align-self: flex-start; }

/* The stage height is capped (max-height) while its 4:3 box is not, so a percentage-height track was taller than the visible
   stage and the bottom of the photo was clipped. The track now fills the visible box itself. */
.gal-track { position: absolute; inset: 0; height: auto; }

/* Show every photo whole: it fills the stage box and is fitted inside it (object-fit: contain), never cropped.
   Photos that do not match the frame get a plain neutral background instead of a blurred copy. */
.gal-main { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.gal-bg { display: none; }
.gal-slide.loaded, .gal-slide.failed { background: #EEF1F5; }
.gal-fail { position: relative; }

/* search bar + partner banner above the ad */
.search-sec-ad { margin-top: 20px; }
.banner-ad { margin: 16px 0 4px; }
@media (max-width: 719px) { .search-sec-ad { margin-top: 12px; } .banner-ad { margin-top: 12px; } }

/* wider photo column, smaller price */
@media (min-width: 1000px) {
  .ad-grid { grid-template-columns: minmax(0, 2.7fr) minmax(300px, 1fr); column-gap: 28px; }
  .gal-stage { max-height: 540px; }
}
.price-big { font-size: clamp(22px, 2vw, 27px); }
.price-inline .price-big { font-size: 24px; }
.banner-ad { margin: 20px 0 0; }
.search-sec-ad { margin: 16px 0 4px; }
@media (max-width: 719px) { .banner-ad { margin-top: 12px; } .search-sec-ad { margin-top: 12px; } }

/* title row (title, actions, meta) now sits above the photo carousel; actions are right-aligned */
.ad-head { grid-row: 1; }
.ad-gallery { grid-row: 2; }
.ad-aside { grid-row: 1 / span 4; }
.ad-body { grid-row: 3; }
.ad-actions { margin-left: auto; justify-content: flex-end; }
@media (max-width: 999px) {
  .ad-aside { grid-row: 3; }
  .ad-body { grid-row: 4; }
}
@media (max-width: 719px) {
  .ad-head-top { flex-direction: column; align-items: stretch; gap: 10px; }
  .ad-actions { width: auto; align-self: flex-end; }
  .ad-actions .icon-btn { flex: none; width: 44px; }
}

/* order in the left column: title row, photo carousel, chips + key facts, then the details */
.ad-sub { grid-column: 1; grid-row: 3; min-width: 0; }
.ad-body { grid-row: 4; }
.ad-aside { grid-row: 1 / span 5; }
.ad-sub .ad-chips { margin-top: 0; }
@media (max-width: 999px) {
  .ad-sub { grid-column: 1; }
  .ad-aside { grid-row: 4; }
  .ad-body { grid-row: 5; }
}

/* phones: the price (and its "negotiable" tag) is already in the sticky bar at the bottom, so it is not repeated above the title */
@media (max-width: 719px) { .price-inline { display: none; } }

/* phones: the three action buttons share the full width */
@media (max-width: 719px) {
  .ad-actions { width: 100%; align-self: stretch; margin-left: 0; }
  .ad-actions .icon-btn { flex: 1; width: auto; }
}

/* phones: title, then the date/views/number line, then the three action buttons below it */
@media (max-width: 719px) {
  .ad-head { display: flex; flex-direction: column; }
  .ad-head-top { display: contents; }
  .ad-title { order: 1; }
  .ad-meta { order: 2; }
  .ad-actions { order: 3; margin-top: 12px; }
}

/* single-column layout (phones and tablets): one vertical order across the left and right columns.
   Title row, photos, chips + key facts, specs, description, seller, location, safety tips, ad zone. */
@media (max-width: 999px) {
  .ad-grid { display: flex; flex-direction: column; align-items: stretch; gap: 16px; }
  .ad-body, .ad-aside, .ad-aside-in { display: contents; }
  .ad-head { order: 1; }
  .ad-gallery { order: 2; }
  .ad-sub { order: 3; }
  .ad-body > .box[aria-labelledby="h-specs"] { order: 4; }
  .ad-body > .box[aria-labelledby="h-desc"] { order: 5; }
  .ad-aside-in > .panel:not(.price-panel) { order: 6; }
  .ad-body > .box[aria-labelledby="h-loc"] { order: 7; }
  .ad-body > .box.safety { order: 8; }
  .ad-aside-in > .ad-zone { order: 9; }
  .ad-grid > * { min-width: 0; }
}

/* desktop: Характеристики before Описание */
@media (min-width: 1000px) {
  .ad-body > .box[aria-labelledby="h-specs"] { order: -1; }
}

/* call / write buttons under the seller card */
.contact-block .contact-actions { margin-top: 0; }
.contact-block .btn-call { flex-direction: column; gap: 1px; height: auto; min-height: 56px; padding: 8px 18px; }
.contact-block .btn-call .masked { font-size: 13px; letter-spacing: .02em; }
@media (max-width: 999px) { .contact-block { display: none; } }

/* the buttons now live inside the seller card, between the seller name and the "all ads" link */
.seller-link { margin-top: 16px; }
.contact-block { margin-top: 16px; }

/* title of the price zone */
.price-title { font-size: 14px; font-weight: 700; color: var(--muted); margin: 0 0 6px; letter-spacing: 0; }

/* no photo: a fixed-height placeholder */
.gal-empty { aspect-ratio: auto; height: 350px; }

.spec-group { margin: 16px 0 6px; font-size: 14px; font-weight: 700; color: #35638A; }
.spec-group:first-of-type { margin-top: 0; }
