/* ==========================================================
   IslandTravelAtlas Readability and Widget System V1

   Purpose:
   - Fix text contrast on known dark surfaces
   - Control oversized dark-section headings
   - Preserve all existing page layouts
   - Style embedded live-result workspaces
   ========================================================== */

:root {
  --ita-rw-ink: #14271f;
  --ita-rw-text: #41574d;
  --ita-rw-muted: #687a72;

  --ita-rw-page: #f4f8f6;
  --ita-rw-surface: #ffffff;
  --ita-rw-soft: #edf5f2;
  --ita-rw-border: #d8e5df;

  --ita-rw-accent: #078675;
  --ita-rw-accent-hover: #066d60;

  --ita-rw-dark: #092d25;
  --ita-rw-dark-two: #12483b;
  --ita-rw-white: #ffffff;
  --ita-rw-on-dark: #edf7f3;
  --ita-rw-on-dark-muted: #d2e5dd;

  --ita-rw-shadow:
    0 18px 48px rgba(16, 49, 39, 0.10);
}

/* ==========================================================
   HOMEPAGE DARK TEXT
   ========================================================== */

/* Product homepage final call to action */

html body.ita-home-v3 .hp-final {
  background:
    linear-gradient(
      135deg,
      var(--ita-rw-dark),
      var(--ita-rw-dark-two)
    ) !important;

  color: var(--ita-rw-on-dark) !important;
}

html body.ita-home-v3 .hp-final h2 {
  max-width: 760px;

  color: var(--ita-rw-white) !important;

  font-size:
    clamp(1.85rem, 3.4vw, 2.75rem) !important;

  line-height: 1.1 !important;
  letter-spacing: -0.04em !important;
}

html body.ita-home-v3 .hp-final p {
  color: var(--ita-rw-on-dark-muted) !important;

  font-size: 1rem !important;
  line-height: 1.65 !important;
}

html body.ita-home-v3 .hp-final .hp-button {
  border-color: var(--ita-rw-white) !important;

  background: var(--ita-rw-white) !important;
  color: var(--ita-rw-dark) !important;
}

/* Previous homepage versions remain readable if still cached */

html body.ita-home-v2 .ita-v2-final,
html body.rf-home-page .rf-final-cta {
  background:
    linear-gradient(
      135deg,
      var(--ita-rw-dark),
      var(--ita-rw-dark-two)
    ) !important;

  color: var(--ita-rw-on-dark) !important;
}

html body.ita-home-v2
.ita-v2-final
:is(h1, h2, h3, strong),
html body.rf-home-page
.rf-final-cta
:is(h1, h2, h3, strong) {
  color: var(--ita-rw-white) !important;
}

html body.ita-home-v2
.ita-v2-final
:is(p, span, small),
html body.rf-home-page
.rf-final-cta
:is(p, span, small) {
  color: var(--ita-rw-on-dark-muted) !important;
  opacity: 1 !important;
}

html body.ita-home-v2 .ita-v2-final h2,
html body.rf-home-page .rf-final-cta h2 {
  font-size:
    clamp(1.85rem, 3.5vw, 2.9rem) !important;

  line-height: 1.1 !important;
}

/* Older featured-route treatment */

html body.ita-home-v2 .ita-v2-feature-content,
html body.rf-home-page .rf-feature-story > div {
  background:
    rgba(7, 31, 25, 0.90) !important;

  color: var(--ita-rw-on-dark) !important;
}

html body.ita-home-v2
.ita-v2-feature-content
:is(h1, h2, h3, strong, a),
html body.rf-home-page
.rf-feature-story > div
:is(h1, h2, h3, strong, a) {
  color: var(--ita-rw-white) !important;
}

html body.ita-home-v2
.ita-v2-feature-content
:is(p, span, small),
html body.rf-home-page
.rf-feature-story > div
:is(p, span, small) {
  color: var(--ita-rw-on-dark-muted) !important;
  opacity: 1 !important;
}

html body.ita-home-v2 .ita-v2-feature-content h2,
html body.rf-home-page .rf-feature-story h2 {
  font-size:
    clamp(1.65rem, 3vw, 2.45rem) !important;

  line-height: 1.14 !important;
}

/* ==========================================================
   GUIDES PAGE
   ========================================================== */

html body.rf-library-page .rf-library-hero {
  color: var(--ita-rw-on-dark) !important;
}

html body.rf-library-page
.rf-library-hero
:is(h1, h2, h3, strong, a) {
  color: var(--ita-rw-white) !important;
  opacity: 1 !important;
}

html body.rf-library-page
.rf-library-hero
:is(p, span, small, label, .rf-kicker, .breadcrumbs) {
  color: var(--ita-rw-on-dark) !important;
  opacity: 1 !important;
}

html body.rf-library-page
.rf-library-hero
.rf-search {
  background: var(--ita-rw-white) !important;
  color: var(--ita-rw-ink) !important;
}

html body.rf-library-page
.rf-library-hero
.rf-search
:is(input, b) {
  color: var(--ita-rw-ink) !important;
}

html body.rf-library-page
.rf-library-hero
.rf-search
input::placeholder {
  color: var(--ita-rw-muted) !important;
  opacity: 1 !important;
}

/* Destination-card overlay and actual text */

html body.ita-site
.rf-destination-card
.rf-destination-shade {
  background:
    linear-gradient(
      180deg,
      rgba(4, 18, 14, 0.06) 0%,
      rgba(4, 18, 14, 0.46) 40%,
      rgba(4, 18, 14, 0.94) 100%
    ) !important;

  opacity: 1 !important;
}

html body.ita-site
.rf-destination-card
.rf-destination-content {
  color: var(--ita-rw-white) !important;

  text-shadow:
    0 2px 10px rgba(0, 0, 0, 0.72) !important;
}

html body.ita-site
.rf-destination-card
.rf-destination-content
:is(small, strong, p, em, span) {
  color: var(--ita-rw-white) !important;
  opacity: 1 !important;
}

/* Plan-by-decision section */

html body.ita-site .rf-planning-section,
html body.ita-site .rf-route-method {
  color: var(--ita-rw-on-dark) !important;
}

html body.ita-site
.rf-planning-section
> .rf-shell
> div:first-child
:is(h1, h2, h3, p, .rf-kicker),
html body.ita-site
.rf-route-method
> .rf-shell
> div:first-child
:is(h1, h2, h3, p, .rf-kicker) {
  color: var(--ita-rw-on-dark) !important;
  opacity: 1 !important;
}

html body.ita-site
.rf-planning-section
.rf-planning-link
:is(strong, span, em) {
  color: var(--ita-rw-white) !important;
  opacity: 1 !important;
}

html body.ita-site
.rf-planning-section
.rf-planning-link p {
  color: var(--ita-rw-on-dark-muted) !important;
  opacity: 1 !important;
}

html body.ita-site
.rf-route-method
.rf-method-list
:is(strong, b) {
  color: var(--ita-rw-white) !important;
}

html body.ita-site
.rf-route-method
.rf-method-list
:is(small, p, span) {
  color: var(--ita-rw-on-dark-muted) !important;
  opacity: 1 !important;
}

/* ==========================================================
   SHARED NAVIGATION AND FOOTER
   ========================================================== */

html body.ita-site .pm-mega-intro {
  color: var(--ita-rw-on-dark) !important;
}

html body.ita-site
.pm-mega-intro
:is(h1, h2, h3, strong, a) {
  color: var(--ita-rw-white) !important;
  opacity: 1 !important;
}

html body.ita-site
.pm-mega-intro
:is(p, span, small) {
  color: var(--ita-rw-on-dark-muted) !important;
  opacity: 1 !important;
}

html body.ita-site .pm-footer {
  background: #082820 !important;
  color: var(--ita-rw-on-dark) !important;
}

html body.ita-site
.pm-footer
:is(h1, h2, h3, h4, strong, b, a) {
  color: var(--ita-rw-white) !important;
  opacity: 1 !important;
}

html body.ita-site
.pm-footer
:is(p, span, small, button) {
  color: var(--ita-rw-on-dark-muted) !important;
  opacity: 1 !important;
}

/* ==========================================================
   OTHER DARK SURFACES
   ========================================================== */

html body.ita-site
:is(
  .hero-dark,
  .dark-section,
  .section-dark,
  .surface-dark,
  [data-theme="dark"]
) {
  color: var(--ita-rw-on-dark) !important;
}

html body.ita-site
:is(
  .hero-dark,
  .dark-section,
  .section-dark,
  .surface-dark,
  [data-theme="dark"]
)
:is(h1, h2, h3, h4, strong, b, a) {
  color: var(--ita-rw-white) !important;
  opacity: 1 !important;
}

html body.ita-site
:is(
  .hero-dark,
  .dark-section,
  .section-dark,
  .surface-dark,
  [data-theme="dark"]
)
:is(p, li, span, small, label, dt, dd) {
  color: var(--ita-rw-on-dark-muted) !important;
  opacity: 1 !important;
}

/* Dark tool section heading, but not its white cards */

html body.ita-site
.ita-tool-section
> .ita-tool-shell
> .ita-section-heading
:is(h1, h2, h3, p, .ita-tool-eyebrow) {
  color: var(--ita-rw-on-dark) !important;
  opacity: 1 !important;
}

/* ==========================================================
   LIVE RESULTS COMPONENT
   ========================================================== */

html body.ita-site .ita-live-results {
  padding:
    clamp(50px, 6vw, 78px)
    0;

  background: var(--ita-rw-page);
}

html body.ita-site .ita-live-results__shell {
  width:
    min(1160px, calc(100% - 36px));

  margin-inline: auto;
}

html body.ita-site .ita-live-results__intro {
  max-width: 780px;

  margin-bottom: 28px;
}

html body.ita-site
.ita-live-results__eyebrow {
  margin: 0 0 9px;

  color: var(--ita-rw-accent) !important;

  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

html body.ita-site
.ita-live-results__intro h2 {
  margin: 0;

  color: var(--ita-rw-ink) !important;

  font-size:
    clamp(1.8rem, 3.3vw, 2.55rem);

  line-height: 1.1;
  letter-spacing: -0.038em;
}

html body.ita-site
.ita-live-results__intro > p:last-child {
  margin: 13px 0 0;

  color: var(--ita-rw-text) !important;

  font-size: 1rem;
  line-height: 1.66;
}

html body.ita-site .ita-live-results__layout {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    minmax(280px, 340px);

  align-items: start;

  gap: 22px;
}

html body.ita-site .ita-live-widget {
  min-width: 0;

  overflow: hidden;

  border: 1px solid var(--ita-rw-border);
  border-radius: 20px;

  background: var(--ita-rw-surface);

  box-shadow: var(--ita-rw-shadow);
}

html body.ita-site .ita-live-widget__toolbar {
  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 16px;

  padding: 18px 20px;

  border-bottom: 1px solid var(--ita-rw-border);

  background: var(--ita-rw-surface);
}

html body.ita-site
.ita-live-widget__toolbar strong {
  color: var(--ita-rw-ink) !important;
}

html body.ita-site .ita-live-widget__status {
  margin: 0;

  color: var(--ita-rw-muted) !important;

  font-size: 0.8rem;
}

html body.ita-site .ita-live-widget__load {
  min-height: 46px;

  padding: 12px 18px;

  border: 0;
  border-radius: 11px;

  background: var(--ita-rw-accent);
  color: var(--ita-rw-white) !important;

  font: inherit;
  font-size: 0.9rem;
  font-weight: 800;

  cursor: pointer;
}

html body.ita-site
.ita-live-widget__load:hover {
  background: var(--ita-rw-accent-hover);
}

html body.ita-site
.ita-live-widget__load:disabled {
  cursor: wait;
  opacity: 0.72;
}

html body.ita-site .ita-live-widget__stage {
  position: relative;

  min-height: 430px;

  padding: 18px;

  background: #f7faf9;
}

html body.ita-site .ita-live-widget__placeholder {
  display: grid;
  place-items: center;

  min-height: 390px;

  padding: 28px;

  border:
    1px dashed #bfd3cb;

  border-radius: 15px;

  background: var(--ita-rw-soft);

  color: var(--ita-rw-muted) !important;

  text-align: center;
}

html body.ita-site .ita-live-widget iframe {
  display: block;

  width: 100%;
  min-height: 430px;

  border: 0;

  background: var(--ita-rw-surface);
}

html body.ita-site .ita-live-review {
  padding: 24px;

  border-radius: 20px;

  background:
    linear-gradient(
      145deg,
      var(--ita-rw-dark),
      var(--ita-rw-dark-two)
    );

  color: var(--ita-rw-on-dark);
}

html body.ita-site .ita-live-review h3 {
  margin: 0;

  color: var(--ita-rw-white) !important;

  font-size: 1.2rem;
  line-height: 1.25;
}

html body.ita-site
.ita-live-review > p {
  margin: 10px 0 20px;

  color: var(--ita-rw-on-dark-muted) !important;

  font-size: 0.9rem;
  line-height: 1.58;
}

html body.ita-site .ita-live-review__checklist {
  display: grid;

  gap: 12px;

  margin: 0;
  padding: 0;

  list-style: none;
}

html body.ita-site
.ita-live-review__checklist label {
  display: grid;

  grid-template-columns:
    18px 1fr;

  align-items: start;

  gap: 10px;

  color: var(--ita-rw-on-dark) !important;

  font-size: 0.88rem;
  line-height: 1.45;

  cursor: pointer;
}

html body.ita-site
.ita-live-review__checklist input {
  width: 16px;
  height: 16px;

  margin-top: 2px;

  accent-color: #55c9ae;
}

html body.ita-site .ita-live-review__links {
  display: grid;

  gap: 8px;

  margin-top: 22px;
  padding-top: 18px;

  border-top:
    1px solid rgba(255, 255, 255, 0.16);
}

html body.ita-site
.ita-live-review__links a {
  color: var(--ita-rw-white) !important;

  font-size: 0.86rem;
  font-weight: 750;
}

html body.ita-site
.ita-live-review__disclosure {
  margin: 18px 0 0 !important;

  color: var(--ita-rw-on-dark-muted) !important;

  font-size: 0.76rem !important;
  line-height: 1.5 !important;
}

/* ==========================================================
   RESPONSIVE
   ========================================================== */

@media (max-width: 900px) {
  html body.ita-site
  .ita-live-results__layout {
    grid-template-columns: 1fr;
  }

  html body.ita-site .ita-live-review {
    order: -1;
  }
}

@media (max-width: 600px) {
  html body.ita-site .ita-live-results {
    padding:
      42px 0;
  }

  html body.ita-site
  .ita-live-results__shell {
    width:
      min(100% - 24px, 1160px);
  }

  html body.ita-site
  .ita-live-widget__toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  html body.ita-site
  .ita-live-widget__load {
    width: 100%;
  }

  html body.ita-site
  .ita-live-widget__stage {
    min-height: 360px;
    padding: 10px;
  }

  html body.ita-site
  .ita-live-widget iframe {
    min-height: 390px;
  }
}
