/* Trip Itinerary Builder — visual design
   Scoped under .tib-page so it never leaks into the rest of the theme. */

.tib-page {
  --bg: #F7F8FA;
  --ink: #2C3E35;
  --ink-soft: rgba(44,62,53,0.66);
  --ink-faint: rgba(44,62,53,0.42);
  --ochre: #D4A373;
  --ochre-deep: #C08A53;
  --sage: #94D2BD;
  --sage-deep: #5FA88F;
  --terracotta: #E9D8A6;
  --line: rgba(44,62,53,0.12);
  --line-soft: rgba(44,62,53,0.07);
  --card: #FFFFFF;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --serif: 'Fraunces', serif;
  --sans: 'Inter', sans-serif;
  --grotesk: 'Space Grotesk', sans-serif;

  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  max-width: 1040px;
  margin: 40px auto;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(44,62,53,0.08);
}
.tib-page * { box-sizing: border-box; }
.tib-page img { width: 100%; display: block; object-fit: cover; }
.tib-page a { color: inherit; }

.tib-eyebrow {
  font-family: var(--grotesk); font-size: 13px; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--ochre-deep);
  display: flex; align-items: center; gap: 10px; margin: 0 0 16px;
}
.tib-eyebrow::before { content:''; width: 18px; height: 1px; background: var(--ochre-deep); }

.tib-section { padding: 28px 24px; }
.tib-section h2 { font-family: var(--serif); font-size: 20px; font-weight: 500; margin: 0 0 14px; }

/* ---------- HERO ---------- */
.tib-hero {
  position: relative; min-height: 320px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; padding: 40px 24px;
  background: linear-gradient(135deg, #3A5A45, #7FBFA3);
}
.tib-hero img { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; }
.tib-hero::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(rgba(20,28,24,.55), rgba(20,28,24,.55));
}
.tib-hero > * { position: relative; z-index: 2; }
.tib-hero-label {
  font-family: var(--grotesk); font-size: 13px; letter-spacing: .16em; text-transform: uppercase;
  color: #F7F8FA; opacity: .85; margin-bottom: 10px;
}
.tib-hero-title { font-family: var(--serif); font-weight: 500; font-size: clamp(32px, 6vw, 44px); color: #fff; }
.tib-hero-sub { font-family: var(--grotesk); font-size: 14px; letter-spacing: .08em; color: var(--terracotta); margin-top: 10px; }

/* ---------- QUICK FACTS STRIP ---------- */
.tib-facts { display: flex; border-bottom: .5px solid var(--line); }
.tib-fact { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 16px 8px; border-right: .5px solid var(--line); }
.tib-fact:last-child { border-right: none; }
.tib-fact .icon { width: 18px; height: 18px; stroke: var(--ochre-deep); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tib-fact .lbl { font-size: 12.5px; color: var(--ink-soft); margin-top: 6px; }
.tib-fact .val { font-size: 15px; font-weight: 600; margin-top: 2px; }

/* ---------- OVERVIEW + MAP ---------- */
.tib-overview-map { display: flex; gap: 20px; flex-wrap: wrap; }
.tib-overview-card, .tib-map-card { flex: 1; min-width: 280px; border-radius: var(--radius-lg); padding: 20px; }
.tib-overview-card { background: var(--card); border: 1px solid var(--line-soft); }
.tib-overview-card h3, .tib-map-card h3 { font-family: var(--serif); font-size: 17px; font-weight: 500; margin-bottom: 12px; }
.tib-overview-row { display: flex; gap: 10px; font-size: 14.5px; padding: 5px 0; }
.tib-overview-row .day { color: var(--ochre-deep); font-weight: 600; min-width: 46px; }
.tib-overview-row .txt { color: var(--ink-soft); }
.tib-map-card { background: var(--ink); color: #F7F8FA; }
.tib-map-card h3 { color: #fff; }
#tibMap { height: 220px; border-radius: 12px; overflow: hidden; }
.tib-map-empty { height: 150px; border-radius: 12px; background: rgba(247,248,250,.08); display: flex; align-items: center; justify-content: center; color: rgba(247,248,250,.5); font-size: 13px; }

/* ---------- DAY BY DAY (accordion + connected timeline) ---------- */
.tib-days-toolbar { display: flex; justify-content: flex-end; margin: -6px 0 14px; }
.tib-expand-toggle {
  background: none; border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 14px; font-size: 12.5px; color: var(--ink-soft); cursor: pointer;
}
.tib-expand-toggle:hover { background: var(--line-soft); }

.tib-day-block { margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 18px; }
.tib-day-block:last-child { margin-bottom: 0; border-bottom: none; padding-bottom: 0; }

/* <details>/<summary> gives the accordion its toggle + keyboard support
   for free — same pattern the admin repeater rows already use. */
.tib-day-heading-row { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 4px 0; list-style: none; }
.tib-day-heading-row::-webkit-details-marker { display: none; }
.tib-day-chevron {
  width: 16px; height: 16px; stroke: var(--ink-soft); fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; transition: transform .2s ease;
}
.tib-day-block[open] .tib-day-chevron { transform: rotate(180deg); }
.tib-day-heading { font-size: 15px; font-weight: 600; color: var(--ink); flex: 1; min-width: 0; margin: 0; }
.tib-day-heading .date { color: var(--ink-soft); font-weight: 400; font-size: 13px; margin-left: 8px; }
.tib-day-total-pill {
  display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
  background: rgba(192,138,83,.12); border: 1px solid rgba(192,138,83,.28);
  color: #7A5A2A; font-family: var(--grotesk); font-size: 13px; font-weight: 600;
  padding: 5px 13px; border-radius: 999px; white-space: nowrap;
}
.tib-day-total-pill .icon { width: 13px; height: 13px; stroke: #7A5A2A; fill: none; stroke-width: 1.8; }

.tib-day-panel { padding-top: 14px; }
.tib-day-tip { font-size: 13px; color: var(--ink-soft); font-style: italic; margin-bottom: 12px; }
.tib-day-body { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }

/* Boxed stops (one card per item) with transit notes as a small muted
   pill in between. The day itself stays collapsible. */
.tib-day-flow { flex: 3 1 0; min-width: 300px; }
.tib-stop {
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 13px 15px;
  background: var(--card); font-size: 14.5px; margin-bottom: 4px; display: flex; gap: 10px; align-items: flex-start;
}
.tib-stop .icon-badge { width: 22px; height: 22px; min-width: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: rgba(192,138,83,.12); }
.tib-stop .icon { width: 13px; height: 13px; stroke: var(--ochre-deep); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tib-stop .stop-body { flex: 1; min-width: 0; }
.tib-stop .stop-time { font-family: var(--grotesk); font-size: 12px; color: var(--ink-soft); display: block; margin-bottom: 2px; }
.tib-stop .stop-label { font-weight: 500; margin: 0; }
.tib-stop .stop-desc { color: var(--ink-soft); font-size: 13px; margin-top: 1px; }
.tib-stop .stop-cost { font-family: var(--grotesk); font-size: 13.5px; color: var(--ink-soft); white-space: nowrap; }
.tib-transit {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0 4px 15px; font-size: 12px; color: var(--ink-soft);
}
.tib-transit .tib-transit-text { flex: 1; min-width: 0; }
/* Right edge lines up with .stop-cost: card border (1px) + card padding (15px). */
.tib-transit { padding-right: 16px; }
.tib-transit .tib-transit-cost { margin-left: auto; padding-left: 10px; font-family: var(--grotesk); font-size: 13.5px; color: var(--ink-soft); white-space: nowrap; }
.tib-transit .icon { width: 11px; height: 11px; flex-shrink: 0; stroke: var(--ink-soft); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Day photos: full-width shots stacked next to the timeline, sized to
   actually match its height instead of one small stack lost in
   whitespace. Click any photo to open the lightbox and flip through
   all of that day's photos (see the template's <script> block). */
.tib-day-photos { flex: 1 1 0; min-width: 150px; display: flex; flex-direction: column; gap: 10px; }
.tib-day-photos .day-photo { position: relative; display: block; width: 100%; border: none; background: none; padding: 0; cursor: pointer; border-radius: 12px; overflow: hidden; }
.tib-day-photos .day-photo img { width: 100%; height: auto; display: block; }
.tib-day-photos .photo-count-badge {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(44,62,53,.72); color: #fff;
  font-family: var(--grotesk); font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px;
}

/* ---------- LIGHTBOX ---------- */
.tib-lightbox {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(20,26,22,.92);
  display: flex; align-items: center; justify-content: center;
}
.tib-lightbox[hidden] { display: none; }
.tib-lightbox .lb-stage { max-width: min(88vw, 900px); max-height: 84vh; display: flex; flex-direction: column; align-items: center; }
.tib-lightbox img { max-width: 100%; max-height: 72vh; width: auto; height: auto; border-radius: 8px; box-shadow: 0 12px 40px rgba(0,0,0,.4); }
.tib-lightbox .lb-caption { color: #F7F8FA; font-size: 14px; margin-top: 14px; text-align: center; max-width: 640px; }
.tib-lightbox .lb-count { color: rgba(247,248,250,.55); font-family: var(--grotesk); font-size: 12px; margin-top: 6px; }
.tib-lightbox .lb-close {
  position: absolute; top: 18px; right: 22px;
  background: none; border: none; color: #F7F8FA; font-size: 30px; line-height: 1;
  cursor: pointer; padding: 6px;
}
.tib-lightbox .lb-nav {
  background: rgba(247,248,250,.1); border: none; color: #F7F8FA;
  font-size: 34px; line-height: 1; width: 52px; height: 52px; border-radius: 50%;
  cursor: pointer; flex-shrink: 0; margin: 0 16px;
}
.tib-lightbox .lb-nav:hover { background: rgba(247,248,250,.2); }

/* ---------- TOTAL EXPENSES ---------- */
.tib-totals-layout { display: flex; gap: 20px; flex-wrap: wrap; }
.tib-totals-table-wrap { flex: 1.4; min-width: 260px; }
.tib-totals-table { width: 100%; font-size: 14.5px; border-collapse: collapse; }
.tib-totals-table td { padding: 9px 0; border-bottom: 1px solid var(--line); }
.tib-totals-table td:first-child { color: var(--ink-soft); }
.tib-totals-table td:last-child { text-align: right; font-weight: 500; }
.tib-cat-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: middle; }
.tib-chart-wrap { flex: 1; min-width: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.tib-chart-wrap canvas { max-width: 180px; max-height: 180px; }
.tib-chart-legend { display: flex; gap: 12px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.tib-chart-legend .li { font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 4px; }
.tib-chart-legend .dot { width: 8px; height: 8px; border-radius: 2px; }

/* ---------- TOTAL COST BANNER ---------- */
.tib-total-banner { padding: 30px 24px; background: var(--ink); }
.tib-total-banner .lbl { font-family: var(--grotesk); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: rgba(247,248,250,.65); }
.tib-total-banner .amt { font-family: var(--serif); font-size: 34px; color: #fff; margin-top: 4px; }
.tib-total-banner .pp-note { font-size: 12px; color: rgba(247,248,250,.55); margin-top: 4px; }

/* ---------- PRACTICAL INFO ---------- */
.tib-info-cards { display: flex; gap: 14px; flex-wrap: wrap; }
.tib-info-card { flex: 1; min-width: 260px; background: var(--card); border: 1px solid var(--line-soft); border-radius: var(--radius-md); padding: 18px; }
.tib-info-card .info-title { font-size: 14.5px; font-weight: 500; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.tib-info-card .icon { width: 17px; height: 17px; stroke: var(--ochre-deep); fill: none; stroke-width: 1.7; }
.tib-info-card .info-text { font-size: 13.5px; color: var(--ink-soft); line-height: 1.6; white-space: pre-line; }

.tib-disclaimer { font-size: 12.5px; color: var(--ink-soft); line-height: 1.6; border-top: 1px solid var(--line); padding-top: 16px; }

.tib-cta-wrap { display: flex; justify-content: center; padding: 8px 24px 32px; }
/* .tib-page .tib-cta-btn (not just .tib-cta-btn) so this beats the
   global ".tib-page a { color: inherit }" rule, which otherwise wins
   on specificity and makes the button text invisible against its own
   dark background. */
.tib-page .tib-cta-btn {
  background: var(--ink); color: #fff; border: none; border-radius: 999px; padding: 13px 28px;
  font-size: 14.5px; font-weight: 500; cursor: pointer; text-decoration: none; display: inline-block;
}
.tib-page .tib-cta-btn:hover { background: var(--sage-deep); color: #fff; }

/* ---------- RELATED DESTINATIONS ---------- */
.tib-related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tib-related-card {
  position: relative; height: 90px; border-radius: var(--radius-md); overflow: hidden;
  display: flex; align-items: flex-end; padding: 10px; background: linear-gradient(135deg, #3A5A45, #7FBFA3);
  text-decoration: none;
}
.tib-related-card::before { content:''; position:absolute; inset:0; background: linear-gradient(rgba(0,0,0,.05), rgba(0,0,0,.45)); }
.tib-related-card img { position: absolute; inset: 0; height: 100%; }
.tib-related-card span { position: relative; z-index: 1; color: #fff; font-size: 13.5px; font-weight: 500; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 640px) {
  .tib-page { margin: 0; border-radius: 0; }
  .tib-facts { flex-wrap: wrap; }
  .tib-fact { flex: 1 1 50%; border-right: none; border-bottom: .5px solid var(--line); }
  .tib-day-heading-row { align-items: flex-start; }
  .tib-day-photos { flex: 1 1 100%; max-width: 480px; margin: 8px auto 0; }
  .tib-lightbox .lb-nav { width: 42px; height: 42px; font-size: 26px; margin: 0 6px; }
  .tib-lightbox .lb-close { top: 10px; right: 14px; font-size: 26px; }
}

/* Printing/exporting to PDF should always show the full itinerary,
   regardless of which days are collapsed on screen. */
@media print {
  .tib-day-panel { display: block !important; }
  .tib-day-block::details-content { content-visibility: visible; display: block; }
  .tib-day-chevron, .tib-days-toolbar { display: none !important; }
}

.tib-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
