/* The trip page: the form, the route options and the playlist in a panel beside
   Google's map. */

.layout {
  display: grid;
  grid-template-columns: minmax(340px, 460px) 1fr;
  height: 100vh;
}

.panel {
  overflow-y: auto;
  padding: 20px 20px 12px;
  background: var(--ground);
  border-right: 1px solid var(--line);
}

.map { min-height: 300px; }
/* In the map's place until there are routes to draw on it, since Google charges
   for each map made */
.map-waiting {
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}
.map-waiting .logo { width: 64px; height: 64px; opacity: 0.4; }
.map-waiting p { margin: 0; max-width: 26ch; font-size: 17px; }

.head { display: grid; gap: 10px; margin-bottom: 18px; }
.tagline { margin: 0; color: var(--muted); }

.trip { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field-name { font-weight: 700; font-size: 15px; }
gmp-place-autocomplete { width: 100%; }

.avoid { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; padding: 0; border: 0; }
.avoid legend { float: left; margin-right: 6px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 0; padding: 0; border: 0; }
.chips legend { margin-bottom: 6px; }
.wide { width: 100%; font-size: 18px; padding-block: 13px; border-radius: 12px; }

.status { min-height: 1.45em; margin: 14px 0 0; color: var(--muted); scroll-margin-top: 12px; }
.status.error { color: var(--error); }

/* Route options, as cards: the way, how long and how far, and how many towns with
   artists it passes */
.options { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 13px 14px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  cursor: pointer;
}
.option.chosen { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
@media (hover: hover) {
  .option:not(.chosen):hover { border-color: var(--muted); }
}
.option-head { font-weight: 700; font-size: 17px; }
.option-head input {
  width: 18px;
  height: 18px;
  margin: 0 8px 0 0;
  vertical-align: -3px;
  accent-color: var(--accent);
}
.option-badge {
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--sign);
  color: var(--sign-ink);
  font-size: 12px;
  vertical-align: 2px;
}
.option-time { color: var(--muted); font-size: 15px; }
.option-count { grid-row: 1 / span 2; grid-column: 2; display: grid; justify-items: end; align-content: start; }
.option-count strong { font-size: 26px; line-height: 1; }
.option-count span { color: var(--muted); font-size: 13px; }
.option-towns { grid-column: 1 / -1; color: var(--muted); font-size: 14px; margin: 2px 0 0; }

/* Genres and decades, folded out once a route is picked, and the button that
   builds its playlist */
.choices {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  scroll-margin-top: 12px;
}
.choices:not([hidden]) { animation: unfold 0.25s ease-out; }
.choices h2 { font-size: 18px; }
.choices .wide { margin-top: 16px; }
@keyframes unfold {
  from { opacity: 0; transform: translateY(-8px); }
}
@media (prefers-reduced-motion: reduce) {
  .choices:not([hidden]) { animation: none; }
}

.playlist {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}
.playlist { scroll-margin-top: 12px; }
#playlist-title:focus { outline: none; }   /* a heading, focused only to land there */
.summary { margin: 0; color: var(--muted); font-size: 15px; }
.summary[hidden], #playlist-more[hidden] { display: none; }
/* What to do with the playlist, kept in view while the songs scroll past */
.playlist-bar {
  position: sticky;
  top: -20px;   /* the panel's padding: stuck to its very top */
  z-index: 2;
  display: grid;
  gap: 6px;
  margin: 0 -16px;
  padding: 8px 16px;
  background: var(--panel);
  border-block: 1px solid var(--line);
}
.playlist-bar[hidden] { display: none; }
.playlist-bar .actions { flex-wrap: nowrap; }
.playlist-bar .button, .playlist-bar button { min-height: 40px; padding: 7px 12px; }
.playlist-bar #playlist-app { flex: 1; line-height: 1.2; }
.playlist-bar .hint:empty { display: none; }
.playlist-bar .hint.error { color: var(--error); }

/* The places of a playlist on the map, coloured as their tags are */
.marker {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  border: 2px solid #16212c;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.4);
}
.marker.passed { background: #f5c518; }
.marker.arriving { background: #6a3a1c; border-color: #ffffff; }
.marker.focus { transform: scale(1.8); }

/* A phone: one column, the panel's contents and the map together, so the map can go
   between them. Once there are routes it's under the form, above the route cards;
   once there's a playlist it's above that, with its places marked. Scrolling on to
   the routes or the playlist stops a map's height short, to show the map first. */
@media (max-width: 760px) {
  .layout {
    --map-height: clamp(180px, 30vh, 300px);
    display: flex;
    flex-direction: column;
    height: auto;
    padding: 16px 16px 12px;
  }
  .panel { display: contents; }
  .map-waiting { display: none; }
  .map { order: 1; height: var(--map-height); min-height: 0; margin: 16px -16px 0; }
  .status, .options, .choices { order: 2; }
  .layout:has(.playlist:not([hidden])) .map { order: 3; }
  .playlist, .colophon { order: 4; }
  .status { scroll-margin-top: calc(var(--map-height) + 14px); }   /* its margin-top */
  .playlist { scroll-margin-top: calc(var(--map-height) + 18px); }
  .playlist-bar { top: 0; }
}
