/*
 * Finder-style navigation on the desktop and in Places. Covers the photo window menu bar (#desk-photos), the
 * entry window (#desk-entry: shuffle object and quick area search with suggestions), the retired Places finder
 * window (#desk-places, hidden in the HTML) with its toolbar, tabs, folder grid and footer, and the Places page
 * heading and search tools. Colours here are plum defaults; hyd-theme.css re-colours many of these surfaces
 * from the active theme.
 */

/* Finder-like navigation inside the existing plum/Aqua desktop. */
#home #desk-photos .desktop-menu {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 5px 7px;
  background: linear-gradient(#dfdfe7, #b9bac6);
  border-bottom: 1px solid #777080;
}

#home #desk-photos .desktop-menu button {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  min-height: 29px;
  border: 1px solid #8b8b9b;
  border-radius: 4px;
  background: linear-gradient(#faf9fc, #c8c8d4);
  color: #302c3b;
  text-shadow: 0 1px #fff8;
  font:
    calc(11 * var(--px)) Tahoma,
    sans-serif;
  box-shadow: inset 0 1px #fff;
}

#home #desk-photos .desktop-menu svg {
  width: 20px;
  height: 20px;
  flex: none;
}

/* --- Entry window (#desk-entry): shuffle object and quick area search --- */
#home #desk-entry {
  width: 470px;
  border-color: #e4ddec #665674 #665674 #e4ddec;
}

#home #desk-entry .visual-entry {
  grid-template-columns: 155px minmax(0, 1fr);
  padding: 9px;
  gap: 12px;
  background: linear-gradient(130deg, #3c2c4833, transparent), #21182c;
  border-color: #71637e;
}

#home .visual-entry .shuffle-object {
  padding: 10px 3px;
  border: 1px solid transparent;
  border-radius: 8px;
  gap: 7px;
  align-self: stretch;
  justify-content: center;
}

#home .visual-entry .shuffle-object:hover {
  background: #d7bcf011;
  border-color: #a18bb54a;
}

#home .visual-entry .recording-shuffle,
#home .visual-entry .recording-shuffle svg {
  width: 108px;
  height: 108px;
  flex-basis: 108px;
  rotate: 0deg;
}

#home .visual-entry .shuffle-object b {
  font:
    700 calc(12 * var(--px))/1.4 Tahoma,
    sans-serif;
  color: #f8efff;
}

#home .visual-entry .entry-play {
  display: grid;
  place-items: center;
  width: 34px;
  height: 21px;
  min-height: 0;
  line-height: 1;
  margin-top: 0;
  border-radius: 10px;
  background: linear-gradient(#eff4ff, #b1c0d8 45%, #7188b1 50%, #c4d7e9);
  border: 1px solid #617191;
  color: #20304b;
  text-shadow: 0 1px #fff8;
  box-shadow: inset 0 1px #fff9;
  font-size: 10px;
}

#home .visual-entry .area-terminal {
  margin: 0;
  padding: 0;
  border-left: 1px solid #65517255;
  min-width: 0;
  padding-left: 10px;
}

#home .visual-entry .area-terminal > label {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 0 0 5px;
}

#home .visual-entry .area-terminal > label > b {
  font:
    700 calc(12 * var(--px)) Tahoma,
    sans-serif;
  color: #f1e9fa;
}

.finder-folder-icon {
  display: block;
  width: 30px;
  height: 26px;
  flex: none;
  overflow: visible;
  filter: drop-shadow(0 1px 1px #03020b35);
}

/* --- Quick area search field and suggestions --- */
#home .visual-entry .terminal-input {
  display: flex;
  gap: 0;
  border: 1px solid #70677e;
  border-radius: 12px;
  background: #110e1b;
  box-shadow: inset 0 1px 3px #0006;
  overflow: hidden;
  margin-bottom: 6px;
}

#home .visual-entry .terminal-input input {
  width: 100%;
  min-width: 0;
  padding: 6px 9px;
  min-height: 28px;
  /*
   * !important (border and background): the pill-shaped wrapper draws the border and background, so the bare
   * field inside has to stay transparent whatever form field styles other sheets apply.
   */
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: #fff4ff;
  font:
    calc(11 * var(--px)) Tahoma,
    sans-serif;
  box-shadow: none;
  outline-offset: -2px;
}

#home .visual-entry .terminal-input input::placeholder {
  color: #b8acc7;
  opacity: 1;
}

#home .visual-entry .terminal-input > button {
  padding: 2px 7px;
  /* rem: the arrow grows with bigger text (hyd-classic-desktop.css sizes it), so its button does too. */
  width: calc(29 * var(--px));
  background: linear-gradient(#c7c2d5, #8b839f);
  border: 0;
  border-left: 1px solid #70677e;
  color: #211a31;
  font: 17px Tahoma;
}

#home .visual-entry .area-suggestions,
#home .visual-entry .area-suggestions.has-query {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  max-height: 156px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #8c78a0 #1c1525;
  border: 1px solid #665672;
  border-radius: 3px;
  background: #191323;
  margin: 0;
}

#home .visual-entry .area-suggestions .discovery-result,
#home .visual-entry .area-suggestions.has-query .discovery-result {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 6px;
  row-gap: 1px;
  min-height: 38px;
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 5px 7px;
  background: transparent;
  text-decoration: none;
  color: #f4eafa;
  text-align: left;
  font:
    calc(11 * var(--px))/1.25 Tahoma,
    sans-serif;
}

#home .visual-entry .area-suggestions .discovery-result:nth-child(even) {
  background: #d9b9ed07;
}

#home .visual-entry .area-suggestions .discovery-result:hover,
#home .visual-entry .area-suggestions .discovery-result:focus-visible {
  background: linear-gradient(#736285, #574569);
  box-shadow: inset 0 1px #c4afd340;
  outline-offset: -2px;
  color: #fff;
}

#home .visual-entry .area-suggestions .discovery-result > span {
  grid-column: 2;
  grid-row: 1;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

#home .visual-entry .area-suggestions .discovery-result > small {
  display: block;
  grid-column: 2;
  grid-row: 2;
  font:
    calc(9 * var(--px))/1.2 Tahoma,
    sans-serif;
  color: #bfb1cc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bigger text: the one-line name and count wrap instead of ending in an ellipsis (see --px in hyd-platform.css). */
@container not style(--px: 1px) {
  #home .visual-entry .area-suggestions .discovery-result > :is(span, small) {
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

#home .visual-entry .area-suggestions .finder-folder-icon,
#home .visual-entry .area-suggestions .discovery-result > img {
  width: 25px;
  height: 24px;
  grid-column: 1;
  grid-row: 1/3;
  object-fit: cover;
  border: 0;
}

/* Station and line results show a text glyph tinted by --result-line (pale blue by default). */
#home .visual-entry .area-suggestions .discovery-result[data-kind='station']::before {
  content: '▦';
  grid-column: 1;
  grid-row: 1/3;
  font: 20px Tahoma;
  color: var(--result-line,#b1cce6);
}

#home .visual-entry .area-suggestions .discovery-result[data-kind='line']::before {
  content: '━';
  grid-column: 1;
  grid-row: 1/3;
  color: var(--result-line,#b1cce6);
}

#home .visual-entry .finder-all-areas {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 6px 4px 1px;
  border: 0;
  background: none;
  color: #ddcce9;
  font:
    calc(10 * var(--px)) Tahoma,
    sans-serif;
  text-decoration: none;
}

#home .visual-entry .finder-all-areas:hover {
  color: #fff;
}

#home .visual-entry .finder-all-areas span {
  font: 16px/1 Tahoma;
}

#quick-area-status:empty {
  display: none;
}

/* --- Places finder window (#desk-places, retired: hidden in the HTML) --- */
#home #desk-places {
  width: 405px;
  rotate: 0deg;
  right: 7%;
  top: 160px;
  max-width: calc(100% - 105px);
}

.places-finder-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: space-between;
  padding: 7px 8px;
  background:
    repeating-linear-gradient(0deg, #ffffff18 0 1px, transparent 1px 3px),
    linear-gradient(#dedde5, #b3adbf);
  color: #32293c;
  border-bottom: 1px solid #797080;
}

.places-finder-toolbar > span {
  display: flex;
  gap: 5px;
  align-items: center;
  font:
    700 11px Tahoma,
    sans-serif;
  white-space: nowrap;
}

.places-finder-toolbar svg {
  width: 25px;
  height: 22px;
}

.places-finder-toolbar label {
  min-width: 0;
  max-width: 190px;
}

.places-finder-toolbar input {
  width: 100%;
  min-width: 0;
  padding: 5px 9px;
  border: 1px solid #898494;
  border-radius: 12px;
  background: #f1f0f6;
  color: #292234;
  box-shadow: inset 0 1px 2px #4e405530;
  font:
    11px Tahoma,
    sans-serif;
  color-scheme: light;
}

.places-finder-toolbar input::placeholder {
  color: #756b81;
}

.places-finder-tabs {
  display: flex;
  justify-content: center;
  gap: 0;
  padding: 8px 10px;
  background: #2d2038;
  border-bottom: 1px solid #67536e;
}

.places-finder-tabs button {
  min-height: 25px;
  padding: 3px 12px;
  border: 1px solid #928699;
  background: linear-gradient(#dad5e1, #aaa1b8);
  font:
    10px Tahoma,
    sans-serif;
  color: #342a42;
  text-shadow: 0 1px #ffffff80;
  box-shadow: inset 0 1px #fff8;
}

.places-finder-tabs button + button {
  border-left: 0;
}

.places-finder-tabs button:first-child {
  border-radius: 5px 0 0 5px;
}

.places-finder-tabs button:last-child {
  border-radius: 0 5px 5px 0;
}

.places-finder-tabs button[aria-pressed='true'] {
  background: linear-gradient(#b6b3d7, #7c74a6 48%, #61578c 50%, #978eb9);
  color: #fff;
  text-shadow: 0 1px #352853;
  border-color: #b2a2c8;
}

#desktop-area-folders {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  align-content: start;
  padding: 10px 7px;
  max-height: 300px;
  min-height: 155px;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: #8c78a0 #211829;
  background: repeating-linear-gradient(0deg, #ede0fa03 0 1px, transparent 1px 4px), #241a30;
}

#desktop-area-folders .finder-area {
  display: flex;
  align-items: center;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  min-height: 99px;
  padding: 6px 3px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: #f3e8f8;
  text-align: center;
}

#desktop-area-folders .finder-area svg {
  width: 58px;
  height: 51px;
  transition: translate 0.16s ease;
}

#desktop-area-folders .finder-area b {
  font:
    11px/1.2 Tahoma,
    sans-serif;
  max-width: 100%;
  overflow-wrap: anywhere;
}

#desktop-area-folders .finder-area small {
  font:
    9px/1.25 Tahoma,
    sans-serif;
  color: #bca9c9;
}

#desktop-area-folders .finder-area:hover,
#desktop-area-folders .finder-area:focus-visible {
  border-color: #aa94bd;
  background: #81659835;
  outline-offset: -1px;
}

#desktop-area-folders .finder-area:hover svg {
  translate: 0 -2px;
}

.finder-empty {
  grid-column: 1/-1;
  text-align: center;
  align-self: center;
  padding: 22px;
  color: #d2c2df;
  font:
    12px/1.5 Tahoma,
    sans-serif;
}

.places-finder-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 9px;
  border-top: 1px solid #8e7e9d;
  background: linear-gradient(#c6becf, #a69aaf);
  color: #392c45;
  font:
    10px Tahoma,
    sans-serif;
}

.places-finder-footer button {
  padding: 3px 7px;
  border: 1px solid #8a7a96;
  border-radius: 3px;
  background: linear-gradient(#eee5f3, #b1a1be);
  color: #32213f;
  font:
    10px Tahoma,
    sans-serif;
}

/* --- Places page: heading, search tools and area results --- */
#places .places-heading h1 {
  font:
    700 32px/1.1 Tahoma,
    sans-serif;
  letter-spacing: -1px;
  text-shadow: 0 2px #160e22;
  margin: 0;
}

#places .map-tools label {
  border-radius: 16px;
  border: 1px solid #80658f;
  background: #1b1228;
  box-shadow: inset 0 1px 4px #0006;
  overflow: hidden;
}

#places .map-tools label:focus-within {
  outline: 2px solid #dac4e8;
  outline-offset: 2px;
}

#places .map-tools input {
  font:
    13px Tahoma,
    sans-serif;
  border: 0;
  border-radius: 0;
  color: #f9edff;
  background: transparent;
  box-shadow: none;
}

#places .map-tools input:focus-visible {
  outline: none;
  box-shadow: none;
}

#places .map-tools > button {
  font:
    11px Tahoma,
    sans-serif;
  border-radius: 5px;
  color: #f8edfc;
  background: linear-gradient(#6a507b, #402c50);
  border: 1px solid #a38bae;
  box-shadow: inset 0 1px #e1b7ed40;
}

#places .discovery-result[data-kind='area'] {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 2px 8px;
}

#places .discovery-result[data-kind='area'] svg {
  grid-row: 1/3;
  align-self: center;
}

#places .discovery-result[data-kind='area'] > span,
#places .discovery-result[data-kind='area'] > small {
  grid-column: 2;
}

/*
 * Tablet widths (621px to 900px): the entry window moves right with tighter columns, and the Places finder
 * window moves.
 */
@media (min-width: 621px) and (max-width: 900px) {
  #home #desk-entry {
    left: 23%;
    width: 450px;
    max-width: calc(100% - 125px);
  }

  #home #desk-entry .visual-entry {
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 7px;
  }

  #home #desk-places {
    right: 4%;
    top: 200px;
  }
}

/* Phone widths (620px and below): both windows become full-width blocks instead of floating. */
@media (max-width: 620px) {
  #home #desk-entry,
  #home #desk-places {
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    width: 100%;
    max-width: 100%;
    margin: 0;
  }

  #home #desk-entry .visual-entry {
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 7px;
    padding: 8px;
  }

  #home .visual-entry .recording-shuffle,
  #home .visual-entry .recording-shuffle svg {
    width: 88px;
    height: 88px;
    flex-basis: 88px;
  }

  #home .visual-entry .shuffle-object b {
    font-size: calc(11 * var(--px));
  }

  #home .visual-entry .area-terminal {
    padding-left: 7px;
  }

  #home .visual-entry .area-suggestions {
    max-height: 156px;
  }

  #desktop-area-folders {
    max-height: 330px;
  }

  #places .places-heading h1 {
    font-size: 28px;
  }

  .places-finder-toolbar {
    gap: 8px;
  }

  .places-finder-toolbar label {
    max-width: 55%;
  }
}

/* Reduced motion and the motion-off setting: folder icons do not slide on hover. */
@media (prefers-reduced-motion: reduce) {
  #desktop-area-folders .finder-area svg {
    transition: none;
  }
}

.motion-off #desktop-area-folders .finder-area svg {
  transition: none;
}
