/* The finder: what the one search would find, under its field, wherever the
   search stands, in the hero grown into its screen or on the search's own
   page. Before a word is typed, the ways, each an example that works, and what
   the search never takes; as one types, the rows the site's script shows, the
   case number's among them, or why nothing stands. Each part draws its own
   hairline, so a finder with nothing to say draws nothing. */

.la-finder {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

/* A way says what its example finds, in words that wrap; a place found is named in one line. */
.la-finder-ways .la-ss-secondary {
  font-family: var(--la-font-sans);
  font-size: var(--la-text-xs);
  letter-spacing: 0;
  white-space: normal;
}

.la-finder-rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.la-finder-ways,
.la-finder-list,
.la-finder-refused {
  border-block-start: 1px solid var(--la-color-border);
}

/* The ways stand while the field is empty, and only then. */
.la-smart-search:not(:has(.la-ss-input:placeholder-shown)) .la-finder-ways {
  display: none;
}

/* A list whose every row is hidden stands not, nor its hairline. */
.la-finder-list:not(:has(> li:not([hidden]))) {
  display: none;
}

.la-finder-rows .la-ss-section-label {
  border-block-start: 0;
}

/* A row is a link, or for the number a button: one look, the button's own
   dress undone. Rows after the first visible one are ruled. */
.la-finder-rows .la-ss-row {
  width: 100%;
  font: inherit;
  text-align: start;
  text-decoration: none;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.la-finder-rows > li:not([hidden]) ~ li:not([hidden]) > .la-ss-row {
  border-block-start: 1px solid var(--la-color-border);
}

.la-finder-rows .la-ss-row:focus-visible {
  outline: 2px solid var(--la-color-border-focus);
  outline-offset: -2px;
}

.la-finder-rows .la-ss-primary,
.la-finder-rows .la-ss-secondary {
  display: block;
}

.la-finder-never,
.la-finder-refused {
  margin: 0;
  padding: var(--la-space-3) var(--la-space-4);
  color: var(--la-color-fg-muted);
  font-size: var(--la-text-sm);
  line-height: var(--la-leading-normal);
}

.la-finder-refused {
  color: var(--la-color-fg);
  background: var(--la-color-accent-subtle);
  border-inline-start: 3px solid var(--la-color-accent);
}

.la-finder-close {
  display: none;
}

/* In the hero, the finder stands only while the field is held: grown. */
.la-ss-hero:not(:focus-within) .la-finder {
  display: none;
}

/* Grown into its screen, the field and its finder share one column, and the
   cross that leaves stands at the screen's corner. */
.la-screens .la-ss-hero:focus-within {
  grid-template-columns: minmax(0, 1fr);
}

.la-screens .la-ss-hero:focus-within .la-finder {
  width: min(100%, 48rem);
  margin-inline: auto;
  overflow: auto;
  background: var(--la-color-bg-raised);
  border: 1px solid var(--la-color-border);
  border-block-start: 0;
  border-end-start-radius: var(--la-radius-md);
  border-end-end-radius: var(--la-radius-md);
}

.la-screens .la-ss-hero:focus-within .la-ss-input-wrap {
  background: var(--la-color-bg-raised);
  border: 2px solid var(--la-color-border-focus);
  border-radius: var(--la-radius-md);
}

.la-screens .la-ss-hero:focus-within .la-finder-close {
  position: absolute;
  inset-block-start: var(--la-space-3);
  inset-inline-end: var(--la-page-edge);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: max(var(--la-control-md), var(--la-tap-target));
  height: max(var(--la-control-md), var(--la-tap-target));
  padding: 0;
  color: var(--la-color-fg);
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--la-color-border-strong);
  border-radius: var(--la-radius-sm);
}

.la-finder-close svg {
  width: var(--la-icon-md);
  height: var(--la-icon-md);
}

/* The search's own screen on a phone: the field at the top, its heading
   short, its lede left to the ways, which say the same by example. */
@container la-page (max-width: 40rem) {
  .la-search {
    padding-block-start: var(--la-space-4);
  }

  .la-search .la-band-eyebrow,
  .la-search .la-opening-lede {
    display: none;
  }

  .la-search .la-opening-line {
    font-size: var(--la-text-xl);
  }

  .la-search .la-search-box {
    margin-block-start: var(--la-space-3);
  }
}

/* The search's own page is one screen: its part in the middle of the room at a tablet and a desk, the foot beneath;
   on a phone at the top, where the keys rise under it. Its note on what is shown stands with what was found alone. */
.la-screens .la-search {
  width: min(100%, 48rem);
  /* Its own column's edge, never the page's, which at a large desk is half the room's spare width. */
  padding-inline: min(var(--la-page-edge), var(--la-space-6));
  padding-block: clamp(16px, 6svh, 72px);
  background: transparent;
}

.la-search:not(:has(.la-search-cases, .la-search-places, .la-search-said)) .la-search-note {
  display: none;
}

.la-ss-page .la-ss-input {
  font-size: var(--la-text-xl);
}

@container la-page (max-width: 40rem) {
  .la-screen.is-last > .la-search {
    align-self: start;
  }
}

/* A phone on its side, and any room with little height: the title smaller, the lede left to the ways, and the ways
   side by side under the field, so the field and all three stand in the one screen. */
@media (orientation: landscape) and (max-height: 32rem) {
  .la-search .la-band-eyebrow,
  .la-search .la-opening-lede {
    display: none;
  }

  .la-screens .la-search {
    padding-block: var(--la-space-3);
  }

  .la-screens .la-search .la-opening-line {
    font-size: clamp(1.25rem, 6svh, 1.75rem);
  }

  .la-search .la-search-box {
    margin-block-start: var(--la-space-3);
  }

  .la-finder-ways .la-finder-rows {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .la-finder-ways .la-finder-rows > .la-ss-section-label {
    grid-column: 1 / -1;
  }

  .la-finder-ways .la-finder-rows > li:not([hidden]) ~ li:not([hidden]) > .la-ss-row {
    border-block-start: 0;
    border-inline-start: 1px solid var(--la-color-border);
  }
}

/* A number's answer: each case at its court a card of its own, the hearing it moves at first told large, the day a
   person must be there; the one after it quieter. */
.la-search-cases .la-case-num {
  font-size: var(--la-text-xl);
}

.la-search-cases .la-case-court {
  font-size: var(--la-text-base);
  color: var(--la-color-fg);
}

.la-search-cases .la-case-hearing:not(.la-case-hearing ~ .la-case-hearing) {
  padding: var(--la-space-3) var(--la-space-4);
  background: var(--la-color-accent-subtle);
}

.la-search-cases .la-case-hearing:not(.la-case-hearing ~ .la-case-hearing) .la-when {
  font-size: var(--la-text-xl);
  line-height: var(--la-leading-display, 1.15);
}
