/* ═══════════════════════════════════════════════
   Dream Nest Spain Explorer
   Editorial discovery experience — not a dashboard
   ═══════════════════════════════════════════════ */

/* ─── HERO ─── */
.explorer-hero {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 60vh;
  padding: clamp(60px, 10vw, 120px) clamp(20px, 6vw, 76px) clamp(40px, 6vw, 80px);
  background:
    linear-gradient(168deg, rgba(250,250,245,0) 40%, rgba(28,59,52,0.04) 100%),
    url('/assets/explorer-hero.webp') center/cover no-repeat;
  background-color: var(--cream);
}

.explorer-hero-text {
  max-width: 680px;
}

.explorer-hero h1 {
  margin: 12px 0 20px;
  font-family: "Tenor Sans", Georgia, serif;
  font-weight: 400;
  font-size: clamp(36px, 5.5vw, 72px);
  line-height: 1.06;
  color: var(--pine);
}

.explorer-hero p {
  max-width: 520px;
  color: var(--muted);
  font-size: clamp(16px, 1.8vw, 20px);
  line-height: 1.6;
}

/* ─── MAP SECTION ─── */
.explorer-map-section {
  position: relative;
  padding: clamp(40px, 6vw, 80px) clamp(20px, 6vw, 76px);
  background:
    radial-gradient(ellipse at 70% 30%, rgba(167,213,189,0.08) 0%, transparent 60%),
    linear-gradient(180deg, var(--cream) 0%, var(--white) 100%);
}

.map-container {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
}

/* ─── THE MAP ─── */
.spain-map {
  width: 100%;
  height: auto;
  display: block;
}

.province-path {
  fill: #dce8df;
  stroke: var(--cream);
  stroke-width: 0.6;
  cursor: pointer;
  transition: fill 0.35s ease, transform 0.35s ease, filter 0.35s ease;
  transform-origin: center;
}

.province-path:hover {
  fill: var(--sage);
  filter: drop-shadow(0 2px 6px rgba(28,59,52,0.15));
  transform: scale(1.008);
}

.province-path.is-active {
  fill: var(--pine);
  stroke: var(--sage);
  stroke-width: 1;
}

.province-path.is-highlighted {
  fill: var(--sage);
  stroke: var(--pine);
  stroke-width: 0.8;
}

.province-label {
  font-family: "Karla", sans-serif;
  font-size: 7px;
  font-weight: 600;
  fill: var(--pine);
  text-anchor: middle;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.province-path:hover + .province-label,
.province-path.is-active + .province-label {
  opacity: 1;
}

.canary-label {
  font-family: "Karla", sans-serif;
  font-size: 8px;
  font-weight: 600;
  fill: var(--muted);
  text-anchor: start;
}

.canary-box {
  fill: none;
  stroke: var(--line);
  stroke-width: 0.5;
  rx: 4;
}

/* ─── PROVINCE DETAIL PANEL — deep pine, sculpted ─── */
.province-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: clamp(340px, 38%, 460px);
  height: 100%;
  background:
    radial-gradient(ellipse 120% 40% at 80% 0%, rgba(240,233,111,0.05) 0%, transparent 55%),
    radial-gradient(ellipse 100% 60% at 20% 100%, rgba(0,0,0,0.25) 0%, transparent 60%),
    linear-gradient(168deg, #17332C 0%, #122822 55%, #0E211C 100%);
  box-shadow: -12px 0 48px rgba(10,25,20,0.35), inset 1px 0 0 rgba(250,250,245,0.06);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 10;
}

.province-panel[hidden] {
  display: block;
  visibility: hidden;
  pointer-events: none;
}

.province-panel.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.panel-close {
  position: sticky;
  top: 0;
  float: right;
  margin: 16px 16px 0 0;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(250,250,245,0.15);
  background: rgba(14,33,28,0.65);
  backdrop-filter: blur(8px);
  border-radius: 50%;
  font-size: 20px;
  color: var(--cream);
  cursor: pointer;
  z-index: 2;
  transition: background 0.25s ease, color 0.25s ease;
}

.panel-close:hover {
  background: var(--sage);
  color: var(--pine);
}

.panel-photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: rgba(250,250,245,0.04) center/cover no-repeat;
  position: relative;
  overflow: hidden;
}

.panel-photo::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 70px;
  background: linear-gradient(0deg, #17332C 0%, transparent 100%);
  pointer-events: none;
}

.panel-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: slowZoom 20s ease-in-out infinite alternate;
}

@keyframes slowZoom {
  from { transform: scale(1); }
  to { transform: scale(1.06); }
}

.panel-content {
  padding: 28px 24px 40px;
}

.panel-ccaa {
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sage);
}

.panel-name {
  margin: 0 0 8px;
  font-family: "Tenor Sans", Georgia, serif;
  font-weight: 400;
  font-size: 28px;
  color: var(--cream);
  line-height: 1.15;
}

.panel-tagline {
  margin: 0 0 24px;
  color: rgba(250,250,245,0.7);
  font-size: 16px;
  line-height: 1.55;
  font-style: italic;
}

/* Panel stats grid — carved tiles */
.panel-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.panel-stat {
  padding: 14px;
  background: rgba(250,250,245,0.05);
  border: 1px solid rgba(250,250,245,0.08);
  border-radius: 8px;
  box-shadow: inset 0 1px 0 rgba(250,250,245,0.06), 0 2px 8px rgba(10,25,20,0.25);
}

.panel-stat-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(167,213,189,0.8);
  margin-bottom: 4px;
}

.panel-stat-value {
  display: block;
  font-family: "Tenor Sans", Georgia, serif;
  font-size: 18px;
  color: var(--cream);
}

/* What it costs */
.panel-costs {
  margin-bottom: 24px;
}

.panel-costs h3 {
  margin: 0 0 10px;
  font-family: "Tenor Sans", Georgia, serif;
  font-weight: 400;
  font-size: 18px;
  color: var(--cream);
}

.cost-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid rgba(250,250,245,0.1);
}

.cost-type {
  font-size: 14px;
  color: rgba(250,250,245,0.7);
}

.cost-price {
  font-family: "Tenor Sans", Georgia, serif;
  font-size: 17px;
  color: var(--yellow);
  white-space: nowrap;
}

.cost-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: rgba(250,250,245,0.45);
  line-height: 1.5;
}

/* International community meter */
.panel-community {
  margin-bottom: 24px;
}

.community-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.community-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(167,213,189,0.8);
}

.community-word {
  font-family: "Tenor Sans", Georgia, serif;
  font-size: 15px;
  color: var(--cream);
}

.community-bar {
  height: 4px;
  border-radius: 2px;
  background: rgba(250,250,245,0.12);
  overflow: hidden;
}

.community-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--sage) 0%, #CDEBDA 100%);
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* What almost nobody knows */
.panel-nobody {
  margin-bottom: 24px;
  padding: 18px;
  background: rgba(240,233,111,0.06);
  border: 1px solid rgba(240,233,111,0.14);
  border-radius: 10px;
}

.panel-nobody h3 {
  margin: 0 0 8px;
  font-family: "Tenor Sans", Georgia, serif;
  font-weight: 400;
  font-size: 16px;
  color: var(--yellow);
}

.panel-nobody p {
  margin: 0;
  font-size: 14px;
  color: rgba(250,250,245,0.85);
  line-height: 1.6;
}

/* Hidden gems */
.panel-gems h3 {
  margin: 0 0 12px;
  font-family: "Tenor Sans", Georgia, serif;
  font-weight: 400;
  font-size: 18px;
  color: var(--cream);
}

.gem-item {
  padding: 12px 0;
  border-top: 1px solid rgba(250,250,245,0.1);
}

.gem-item strong {
  display: block;
  font-size: 14px;
  color: var(--sage);
  margin-bottom: 2px;
}

.gem-item span {
  font-size: 14px;
  color: rgba(250,250,245,0.65);
  line-height: 1.5;
}

/* Panel insight */
.panel-insight {
  margin: 24px 0;
  padding: 18px;
  background: rgba(167,213,189,0.08);
  border-left: 3px solid var(--sage);
  border-radius: 0 8px 8px 0;
}

.panel-insight p {
  margin: 0;
  font-size: 14px;
  color: rgba(250,250,245,0.85);
  line-height: 1.55;
}

.panel-cta {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: 24px;
}

/* ─── RECOMMENDATION ENGINE ─── */
.explorer-match {
  background:
    radial-gradient(ellipse at 30% 70%, rgba(167,213,189,0.06) 0%, transparent 50%),
    var(--cream);
  padding-bottom: clamp(60px, 8vw, 100px);
}

.match-subtitle {
  max-width: 560px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.6;
}

.match-preferences {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
  max-width: 900px;
  margin: clamp(32px, 4vw, 48px) auto 0;
  padding: 0 clamp(20px, 4vw, 40px);
}

.pref-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 14px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  font-family: inherit;
  color: var(--pine);
  box-shadow: 0 1px 3px rgba(28,59,52,0.04);
}

.pref-card:hover {
  border-color: var(--sage);
  box-shadow: 0 4px 16px rgba(28,59,52,0.08);
  transform: translateY(-3px);
}

.pref-card[aria-pressed="true"] {
  background: var(--pine);
  border-color: var(--pine);
  color: var(--white);
  box-shadow: 0 6px 20px rgba(28,59,52,0.18);
  transform: translateY(-3px);
}

.pref-icon {
  width: 36px;
  height: 36px;
}

.pref-label {
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

/* ─── MATCH RESULTS ─── */
.match-results {
  max-width: 900px;
  margin: 48px auto 0;
  padding: 0 clamp(20px, 4vw, 40px);
  animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

.match-results-title {
  margin: 0 0 24px;
  font-family: "Tenor Sans", Georgia, serif;
  font-weight: 400;
  font-size: 22px;
  color: var(--pine);
}

.match-cards {
  display: grid;
  gap: 20px;
}

.match-card {
  display: grid;
  grid-template-columns: 200px 1fr;
  background: var(--white);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 2px 8px rgba(28,59,52,0.05);
  transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  cursor: pointer;
  animation: fadeUp 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.match-card:hover {
  box-shadow: 0 8px 28px rgba(28,59,52,0.10);
  transform: translateY(-2px);
}

.match-card-photo {
  aspect-ratio: 1;
  background: var(--line) center/cover no-repeat;
  overflow: hidden;
}

.match-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 6s ease;
}

.match-card:hover .match-card-photo img {
  transform: scale(1.05);
}

.match-card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.match-card-ccaa {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 4px;
}

.match-card-name {
  margin: 0 0 6px;
  font-family: "Tenor Sans", Georgia, serif;
  font-weight: 400;
  font-size: 22px;
  color: var(--pine);
}

.match-card-tagline {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.match-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.match-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pine);
  white-space: nowrap;
}

.match-bar {
  flex: 1;
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.match-bar-fill {
  height: 100%;
  background: var(--sage);
  border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.match-pct {
  font-family: "Tenor Sans", Georgia, serif;
  font-size: 18px;
  color: var(--pine);
  min-width: 38px;
  text-align: right;
}

/* ─── BEYOND THE OBVIOUS ─── */
.explorer-beyond {
  background: var(--white);
}

.beyond-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(16px, 2vw, 28px);
  max-width: 1100px;
  margin: clamp(32px, 4vw, 48px) auto 0;
  padding: 0 clamp(20px, 6vw, 76px);
}

.beyond-card {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.4s ease;
  animation: fadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.beyond-card:nth-child(2) { animation-delay: 0.1s; }
.beyond-card:nth-child(3) { animation-delay: 0.2s; }

.beyond-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 36px rgba(28,59,52,0.14);
}

.beyond-card-photo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: linear-gradient(135deg, #2a5a4e 0%, #1C3B34 100%);
}

.beyond-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 8s ease;
}

.beyond-card:hover .beyond-card-photo img {
  transform: scale(1.08);
}

.beyond-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(0deg, rgba(28,59,52,0.7) 0%, rgba(28,59,52,0.1) 50%, transparent 100%);
  transition: background 0.4s ease;
}

.beyond-card:hover .beyond-card-overlay {
  background: linear-gradient(0deg, rgba(28,59,52,0.8) 0%, rgba(28,59,52,0.15) 55%, transparent 100%);
}

.beyond-card-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 24px;
  color: var(--white);
  transform: translateY(4px);
  transition: transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.beyond-card:hover .beyond-card-text {
  transform: translateY(0);
}

.beyond-card-name {
  margin: 0 0 4px;
  font-family: "Tenor Sans", Georgia, serif;
  font-weight: 400;
  font-size: 22px;
}

.beyond-card-line {
  margin: 0;
  font-size: 14px;
  opacity: 0.85;
  line-height: 1.45;
}

/* ─── ANIMATIONS ─── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ─── RESPONSIVE ─── */
@media (max-width: 980px) {
  .province-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 70vh;
    transform: translateY(100%);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -12px 48px rgba(10,25,20,0.4), inset 0 1px 0 rgba(250,250,245,0.08);
  }

  .province-panel.is-open {
    transform: translateY(0);
  }

  .match-card {
    grid-template-columns: 140px 1fr;
  }

  .beyond-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .explorer-hero {
    min-height: 45vh;
    align-items: center;
  }

  .explorer-hero h1 {
    font-size: 32px;
  }

  .match-preferences {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
  }

  .pref-card {
    padding: 16px 10px;
  }

  .pref-icon {
    width: 28px;
    height: 28px;
  }

  .pref-label {
    font-size: 11px;
  }

  .match-card {
    grid-template-columns: 1fr;
  }

  .match-card-photo {
    aspect-ratio: 16 / 9;
  }

  .beyond-grid {
    grid-template-columns: 1fr;
  }

  .beyond-card {
    aspect-ratio: 4 / 3;
  }

  .province-panel {
    height: 80vh;
  }

  .panel-stats {
    grid-template-columns: 1fr;
  }
}
