/**
 * Jeepa Travel Sikkim: trip page readability and responsive layout.
 *
 * Loaded after trip-design.css (see inc/assets.php). It only overrides
 * sizes, spacing and column logic. Remove its enqueue line to roll back.
 *
 * Column logic (one rule for the whole page):
 *   1. The page uses one column below 1100px, and on any portrait screen
 *      narrower than 1280px. Main content and sidebar never sit side by
 *      side on phones or portrait tablets.
 *   2. Cards inside the page (cost, highlights, trip facts) only split into
 *      columns on landscape screens (or 1280px and wider) AND when the card
 *      itself is wide enough. Container queries measure the real card
 *      width, so a narrow column can never squeeze two lists side by side.
 *      Browsers without container query support keep the single column.
 *
 * No fonts are added. Text uses the theme's local Jost font.
 */

body.single-trip {
  --jtd-muted: #565e7a; /* 5.9:1 on the snow tiles, was 4.3:1 */
  --jtd-text: 1.125rem; /* 18px running text */
  --jtd-text-list: 1.0625rem; /* 17px list items */
  --jtd-label: 0.8125rem; /* 13px smallest label */
}

/* ===== 1. Page columns ===== */

/* WP Travel Engine caps .trip-content-area at 720px below 1024px. The theme
   shell already sets the page width, so the cap only squeezed the cards. */
@media (max-width: 1024px) {
  body.single-trip .jeepa-trip-detail-shell #wp-travel-trip-wrapper.trip-content-area {
    max-width: none;
  }
}

/* One column. The plugin's 20px wrapper padding, -20px row margin and 20px
   column padding (all !important in its CSS) are only needed for its own
   side-by-side columns. In one column they added 38px of empty gutter per
   side on phones, so the theme shell's gutter is used alone. Desktop keeps
   the plugin spacing untouched. */
@media (max-width: 1099px), (orientation: portrait) and (max-width: 1279px) {
  .jeepa-trip-detail-shell #wp-travel-trip-wrapper > .row {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 48px;
  }

  body.single-trip .jeepa-trip-detail-shell #wp-travel-trip-wrapper.trip-content-area {
    padding-inline: 0 !important;
  }

  body.single-trip .jeepa-trip-detail-shell #wp-travel-trip-wrapper > .row {
    margin-inline: 0 !important;
  }

  body.single-trip .jeepa-trip-detail-shell #wp-travel-trip-wrapper #primary,
  body.single-trip .jeepa-trip-detail-shell #wp-travel-trip-wrapper #secondary {
    margin-top: 0 !important;
    padding-inline: 0 !important;
  }
}

/* ===== 2. Cards decide their own columns ===== */

html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .nb-configurations,
html body.single-trip .jeepa-trip-detail-shell .wpte-highlights-card,
html body.single-trip .jeepa-trip-detail-shell .wte-trip-facts {
  container-type: inline-size;
}

/* Default: one column everywhere */
html body.single-trip .jeepa-trip-detail-shell .post-data.cost,
html body.single-trip .jeepa-trip-detail-shell .wpte-trip-highlights {
  grid-template-columns: minmax(0, 1fr) !important;
}

html body.single-trip .jeepa-trip-detail-shell .wte-trip-facts .trip-facts-value {
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 10px !important;
}

html body.single-trip .jeepa-trip-detail-shell .wte-trip-facts .trip-facts-value > li {
  flex-direction: row;
  align-items: center !important;
  gap: 14px !important;
  padding: 12px 14px !important;
}

html body.single-trip .jeepa-trip-detail-shell .wte-trip-facts .icon-holder {
  flex-basis: 42px;
  width: 42px !important;
  height: 42px !important;
}

@media (orientation: landscape), (min-width: 1280px) {
  @container (min-width: 560px) {
    html body.single-trip .jeepa-trip-detail-shell .post-data.cost {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
  }

  @container (min-width: 540px) {
    html body.single-trip .jeepa-trip-detail-shell .wpte-trip-highlights {
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }
  }

  @container (min-width: 500px) {
    html body.single-trip .jeepa-trip-detail-shell .wte-trip-facts .trip-facts-value {
      grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)) !important;
    }
  }
}

/* ===== 3. Text sizes ===== */

/* Overview */
html body.single-trip .jeepa-trip-detail-shell .post-data.overview p {
  margin: 0 0 1.35em !important;
  font-size: var(--jtd-text) !important;
  line-height: 1.8 !important;
  text-wrap: pretty;
}

html body.single-trip .jeepa-trip-detail-shell .post-data.overview > p:first-of-type {
  font-size: 1.1875rem !important;
  line-height: 1.75 !important;
}

/* Trip brief above the itinerary */
html body.single-trip .jeepa-trip-detail-shell .wte-itinerary-header-wrapper > div:not(.wp-travel-engine-itinerary-header) p {
  font-size: var(--jtd-text-list) !important;
  line-height: 1.75 !important;
}

/* Itinerary days */
html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .wte-trip-itinerary-v2 .itinerary-row .itinerary-title span {
  font-size: clamp(1.0625rem, 1rem + 0.3vw, 1.2rem) !important;
}

html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .wte-trip-itinerary-v2 .itinerary-row .itinerary-content .content {
  font-size: var(--jtd-text) !important;
  line-height: 1.8 !important;
}

html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .wte-trip-itinerary-v2 .itinerary-row .itinerary-content .content p {
  margin: 0 0 1.3em !important;
  text-wrap: pretty;
}

html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .wte-trip-itinerary-v2 .itinerary-row .itinerary-content .content > :last-child {
  margin-bottom: 0 !important;
}

html body.single-trip .jeepa-trip-detail-shell .wte-trip-itinerary-v2 .itinerary-content .content p.jtd-stay {
  margin-top: 0.4em !important;
  font-size: 1rem !important;
}

html body.single-trip .jeepa-trip-detail-shell .wte-trip-itinerary-v2 .itinerary-content .content p.jtd-note {
  font-size: var(--jtd-text-list) !important;
}

html body.single-trip .jeepa-trip-detail-shell .wte-trip-itinerary-v2 .jtd-day-kicker {
  font-size: 0.6875rem;
}

/* Cost lists */
html body.single-trip .jeepa-trip-detail-shell .post-data.cost > .content h3 {
  font-size: 1.25rem !important;
}

html body.single-trip .jeepa-trip-detail-shell .post-data.cost :is(#include-result, #exclude-result) li {
  padding: 12px 0 12px 34px !important;
  font-size: var(--jtd-text-list) !important;
  line-height: 1.6 !important;
}

html body.single-trip .jeepa-trip-detail-shell .post-data.cost :is(#include-result, #exclude-result) li::before {
  top: 14px !important;
}

html body.single-trip .jeepa-trip-detail-shell .post-data.cost :is(#include-result, #exclude-result) li::after {
  top: 19px !important;
}

/* Highlights */
html body.single-trip .jeepa-trip-detail-shell .wpte-trip-highlights .trip-highlight {
  font-size: var(--jtd-text-list) !important;
  line-height: 1.55 !important;
}

/* Trip facts */
html body.single-trip .jeepa-trip-detail-shell .wte-trip-facts .trip-facts-text label {
  font-size: var(--jtd-label) !important;
  letter-spacing: 0.06em !important;
}

html body.single-trip .jeepa-trip-detail-shell .wte-trip-facts .trip-facts-text .value {
  font-size: var(--jtd-text-list) !important;
}

/* FAQs */
html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .faq-row .faq-title,
html body.single-trip .jeepa-trip-detail-shell .wpte-faq-item .wpte-faq-question {
  font-size: var(--jtd-text-list) !important;
}

html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .faq-row .faq-content,
html body.single-trip .jeepa-trip-detail-shell .wpte-faq-item .wpte-faq-answer-content {
  font-size: var(--jtd-text) !important;
  line-height: 1.8 !important;
}

html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .faq-row .faq-content p,
html body.single-trip .jeepa-trip-detail-shell .wpte-faq-item .wpte-faq-answer-content p {
  margin: 0 0 1.2em !important;
}

/* Expand-all switch */
html body.single-trip .jeepa-trip-detail-shell .expand-all-button label {
  font-size: 0.9375rem !important;
}

/* Enquiry form: 16px inputs also stop iPhones zooming in on focus */
html body.single-trip .jeepa-trip-detail-shell .wte_enquiry_contact_form label {
  font-size: 1rem !important;
}

html body.single-trip .jeepa-trip-detail-shell .wte_enquiry_contact_form :is(.input, input[type="text"], input[type="email"], input[type="tel"], input[type="number"], select, textarea) {
  font-size: 1rem !important;
}

/* Related trip cards */
html body.single-trip .jeepa-trip-detail-shell .wte-related-trips .category-trip-types a {
  font-size: 0.875rem !important;
}

html body.single-trip .jeepa-trip-detail-shell .wte-related-trips .category-trip-meta-info-label {
  font-size: 0.75rem !important;
}

html body.single-trip .jeepa-trip-detail-shell .wte-related-trips .category-trip-meta-info-value {
  font-size: 1rem !important;
}

/* Sidebar contact and quick links widgets */
body.single-trip .jeepa-trip-detail-shell #secondary #block-21 .jeepa-contact-label {
  font-size: var(--jtd-label) !important;
}

body.single-trip .jeepa-trip-detail-shell #secondary #block-21 .jeepa-contact-value,
body.single-trip .jeepa-trip-detail-shell #secondary #block-22 ul.jeepa-links-list > li > a {
  font-size: 1rem !important;
}

/* ===== 4. Sidebar stays in view beside the trip details =====
   Only when main content and sidebar sit side by side. The class and the
   two measurements come from trip-design.js; without them nothing sticks.
   A sidebar that fits the screen pins to the top. A taller one (any number
   of widgets) scrolls normally until its last widget is in view, then holds
   there, above the floating chat and back-to-top buttons. It lets go where
   the trip details end, before Related Trips. */
@media (min-width: 1280px), (min-width: 1100px) and (orientation: landscape) {
  body.single-trip .jeepa-trip-detail-shell #wp-travel-trip-wrapper > .row > #secondary {
    align-self: start;
  }

  body.single-trip .jeepa-trip-detail-shell #wp-travel-trip-wrapper > .row.jtd-side-sticky > #secondary {
    position: -webkit-sticky;
    position: sticky;
    top: min(var(--jtd-sticky-top, 12px), calc(100vh - var(--jtd-side-h, 100vh) - var(--jtd-side-gap, 24px)));
  }
}

/* ===== 5. Phones: give the words the width ===== */
@media (max-width: 767px) {
  html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container:not(.wpte-tabs-sticky) .tab-content {
    padding: 22px 14px !important;
  }

  html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .wte-trip-itinerary-v2 .itinerary-row .itinerary-content .content {
    margin: 0 14px !important;
    padding: 16px 0 20px !important;
    font-size: var(--jtd-text) !important;
  }

  html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .post-data.itinerary.wte-trip-itinerary-v2 {
    --node: 48px;
  }

  html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .wte-trip-itinerary-v2 .itinerary-row .wte-itinerary-head-wrap > .title {
    margin: 13px 0 0 12px !important;
  }

  html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .wte-trip-itinerary-v2 .itinerary-row .accordion-tabs-toggle {
    min-height: 74px !important;
    padding: 14px 52px 14px 74px !important;
  }

  html body.single-trip .jeepa-trip-detail-shell .wte-trip-itinerary-v2 .jtd-day-kicker {
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
  }

  html body.single-trip .jeepa-trip-detail-shell .wte-trip-itinerary-v2 .jtd-day-num {
    font-size: 1.15rem;
  }

  html body.single-trip .jeepa-trip-detail-shell .post-data.cost > .content {
    padding: 20px 18px 12px !important;
  }

  html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .faq-row .faq-title,
  html body.single-trip .jeepa-trip-detail-shell .wpte-faq-item .wpte-faq-question {
    font-size: var(--jtd-text-list) !important;
  }

  html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container .faq-row .faq-content,
  html body.single-trip .jeepa-trip-detail-shell .wpte-faq-item .wpte-faq-answer-content {
    padding: 0 16px 18px !important;
  }

  /* Tab bar labels: up from 10px */
  html body.single-trip .jeepa-trip-detail-shell .wpte-tabs-container:not(.wpte-tabs-sticky) a.nav-tab {
    font-size: clamp(0.75rem, 0.6rem + 0.7vw, 0.875rem) !important;
  }
}
