/* ==========================================================================
   OSSA — property detail page
   ========================================================================== */

.pd { padding: 143px var(--gutter) 40px; }
/* the original's desktop title column is fixed, putting the stats at x563 */
@media (min-width: 1200px) {
  .pd-title-col { flex: 0 0 473px; max-width: 473px; }
}

/* Title block */
.pd-head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.pd-badge {
  align-self: flex-start;
  background: var(--c-orange-60);
  color: var(--c-white);
  padding: 4px 14px;
}
.pd-title-row { display: flex; align-items: flex-end; gap: 40px; flex-wrap: wrap; }
.pd-title-col { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.pd-meta { display: flex; align-items: center; gap: 8px; color: var(--c-text-70); text-transform: uppercase; }
/* the original puts the two stats on a 199px pitch with a serif label
   sitting directly above the value */
.pd-stats { display: grid; grid-template-columns: 199px auto; gap: 0; }
.pd-stat { display: flex; flex-direction: column; gap: 0; }
.pd-stat .ps-label { font-family: var(--f-display); font-size: 20px; color: var(--c-black); }

/* Content: gallery + sidebar */
.pd-content { display: flex; gap: 30px; align-items: flex-start; }
.pd-gallery { flex: 1 1 66%; min-width: 0; }
.pd-main {
  position: relative;
  aspect-ratio: 1.5;
  overflow: hidden;
  background: var(--c-grey-bg);
  cursor: zoom-in;
}
.pd-main img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.55s cubic-bezier(0.65, 0, 0.35, 1);
  will-change: transform;
}
/* gallery.js parks the next photo off to the side before sliding it in */
.pd-main img.is-entering { transition: none; }
.pd-main .pd-nav, .pd-main .pd-count { z-index: 2; }
@media (prefers-reduced-motion: reduce) { .pd-main img { transition: none; } }
.pd-main .pd-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.75);
  color: var(--c-dark);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.25s ease;
}
.pd-main .pd-nav:hover { background: var(--c-white); }
.pd-main .pd-nav svg { width: 18px; height: 18px; }
.pd-main .pd-nav--prev { left: 16px; }
.pd-main .pd-nav--next { right: 16px; }
.pd-count {
  position: absolute; right: 16px; bottom: 14px;
  background: rgba(0, 0, 0, 0.45);
  color: var(--c-white);
  padding: 4px 10px;
  font-family: var(--f-ui); font-size: 11px;
  border-radius: 20px;
}
.pd-thumbs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.pd-thumbs button { aspect-ratio: 1.5; overflow: hidden; opacity: 0.75; transition: opacity 0.2s ease; }
.pd-thumbs button:hover, .pd-thumbs button.active { opacity: 1; }
.pd-thumbs img { width: 100%; height: 100%; object-fit: cover; }

/* Agent sidebar */
.pd-sidebar { flex: 1 1 34%; max-width: 420px; position: sticky; top: 110px; }
.agent-card {
  background: var(--c-grey-bg);
  border: 1px solid var(--c-border);
  display: flex; flex-direction: column;
}
.agent-card .ac-top {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 0 0 24px;
}
.agent-card .ac-titles { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.agent-card .ac-photo { width: 52%; flex: none; aspect-ratio: 201 / 400; overflow: hidden; }
.agent-card .ac-photo img { width: 100%; height: 100%; object-fit: contain; object-position: bottom center; }
.agent-card .ac-body { padding: 10px 24px 0; display: flex; flex-direction: column; gap: 8px; }
.agent-card .ac-name { color: var(--c-dark); }
.agent-card .ac-role { font-family: var(--f-ui); font-size: 11px; line-height: 1.5; color: var(--c-text-70); }
.agent-card .ac-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0 6px;
  border-top: 1px solid var(--c-border);
  font-family: var(--f-ui); font-size: 11px; color: var(--c-text-70);
}
.agent-card .ac-row a { color: var(--c-text); }
.agent-card .ac-row a:hover { color: var(--c-orange); }
.agent-card .ac-cta {
  margin: 14px 24px 24px;
  border: 1px solid var(--c-text-45);
  padding: 11px;
  text-align: center;
  color: var(--c-dark);
  transition: background 0.25s ease, color 0.25s ease;
}
.agent-card .ac-cta:hover { background: var(--c-dark); color: var(--c-white); }

/* Description — rich text carried over from the original (p/ul/li/strong/em/br) */
.pd-desc { max-width: 1100px; margin-top: 44px; }
/* the original renders the Opis / facts headings at 20px (map + recommended stay large) */
.pd-desc h4, .pd-facts h4 { font-size: 20px; line-height: 1.5em; }
.pd-desc h4 { margin-bottom: 18px; }
/* long descriptions roll up behind "Pokaż więcej" at every width, like the original */
.pd-desc.is-collapsed .pd-desc-body {
  max-height: 380px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent);
  mask-image: linear-gradient(to bottom, #000 75%, transparent);
}
@media (max-width: 809px) {
  .pd-desc { margin-top: 21px; }
  .pd-desc.is-collapsed .pd-desc-body { max-height: 360px; }
}
.pd-desc p { margin-bottom: 14px; }
.pd-desc p, .pd-desc li {
  font-family: var(--f-copy);
  font-size: 16px;
  line-height: 1.5;
  color: var(--c-text);
}
.pd-desc strong, .pd-desc b { font-weight: 700; }
.pd-desc em, .pd-desc i { font-style: italic; }
.pd-desc ul, .pd-desc ol { margin: 0 0 14px 8px; }
.pd-desc li { list-style: none; position: relative; padding-left: 16px; margin-bottom: 4px; }
.pd-desc li::before { content: "•"; position: absolute; left: 0; }
.pd-desc li p { margin-bottom: 0; }

/* Facts sections (Więcej informacji / Dodatkowe Informacje) */
.pd-facts { margin-top: 48px; }
.pd-facts h4 { margin-bottom: 22px; }
.facts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 80px;
}
.fact {
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 13px 0;
  border-bottom: 1px solid var(--c-border);
}
.fact .f-label {
  display: inline-flex; align-items: center; gap: 14px;
  font-family: var(--f-copy); font-size: 16px; color: var(--c-text-70);
}
.fact .f-label svg { width: 16px; height: 16px; flex: none; opacity: 0.7; }
.fact .f-value { font-family: var(--f-ui); font-size: 16px; font-weight: 700; color: var(--c-black); text-align: right; }

/* collapsed "Dodatkowe Informacje" hides its rows until expanded */
.pd-facts--extra .pg-hidden-block { display: none; }
.pd-facts--extra.is-expanded .pg-hidden-block { display: grid; }

/* expander button */
.pd-expander {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin: 26px auto 0;
  font-family: var(--f-ui); font-size: 14px; letter-spacing: 0.04em; text-transform: uppercase;
  color: rgba(67, 63, 56, 0.6);
  transition: color 0.2s ease;
}
.is-expanded > .pd-expander { flex-direction: column-reverse; }
.pd-expander:hover { color: var(--c-black); }
.pd-expander i { font-style: normal; font-size: 11px; line-height: 1; }

/* photo grid under the facts */
.pd-photo-grid { margin-top: 44px; }
.pd-photo-grid .pg-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.pd-photo-grid .pg-item { overflow: hidden; aspect-ratio: 1.5; cursor: zoom-in; }
.pd-photo-grid .pg-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.44, 0, 0.56, 1);
}
.pd-photo-grid .pg-item:hover img { transform: scale(1.05); }
.pd-photo-grid .pg-item.pg-hidden { display: none; }
.pd-photo-grid.is-expanded .pg-item.pg-hidden { display: block; }

@media (max-width: 809px) {
  .facts-grid { grid-template-columns: 1fr; column-gap: 0; }
  .pd-photo-grid .pg-items { grid-template-columns: 1fr; }
}

/* Map */
.pd-map { margin-top: 44px; }
.pd-map h4 { margin-bottom: 18px; }
.pd-map .map-frame iframe, .cp-map .map-frame iframe { filter: grayscale(1); }
.pd-map .map-frame {
  aspect-ratio: 2.6;
  background: var(--c-beige-15);
  border: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: center;
}
.pd-map iframe { width: 100%; height: 100%; border: 0; }

/* Expert form */
/* original desktop: agent portrait on the left, form on the right, both inset */
.pd-expert {
  margin-top: 54px; display: flex; gap: 102px; align-items: flex-start;
  background: rgba(203, 196, 188, 0.5);
  padding: 28px 100px 40px 53px;
}
.pd-expert .pe-photo { width: 303px; flex: none; aspect-ratio: 303 / 353; overflow: hidden; }
.pd-expert .pe-photo img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.pd-expert .pe-form { flex: 1; }
.pd-expert .pe-form { padding-top: 60px; }
.pd-expert .pe-form h4 { margin-bottom: 20px; font-size: 30px; color: rgba(0, 0, 0, 0.6); }
.pd-expert form { display: flex; flex-direction: column; }
.pd-expert form > .form-field:has(textarea) { order: 2; }
.pd-expert form > .form-row { order: 3; }
.pd-expert form > .form-submit { order: 4; }
.pd-expert .form-submit {
  margin-top: 26px; width: 100%; padding: 12px 20px; text-align: center;
  background: var(--c-dark); color: var(--c-white);
  transition: opacity 0.25s ease;
}
.pd-expert .form-submit:hover { opacity: 0.9; }

/* Recommended */
.pd-recommended { margin-top: 60px; }
.pd-recommended h4 { margin-bottom: 30px; }
.pd-recommended .more { display: flex; justify-content: center; margin-top: 36px; }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(0, 0, 0, 0.92);
  display: none;
  align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88vh; object-fit: contain; }
.lightbox .lb-close { position: absolute; top: 22px; right: 28px; color: #fff; font-size: 30px; line-height: 1; }
.lightbox .lb-prev, .lightbox .lb-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  color: #fff; padding: 20px;
}
.lightbox .lb-prev { left: 8px; }
.lightbox .lb-next { right: 8px; }
.lightbox svg { width: 26px; height: 26px; }

@media (max-width: 1199px) {
  .pd { padding-top: 100px; }
  .pd-content { flex-direction: column; align-items: stretch; }
  .pd-gallery { width: 100%; }
  .pd-sidebar { max-width: none; width: 100%; position: static; }
  .pd-expert { flex-direction: column; padding: 28px 30px 40px; gap: 30px; }
  .pd-expert .pe-form { padding-top: 0; }
  .pd-thumbs { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 809px) {
  /* header is 140px tall on mobile; the original puts the title at y178 */
  .pd { padding-top: 140px; }
  .pd-title-row { flex-direction: column; align-items: stretch; gap: 43px; }
  /* the location line stays under the title here too, with a 24px pin */
  .pd-badge { background: rgba(0, 0, 0, 0.05); color: var(--c-orange); border-radius: 50px; padding: 6px 10px; }
  .pd-title-col { gap: 0; }
  .pd-meta { display: flex; margin-top: 20px; gap: 4px; font-size: 15px; line-height: 18px; }
  .pd-meta .pin { display: inline-flex; }
  .pd-meta .pin svg { width: 24px; height: 24px; }
  /* original mobile stats: serif labels and larger serif values, two columns
     at x0 and x199, label sitting directly on top of the value */
  .pd-stats { display: grid; grid-template-columns: 208px 1fr; gap: 0; }
  .pd-stat { padding-left: 0; border-left: 0; gap: 0; }
  /* 1px beige rule between the two stats, like the original */
  .pd-stat:first-child { position: relative; }
  .pd-stat:first-child::after { content: ""; position: absolute; right: 11px; top: 3px; width: 1px; height: 45px; background: var(--c-beige); }
  .pd-stat .ps-label { font-family: var(--f-display); font-size: 18px; line-height: 18px; color: var(--c-text-70); }
  .pd-stat .t-h6 { font-size: 22px; line-height: 28.6px; color: var(--c-dark); }
  .pd-thumbs { grid-template-columns: repeat(3, 1fr); }

  /* original mobile order: photo, desc, facts, photo grid, extra facts,
     map, agent card, recommended (no expert form) */
  .pd { display: flex; flex-direction: column; }
  .pd-content { display: contents; }
  .pd-head { order: 0; }
  .pd-gallery { order: 1; width: 100%; }
  .pd-desc { order: 2; }
  .pd-facts { order: 3; }
  .pd-photo-grid { order: 4; }
  .pd-facts--extra { order: 5; }
  .pd-map { order: 6; }
  .pd-sidebar { order: 7; margin-top: 44px; }
  .pd-recommended { order: 8; }
  .pd-recommended .listing-grid { gap: 30px; }
  .pd-expert { display: none; }

  /* phones: no arrows, the photo is swiped (gallery.js) */
  .pd-main { aspect-ratio: 335 / 247; }
  .pd-main .pd-nav { display: none; }
  /* no arrows on phones (swipe instead), so keep the "3 / 17" counter as a hint */

  /* section headings drop to 20px on mobile */
  .pd-desc h4, .pd-facts h4, .pd-map h4 { font-size: 20px; }

  /* facts rows: 16px Arial labels, 16px values */

  /* photo grid: the original's tiles run 8px wider than the gutter (352px) */
  .pd-photo-grid .pg-items { margin: 0 -8px; }
  .pd-photo-grid .pg-item { aspect-ratio: 352 / 273; }
  .pd-photo-grid:not(.is-expanded) .pg-item:nth-child(n + 2) { display: none; }

  /* portrait map */
  .pd-map .map-frame { aspect-ratio: 335 / 501; }

  /* agent card: beige, borderless, photo on top, no CTA */
  .agent-card { background: rgba(203, 196, 188, 0.3); border: none; padding-bottom: 24px; }
  .agent-card .ac-top { flex-direction: column-reverse; align-items: stretch; gap: 16px; padding: 8px 8px 0; }
  .agent-card .ac-photo { width: 100%; aspect-ratio: 319 / 479; }
  /* cover-crop from the top so tall full-length portraits keep the head (Krystian) */
  .agent-card .ac-photo img { object-fit: cover; object-position: top center; }
  .agent-card .ac-titles { padding: 0 12px; }
  .agent-card .ac-name { font-size: 26px; }
  .agent-card .ac-role { font-size: 12px; }
  .agent-card .ac-cta { display: none; }

  /* expander text style (original: 14px, no uppercase) */
}

/* ---------- Desktop layout measured on the original at 1455px ----------
   the agent card runs level with the badge (sidebar spans head + photo),
   900x590 photo, full-width black description, 653px fact columns */
@media (min-width: 1200px) {
  /* the original keeps the 66.4% / 33.6% split at every width (10px gap) */
  .pd { display: grid; grid-template-columns: 66.42% minmax(0, 1fr); column-gap: 10px; padding-top: 138px; }
  .pd > * { grid-column: 1 / -1; }
  .pd > .pd-head { grid-column: 1; grid-row: 1; margin-bottom: 15px; gap: 13px; }
  .pd > .pd-content { display: contents; }
  .pd-content > .pd-gallery { grid-column: 1; grid-row: 2; }
  .pd-content > .pd-sidebar { grid-column: 2; grid-row: 1 / span 2; max-width: none; position: static; align-self: start; padding: 0 16px 0 27px; }
  .pd-main { aspect-ratio: auto; height: 590px; }
  .pd-badge { background: rgba(0, 0, 0, 0.05); color: var(--c-orange); border-radius: 50px; padding: 6px 10px; }
  .pd-title-row { display: grid; grid-template-columns: 1fr 1fr; align-items: flex-start; gap: 10px; }
  .pd-title-col { max-width: none; gap: 19px; }
  .pd-title-col h3 { font-size: 22px; line-height: 22px; }
  .pd-meta { font-size: 15px; line-height: 18px; gap: 10px; }
  .pd-meta .pin svg { width: 18px; height: 18px; }
  .pd-stats { display: flex; margin-top: 30px; }
  .pd-stat:first-child { width: 135px; border-right: 1px solid var(--c-beige); margin-right: 30px; }
  .pd-stat .ps-label { font-size: 20px; line-height: 20px; color: var(--c-text-70); }
  .pd-stat .t-h6 { font-size: 22px; line-height: 22px; color: var(--c-dark); }
  /* agent card: 402x715, photo bottom-right, rows + beige CTA at the bottom */
  .agent-card { min-height: 715px; justify-content: flex-end; padding: 0 36px 22px 26px; background: none; }
  .agent-card .ac-top { padding: 0; gap: 10px; }
  .agent-card .ac-photo { width: 201px; height: 400px; aspect-ratio: auto; }
  .agent-card .ac-name { font-size: 20px; line-height: 20px; color: #000; }
  .agent-card .ac-body { padding: 0; gap: 5px; }
  .agent-card .ac-row { padding: 5px 0; border-top: 1px solid #e8e8e8; border-bottom: 1px solid #e8e8e8; }
  .agent-card .ac-row a { color: #000; }
  .agent-card .ac-cta { margin: 40px 0 0; border: 0; padding: 6px 10px; background: rgba(203, 196, 188, 0.8); color: #000; font-size: 12px; }
  /* description */
  .pd-desc { max-width: none; margin-top: 14px; }
  .pd-desc h4 { margin-bottom: 20px; color: #000; line-height: 26px; }
  .pd-desc.is-collapsed .pd-desc-body { max-height: 384px; }
  .pd-desc p, .pd-desc li { line-height: 25.6px; color: #000; }
  .pd-desc p { margin-bottom: 25.6px; }
  .pd-desc ul, .pd-desc ol { margin-left: 0; }
  .pd-desc li { padding-left: 18px; margin-bottom: 0; }
  /* facts */
  .pd-facts { margin-top: 85px; padding-top: 31px; border-top: 1px solid #e8e8e8; }
  .pd-facts h4 { color: #000; line-height: 26px; margin-bottom: 20px; }
  .facts-grid { column-gap: 50px; }
  .fact { padding: 12.5px 0; }
  .fact .f-label { gap: 14px; }
  .fact .f-value { font-weight: 600; line-height: 22.4px; }
}
@media (min-width: 1200px) {
  /* photo grid: black 433/434/443 x 270 tiles 10px apart, inset 13/12px, photo zoomed 1.05 */
  .pd-photo-grid { margin-top: 45px; padding: 0 12px 0 13px; }
  .pd-photo-grid .pg-items { grid-template-columns: 433fr 434fr 443fr; gap: 10px; }
  .pd-photo-grid .pg-item { aspect-ratio: auto; height: 270px; background: #000; }
  .pd-photo-grid .pg-item img { transform: scale(1.05); }
  .pd-photo-grid .pg-item:hover img { transform: scale(1.1); }
}
/* the original's main photo shows no controls at rest; ours appear on hover */
@media (hover: hover) {
  .pd-main .pd-nav, .pd-main .pd-count { opacity: 0; transition: opacity 0.25s ease, background 0.25s ease; }
  .pd-main:hover .pd-nav, .pd-main:hover .pd-count { opacity: 1; }
}
