/* IslandTravelAtlas card and panel typography
 * Keeps page-level hierarchy strong while preventing long headings from
 * overwhelming constrained cards, split panels, and narrow mobile layouts.
 */

/* Reduce the global section-heading ceiling without shrinking the hero. */
body.rf-theme main h2 {
  font-size: clamp(2rem, 3.35vw, 3.25rem);
  line-height: 1.08;
  text-wrap: balance;
  overflow-wrap: break-word;
}

body.rf-theme main h3,
body.rf-theme main h4 {
  text-wrap: balance;
  overflow-wrap: break-word;
}

/* Grid children must be allowed to shrink instead of forcing overflow. */
.rf-route-method-grid > *,
.rf-feature-grid > *,
.rf-latest-grid > *,
.rf-planning-grid > *,
.rf-section-heading > *,
.rf-library-hero-grid > *,
.rf-destination-grid > * {
  min-width: 0;
}

/* Homepage route-method panel: this is the specific oversized example. */
body.rf-theme .rf-route-method h2 {
  max-width: 20ch;
  margin-bottom: .9rem;
  font-size: clamp(1.9rem, 2.65vw, 2.65rem);
  line-height: 1.12;
}

body.rf-theme .rf-route-method > .rf-shell > div:first-child > p:not(.rf-kicker) {
  max-width: 48ch;
  margin: 0;
  font-size: clamp(.96rem, 1vw, 1.04rem);
  line-height: 1.68;
  text-wrap: pretty;
}

/* Homepage cards and split panels. */
body.rf-theme .rf-feature-story h2 {
  max-width: 25ch;
  font-size: clamp(1.85rem, 2.7vw, 2.7rem);
  line-height: 1.1;
}

body.rf-theme .rf-tool-panel h2 {
  max-width: 22ch;
  font-size: clamp(1.65rem, 2.25vw, 2.25rem);
  line-height: 1.14;
}

body.rf-theme .rf-latest-grid h2,
body.rf-theme .rf-planning-section h2 {
  max-width: 22ch;
  font-size: clamp(1.8rem, 2.55vw, 2.55rem);
  line-height: 1.12;
}

body.rf-theme .rf-final-cta h2 {
  font-size: clamp(2rem, 3.1vw, 3rem);
}

/* Destination image cards. */
body.rf-theme .rf-destination-content strong {
  max-width: 20ch;
  font-size: clamp(1.75rem, 2.7vw, 2.7rem);
  line-height: 1.06;
  text-wrap: balance;
  overflow-wrap: break-word;
}

body.rf-theme .rf-destination-content p {
  max-width: 58ch;
  font-size: clamp(.89rem, .95vw, .96rem);
}

/* Searchable guide-library cards. */
body.rf-theme .rf-library-item strong {
  font-size: clamp(1.08rem, 1.35vw, 1.24rem);
  line-height: 1.3;
  text-wrap: balance;
  overflow-wrap: break-word;
}

body.rf-theme .rf-library-item p {
  font-size: .92rem;
  line-height: 1.58;
  text-wrap: pretty;
}

/* Existing destination, article-sidebar, and commercial cards. */
body.rf-theme :where(
  .rf-destination-hub [class*="hub-card"],
  .rf-destination-hub [class*="guide-card"],
  .rf-guide-article [class*="sidebar-widget"],
  .rf-commercial-page [class*="partner-card"],
  .rf-commercial-page [class*="decision-card"]
) :where(h2, h3) {
  margin-top: 0;
  font-size: clamp(1.18rem, 1.7vw, 1.55rem) !important;
  line-height: 1.24 !important;
  text-wrap: balance;
  overflow-wrap: break-word;
}

body.rf-theme :where(
  .rf-destination-hub [class*="hub-card"],
  .rf-destination-hub [class*="guide-card"],
  .rf-guide-article [class*="sidebar-widget"],
  .rf-commercial-page [class*="partner-card"],
  .rf-commercial-page [class*="decision-card"]
) p {
  font-size: .94rem;
  line-height: 1.62;
  text-wrap: pretty;
}

/* Prevent labels and action rows from enlarging card width. */
.rf-method-list span,
.rf-planning-link div,
.rf-library-item,
.rf-destination-content,
.rf-feature-story > div,
.rf-tool-panel {
  min-width: 0;
}

.rf-method-list small,
.rf-planning-link p,
.rf-library-item p,
.rf-destination-content p {
  overflow-wrap: break-word;
}

@media (max-width: 900px) {
  body.rf-theme main h2 {
    font-size: clamp(1.85rem, 6.2vw, 2.65rem);
  }

  body.rf-theme .rf-route-method h2,
  body.rf-theme .rf-planning-section h2,
  body.rf-theme .rf-latest-grid h2 {
    max-width: 26ch;
  }

  .rf-route-method-grid,
  .rf-feature-grid,
  .rf-latest-grid,
  .rf-planning-grid {
    gap: clamp(2rem, 5vw, 3rem);
  }
}

@media (max-width: 680px) {
  body.rf-theme main h2 {
    font-size: clamp(1.72rem, 8.2vw, 2.25rem);
    line-height: 1.12;
  }

  body.rf-theme .rf-route-method h2,
  body.rf-theme .rf-feature-story h2,
  body.rf-theme .rf-tool-panel h2,
  body.rf-theme .rf-latest-grid h2,
  body.rf-theme .rf-planning-section h2 {
    max-width: none;
    font-size: clamp(1.55rem, 7.2vw, 2rem);
    line-height: 1.16;
  }

  body.rf-theme .rf-route-method > .rf-shell > div:first-child > p:not(.rf-kicker) {
    font-size: .95rem;
    line-height: 1.65;
  }

  .rf-feature-story > div,
  .rf-tool-panel,
  .rf-destination-content {
    padding: 1.4rem;
  }

  body.rf-theme .rf-destination-content strong {
    font-size: clamp(1.55rem, 7vw, 2rem);
  }

  body.rf-theme .rf-library-item strong {
    font-size: 1.08rem;
  }
}
