/*
 * Pura Rica — final visual hardening layer
 *
 * Loaded by site-foundation.js after the page and feature styles. The project
 * has several historical CSS layers; this file keeps their visual language but
 * gives every public page one predictable set of overflow, contrast and mobile
 * rules. No content or live value is invented here.
 */

:root {
  --visual-ink: #173c2e;
  --visual-copy: #53675a;
  --visual-muted: #65766a;
  --visual-paper: #f8f6ee;
  --visual-line: #d4dfd2;
  --visual-focus: #f0c766;
}

html,
body {
  min-width: 320px;
  max-width: 100%;
  overflow-x: clip;
}

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

main,
section,
article,
aside,
header,
footer,
div,
form,
fieldset {
  min-width: 0;
}

img,
picture,
video,
canvas,
svg,
iframe {
  max-width: 100%;
}

img,
picture,
video,
canvas {
  height: auto;
}

h1,
h2,
h3,
h4,
p,
small,
strong,
em,
label,
button,
a,
output {
  min-width: 0;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--visual-focus) !important;
  outline-offset: 3px !important;
}

/* Shared hero contrast: the previous cascade left body copy grey on green. */
.home-hero .hero-intro,
.page-hero .hero-intro,
.page-hero .hero-notes,
.page-hero .hero-notes span,
.home-hero .hero-notes,
.home-hero .hero-notes span,
.studio-hero .hero-intro,
.studio-hero .hero-notes,
.studio-hero .hero-notes span {
  color: #dce8dc !important;
}

.home-hero .hero-notes b,
.page-hero .hero-notes b,
.studio-hero .hero-notes b {
  color: #f5d77f !important;
}

.home-hero .hero-caption,
.home-hero .hero-caption strong,
.page-hero .hero-caption,
.page-hero .hero-caption strong {
  color: #fff !important;
  text-shadow: 0 2px 14px rgba(5, 26, 17, .82);
}

.hero-actions,
.tour-pres-actions,
.stage-tour-bar,
.detail-pagination,
.site-footer,
.footer-meta,
.booking-links,
.lodging-actions,
.guide-actions-row,
.experience-links {
  min-width: 0;
  flex-wrap: wrap;
}

.hero-actions .button,
.tour-pres-actions .button,
.stage-tour-bar .button,
.detail-pagination .button,
.lodging-actions a,
.guide-actions-row a,
.experience-links > * {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

.experience-action-icon {
  position: relative;
  display: inline-block;
  flex: 0 0 12px;
  width: 12px;
  height: 12px;
}

.experience-action-icon.is-plus::before,
.experience-action-icon.is-plus::after {
  content: '';
  position: absolute;
  top: 5px;
  left: 1px;
  width: 10px;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
}

.experience-action-icon.is-plus::after {
  transform: rotate(90deg);
}

.experience-action-icon.is-check::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 1px;
  width: 8px;
  height: 5px;
  border-bottom: 1.8px solid currentColor;
  border-left: 1.8px solid currentColor;
  transform: rotate(-45deg);
}

/* Headers and common section heads stay readable at the in-between widths. */
.site-header {
  min-width: 0;
}

.site-header .brand,
.site-header .main-nav,
.site-header .header-cta,
.section-heading > *,
.section-heading > div {
  min-width: 0;
}

.section-heading h2,
.section-heading h3 {
  max-width: 100%;
}

.section-heading > p {
  color: var(--visual-copy);
}

/* Cards: consistent media blocks, no stretched inline images or content leaks. */
:where(.route-card,
  .activity-card,
  .stage-card,
  .walk-card,
  .lodging-card,
  .fauna-card,
  .guide-pro-card,
  .official-card,
  .program-card,
  .official-region-card,
  .experience-card,
  .flight-offer-card,
  .home-page-card) {
  min-width: 0;
  overflow: hidden;
}

:where(.activity-image,
  .stage-card-image,
  .walk-image,
  .lodging-image,
  .fauna-image,
  .experience-media,
  .official-card,
  .program-card) {
  min-width: 0;
  background-color: #dfe9dc;
}

:where(.activity-info,
  .stage-card-info,
  .walk-info,
  .lodging-info,
  .fauna-info,
  .experience-body,
  .official-card,
  .program-card) {
  min-width: 0;
}

:where(.activity-info p,
  .stage-card-info p,
  .walk-info p,
  .lodging-info p,
  .fauna-info p,
  .experience-description,
  .official-card p,
  .program-card p) {
  color: var(--visual-copy) !important;
}

.activity-card .activity-image-gallery,
.experience-media,
.stage-activity-image,
.stage-gallery-main,
.gallery-viewer,
.video-poster,
.detail-video {
  isolation: isolate;
}

/* Keep metadata and status chips inside their cards, including long source names. */
:where(.activity-tag,
  .activity-duration,
  .activity-place,
  .activity-meta,
  .stage-card-meta,
  .walk-meta,
  .lodging-meta,
  .fauna-meta,
  .experience-meta,
  .experience-disclosure,
  .api-fallback,
  .data-status-note,
  .detail-source,
  .status-chip) {
  max-width: 100%;
  overflow-wrap: anywhere;
}

/* Native controls: one visual treatment, no surprise minimum width. */
input,
select,
textarea,
button {
  max-width: 100%;
  box-sizing: border-box;
}

select,
input[type='date'],
input[type='search'],
input[type='number'],
input[type='text'] {
  min-width: 0;
}

/* Official regional cards were the main raw-data visual failure. */
.official-regions-section > .section-heading {
  margin-bottom: 30px;
}

#official-regions-grid {
  display: grid;
  gap: 20px;
}

.official-region-card {
  margin-bottom: 0 !important;
  border-radius: 18px !important;
  border-color: var(--visual-line) !important;
  box-shadow: 0 8px 0 #e2eadf, 0 18px 30px rgba(18, 57, 39, .06);
}

.official-region-card > div:first-child {
  min-height: 210px;
  height: auto !important;
  padding: 24px !important;
}

.official-region-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  background-position: center;
  background-size: cover;
  color: #fff;
}

.official-region-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.official-region-hero > * {
  position: relative;
  z-index: 1;
}

.official-region-hero > span {
  color: #f5b08e;
  font: 10px var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.official-region-hero h3 {
  margin: 0;
  color: #fff !important;
  font-size: clamp(28px, 4vw, 40px);
  line-height: .98;
}

.official-region-hero p {
  margin: 0;
  color: #e3ebdf !important;
  font-size: 13px;
}

.official-region-card > div:nth-child(2) {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
  align-items: start;
  padding: 24px !important;
}

.official-region-card h3 {
  overflow-wrap: anywhere;
}

.official-region-card h4 {
  color: var(--visual-ink) !important;
}

.official-region-card p {
  max-width: 62ch;
  line-height: 1.55 !important;
}

.official-region-body > div {
  min-width: 0;
}

.official-region-body h4 {
  margin: 0 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--visual-line);
  font: 700 10px var(--mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.official-region-attractions {
  display: grid;
  gap: 12px;
}

.official-region-attractions strong {
  display: block;
  color: var(--visual-ink);
  font-size: 13px;
}

.official-region-attractions p {
  display: -webkit-box;
  margin: 3px 0 0;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  color: var(--visual-copy) !important;
  font-size: 12px;
}

.official-region-protected {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.official-region-protected span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 6px 8px;
  border: 1px solid #d5e0d3;
  border-radius: 999px;
  background: #eef3eb;
  color: #405748;
  font: 10px var(--mono);
  overflow-wrap: anywhere;
}

.official-region-card .region-source-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-items: center;
  margin-top: 18px;
}

.official-region-card .region-source-actions .button {
  min-width: 0;
}

/* Destination and activity detail pages: stable two-column rhythm. */
.page-detail-columns,
.detail-page-hero {
  min-width: 0;
}

.page-detail-columns > *,
.detail-page-hero > * {
  min-width: 0;
  max-width: 100%;
}

.page-detail-card-grid,
.stage-activity-grid,
.detail-fact-grid,
.flight-offers-grid,
.program-grid,
.official-programs {
  min-width: 0;
}

.page-detail-card-actions {
  align-items: stretch;
}

.page-detail-card-actions .button {
  min-width: 0;
}

/* Loading and empty states need a visible surface instead of inheriting the page. */
:where(.page-loading,
  .api-loading,
  .api-fallback,
  .map-results-empty,
  .empty-results) {
  color: var(--visual-copy) !important;
  background: var(--visual-paper);
  border: 1px solid var(--visual-line);
  border-radius: 12px;
}

.map-results-empty,
.api-loading,
.api-fallback,
.page-loading {
  padding: 18px;
  line-height: 1.5;
}

/* Video poster is an identifiable player, never an opaque click trap. */
.video-poster {
  min-height: 260px;
  overflow: hidden;
  background: #0b251b !important;
}

.video-poster > img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 260px;
  object-fit: cover;
}

.video-poster-footer {
  min-width: 0;
}

.video-poster-footer > * {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Footer is content, not a one-line flex trap. */
.site-footer {
  align-items: center;
}

.site-footer > * {
  min-width: 0;
}

.site-footer p {
  max-width: 42ch;
  line-height: 1.5;
}

/* Fixed overlays respect mobile browser safe areas. */
.toast {
  max-width: min(520px, calc(100vw - 28px));
  overflow-wrap: anywhere;
  bottom: max(18px, env(safe-area-inset-bottom));
}

.detail-modal,
.stage-lightbox,
.fauna-lightbox,
.postcard-lightbox {
  box-sizing: border-box;
}

@media (max-width: 980px) {
  .official-region-card > div:nth-child(2) {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 24px !important;
  }

  .official-region-card .region-source-actions {
    margin-top: 12px;
  }
}

@media (max-width: 760px) {
  .site-header {
    gap: 12px !important;
  }

  .site-header .brand {
    max-width: calc(100% - 58px);
  }

  .site-header .brand > span:last-child {
    min-width: 0;
  }

  .site-header .brand strong,
  .site-header .brand small {
    white-space: nowrap;
  }

  .page-hero .hero-intro,
  .home-hero .hero-intro,
  .studio-hero .hero-intro {
    font-size: 15px;
    line-height: 1.6;
  }

  .page-hero .hero-notes,
  .home-hero .hero-notes,
  .studio-hero .hero-notes {
    gap: 10px 16px;
  }

  .official-region-card > div:first-child {
    min-height: 190px;
    padding: 20px !important;
  }

  .official-region-card > div:nth-child(2) {
    padding: 20px !important;
  }

  .official-region-card .region-source-actions .button {
    width: 100%;
  }

  .stage-activity-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .detail-pagination {
    align-items: stretch;
  }

  .detail-pagination .button {
    flex: 1 1 45%;
  }

  .video-poster,
  .video-poster > img {
    min-height: 220px;
  }

  .video-poster-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
  }

  .video-poster-footer small {
    text-align: left;
  }
}

@media (max-width: 520px) {
  .hero-actions .button,
  .tour-pres-actions .button,
  .stage-tour-bar .button {
    width: 100%;
  }

  .section-heading h2 {
    font-size: clamp(30px, 9vw, 42px);
  }

  .official-region-card h3 {
    font-size: clamp(26px, 8vw, 34px) !important;
  }

  .page-detail-card-actions,
  .stage-activity-actions,
  .lodging-actions,
  .guide-actions-row,
  .experience-links {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .page-detail-card-actions .button,
  .stage-activity-actions .button,
  .lodging-actions a,
  .guide-actions-row a,
  .experience-links > * {
    width: 100%;
  }

  .detail-pagination .button {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
