/* ===== Variables ===== */
:root {
  --accent: #ff385c;
  --accent-dark: #d70466;
  --text: #222222;
  --text-soft: #6a6a6a;
  --line: #dddddd;
  --line-soft: #ebebeb;
  --bg: #ffffff;
  --bg-soft: #f7f7f7;
  --radius: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 6px 16px rgba(0, 0, 0, .12);
  --shadow-pill: 0 1px 2px rgba(0, 0, 0, .08), 0 4px 12px rgba(0, 0, 0, .05);
  --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 96px; }
body {
  margin: 0;
  font-family: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
[hidden] { display: none !important; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 24px; }
.underline { text-decoration: underline; font-weight: 600; }
.dot { color: var(--text-soft); }

/* ===== Encabezado ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line-soft);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 80px; gap: 16px; }
.brand { display: flex; align-items: center; gap: 6px; color: var(--accent); text-decoration: none; font-weight: 800; font-size: 24px; letter-spacing: -.5px; }
.brand-mark { width: 34px; height: 34px; }

.header-pill {
  display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--line); border-radius: 40px;
  padding: 7px 7px 7px 20px; box-shadow: var(--shadow-pill);
  transition: box-shadow .2s;
}
.header-pill:hover { box-shadow: 0 2px 4px rgba(0,0,0,.18); }
.header-pill > a:not(.pill-search) { text-decoration: none; font-size: 14px; font-weight: 600; padding: 0 12px; }
.pill-sep { width: 1px; height: 24px; background: var(--line); }
.pill-search {
  display: grid; place-items: center;
  width: 34px; height: 34px; margin-left: 8px;
  border-radius: 50%; background: var(--accent); color: #fff;
}
.pill-search svg { width: 12px; height: 12px; }

.icon-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; border: 0; padding: 8px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 600; text-decoration: underline;
}
.icon-btn:hover { background: var(--bg-soft); }
.icon-btn svg { width: 16px; height: 16px; }

/* ===== Título ===== */
.listing-title { padding-top: 24px; }
.listing-title h1 { font-size: 26px; font-weight: 700; }
.title-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; font-size: 14px; }
.badge-new { font-weight: 700; }

/* ===== Galería ===== */
.gallery { position: relative; margin-top: 24px; }
.gallery-grid {
  display: grid; gap: 8px;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  height: min(52vw, 460px);
  border-radius: var(--radius); overflow: hidden;
}
.g-item { position: relative; overflow: hidden; background: var(--bg-soft); border: 0; padding: 0; }
.g-item:first-child { grid-row: 1 / span 2; }
.g-item img { width: 100%; height: 100%; object-fit: cover; transition: filter .2s; }
.g-item:hover img { filter: brightness(.85); }
.g-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--text-soft); font-size: 13px; text-align: center; padding: 12px; cursor: default;
}
.g-placeholder svg { width: 28px; height: 28px; opacity: .6; }

.show-all-btn {
  position: absolute; right: 24px; bottom: 24px;
  display: inline-flex; align-items: center; gap: 8px;
  background: #fff; border: 1px solid var(--text); border-radius: 8px;
  padding: 7px 15px; font-size: 14px; font-weight: 600;
}
.show-all-btn:hover { background: var(--bg-soft); }
.show-all-btn svg { width: 16px; height: 16px; }
.gallery-mobile-count { display: none; }

/* ===== Layout principal ===== */
.listing-layout { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 80px; margin-top: 32px; }
.section { padding: 32px 0; border-bottom: 1px solid var(--line); }
.section:first-child { padding-top: 0; }
.section h2 { font-size: 22px; font-weight: 700; }

.host-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.specs { display: flex; flex-wrap: wrap; list-style: none; padding: 0; margin: 4px 0 0; color: var(--text); }
.specs li + li::before { content: "·"; margin: 0 6px; }
.host-avatar {
  flex: none; width: 56px; height: 56px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2d3a4a, #4a6a8a); color: #fff; font-weight: 800; font-size: 22px;
}

.highlights { display: grid; gap: 24px; }
.highlight { display: flex; gap: 24px; align-items: flex-start; }
.highlight svg { flex: none; width: 26px; height: 26px; margin-top: 2px; }
.highlight h3 { font-size: 16px; font-weight: 700; }
.highlight p { margin: 2px 0 0; color: var(--text-soft); font-size: 14px; }

.description p { margin: 0 0 16px; }
.link-btn { background: none; border: 0; padding: 0; font-weight: 700; text-decoration: underline; }

.amenity-list { list-style: none; padding: 0; margin: 24px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.amenity-list li { display: flex; align-items: center; gap: 16px; }
.amenity-list svg { flex: none; width: 24px; height: 24px; }
.amenity-list em { color: var(--text-soft); font-style: normal; font-size: 13px; }

/* ===== Tarjeta de reserva ===== */
.listing-aside { position: relative; }
.booking-card {
  position: sticky; top: 112px;
  border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-card); background: #fff;
}
.price-row { margin-bottom: 24px; }
.price { font-size: 22px; font-weight: 700; }
.price small { font-size: 16px; font-weight: 400; }

.booking-fields {
  display: grid; grid-template-columns: 1fr 1fr;
  border: 1px solid #b0b0b0; border-radius: 8px; overflow: hidden;
}
.field { display: flex; flex-direction: column; padding: 10px 12px; cursor: pointer; }
.field-half:first-child { border-right: 1px solid #b0b0b0; }
.field-full { grid-column: 1 / -1; border-top: 1px solid #b0b0b0; }
.field span { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; }
.field input, .field select {
  border: 0; padding: 2px 0 0; font: inherit; font-size: 14px; color: var(--text);
  background: transparent; outline: none; width: 100%; min-width: 0;
}
.field:focus-within { outline: 2px solid var(--text); outline-offset: -2px; border-radius: 8px; }

.form-error { color: #c13515; font-size: 14px; margin: 12px 0 0; }

.btn-primary {
  display: inline-flex; justify-content: center; align-items: center;
  width: 100%; margin-top: 16px; padding: 14px 24px;
  border: 0; border-radius: 8px; color: #fff; text-decoration: none;
  font-size: 16px; font-weight: 700;
  background: radial-gradient(circle at var(--mx, 50%) var(--my, 50%), #ff385c 0%, #e61e4d 27.5%, #e31c5f 40%, #d70466 57.5%, #bd1e59 75%, #bd1e59 100%);
  background-size: 200% 200%; background-position: center;
}
.btn-primary:active { transform: scale(.98); }
.fine-print { text-align: center; font-size: 14px; color: var(--text-soft); margin: 12px 0 0; }
.nights-summary { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.sum-row { display: flex; justify-content: space-between; font-weight: 700; }

/* ===== Ubicación y normas ===== */
.section-wide { padding: 48px 0; border-top: 1px solid var(--line); margin-top: 48px; }
.section-wide + .section-wide { margin-top: 0; }
.section-wide h2 { font-size: 22px; font-weight: 700; }
.location-sub { margin: 8px 0 24px; }
.map-wrap { border-radius: var(--radius); overflow: hidden; height: 420px; background: var(--bg-soft); }
.map-wrap iframe { width: 100%; height: 100%; border: 0; }
.map-note { color: var(--text-soft); font-size: 14px; margin: 12px 0 0; }
.nearby { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 24px; }
.nearby-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 2px; }
.nearby-item span { color: var(--text-soft); font-size: 14px; }

.views-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.view-card { position: relative; border: 0; padding: 0; border-radius: var(--radius); overflow: hidden; background: var(--bg-soft); aspect-ratio: 3 / 4; }
.view-card img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.view-card:hover img { transform: scale(1.04); }
.view-card span {
  position: absolute; left: 12px; bottom: 12px;
  background: rgba(255,255,255,.92); color: var(--text);
  font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 20px;
}

.rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 24px; }
.rules-grid h3 { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.rules-grid ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }

/* ===== Pie ===== */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--line); padding: 24px 0; font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

.mobile-bar { display: none; }

/* ===== Modal de fotos ===== */
.modal { position: fixed; inset: 0; z-index: 100; background: #fff; overflow-y: auto; animation: slideUp .3s ease; }
.modal-top { position: sticky; top: 0; background: #fff; padding: 12px 24px; z-index: 1; }
.tour-body { max-width: 820px; margin: 0 auto; padding: 8px 24px 64px; }
.tour-section { padding: 32px 0; }
.tour-section h2 { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.tour-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tour-grid button { border: 0; padding: 0; background: var(--bg-soft); }
.tour-grid button:nth-child(3n+1) { grid-column: 1 / -1; }
.tour-grid img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 4 / 3; }
.tour-grid button:nth-child(3n+1) img { aspect-ratio: 16 / 9; }
.tour-grid img.portrait { object-position: center 70%; }

/* ===== Lightbox ===== */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: #000; color: #fff;
  display: grid; grid-template-columns: 80px 1fr 80px; grid-template-rows: auto 1fr; align-items: center;
}
.lb-top { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; }
.lb-close { background: none; border: 0; color: #fff; font-weight: 600; padding: 8px 12px; border-radius: 8px; }
.lb-close:hover { background: rgba(255,255,255,.12); }
.lb-count { font-size: 15px; }
.lb-figure { margin: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 32px; min-height: 0; }
.lb-figure img { max-height: calc(100vh - 160px); max-width: 100%; object-fit: contain; }
.lb-figure figcaption { margin-top: 12px; font-size: 15px; color: #ddd; }
.lb-nav {
  justify-self: center; width: 48px; height: 48px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.5); background: transparent; color: #fff; font-size: 28px; line-height: 1;
}
.lb-nav:hover { background: rgba(255,255,255,.12); }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translate(-50%, 20px);
  background: var(--text); color: #fff; padding: 12px 20px; border-radius: 8px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 300;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .listing-layout { grid-template-columns: minmax(0, 1fr) 330px; gap: 40px; }
  .nearby { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
  .header-pill { display: none; }
  .listing-layout { grid-template-columns: 1fr; gap: 0; }
  .booking-card { position: static; margin-top: 32px; }
  .rules-grid { grid-template-columns: 1fr; }
}

@media (max-width: 743px) {
  html { scroll-padding-top: 72px; }
  .container { padding: 0 16px; }
  .header-inner { height: 64px; }
  .hide-sm { display: none; }

  .listing-title { padding-top: 16px; }
  .listing-title h1 { font-size: 22px; }

  /* La galería se convierte en carrusel deslizable */
  .gallery { margin: 16px -16px 0; }
  .gallery-grid {
    display: flex; height: auto; border-radius: 0; gap: 0;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  }
  .gallery-grid::-webkit-scrollbar { display: none; }
  .g-item { flex: 0 0 100%; aspect-ratio: 4 / 3; scroll-snap-align: start; }
  .g-placeholder { display: none; }
  .show-all-btn { display: none; }
  .gallery-mobile-count {
    display: block; position: absolute; right: 12px; bottom: 12px;
    background: rgba(34,34,34,.7); color: #fff; font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 6px;
  }

  .amenity-list { grid-template-columns: 1fr; }
  .nearby { grid-template-columns: 1fr; }
  .map-wrap { height: 300px; }
  .views-strip {
    display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    margin: 0 -16px; padding: 0 16px;
  }
  .views-strip::-webkit-scrollbar { display: none; }
  .view-card { flex: 0 0 72%; scroll-snap-align: start; }
  .section-wide { padding: 32px 0; margin-top: 32px; }

  .site-footer { padding-bottom: 96px; }
  .mobile-bar {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: #fff; border-top: 1px solid var(--line); padding: 12px 16px;
  }
  .mobile-bar strong { display: block; font-size: 15px; }
  .mobile-bar span { font-size: 13px; color: var(--text-soft); }
  .btn-small { width: auto; margin: 0; padding: 12px 22px; }

  .tour-body { padding: 8px 16px 48px; }
  .lightbox { grid-template-columns: 1fr; }
  .lb-nav { position: absolute; top: 50%; background: rgba(0,0,0,.4); }
  .lb-prev { left: 8px; } .lb-next { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .modal { animation: none; }
}
