/* Vacation overview: list + map */
body.page-trips { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
body.page-trips > main { flex: 1; min-height: 0; display: flex; }
.trips { flex: 1; min-height: 0; min-width: 0; width: 100%; display: flex; flex-direction: column; }

/* Bar with filters, view and sort */
.trips-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: var(--cream); position: relative; z-index: 20; }
.filters { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter { position: relative; }
.chip { height: 42px; padding: 0 14px; border-radius: 21px; border: 1px solid var(--sky); background: #fff; color: var(--navy); font-weight: 500; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--navy); }
.chip.is-active { background: var(--navy); border-color: var(--navy); color: var(--cream); }
.chip[aria-expanded="true"] svg { transform: rotate(180deg); }
.filter__panel { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 260px; max-width: 340px; max-height: min(60vh, 460px); overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(13, 44, 64, .18); padding: 8px; }
.filter__panel fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px; border-radius: 8px; cursor: pointer; }
.opt:hover { background: var(--pale); }
.opt input { width: 18px; height: 18px; accent-color: var(--navy); flex: none; margin: 0; }
.opt__icon { width: 28px; height: 28px; border-radius: 50%; background: #266993; flex: none; object-fit: contain; }
.opt__icon--photo { width: 40px; height: 40px; object-fit: cover; background: var(--sky); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); }
.opt__name { flex: 1; }
.opt__count { color: var(--muted); font-size: 14px; min-width: 2ch; text-align: right; }
.opt.is-empty { opacity: .45; }
.filter__clear { margin: 4px 8px 2px; }
.bar-right { display: flex; align-items: center; gap: 10px; flex: none; }
.views { display: flex; padding: 3px; border: 1px solid var(--sky); border-radius: 10px; background: #fff; }
.views button { height: 36px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--navy); font-weight: 500; font-size: 14px; cursor: pointer; }
.views button[aria-pressed="true"] { background: var(--navy); color: var(--cream); font-weight: 700; }
.sort select { height: 42px; padding: 0 34px 0 14px; border-radius: 8px; border: 1px solid var(--sky); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6' fill='none' stroke='%2318425d' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--navy); font-size: 15px; appearance: none; cursor: pointer; }

/* Body: list | map */
.trips-body { flex: 1; min-height: 0; display: flex; position: relative; }
.trips-list { width: 520px; flex: none; display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--cream); }
.trips-count { margin: 0; padding: 18px 24px 10px; font: 400 24px/1.2 var(--title); color: var(--navy); flex: none; }
.no-results { margin: 0 24px 12px; color: var(--muted); }
.cards { list-style: none; margin: 0; padding: 4px 24px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; flex: 1; min-height: 0; overscroll-behavior: contain; }
.sheet-handle { display: none; }

.card.is-sel .card__details { display: inline-flex; }
.card.is-sel .card__show { display: none; }

/* Map */
.trips-map { flex: 1; min-width: 0; position: relative; background: var(--navy); }
.map { position: absolute; inset: 0; }
.map-ui { position: absolute; top: 16px; left: 16px; z-index: 5; display: flex; flex-direction: column; gap: 10px; max-width: min(480px, calc(100% - 90px)); pointer-events: none; }
.map-ui > * { pointer-events: auto; }
.map-reset { align-self: flex-start; height: 42px; padding: 0 16px; border-radius: 21px; border: 0; background: #fff; color: var(--navy); font-weight: 700; font-size: 15px; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.map-reset[hidden], .map-legend[hidden] { display: none; }
.map-legend { width: 480px; max-width: 100%; }
.map-legend .card { margin: 0; box-shadow: 0 6px 22px rgba(13, 44, 64, .3), inset 0 0 0 1px var(--yellow); }
.map-zoom { position: absolute; top: 16px; right: 16px; z-index: 5; display: flex; flex-direction: column; border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, .25); }
.map-zoom button { width: 44px; height: 44px; border: 0; background: #fff; font-size: 22px; color: var(--navy); cursor: pointer; }
.map-zoom button + button { border-top: 1px solid var(--line); }
.map-zoom button:hover { background: var(--pale); }
/* Hover box on the map: the same as the card in the list */
.map-tip { position: absolute; z-index: 6; pointer-events: none; width: 400px; max-width: calc(100% - 24px); border-radius: 14px; background: #fff; box-shadow: 0 6px 22px rgba(13, 44, 64, .3); display: flex; gap: 12px; overflow: hidden; }
.map-tip[hidden] { display: none; }
.map-tip .card__img { width: 120px; min-height: 120px; }
.map-tip .card__body { padding: 10px 12px 10px 0; }
.map-tip .card__title { font-size: 17px; color: var(--navy); }
.map-tip .card__foot { padding-top: 4px; }
.maplibregl-ctrl-attrib { font-size: 11px; }

/* Map markers (HTML) */
.pin { width: 30px; height: 42px; padding: 0; border: 0; background: transparent; cursor: pointer; display: block; }
.pin svg { display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); transform-origin: 50% 100%; transition: transform 120ms ease; }
.pin .pin-body { fill: var(--pin); }
.pin .pin-ink { stroke: #5c1415; }
.pin .pin-dot { fill: #5c1415; }
.pin .pin-hole { fill: var(--pin); }
.pin.is-hover { z-index: 3; }
.pin.is-hover svg { transform: scale(1.15); }
.pin.is-hover .pin-body, .pin.is-hover .pin-hole { fill: var(--hover); }
.pin.is-hover .pin-ink { stroke: var(--deep); }
.pin.is-hover .pin-dot { fill: var(--deep); }
.pin[hidden] { display: none; }
.sel-mark { display: flex; align-items: center; gap: 6px; pointer-events: none; }
.sel-mark.left { flex-direction: row-reverse; }
.sel-mark svg { flex: none; display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .35)); }
/* The chosen trip stands out: bigger departure and arrival pins and labels */
.sel-mark.pinmark svg { transform: scale(1.3); transform-origin: 50% 100%; }
.sel-mark.pinmark .lbl { font-size: 14px; padding: 3px 9px; }
.sel-mark .lbl { font-size: 12px; font-weight: 700; color: var(--navy); background: rgba(255, 255, 255, .93); padding: 2px 7px; border-radius: 6px; white-space: nowrap; }
.sel-mark.pinmark .lbl { margin-top: -18px; }

/* Views */
.trips[data-view="list"] .trips-map { display: none; }
.trips[data-view="list"] .trips-list { width: auto; flex: 1; border-right: 0; }
.trips[data-view="list"] .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); align-content: start; }
.trips[data-view="list"] .card__show { display: none; }
.trips[data-view="list"] .card__details { display: inline-flex; }
.trips[data-view="map"] .trips-list { display: none; }

/* Phones and small tablets: map on top, list below a drag bar */
@media (max-width: 900px) {
    .trips-bar { padding: 8px 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
    .trips-bar::-webkit-scrollbar { display: none; }
    .filters { flex-wrap: nowrap; }
    .chip { height: 40px; }
    .clear-all { white-space: nowrap; }   /* was wrapping word by word, which made the bar twice as high */
    .views .only-wide { display: none; }

    .trips-body { flex-direction: column; }
    .trips-map { order: 1; }
    .trips-list { order: 2; min-width: 0; }
    .trips[data-view="split"] .trips-map { flex: 1; }
    .trips[data-view="split"] .trips-list { width: auto; height: var(--sheet, 50%); flex: none; border-right: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -6px 20px rgba(13, 44, 64, .15); margin-top: -14px; position: relative; z-index: 4; }
    .trips[data-view="split"] .sheet-handle { display: flex; justify-content: center; align-items: center; height: 36px; flex: none; cursor: ns-resize; touch-action: none; }
    .sheet-handle span { width: 44px; height: 5px; border-radius: 3px; background: var(--line); }
    .trips-count { padding: 4px 16px 8px; font-size: 20px; }
    .cards { padding: 0 12px 16px; }
    .trips[data-view="list"] .cards { grid-template-columns: 1fr; }
    .card__img { width: 104px; min-height: 120px; }
    .card__ship { width: 56px; height: 56px; margin-left: -40px; }
    .card__foot { flex-wrap: wrap; }
    .map-zoom { display: none; }
    .map-ui { top: 10px; left: 10px; }
    .map-legend { display: none; }
}
@media (max-width: 1100px) and (min-width: 901px) {
    .trips-list { width: 440px; }
}
@media (prefers-reduced-motion: reduce) {
    .pin svg, .card { transition: none !important; }
}

/* Clusters: pins that would overlap become a circle with the number of trips */
.trips .cluster { width: 30px; height: 30px; padding: 0; border-radius: 50%; border: 2px solid #fff; background: #b23e40; color: #fff; font: 700 14px/1 var(--font); display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 0 0 4px rgba(204, 74, 76, .25), 0 1px 4px rgba(0, 0, 0, .35); }
.trips .cluster.is-big { width: 34px; height: 34px; font-size: 15px; }
.trips .cluster.is-huge { width: 38px; height: 38px; font-size: 16px; }
.trips .cluster.is-hover, .trips .cluster:hover { background: var(--hover); color: var(--deep); box-shadow: 0 0 0 4px rgba(63, 169, 220, .3), 0 1px 4px rgba(0, 0, 0, .35); z-index: 3; }
.cluster:focus-visible { outline: 3px solid var(--yellow); outline-offset: 3px; }
.cluster-list { position: absolute; z-index: 20; width: 320px; max-width: calc(100% - 24px); max-height: 60%; overflow-y: auto; background: #fff; border-radius: 12px; box-shadow: 0 8px 24px rgba(13, 44, 64, .3); padding: 6px; }
.cluster-list[hidden] { display: none; }
.cluster-list__head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 4px 10px; font-size: 16px; color: var(--navy); }
.trips .cluster-list__close { width: 40px; height: 40px; border: 0; background: transparent; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; border-radius: 8px; }
.cluster-list__close:hover { background: var(--pale); }
.trips .cluster-list__item { display: flex; flex-direction: column; gap: 2px; width: 100%; text-align: left; border: 0; background: transparent; padding: 10px; border-radius: 8px; cursor: pointer; border-top: 1px solid #eef1f3; }
.cluster-list__item:hover, .cluster-list__item:focus-visible { background: var(--pale); }
.cluster-list__item b { font: 400 17px/1.25 var(--title); color: var(--navy); }
.cluster-list__item span { font-size: 14px; color: var(--muted); }

/* Filter panel as a sheet at the bottom of the screen (phones, moved to the body by trips.js) */
.filter__done { display: none; }
.filter__panel.is-sheet { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 1001; min-width: 0; max-width: none; max-height: 78vh; max-height: 78dvh; border-radius: 18px 18px 0 0; padding: 14px 12px calc(12px + env(safe-area-inset-bottom)); font-size: 17px; color: var(--navy); }
.filter__panel.is-sheet .filter__done { display: flex; width: 100%; justify-content: center; margin-top: 10px; position: sticky; bottom: 0; }
.filter-backdrop { position: fixed; inset: 0; z-index: 1000; background: rgba(9, 22, 32, .45); }
.trips-list { transition: height .25s ease; }
.trips-list.is-dragging { transition: none; }
@media (prefers-reduced-motion: reduce) { .trips-list { transition: none; } }

/* Next to the list the chosen card already shows the trip: the box on the map is only needed without the list */
@media (min-width: 901px) { .trips[data-view="split"] .map-legend { display: none; } }

.only-narrow-text { display: none; }
/* Phones: compact controls and labels on the map, compact cards, so the route keeps the room */
@media (max-width: 900px) {
    .only-wide-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .only-narrow-text { display: inline; }
    .map-reset { height: 36px; padding: 0 12px; font-size: 14px; gap: 6px; }
    .sel-mark .lbl { font-size: 11px; padding: 2px 6px; }
    .sel-mark.pinmark svg { transform: none; }
    .sel-mark.pinmark .lbl { font-size: 12px; padding: 2px 7px; }
    .sel-mark:not(.pinmark) svg { width: 20px; height: 20px; }
    .card__title { font-size: 17px; }
    .card__route { -webkit-line-clamp: 1; font-size: 13px; }
    .card__meta { font-size: 12px; }
    .card__body { gap: 2px; padding: 8px 10px 8px 0; }
    .card__price strong { font-size: 15px; }
    .card__night { font-size: 12px; }
    .card__show, .card__details { min-height: 34px; font-size: 14px; padding: 0 10px; }
    .card__img { min-height: 112px; }
}

/* Accessibility: on a phone the drag bar overlaps the bottom of the map; keep the map's attribution button free (24px target) */
@media (max-width: 900px) { .trips[data-view="split"] .maplibregl-ctrl-bottom-right, .trips[data-view="split"] .maplibregl-ctrl-bottom-left { margin-bottom: 6px; } }
