body {
  background-color: #f7f7fb;
}

/*
 * The theme's .site-nav is absolutely positioned with translucent white text,
 * meant to float over a dark hero image. On plain pages (no hero) that made
 * the logo/menu invisible (white on white). Force it into normal document
 * flow with a solid background so it's always visible.
 */
.site-nav {
  position: relative;
  background: #1A374D;
}

/* Reclaim the top padding the theme reserved for the nav overlaying the hero. */
.hero {
  padding-top: 3rem;
}

.hero.hero-inner {
  padding-top: 3rem;
}

/*
 * Brand mark. The HM monogram in static/images/logo.svg sits to the left of the MyWorld
 * wordmark, so .logo has to lay the two out side by side; the theme only ever styles .logo
 * as text. Only the height is fixed, so a wide logo keeps its proportions instead of being
 * squashed into a square box.
 */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.logo-mark {
  height: 32px;
  width: auto;
  flex: 0 0 auto;
  /*
   * The monogram is charcoal #3b3938 and the nav bar it sits on is navy #1A374D - all but the
   * same brightness, so the mark would read as invisible. brightness(0) flattens the art to
   * black (its transparent background stays transparent), then invert(1) lifts it to white so
   * it matches the wordmark beside it. To keep the charcoal instead, drop the filter and sit
   * the mark on a light chip: background: #fff; padding: 2px; border-radius: 0.375rem;
   */
  filter: brightness(0) invert(1);
}

/*
 * The theme's .text-primary is #1A374D, i.e. the same navy the nav bar was forced to above,
 * which made the accent dot in "MyWorld ." invisible. Repaint it in the theme's own steel
 * blue so the wordmark still ends in a visible full stop on the dark bar.
 */
.logo .text-primary {
  color: #6998AB !important;
}

#world-map {
  height: 480px;
  border-radius: 0.5rem;
  z-index: 0;
}

.trip-card img {
  height: 200px;
  object-fit: cover;
}

.trip-card {
  margin-bottom: 1.5rem;
}

.itinerary-calendar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
}

.calendar-week-header {
  font-weight: 700;
  color: #1A374D;
  text-align: center;
}

/*
 * Each day box can carry two optional colour layers: --segment is the trip-leg tint
 * painted over the whole cell, --day is the day's own colour, drawn as an inset stripe
 * on the left edge and echoed by the dot. Both default to "no colour", so an uncoloured
 * calendar renders exactly as it always has.
 */
.calendar-day {
  --segment: #ffffff;
  --day: transparent;
  background: #fff;
  /* Older browsers drop the color-mix() line below and keep the plain white background. */
  background: color-mix(in srgb, var(--segment) 18%, #ffffff);
  border: 1px solid #e2e2ea;
  border-radius: 0.375rem;
  padding: 0.5rem;
  min-height: 120px;
  box-shadow: inset 4px 0 0 var(--day);
}

.calendar-day.out-of-range {
  background: #f2f2f7;
  opacity: 0.5;
}

.calendar-day-date {
  font-size: 0.75rem;
  color: #6c757d;
  margin-bottom: 0.25rem;
}

.calendar-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.calendar-day-head .calendar-day-date {
  margin-bottom: 0;
}

/* Invisible until the day gets a colour, then it picks up the same var as the stripe. */
.calendar-day-dot {
  flex: 0 0 auto;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--day);
  box-shadow: 0 0 0 1px rgba(26, 55, 77, 0.15);
}

.calendar-day-segment {
  display: inline-block;
  margin-bottom: 0.25rem;
  padding: 0 0.45rem;
  border: 1px solid rgba(26, 55, 77, 0.12);
  border-radius: 0.75rem;
  background: #fff;
  background: color-mix(in srgb, var(--segment) 40%, #ffffff);
  color: #1A374D;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/*
 * A dated excursion also shows up inside its day box, as a pill in the excursion's own
 * colour. It sits under the trip-leg chip and truncates rather than widening the box.
 */
.calendar-day-activity {
  display: block;
  margin-bottom: 0.2rem;
  padding: 0 0.45rem;
  border-left: 3px solid var(--activity, #cbd3da);
  border-radius: 0.25rem;
  background: #f7f9fb;
  background: color-mix(in srgb, var(--activity, #ffffff) 16%, #ffffff);
  color: #1A374D;
  font-size: 0.7rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Palette, native picker and clear button, shared by day boxes, trip-leg rows and excursions. */
.colour-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.colour-swatch,
.colour-clear,
.colour-custom {
  padding: 0;
  border: 1px solid rgba(26, 55, 77, 0.25);
  background: none;
  cursor: pointer;
}

.colour-swatch,
.colour-clear {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
}

.colour-swatch {
  background: var(--swatch);
}

.colour-swatch.is-active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 3px #1A374D;
}

.colour-custom {
  width: 1.5rem;
  height: 1rem;
  border-radius: 0.2rem;
}

.colour-custom::-webkit-color-swatch-wrapper {
  padding: 0;
}

.colour-custom::-webkit-color-swatch {
  border: 0;
  border-radius: 0.15rem;
}

/* Dimmed while nothing is picked, so the picker's fallback hue is not read as "set". */
.colour-control.is-empty .colour-custom {
  opacity: 0.35;
}

.colour-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6c757d;
  font-size: 0.85rem;
  line-height: 1;
}

.colour-clear.is-active {
  border-color: #1A374D;
  color: #1A374D;
}

.segment-row .colour-control,
.activity-row .colour-control {
  margin-bottom: 0;
}

.itinerary-day-notes {
  width: 100%;
  height: 85px;
  font-size: 0.85rem;
  resize: vertical;
}

/*
 * Activity details. The Notes box lives in the table row so it is always editable;
 * it grows while focused (see the is-editing class the planner script toggles) and
 * shrinks back to two rows on blur, keeping the table compact.
 */
.activity-notes {
  width: 100%;
  min-width: 180px;
  font-size: 0.85rem;
  resize: vertical;
}

.activity-row.is-editing .activity-notes {
  min-height: 9rem;
}

/*
 * An excursion row paints its own colour the way a day box does: --activity drives a
 * stripe down the row's first cell and a light tint across it. The row carries the var
 * inline, so a swatch click previews both before saving, and an uncoloured row is plain
 * white. The stripe lives on the cell because a <tr> box-shadow is not reliable.
 */
.activity-row {
  --activity: transparent;
  background: #fff;
  background: color-mix(in srgb, var(--activity) 10%, #ffffff);
}

.activity-row td:first-child {
  box-shadow: inset 4px 0 0 var(--activity);
}

/*
 * The description cell doubles as the hover target, so it advertises itself as "more
 * info" - dotted underline on the field and the help cursor across the whole cell.
 */
.activity-details-trigger {
  cursor: help;
}

.activity-details-trigger .form-control {
  border-bottom-style: dotted;
}

/*
 * The hover card is appended to <body> and positioned fixed, so the table's
 * .table-responsive scroller can never clip it. pointer-events: none keeps it from
 * stealing the pointer - clicks land on the row, which focuses that row's Notes box.
 * --activity is copied off the hovered row, so the card's accent matches its colour.
 */
.activity-details-card {
  position: fixed;
  z-index: 1080;
  max-width: 26rem;
  padding: 0.65rem 0.85rem;
  background: #fff;
  border: 1px solid #e2e2ea;
  border-left: 4px solid var(--activity, #1A374D);
  border-radius: 0.375rem;
  box-shadow: 0 0.5rem 1.25rem rgba(26, 55, 77, 0.18);
  pointer-events: none;
}

/* Hidden (d-none) until the row has a colour, then it echoes the row and the stripe. */
.activity-details-dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.35rem;
  border-radius: 50%;
  background: var(--activity, #1A374D);
  box-shadow: 0 0 0 1px rgba(26, 55, 77, 0.15);
}

.activity-details-card .activity-details-title {
  font-weight: 700;
  color: #1A374D;
}

.activity-details-card .activity-details-line {
  margin-bottom: 0.15rem;
}

.activity-details-card .activity-details-hint {
  margin-top: 0.35rem;
}

/* Line breaks typed into the Notes box are part of the detail, so keep them. */
.activity-details-notes {
  max-height: 14rem;
  overflow: hidden;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}

.activity-details-empty {
  color: #6c757d;
  font-style: italic;
}

/*
 * Minimise/maximise headers on the itinerary planner cards. Toggling is handled by
 * Bootstrap 4's bundled collapse plugin (data-toggle="collapse"); the chevron simply
 * follows the aria-expanded attribute the plugin keeps up to date.
 */
.itinerary-section-header {
  padding: 0;
  background: #fff;
  border-bottom: 1px solid #e2e2ea;
}

.itinerary-section-toggle {
  display: block;
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: none;
  border: 0;
  font-weight: 700;
  color: #1A374D;
  text-align: left;
  white-space: normal;
  cursor: pointer;
}

.itinerary-section-toggle:hover,
.itinerary-section-toggle:focus {
  color: #1A374D;
  text-decoration: none;
  box-shadow: inset 0 0 0 2px rgba(26, 55, 77, 0.15);
}

.itinerary-section-toggle::after {
  content: "";
  float: right;
  margin-top: 0.35rem;
  padding: 3px;
  border: solid currentColor;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}

.itinerary-section-toggle[aria-expanded="true"]::after {
  transform: rotate(-135deg);
}

/* Native datetime-local controls get clipped below ~180px, hiding the time portion. */
input[type="datetime-local"] {
  min-width: 200px;
}

@media (max-width: 767px) {
  .calendar-week {
    grid-template-columns: 1fr;
  }
  .calendar-week-header {
    display: none;
  }
}


.destination-card {
  color: inherit;
  text-decoration: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.destination-card:hover {
  color: inherit;
  text-decoration: none;
  transform: translateY(-3px);
}

.destination-arrow {
  color: #1A374D;
  font-size: 1.5rem;
}

/* Bootstrap 4 (bundled with the theme) has no .stretched-link utility. */
.stretched-link::after {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  content: "";
}

.stat-card {
  text-align: center;
  padding: 1.5rem;
}

.stat-card .stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: #1A374D;
}

/*
 * The theme relies on Bootstrap's fixed-width .container (max 1140px), which
 * wastes a lot of space on wide screens. Use 80% of the viewport from tablet
 * up, and keep the default full-width behaviour on phones.
 */
@media (min-width: 768px) {
  .container {
    width: 80%;
    max-width: none;
  }
}

/*
 * Widening .container also widens the hero photo column, so the absolutely
 * positioned slide images scale up past the 608px box the theme designed and
 * their -200px overhang covers the section below. Keep the photo at its
 * designed height (crop instead of stretch) once the container is wider than
 * Bootstrap's 1140px default.
 */
@media (min-width: 1200px) {
  .hero .slides img {
    width: 100%;
    max-height: 680px;
    object-fit: cover;
  }
}

/* Travel Log: column headings double as sort buttons, with a caret showing the direction. */
.travel-log-table th[data-sort-key] {
  white-space: nowrap;
}

.travel-log-sort {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
}

.travel-log-sort::after {
  display: inline-block;
  margin-left: 0.35rem;
  content: "\2195";
  font-size: 0.8rem;
  color: #adb5bd;
}

.travel-log-sort:hover::after,
.travel-log-sort:focus::after,
.travel-log-sort.is-sorted-asc::after,
.travel-log-sort.is-sorted-desc::after {
  color: #1A374D;
}

.travel-log-sort.is-sorted-asc::after {
  content: "\2191";
}

.travel-log-sort.is-sorted-desc::after {
  content: "\2193";
}

.travel-log-table td[data-sort-key="duration"] {
  text-align: right;
}

/* Keeps the trip title / purpose note stacked under the city / purpose label. */
.travel-log-note {
  display: block;
}

/* Travel Log: the CSV download button shares the row with the filter box. */
.travel-log-toolbar {
  display: flex;
}

.travel-log-toolbar .form-control {
  flex: 1 1 auto;
}

.travel-log-toolbar .btn {
  flex: 0 0 auto;
  margin-left: 0.5rem;
  white-space: nowrap;
}
