/* Trip-map home page. Colours, radii and fonts come from theme.css tokens only. */
.tripmap { display: grid; grid-template-columns: minmax(280px, 38%) 1fr; height: calc(100vh - 4rem); height: calc(100dvh - 4rem); min-height: 520px; }
.tripmap .panel { overflow-y: auto; padding: 1rem; background: var(--c-surface); border-right: 1px solid var(--c-line-2); min-width: 0; }
.tripmap .panel h1 { font-size: 1.5rem; }
.tripmap .panel h2 { font-size: 1rem; color: var(--c-text-2); margin: 1.25rem 0 .5rem; text-transform: none; }
.tripmap .lead { margin: 0 0 .75rem; }
.tripmap .note { font-size: .9rem; margin: .5rem 0; }
.tripmap .status { min-height: 1.5em; margin: 1rem 0 .25rem; color: var(--c-text-2); font-weight: 600; }

@media (min-width: 900px) { .tripmap { grid-template-columns: minmax(330px, 400px) 1fr; } }

/* Dates and guests */
.tripmap form.plan { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; align-items: end; margin: .75rem 0; }
.tripmap form.plan label { display: grid; gap: .25rem; font-size: .85rem; font-weight: 700; color: var(--c-text-2); min-width: 0; }
.tripmap form.plan fieldset.adults, .tripmap form.plan button.more-kids, .tripmap form.plan input[type="hidden"] { grid-column: 1 / -1; }
.tripmap form.plan select { min-width: 0; }
.tripmap form.plan button { width: 100%; }
.tripmap .stays-all { margin: .5rem 0; }

/* What are you coming for */
.tripmap .chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.tripmap .chip { width: auto; min-height: 44px; padding: .4rem .9rem; background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-line-2); font-weight: 700; }
.tripmap .chip:hover { background: var(--c-surface-3); border-color: var(--c-line-2); }
.tripmap .chip[aria-pressed="true"] { background: var(--c-accent); color: var(--c-accent-ink); border-color: var(--c-accent); }

/* Events on your dates */
.tripmap .event-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.tripmap .event { width: 100%; display: grid; gap: .1rem; text-align: left; padding: .5rem .75rem; background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-line-2); border-radius: var(--r-1); font-weight: 400; }
.tripmap .event:hover { background: var(--c-surface-3); border-color: var(--c-line-2); }
.tripmap .event, .tripmap .event span, .tripmap .event strong { overflow-wrap: break-word; min-width: 0; }
.tripmap .event span { color: var(--c-text-2); font-size: .85rem; }
.tripmap .event[aria-pressed="true"] { border-color: var(--c-accent); background: var(--c-accent-soft); }

/* Your trip */
.tripmap .trip { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; counter-reset: stop; }
.tripmap .trip li { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; padding: .25rem .25rem .25rem .75rem; background: var(--c-surface-2); border-radius: var(--r-1); border-left: 4px solid var(--c-water); overflow-wrap: anywhere; }
.tripmap .trip .live-note { flex: 1 0 100%; margin: 0 0 .25rem; font-size: .85rem; color: var(--c-text-2); }
/* "· checked 3:32 pm" moves to the next line as one piece instead of leaving "pm" alone on a line; it still wraps inside itself if it is wider than the card. */
/* The space before the "·" is a margin: the leading space of an inline-block is collapsed away ("diving· checked"). */
.tripmap .trip .live-note .age { display: inline-block; margin-left: .3em; }
.tripmap .trip li.empty { display: block; background: none; border: 0; padding: 0; color: var(--c-text-2); }
.tripmap .trip .remove { width: auto; flex: none; background: none; color: var(--c-text-2); border: 1px solid var(--c-line-2); font-weight: 600; padding: .2rem .75rem; }
.tripmap .trip .remove:hover { color: var(--c-text); background: var(--c-surface-3); border-color: var(--c-line-2); }

/* Places to stay */
.tripmap .stays { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.tripmap .stay { display: grid; gap: .2rem; padding: .75rem; background: var(--c-surface-2); border: 1px solid var(--c-line); border-radius: var(--r-2); color: var(--c-text); text-decoration: none; overflow-wrap: anywhere; }
.tripmap .stay:hover { border-color: var(--c-line-2); background: var(--c-surface-3); color: var(--c-text); }
.tripmap .stay[aria-current="true"] { border-color: var(--c-accent); background: var(--c-accent-soft); }
.tripmap .stay .name { font-weight: 800; }
.tripmap .stay .town { color: var(--c-text-2); font-size: .9rem; }
.tripmap .stay .near { display: block; color: var(--c-text-2); font-size: .85rem; }
.tripmap .stay .badge { justify-self: start; background: color-mix(in srgb, var(--c-good) 18%, var(--c-surface)); color: var(--c-good); }
.tripmap .stay .badge.warn { background: color-mix(in srgb, var(--c-warn) 18%, var(--c-surface)); color: var(--c-warn); }
.tripmap .times { list-style: none; margin: 0; padding: 0; color: var(--c-text-2); font-size: .85rem; }
.tripmap .stay .fee { color: var(--c-text-2); font-size: .85rem; }
.tripmap .stay .price { font-size: .85rem; color: var(--c-text-2); }
.tripmap .stay .price strong { font-size: 1.1rem; color: var(--c-text); }

/* Map */
.tripmap .skip-map { position: absolute; left: .75rem; top: .75rem; z-index: 5; transform: translateY(-300%); padding: .5rem .75rem; border-radius: var(--r-1); background: var(--c-surface-2); color: var(--c-text); border: 1px solid var(--c-accent); }
.tripmap .skip-map:focus { transform: none; }
.tripmap .map { position: relative; min-width: 0; min-height: 0; background: var(--c-bg); }
.tripmap .map-fail { margin: 2rem 1rem; color: var(--c-text-2); font-weight: 600; }
.tripmap .overlay { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1; }
.tripmap .lines, .tripmap .labels { position: absolute; inset: 0; width: 100%; height: 100%; }
.tripmap .callout { display: none; stroke: var(--c-text-2); stroke-width: 1; }
.tripmap .dot { display: none; stroke: var(--c-bg); stroke-width: 1.5; }
.tripmap .dot.stop { fill: var(--c-water); }
.tripmap .dot.stay { fill: var(--c-text-2); }
.tripmap .dot.stay.best { fill: var(--c-accent); }
.tripmap .dot.stay.selected { fill: var(--c-paper); }
.tripmap .dot.hidden { display: none !important; }

/* Labels: real buttons, placed from script with transform. Hidden until placed. */
.tripmap .overlay .lbl { display: none; position: absolute; left: 0; top: 0; width: auto; min-height: 0; margin: 0; padding: 0 .5rem; pointer-events: auto; font-size: .75rem; font-weight: 700; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; cursor: pointer; border: 1px solid var(--c-line-2); border-radius: var(--r-pill); background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-1); }
.tripmap .overlay .lbl:hover { background: var(--c-surface-3); }
.tripmap .overlay .lbl:focus-visible { outline: 2px solid var(--c-paper); outline-offset: 2px; box-shadow: 0 0 0 5px var(--c-accent); z-index: 2; }
.tripmap .overlay .stop-label { max-width: 220px; height: 26px; background: var(--c-water); color: var(--c-bg); border-color: var(--c-water); }
/* The price pill of a stay: two lines, the hotel's short name, then the price and a refundability flag (words, with a colour as well). Its box is stayBoxSize() in labels.js (164 x 40, 164 x 46 on a touch screen). */
.tripmap .overlay .stay-label { padding: .15rem .4rem; border-radius: var(--r-2); line-height: 1.2; }
.tripmap .overlay .stay-label .p1 { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
.tripmap .overlay .stay-label .p2 { display: flex; align-items: center; justify-content: center; gap: .35rem; white-space: nowrap; }
.tripmap .overlay .stay-label .p-price { font-size: .8rem; font-weight: 800; }
.tripmap .overlay .stay-label .flag { padding: 0 .3rem; border-radius: var(--r-1); font-size: .65rem; font-weight: 700; line-height: 1.4; }
.tripmap .overlay .stay-label .flag.free { background: color-mix(in srgb, var(--c-good) 22%, var(--c-surface)); color: var(--c-good); }
.tripmap .overlay .stay-label .flag.nonref { background: color-mix(in srgb, var(--c-warn) 22%, var(--c-surface)); color: var(--c-warn); }
.tripmap .overlay .stay-label.best { background: var(--c-accent); color: var(--c-accent-ink); border-color: var(--c-accent-2); }
.tripmap .overlay .stay-label.selected { background: var(--c-paper); color: var(--c-paper-ink); border-color: var(--c-paper); }
.tripmap .overlay .bubble { background: var(--c-surface-3); border-radius: var(--r-2); font-weight: 800; }
.tripmap .overlay .bubble { padding: .2rem .3rem; line-height: 1.3; }
.tripmap .overlay .bubble .b1, .tripmap .overlay .bubble .b2 { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* two lines; the ellipsis is only a last resort */
.tripmap .overlay .bubble .b2 { font-weight: 700; color: var(--c-text-2); }
@media (pointer: coarse) { .tripmap .overlay .stop-label { height: 44px; } }

/* The card while prices load: centred over the map, rendered by the server so it shows from the first paint (loading.js takes it over).
   Its box is a live region that is always there; the box and the card let the map's gestures through. Without script it is hidden
   (the noscript note is real markup only then). */
.tripmap .loading-box { position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; padding: 1rem; pointer-events: none; }
.tripmap:has(noscript .msg) .loading-box { display: none; }
/* A browser that never runs the module (no ES modules, or the script failed to load) must not see the card forever: it fades out after 30 s
   unless main.js has marked the page data-live. */
.tripmap:not([data-live]) .loading-box { animation: tripmap-card-out .4s 30s forwards; }
@keyframes tripmap-card-out { to { opacity: 0; visibility: hidden; } }
.tripmap .loading-card { width: min(22rem, 100%); display: grid; gap: .5rem; padding: 1rem 1.1rem; background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-line-2); border-radius: var(--r-2); box-shadow: var(--shadow-1); text-align: center; }
.tripmap .loading-card[hidden] { display: none; }
.tripmap .loading-card p { margin: 0; overflow-wrap: anywhere; }
.tripmap .loading-head { font-size: 1.05rem; font-weight: 800; line-height: 1.3; }
.tripmap .loading-detail { color: var(--c-text-2); font-size: .9rem; font-weight: 600; }
.tripmap .loading-line { color: var(--c-text-2); font-size: .85rem; }
.tripmap .loading-slow { color: var(--c-text); font-size: .85rem; font-weight: 700; }
.tripmap .loading-detail:empty, .tripmap .loading-line:empty, .tripmap .loading-slow:empty { display: none; }
/* An indeterminate bar: a segment slides across, again and again (static for reduced motion, below). */
.tripmap .loading-bar { position: relative; height: 4px; border-radius: var(--r-pill); background: var(--c-surface-3); overflow: hidden; }
.tripmap .loading-bar span { position: absolute; top: 0; bottom: 0; left: 0; width: 40%; border-radius: inherit; background: var(--c-accent); animation: tripmap-bar 1.4s ease-in-out infinite; }
@keyframes tripmap-bar { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.tripmap .loading-card.error { border-color: var(--c-warn); }
.tripmap .loading-card.error .loading-bar { display: none; }

/* Dates and party: a one-line summary that opens the form (a native details element, so it works without script). */
.tripmap .plan-box { margin: .25rem 0 .5rem; border: 1px solid var(--c-line-2); border-radius: var(--r-2); background: var(--c-surface-2); }
.tripmap .plan-sum { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 44px; padding: .4rem .5rem .4rem .75rem; cursor: pointer; list-style: none; font-weight: 700; }
.tripmap .plan-sum::-webkit-details-marker { display: none; }
.tripmap .plan-sum:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; border-radius: var(--r-2); }
.tripmap .sum-text { min-width: 0; overflow-wrap: anywhere; }
.tripmap .sum-change { flex: none; padding: .35rem .9rem; border-radius: var(--r-pill); background: var(--c-accent); color: var(--c-accent-ink); font-size: .9rem; font-weight: 800; }
.tripmap .plan-box[open] .sum-change { background: none; color: var(--c-text-2); border: 1px solid var(--c-line-2); }
.tripmap .plan-box form.plan { margin: 0; padding: .25rem .75rem .75rem; }

/* The hotel card */
.tripmap .hotel-card { position: absolute; left: .75rem; bottom: .75rem; z-index: 3; width: min(320px, calc(100% - 1.5rem)); max-height: calc(100% - 1.5rem); overflow-y: auto; padding: .75rem; background: var(--c-surface); border: 1px solid var(--c-line-2); border-radius: var(--r-2); box-shadow: var(--shadow-1); }
.tripmap .hotel-card h2 { margin: .5rem 0 .1rem; font-size: 1.1rem; color: var(--c-text); }
.tripmap .hotel-card p { margin: .25rem 0; }
.tripmap .hotel-card .town { color: var(--c-text-2); }
.tripmap .hotel-card .near { margin: .1rem 0 0; color: var(--c-text-2); font-size: .9rem; }
.tripmap .hotel-card .photo { display: block; width: 100%; height: 140px; object-fit: cover; border-radius: var(--r-1); background: var(--c-surface-2); }
.tripmap .hotel-card .close { position: sticky; top: 0; float: right; z-index: 1; margin: 0 0 .25rem .5rem; width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: var(--r-pill); font-size: 1.4rem; line-height: 1; background: var(--c-surface); color: var(--c-text); border: 1px solid var(--c-line-2); }
.tripmap .hotel-card .price strong { font-size: 1.25rem; }
.tripmap .hotel-card .fee { color: var(--c-text-2); font-size: .9rem; }
.tripmap .hotel-card .btn { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-top: .5rem; border-radius: var(--r-pill); background: var(--c-accent); color: var(--c-accent-ink); font-weight: 800; text-decoration: none; }
.tripmap .hotel-card .btn:hover { background: var(--c-accent-2); color: var(--c-accent-ink); }

/* Phone: one column, the map on top at 46% of the screen height, the panel below it as the page's normal scroll. Nothing scrolls sideways.
   The hotel card becomes a sheet across the bottom of the map, at most 45% of the map, scrolling inside itself. */
@media (max-width: 819px) {
  .tripmap { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .tripmap .map { order: -1; flex: none; height: 68vh; height: 68svh; min-height: 320px; }
  /* Under the map: the dates summary, then the places to stay, then the trip builder (CSS order: the markup keeps the desktop order, so on a
     phone the Tab order runs summary, trip builder, stays while the eye reads summary, stays, trip builder). The h1 stays for screen readers. */
  .tripmap .panel { display: flex; flex-direction: column; overflow-y: visible; border-right: 0; border-top: 1px solid var(--c-line-2); padding: .5rem 1rem 1rem; }
  .tripmap .panel > .results { order: 1; }
  .tripmap .panel > .pick { order: 2; }
  .tripmap .panel h1 { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
  .tripmap .lead { display: none; }
  .tripmap .results .status { margin-top: .25rem; }
  .tripmap form.plan { grid-template-columns: 1fr; }
  .tripmap .hotel-card { left: 0; right: 0; bottom: 0; width: auto; max-height: 45%; border-width: 1px 0 0; border-radius: var(--r-2) var(--r-2) 0 0; }
  .tripmap .hotel-card .photo { height: 96px; margin-top: .5rem; }
  /* Compact top of the sheet: even a three-line name leaves the See rooms button inside the sheet's own first screen. */
  .tripmap .hotel-card { padding: .5rem .75rem; }
  .tripmap .hotel-card h2 { margin: 0 0 .1rem; font-size: 1rem; line-height: 1.2; }
  .tripmap .hotel-card p { margin: .15rem 0; }
  .tripmap .hotel-card .btn { margin-top: .35rem; }
}
/* Touch screens: the trip map's zoom buttons are 44 px (the hotel page's small map keeps the library's size). */
@media (pointer: coarse) { .tripmap .maplibregl-ctrl-group button { width: 44px; height: 44px; } }

/* Reduced motion: nothing glides or fades (the camera moves are switched off in mapview.js). */
@media (prefers-reduced-motion: reduce) {
  .tripmap .overlay .lbl, .tripmap .hotel-card, .tripmap .callout, .tripmap .dot { transition: none; animation: none; }
  .tripmap .loading-bar span { width: 100%; opacity: .6; animation: none; }
}
