/* ============================================================
   Latin Travel — Country Guide Pages
   Loaded on country pages only (costa-rica.html, peru.html, etc.).
   Depends on latin-travel.css for tokens, nav, footer, typography.
   ============================================================ */

/* ============================================================
   COUNTRY HERO
   Spacing fix: min-height reduced from 55vh -> 38vh
   to tighten the gap between the nav and the country title.
   ============================================================ */
.country-hero {
  position: relative;
  min-height: 38vh;
  display: flex;
  align-items: flex-end;
  padding: 7rem 3rem 1.5rem;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 20%, rgba(184,92,42,0.18), transparent 35%),
    linear-gradient(135deg, #0a0a0a 0%, #141414 60%, #1c1c1c 100%);
}
.country-hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image: var(--hero-bg, url("../images/machu-picchu.jpg"));
  background-size: cover;
  background-position: center;
  opacity: 0.18;
  filter: grayscale(20%);
  transform: scale(1.05);
}
.country-hero::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(10,10,10,1), rgba(10,10,10,0.45));
}
.country-hero-content { position: relative; z-index: 2; max-width: 980px; }
.country-title {
  font-family: var(--font-display);
  font-size: clamp(4.5rem, 10vw, 9rem);
  line-height: 0.9;
  letter-spacing: 0.04em;
  color: #ffffff;
  margin-bottom: 1.25rem;
}
.country-title em { color: var(--gold); font-style: normal; }
.country-subtitle {
  font-family: var(--font-serif);
  font-size: clamp(1.25rem, 2.2vw, 1.65rem);
  font-style: italic;
  color: rgba(240, 235, 225, 0.82);
  line-height: 1.55;
  max-width: 720px;
}

/* ============================================================
   COUNTRY BODY WRAP
   Spacing fix: padding-top reduced from 6rem -> 4rem.
   Combined with the hero change above, total gap drops from
   ~176px (11rem) to ~112px (7rem) — readable, not cavernous.
   ============================================================ */
.country-wrap { background: var(--black); padding: 2rem 3rem 6rem; }
.country-grid {
  display: grid;
  grid-template-columns: minmax(220px, 300px) 1fr;
  gap: 4rem;
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}

/* SIDEBAR */
.country-sidebar {
  position: sticky;
  top: 110px;
  border: 1px solid var(--border-subtle);
  background: var(--charcoal);
  padding: 1.5rem;
}
.country-sidebar h2 {
  font-family: var(--font-display);
  color: var(--gold);
  letter-spacing: 0.08em;
  font-size: 1.35rem;
  margin-bottom: 1rem;
}
.country-sidebar ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}
.country-sidebar a {
  color: var(--mist);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: color 0.2s;
}
.country-sidebar a:hover { color: var(--gold); }

/* CONTENT */
.country-content section {
  margin-bottom: 5rem;
  scroll-margin-top: 120px;
}
.country-content section:last-child { margin-bottom: 0; }
.country-content .lead {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  line-height: 1.75;
  color: var(--mist);
  margin-bottom: 1.5rem;
}
.country-content p {
  font-size: 0.98rem;
  line-height: 1.85;
  color: var(--mist);
  margin-bottom: 1.25rem;
}
.country-content strong { color: var(--white); font-weight: 500; }

/* CARD GRIDS */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  margin-top: 2rem;
}
.info-card {
  background: var(--charcoal);
  padding: 2rem;
  min-height: 190px;
}
.info-card h3 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  letter-spacing: 0.06em;
  color: var(--white);
  margin-bottom: 0.75rem;
}
.info-card p, .info-card li {
  font-size: 0.88rem;
  line-height: 1.7;
  color: var(--mist);
}
.info-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.info-card li::before { content: "— "; color: var(--gold); }

/* FACTS */
.fact-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  margin-top: 2rem;
}
.fact-item { background: var(--charcoal); padding: 1.4rem; }
.fact-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 0.45rem;
}
.fact-value {
  color: var(--mist);
  font-size: 0.9rem;
  line-height: 1.65;
}

/* CALLOUT */
.callout {
  border-left: 3px solid var(--gold);
  background: rgba(201,168,76,0.07);
  padding: 1.5rem 1.75rem;
  margin: 2rem 0;
}
.callout p {
  margin: 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
}

/* ============================================================
   MAP (Leaflet)
   ============================================================ */
.country-map {
  width: 100%;
  height: 520px;
  margin-top: 2rem;
  border: 1px solid var(--border-subtle);
  background: #0e0e0e;
}
.country-map-caption {
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--mist);
  opacity: 0.6;
  margin-top: 1rem;
}

/* Custom gold marker */
.li-marker-wrap { background: transparent; border: none; }
.li-marker {
  width: 14px; height: 14px;
  background: var(--gold);
  border: 2px solid var(--black);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(201,168,76,0.55);
  transition: transform 0.2s;
}
.li-marker:hover { transform: scale(1.2); }

/* Leaflet UI overrides */
.leaflet-container { background: #0e0e0e; font-family: var(--font-body); }
.leaflet-popup-content-wrapper {
  background: var(--charcoal);
  color: var(--cream);
  border: 1px solid var(--gold);
  border-radius: 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.leaflet-popup-content {
  margin: 0.85rem 1.1rem;
  font-family: var(--font-body);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--mist);
}
.leaflet-popup-content strong {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  color: var(--gold);
  font-size: 1rem;
  font-weight: 400;
  display: block;
  margin-bottom: 0.25rem;
}
.leaflet-popup-tip {
  background: var(--charcoal);
  border: 1px solid var(--gold);
}
.leaflet-popup-close-button { color: var(--mist) !important; }
.leaflet-popup-close-button:hover { color: var(--gold) !important; }
.leaflet-control-attribution {
  background: rgba(10,10,10,0.7) !important;
  color: var(--mist) !important;
  font-size: 0.6rem !important;
  letter-spacing: 0.05em;
}
.leaflet-control-attribution a { color: var(--gold) !important; }
.leaflet-control-zoom a {
  background: var(--charcoal) !important;
  color: var(--mist) !important;
  border: 1px solid var(--border-subtle) !important;
}
.leaflet-control-zoom a:hover {
  background: var(--dark) !important;
  color: var(--gold) !important;
}

@media (max-width: 768px) {
  .country-map { height: 380px; }
}

/* CTA BAND */
.cta-band {
  background: var(--dark);
  padding: 4rem 3rem;
  text-align: center;
  border-top: 1px solid var(--border-subtle);
}
.cta-band p {
  color: var(--mist);
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-style: italic;
  margin: 0 auto 1.75rem;
  max-width: 680px;
  line-height: 1.6;
}

/* ============================================================
   COUNTRY PHOTO STRIP
   Three equal images at the top of the article content.
   The first image (photo 1) is also used as the og:image.
   ============================================================ */
.country-photo-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
  margin-bottom: 3rem;
}
.photo-strip-item {
  margin: 0;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  background: var(--charcoal);
  cursor: pointer;
  position: relative;
}
/* Zoom hint on hover */
.photo-strip-item::after {
  content: "";
  position: absolute; inset: 0;
  background: rgba(201,168,76,0.0);
  transition: background 0.25s;
  pointer-events: none;
}
.photo-strip-item:hover::after {
  background: rgba(201,168,76,0.12);
}
.photo-strip-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s ease, opacity 0.3s ease;
  opacity: 0.88;
}
.photo-strip-item:hover img {
  transform: scale(1.04);
  opacity: 1;
}

/* ============================================================
   MOBILE
   ============================================================ */
@media (max-width: 900px) {
  .country-grid { grid-template-columns: 1fr; gap: 2rem; }
  .country-sidebar { position: static; }
}
@media (max-width: 768px) {
  .country-hero { padding: 6rem 1.5rem 2.5rem; min-height: 50vh; }
  .country-wrap { padding: 3rem 1.5rem 4rem; }
  .cta-band { padding: 4rem 1.5rem; }
  .country-photo-strip { grid-template-columns: 1fr; gap: 0.5rem; }
}

/* ============================================================
   LIGHTBOX
   ============================================================ */
.li-lightbox {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.li-lightbox.li-lb-active {
  opacity: 1; visibility: visible;
}
.li-lb-backdrop {
  position: absolute; inset: 0;
  background: rgba(10,10,10,0.96);
  cursor: zoom-out;
}
.li-lb-stage {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  max-width: 90vw; max-height: 90vh;
  padding: 0 3.5rem;
}
.li-lb-img {
  max-width: 100%; max-height: 80vh;
  object-fit: contain;
  display: block;
  opacity: 0;
  transition: opacity 0.3s ease;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.li-lb-img.li-lb-loaded { opacity: 1; }

.li-lb-caption {
  margin-top: 1rem;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.88rem;
  color: var(--mist);
  opacity: 0.6;
  text-align: center;
  max-width: 600px;
  line-height: 1.5;
}
.li-lb-counter {
  margin-top: 0.4rem;
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.6;
}

/* Close button */
.li-lb-close {
  position: absolute; top: 1.25rem; right: 1.5rem; z-index: 2;
  background: none; border: 1px solid rgba(255,255,255,0.15);
  color: var(--mist); width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
}
.li-lb-close:hover { border-color: var(--gold); color: var(--gold); }

/* Prev / Next */
.li-lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  background: none; border: 1px solid rgba(255,255,255,0.15);
  color: var(--mist); width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
}
.li-lb-nav:hover { border-color: var(--gold); color: var(--gold); }
.li-lb-prev { left: 1.25rem; }
.li-lb-next { right: 1.25rem; }

@media (max-width: 768px) {
  .li-lb-stage { padding: 0 2.5rem; max-width: 95vw; }
  .li-lb-prev { left: 0.5rem; }
  .li-lb-next { right: 0.5rem; }
}
