.sley-livesearch-form {
  position: relative;
}

.sley-livesearch-shortcode {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  margin: 28px auto;
  max-width: 1180px;
  position: relative;
}

.sley-livesearch-shortcode__form {
  align-items: stretch;
  align-self: center;
  background: #fff;
  margin: 0;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.1);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  overflow: hidden;
}

.sley-livesearch-shortcode__input[type="search"] {
  background: #fff;
  border: 0 !important;
  border-bottom: 0 !important;
  color: #111827;
  font-size: 28px;
  line-height: 1.2;
  min-height: 86px;
  min-width: 0;
  padding: 22px 24px;
  width: 100%;
}

.sley-livesearch-shortcode__input[type="search"]::placeholder {
  color: #6b7280;
  opacity: 1 !important;
}

.sley-livesearch-shortcode__input[type="search"]:focus {
  border: 0 !important;
  border-bottom: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
}

.sley-livesearch-shortcode__form:focus-within {
  border-color: #0b6a55;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.1);
  outline: 0;
}

.sley-livesearch-shortcode__button {
  background: #0b6a55;
  border: 0 !important;
  outline: 0 !important;
  color: #fff;
  cursor: pointer;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: 0.04em;
  min-width: 86px;
  padding: 0;
  text-transform: uppercase;
}

/* !important above and on the states below: the "sley" theme has a generic
   `.x-btn:hover, .button:hover, [type=submit]:hover { border-color: #600900;
   background-color: #df1600; ... }` rule (found live 2026-09-01 via DevTools on
   www.sley.fi) that matches this <button type="submit"> through the bare attribute
   selector alone — equal specificity to our class selector, loaded later in the
   cascade, so it silently won on hover/focus and drew a thin dark-red border. Without
   !important here, any theme (present or future) with a similar generic button/
   [type=submit] rule can do the same again. */
.sley-livesearch-shortcode__button:hover,
.sley-livesearch-shortcode__button:focus-visible {
  background: #095544 !important;
  border-color: transparent !important;
  outline: 0 !important;
}

.sley-livesearch-shortcode__bubble {
  align-self: center;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
  color: #1f2937;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.38;
  padding: 18px 20px;
  position: relative;
}

.sley-livesearch-shortcode__bubble::before,
.sley-livesearch-shortcode__bubble::after {
  border-bottom: 12px solid transparent;
  border-top: 12px solid transparent;
  content: "";
  height: 0;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
}

.sley-livesearch-shortcode__bubble::before {
  border-right: 14px solid #d1d5db;
  left: -14px;
}

.sley-livesearch-shortcode__bubble::after {
  border-right: 13px solid #fff;
  left: -12px;
}

.sley-livesearch-layer {
  position: relative;
}

.sley-livesearch {
  background: #fff;
  border: 1px solid rgba(24, 28, 32, 0.14);
  border-radius: 6px;
  box-shadow: 0 18px 44px rgba(24, 28, 32, 0.18);
  color: #1d2327;
  font-family: 'Merriweather Sans', sans-serif;
  max-height: min(70vh, 520px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px;
  position: fixed;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  z-index: 100;
  /* Fade/slide-in only, no fade-out — see setOpen()'s own comment for why. 120ms is short
     enough to read as instant feedback rather than a deliberate animation, which is the goal:
     a subtle "arrived" cue, not a show. */
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.sley-livesearch.sley-livesearch--visible {
  opacity: 1;
  transform: translateY(0);
}

.sley-livesearch.is-grouped {
  padding: 10px;
}

.sley-livesearch[hidden] {
  display: none;
}

/* Existing results stay visible (dimmed) while a new keystroke's fetch is in flight — see
   fetchResults() — instead of the panel flashing empty on every keystroke. */
.sley-livesearch.is-loading {
  opacity: 0.5;
  pointer-events: none;
}
.sley-livesearch.is-loading.sley-livesearch--visible {
  /* Override the base rule's opacity:1 (both classes are present at once while loading). */
  opacity: 0.5;
}

/* ---- Osioiden otsikot (2026-09-02: yksi pystysuora lista, ei enää monta CSS-saraketta) ---- */
/* Aiempi columns:280px -toteutus (ja sen JS-tukiratkaisut, alignColumnTops()/
   .sley-livesearch__column-spacer/per-kortti-tyyppikickerit) poistettiin kokonaan: yksikään
   tunnettu state of art -komentopaletti (Spotlight, Raycast, Linear Cmd-K, Algolia DocSearch)
   ei käytä monisarakkeista layoutia omassa pudotusvalikossaan — se on työkalu koko
   hakutulossivulle, ei ohimenevälle ylivalikolle. Yksi pystysuora lista + tiukka per-osio-katto
   (ks. capGroupSizes() JS:ssä) poistaa samalla kertaa: epätasapainoiset "sarakkeet", tarpeen
   päätellä mikä sarake alkaa otsikolla, ja näppäimistönavigoinnin visuaalinen-vs-looginen-
   järjestys-ristiriita. */
.sley-livesearch__groups {
  display: block;
}

.sley-livesearch__group {
  margin-bottom: 6px;
}

.sley-livesearch__group-title {
  color: #475467;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.02em;
  line-height: 1.2;
  padding: 8px 7px 4px;
  text-transform: uppercase;
}

/* ---- Yhtenäinen tulosrivi — sama malli KAIKILLE sisältötyypeille (2026-09-02) ---- */
/* Korvaa kolme aiempaa erillistä, keskenään hyvin erimuotoista toteutusta (geneerinen <a>,
   monirivinen tapahtuma"kortti" badgeineen ja toimintopainikkeineen, pilleillä ja
   tel:/mailto:-linkeillä varustettu yhteystieto"kortti"). Ennustettava, aina samanmuotoinen
   rivi on nopeampi silmäillä kuin vaihtelevat kortit — sama periaate jota Spotlight/Raycast/
   Linearin Cmd-K noudattavat: yksi rivimalli, ikoni kertoo tyypin, ei väritetty teksti. */
.sley-livesearch__row {
  align-items: center;
  border-radius: 6px;
  color: inherit;
  display: flex;
  gap: 10px;
  min-height: 48px;
  padding: 6px 7px;
  text-decoration: none;
}

.sley-livesearch__row:hover,
.sley-livesearch__row[aria-selected="true"] {
  background: #f1f5f4;
  color: inherit;
  text-decoration: none;
}

.sley-livesearch__row-icon {
  align-items: center;
  background-color: #f3f4f6;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 16px 16px;
  border-radius: 999px;
  display: flex;
  flex: 0 0 32px;
  height: 32px;
  justify-content: center;
  overflow: hidden;
  width: 32px;
}

.sley-livesearch__row-icon--image img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.sley-livesearch__row-icon--events {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
}

.sley-livesearch__row-icon--contacts {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 20c0-4 4-6 8-6s8 2 8 6'/%3E%3C/svg%3E");
}

.sley-livesearch__row-icon--media {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M10 8.5l6 3.5-6 3.5v-7z' fill='%236b7280' stroke='none'/%3E%3C/svg%3E");
}

.sley-livesearch__row-icon--document {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 2h9l5 5v15H6z'/%3E%3Cpath d='M14 2v6h6'/%3E%3Cpath d='M9 13h6M9 17h6'/%3E%3C/svg%3E");
}

.sley-livesearch__row-icon--product {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 12.5L12 21 3 12V3h9l8.5 9.5z'/%3E%3Ccircle cx='7.5' cy='7.5' r='1.4' fill='%236b7280' stroke='none'/%3E%3C/svg%3E");
}

.sley-livesearch__row-icon--default {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}

.sley-livesearch__row-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.sley-livesearch__row-title {
  display: block;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sley-livesearch__row-meta {
  color: #6b7280;
  display: block;
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sley-livesearch__reg-slot {
  flex: 0 0 auto;
  margin-left: auto;
}

.sley-livesearch__reg-btn {
  align-items: center;
  border-radius: 4px;
  box-sizing: border-box;
  color: #fff;
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  justify-content: center;
  line-height: 1.2;
  min-height: 24px;
  padding: 4px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.sley-livesearch__reg-btn--open {
  background: #0c7a60;
}

.sley-livesearch__reg-btn--open:hover {
  background: #095544;
  color: #fff;
}

.sley-livesearch__reg-btn--pending {
  background: #f59e0b;
  cursor: default;
}

.sley-livesearch__status,
.sley-livesearch__all {
  border-radius: 5px;
  display: block;
  font-size: 14px;
  line-height: 1.3;
  padding: 12px;
  text-align: left;
  width: 100%;
}

.sley-livesearch__status {
  color: #475467;
}

.sley-livesearch__status.is-error {
  color: #9f1239;
}

.sley-livesearch__all {
  background: #f6f7f7;
  border: 0;
  color: #1d2327;
  cursor: pointer;
  font-weight: 650;
  margin-top: 4px;
}

.sley-livesearch__all:hover,
.sley-livesearch__all:focus-visible {
  background: #e7ecea;
}

/* ---- "Top Hit" — yksi yhtenäinen malli paikkakunta- JA henkilönnimiosumalle (2026-09-02) ---- */
/* Aiemmin kaksi erillistä toteutusta (oma locality-callout-layout, plus rakenteellinen
   :first-child-valitsin tavalliselle yhteystietokortille) — yhdistetty, koska molemmat ovat
   käsitteellisesti sama asia: "olemme varmoja, tämä on vastauksesi" (sama konsepti kuin macOS
   Spotlightin "Top Hit"). */
.sley-livesearch__tophit {
  background: #f0faf6;
  border: 1px solid #bfe5d6;
  border-left: 4px solid #0b6a55;
  border-radius: 8px;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin: 4px 2px 8px;
  padding: 12px 32px 12px 14px;
  position: relative;
  text-decoration: none;
  transition: background-color 0.16s ease, border-color 0.16s ease;
}

.sley-livesearch__tophit[aria-selected="true"],
.sley-livesearch__tophit:hover {
  background: #e2f5ec;
  border-color: #0b6a55;
}

.sley-livesearch__tophit-badge {
  color: #0b6a55;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sley-livesearch__tophit-title {
  color: #111827;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.sley-livesearch__tophit-meta {
  color: #4b5563;
  display: -webkit-box;
  font-size: 12px;
  line-height: 1.3;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sley-livesearch__tophit-arrow {
  color: #0b6a55;
  font-size: 16px;
  font-weight: 700;
  position: absolute;
  right: 14px;
  top: 12px;
}

@media (max-width: 640px) {
  .sley-livesearch-shortcode {
    display: flex;
    flex-direction: column-reverse;
    gap: 12px;
    margin: 20px auto;
  }

  .sley-livesearch-shortcode__form {
    width: 100%;
  }

  .sley-livesearch-shortcode__input[type="search"] {
    font-size: 22px;
    min-height: 72px;
    padding: 18px;
  }

  .sley-livesearch-shortcode__button {
    font-size: 16px;
    padding: 0 18px;
  }

  .sley-livesearch-shortcode__bubble {
    font-size: 14px;
    margin-bottom: 6px;
    width: 100%;
  }

  .sley-livesearch-shortcode__bubble::before,
  .sley-livesearch-shortcode__bubble::after {
    border-bottom: 0;
    border-left: 12px solid transparent;
    border-right: 12px solid transparent;
    left: 32px;
    top: auto;
    transform: none;
  }

  .sley-livesearch-shortcode__bubble::before {
    border-top: 14px solid #d1d5db;
    bottom: -14px;
  }

  .sley-livesearch-shortcode__bubble::after {
    border-top: 13px solid #fff;
    bottom: -12px;
  }

  .sley-livesearch {
    border-radius: 6px;
    max-height: 72vh;
  }
}
