:root {
  --jp-radius: 22px;
  --jp-shadow: 0 8px 30px rgba(0,0,0,0.12);
  --jp-border: rgba(0,0,0,0.08);
  --jp-pill: rgba(0,0,0,0.06);
  --jp-text: #111;
}

/* =========================
   Portal CSS Isolation (WP-proof)
   ========================= */

/* Reset ONLY inside the portal */
#joya-portal-root button,
#joya-portal-root input,
#joya-portal-root a {
  font: inherit;
  color: inherit;
}

/* Hard reset buttons inside portal (kills WP reset.css) */
#joya-portal-root button {
  all: unset;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}

/* Make anchors behave predictably inside portal */
#joya-portal-root a {
  text-decoration: none;
}

/* Focus visibility */
#joya-portal-root button:focus-visible,
#joya-portal-root a:focus-visible,
#joya-portal-root input:focus-visible {
  outline: 3px solid rgba(17,17,17,0.25);
  outline-offset: 2px;
}

/* =========================
   Layout
   ========================= */

#joya-portal-root {
  position: relative;
  width: 100%;
  margin-top: 185px;
  padding: 0 185px 40px;
  box-sizing: border-box;
}

@media (max-width: 1024px) {
  #joya-portal-root { padding: 0 18px 36px; }
}

@media (max-width: 768px) {
  #joya-portal-root { padding: 0 14px 32px; }
}

#joya-portal-root .jp-portal {
  max-width: 1120px;
  margin: 0 auto;
  font-family: inherit;
}

/* =========================
   Search bar
   ========================= */

#joya-portal-root .jp-searchbar {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 22px 0 18px;
}

#joya-portal-root .jp-searchbar input {
  flex: 1;
  height: 56px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.92);
  padding: 0 20px;
  font-size: 16px;
  outline: none;
}

#joya-portal-root .jp-searchbar button {
  height: 56px;
  padding: 0 22px;
  border-radius: 999px;
  border: none;
  background: rgba(0,0,0,0.75);
  color: #fff;
  font-weight: 800;
}

#joya-portal-root .jp-searchbar button:hover {
  background: rgba(0,0,0,0.88);
}

/* =========================
   Grid & Card
   ========================= */

#joya-portal-root .jp-grid {
  display: grid;
  gap: 18px;
}

#joya-portal-root .jp-card {
  background: #fff;
  border-radius: var(--jp-radius);
  box-shadow: var(--jp-shadow);
  border: 1px solid var(--jp-border);
  overflow: hidden;
}

#joya-portal-root .jp-card-top {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  padding: 16px;
  align-items: center;
}

@media (max-width: 900px) {
  #joya-portal-root .jp-card-top { grid-template-columns: 1fr; }
}

#joya-portal-root .jp-media {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #eee;
  min-height: 170px;
}

#joya-portal-root .jp-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

#joya-portal-root .jp-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

#joya-portal-root .jp-ref {
  position: absolute;
  bottom: 12px;
  left: 12px;
  background: rgba(255,255,255,0.85);
  color: #111;
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 900;
}

#joya-portal-root .jp-info { padding-right: 10px; }

#joya-portal-root .jp-type{
  font-size: 14px;
  font-weight: 600;
  color: rgba(17,17,17,0.65);
  margin-bottom: 6px;
  text-transform: none;
}

#joya-portal-root .jp-price {
  font-size: 26px;
  font-weight: 900;
  color: var(--jp-text);
  margin-bottom: 6px;
}

#joya-portal-root .jp-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--jp-text);
  line-height: 1.25;
}

#joya-portal-root .jp-sub {
  margin-top: 6px;
  color: rgba(17,17,17,0.65);
  font-weight: 700;
}

#joya-portal-root .jp-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

#joya-portal-root .jp-meta span {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.10);
  font-weight: 800;
  background: rgba(0,0,0,0.03);
}

/* =========================
   Bottom area
   ========================= */

#joya-portal-root .jp-card-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

@media (max-width: 900px) {
  #joya-portal-root .jp-card-bottom {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
}

#joya-portal-root .jp-agent {
  display: flex;
  align-items: center;
  gap: 10px;
}

#joya-portal-root .jp-agent-photo {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  object-fit: cover;
  background: #eee;
}

#joya-portal-root .jp-agent-name {
  font-weight: 900;
  color: #111;
}

#joya-portal-root .jp-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

#joya-portal-root .jp-ico{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  margin-right: 8px;
  font-size: 16px;
  line-height: 1;
}

/* =========================
   Buttons (rebuild AFTER reset)
   ========================= */

#joya-portal-root .jp-btn {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;

  font-weight: 900;
  font-size: 14px;
  line-height: 1;

  border: 1px solid rgba(0,0,0,0.10);
  background: #fff;
  color: #111;
}

#joya-portal-root .jp-btn-ghost:hover {
  background: rgba(0,0,0,0.04);
}

#joya-portal-root .jp-btn.jp-btn-primary {
  background: #d1006f;
  color: #fff;
  border-color: #d1006f;
}

#joya-portal-root .jp-btn.jp-btn-primary:hover {
  filter: brightness(0.95);
}

/* Make whole top clickable */
#joya-portal-root .jp-card-link { cursor: pointer; }

/* Fallback when images fail */
#joya-portal-root .jp-img--empty,
#joya-portal-root .jp-agent-photo--empty {
  background: linear-gradient(135deg, rgba(0,0,0,0.06), rgba(0,0,0,0.02));
}

/* States */
#joya-portal-root .jp-loading,
#joya-portal-root .jp-error,
#joya-portal-root .jp-empty {
  padding: 14px 4px;
  color: #fff;
  font-weight: 800;
}

/* =========================
   Pagination
   ========================= */

#joya-portal-root .jp-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

#joya-portal-root .jp-pagination button {
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-weight: 800;
}

#joya-portal-root .jp-pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#joya-portal-root .jp-pageinfo {
  color: rgba(255,255,255,0.8);
  font-weight: 700;
}

/* =========================
   Detail page (PF-ish)
   ========================= */

#joya-portal-root .jp-detail { margin-top: 8px; }

#joya-portal-root .jp-detail-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 14px;
}

#joya-portal-root .jp-detail-refpill{
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-weight: 900;
}

#joya-portal-root .jp-back {
  height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(0,0,0,0.25);
  color: #fff;
  font-weight: 800;
}

/* ✅ Gallery full width, then (left content + right contact) */
#joya-portal-root .jp-detail-layout{
  display: grid;
  grid-template-columns: 1.65fr 0.85fr;
  grid-template-areas:
    "gallery gallery"
    "left right";
  gap: 18px;
  align-items: start;
}

#joya-portal-root .jp-detail-gallery { grid-area: gallery; }
#joya-portal-root .jp-detail-left { grid-area: left; display: grid; gap: 14px; }
#joya-portal-root .jp-detail-right { grid-area: right; position: sticky; top: 18px; align-self: start; }

@media (max-width: 980px){
  #joya-portal-root .jp-detail-layout{
    grid-template-columns: 1fr;
    grid-template-areas:
      "gallery"
      "right"
      "left";
  }
  #joya-portal-root .jp-detail-right{ position: static; }
}

/* ===== Gallery (one block): hero left + thumbs right ===== */
#joya-portal-root .jp-gallery{
  background: #fff;
  border-radius: var(--jp-radius);
  box-shadow: var(--jp-shadow);
  border: 1px solid var(--jp-border);
  overflow: hidden;
}

/* ===== Gallery grid (only this section) ===== */
#joya-portal-root .jp-gallery-grid{
  --heroH: clamp(380px, 42vw, 600px); /* keep your sweet spot */
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px; /* ✅ increase right column width here */
  gap: 14px;
  padding: 14px;
  align-items: start; /* ✅ important: don’t stretch */
}

/* ===== Hero (lock to same height) ===== */
#joya-portal-root .jp-gallery-hero{
  position: relative;
  width: 100%;
  height: var(--heroH);
  min-height: 0;              /* ✅ allows the row to shrink properly */
  border-radius: 18px;
  overflow: hidden;
  background: #eee;
}

#joya-portal-root .jp-gallery-heroimg{
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block;
}


#joya-portal-root .jp-gallery-badge{
  position: absolute;
  top: 14px;
  left: 14px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  font-weight: 900;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

/* ===== FIX: Rail rows must have real height (prevents overlap) ===== */
#joya-portal-root .jp-gallery-rail{
  display: grid;
  gap: 12px;                 /* you can tune this */
  align-content: start;

  height: var(--heroH, clamp(380px, 42vw, 600px));
  min-height: 0;
  overflow-y: auto;

  grid-auto-flow: row;       /* ✅ important */
  grid-auto-rows: max-content; /* ✅ important */
}

/* ===== FIX: Thumb buttons must not inherit weird margin/transform ===== */
#joya-portal-root .jp-thumb{
  display: block;            /* ✅ important */
  width: 100%;
  aspect-ratio: 4 / 3;

  margin: 0 !important;      /* ✅ kills any inherited margin */
  padding: 0;
  transform: none !important;/* ✅ kills any inherited transform */

  border-radius: 12px;
  overflow: hidden;
  background: #f2f2f2;
  border: 2px solid transparent;
}

/* keep your hover transform ONLY here */
#joya-portal-root .jp-thumb:hover{
  transform: translateY(-1px) !important;
}

/* Subtle scrollbar (desktop only) */
#joya-portal-root .jp-gallery-rail::-webkit-scrollbar{
  width: 6px;
}
#joya-portal-root .jp-gallery-rail::-webkit-scrollbar-thumb{
  background: rgba(0,0,0,0.15);
  border-radius: 999px;
}

#joya-portal-root .jp-thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* Active thumb (optional but highly recommended) */
#joya-portal-root .jp-thumb.is-active{
  border-color: #d1006f;
}


/* Mobile: stack hero then thumbs grid */
@media (max-width: 980px){
  #joya-portal-root .jp-gallery-grid{
    grid-template-columns: 1fr;
  }
  #joya-portal-root .jp-gallery-rail{
    height: auto;
    overflow: visible;
    padding-right: 0;
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 560px){
  #joya-portal-root .jp-gallery-rail{
    grid-template-columns: repeat(4, 1fr);
  }
}


/* ===== Content blocks ===== */
#joya-portal-root .jp-detail-block{
  background: #fff;
  border-radius: var(--jp-radius);
  box-shadow: var(--jp-shadow);
  border: 1px solid var(--jp-border);
  padding: 18px;
}

#joya-portal-root .jp-detail-head{ margin-bottom: 10px; }

#joya-portal-root .jp-detail-title{
  font-size: 24px;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 6px;
}

#joya-portal-root .jp-detail-loc{
  color: rgba(17,17,17,0.65);
  font-weight: 700;
}

#joya-portal-root .jp-detail-price{
  font-size: 26px;
  font-weight: 900;
  margin: 12px 0 10px;
}

#joya-portal-root .jp-detail-pills{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 8px;
}

#joya-portal-root .jp-detail-pills span{
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.10);
  font-weight: 900;
  background: rgba(0,0,0,0.02);
}

#joya-portal-root .jp-section-title{
  font-size: 14px;
  font-weight: 900;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: rgba(17,17,17,0.6);
  margin-bottom: 10px;
}

#joya-portal-root .jp-detail-desc{
  color: rgba(17,17,17,0.85);
  font-weight: 600;
  line-height: 1.65;
  font-size: 14px;
}

/* ===== Amenities ===== */
#joya-portal-root .jp-amenities{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

#joya-portal-root .jp-amenity{
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.10);
  background: rgba(0,0,0,0.02);
  font-weight: 900;
  font-size: 13px;
}

/* ===== Contact card ===== */
#joya-portal-root .jp-contact-card{
  background: #fff;
  border-radius: var(--jp-radius);
  box-shadow: var(--jp-shadow);
  border: 1px solid var(--jp-border);
  overflow: hidden;
}

#joya-portal-root .jp-contact-top{
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}

#joya-portal-root .jp-contact-label{
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: rgba(17,17,17,0.6);
  margin-bottom: 10px;
}

#joya-portal-root .jp-contact-agent{
  display:flex;
  gap: 12px;
  align-items:center;
}

#joya-portal-root .jp-agent-sub{
  color: rgba(17,17,17,0.6);
  font-weight: 700;
  font-size: 13px;
}

/* ===== Contact actions: 3 icon buttons in a row + big CTA ===== */
#joya-portal-root .jp-contact-actions{
  padding: 14px 16px 16px;
  display: grid;
  gap: 12px;
}

/* row of 3 */
#joya-portal-root .jp-contact-actions-row{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* compact icon button */
#joya-portal-root .jp-contact-action{
  height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.10);
  background: #fff;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

#joya-portal-root .jp-contact-action:hover{
  background: rgba(0,0,0,0.04);
}

/* icon sizing */
#joya-portal-root .jp-contact-action .jp-ico{
  margin-right: 0;
  font-size: 18px;
}

/* keep Inquire full width */
#joya-portal-root .jp-btn-full{
  width: 100%;
  height: 44px;
  justify-content: center;
}

/* ===== Inquiry Modal ===== */
#joya-portal-root .jp-modal{
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

#joya-portal-root .jp-modal.is-open{ display:flex; }

#joya-portal-root .jp-modal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.55);
}

#joya-portal-root .jp-modal-card{
  position: relative;
  width: min(560px, 100%);
  background: #fff;
  border-radius: 18px;
  border: 1px solid rgba(0,0,0,0.10);
  box-shadow: 0 30px 80px rgba(0,0,0,0.35);
  padding: 16px;
}

#joya-portal-root .jp-modal-x{
  position:absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.12);
  background:#fff;
  cursor:pointer;
  font-size: 18px;
  line-height: 1;
}

#joya-portal-root .jp-modal-head{ margin-bottom: 10px; }
#joya-portal-root .jp-modal-title{ font-weight: 900; font-size: 18px; }
#joya-portal-root .jp-modal-sub{ opacity: .7; font-size: 13px; margin-top: 2px; }

#joya-portal-root .jp-label{
  display:block;
  font-size: 13px;
  font-weight: 800;
  margin: 10px 0 6px;
}

#joya-portal-root .jp-input,
#joya-portal-root .jp-textarea{
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
}

#joya-portal-root .jp-textarea{ resize: vertical; }

#joya-portal-root .jp-modal-actions{
  display:flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 12px;
}

#joya-portal-root .jp-modal-note{
  margin-top: 10px;
  font-size: 13px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.04);
  border: 1px solid rgba(0,0,0,0.08);
}

#joya-portal-root .jp-modal-note.is-error{
  background: rgba(255,0,0,0.06);
  border-color: rgba(255,0,0,0.18);
}

/* honeypot hidden */
#joya-portal-root .jp-hp{ display:none !important; }
