/* butkevicius.eu — paieška: mygtukas navigacijoje, laukas hub'uose ir paieškos langas.
   Langas kuriamas paieska.js; indeksas /paieska.json (tools/paieska.ts). */

/* === Mygtukas navigacijoje === */
.nav__menu { margin-left: auto; }
.nav__search {
  display: inline-flex; align-items: center; gap: 8px;
  margin-left: 24px; height: 40px; padding: 0 14px 0 12px; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 999px; background: #fff;
  color: var(--violet-dark); font: inherit; font-size: 0.9rem; font-weight: 500; cursor: pointer;
  transition: border-color .2s ease, color .2s ease, box-shadow .2s ease;
}
.nav__search svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav__search:hover { border-color: var(--violet); color: var(--violet); box-shadow: var(--shadow-sm); }
.nav__search:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
.nav__search kbd {
  font: inherit; font-size: 0.75rem; line-height: 1; color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 6px; background: var(--bg-soft);
}
/* Siauresniame desktop'e 8 nuorodos + mygtukas netelpa su tekstu — lieka tik ikona. */
@media (max-width: 1180px) {
  .nav__search { width: 40px; padding: 0; justify-content: center; margin-left: 20px; }
  .nav__search span, .nav__search kbd { display: none; }
}
/* 881–1080 px: be šito meniu prilimpa prie logotipo (matuota 960 px: 0 px tarpas). */
@media (min-width: 881px) and (max-width: 1080px) {
  .nav__menu { gap: 18px; }
  .nav__search { margin-left: 16px; }
}
@media (max-width: 880px) {
  .nav__search {
    margin-left: auto; margin-right: 8px; width: 44px; height: 44px;
    border: none; background: rgba(255, 255, 255, 0.92); box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }
  .nav__search svg { width: 20px; height: 20px; }
  .nav.is-scrolled .nav__search, .nav.is-menu-open .nav__search { background: transparent; box-shadow: none; }
}

/* === Laukas hub'uose (/skaiciuokles/, /straipsniai/) — atrodo kaip įvesties laukas, atidaro tą patį langą === */
.hub-search {
  display: flex; align-items: center; gap: 12px; width: 100%; max-width: 560px; margin-top: 26px;
  height: 58px; padding: 0 12px 0 18px; text-align: left; cursor: text;
  background: #fff; border: 1.5px solid #DCD6F5; border-radius: 16px; box-shadow: var(--shadow-md);
  color: var(--text-muted); font: inherit; font-size: 1.02rem;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.hub-search:hover { border-color: var(--violet); }
.hub-search:focus-visible { outline: none; border-color: var(--violet); box-shadow: 0 0 0 4px rgba(128, 98, 239, 0.18), var(--shadow-md); }
.hub-search > svg { width: 22px; height: 22px; color: var(--violet); flex-shrink: 0; }
.hub-search .s { display: none; }
.hub-search span { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hub-search kbd {
  font: inherit; font-size: 0.8rem; color: var(--text-muted); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px;
}
@media (max-width: 880px) { .hub-search { height: 54px; font-size: 1rem; } .hub-search kbd { display: none; } }
@media (max-width: 640px) { .hub-search .l { display: none; } .hub-search .s { display: block; } }

/* === Paieškos langas === */
html.srch-open, html.srch-open body { overflow: hidden; }
.srch { position: fixed; inset: 0; z-index: 10000; display: flex; justify-content: center; align-items: flex-start; padding: 11vh 16px 16px; }
.srch[hidden] { display: none; }
.srch__backdrop { position: absolute; inset: 0; background: rgba(40, 24, 119, 0.32); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); animation: srch-fade .18s ease; }
.srch__panel {
  position: relative; width: 100%; max-width: 640px; max-height: 76vh; display: flex; flex-direction: column;
  background: #fff; border-radius: 20px; overflow: hidden;
  box-shadow: 0 24px 64px rgba(40, 24, 119, 0.28), 0 2px 8px rgba(40, 24, 119, 0.08);
  animation: srch-in .2s cubic-bezier(.2, .8, .2, 1);
}
@keyframes srch-fade { from { opacity: 0; } }
@keyframes srch-in { from { opacity: 0; transform: translateY(-8px) scale(.985); } }
@media (prefers-reduced-motion: reduce) { .srch__backdrop, .srch__panel { animation: none; } }

.srch__bar { display: flex; align-items: center; gap: 12px; padding: 0 14px 0 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.srch__bar > svg { width: 22px; height: 22px; color: var(--violet); flex-shrink: 0; }
.srch__input {
  flex: 1; min-width: 0; height: 64px; border: 0; outline: 0; background: transparent;
  font: inherit; font-size: 1.15rem; font-weight: 500; color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.srch__input::placeholder { color: #9A97A8; font-weight: 400; }
.srch__input::-webkit-search-cancel-button { display: none; }
.srch__close {
  font: inherit; font-size: 0.78rem; color: var(--text-muted); background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px 8px; cursor: pointer;
}
.srch__close .m { display: none; }

.srch__body { overflow-y: auto; overscroll-behavior: contain; padding: 8px 10px 12px; -webkit-overflow-scrolling: touch; }
.srch__label { margin: 14px 10px 6px; font-size: 0.72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); }
.srch__chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 10px 6px; }
.srch__chip {
  font: inherit; font-size: 0.88rem; font-weight: 500; color: var(--violet-dark); cursor: pointer;
  background: var(--bg-soft); border: 1px solid #E6E1F7; border-radius: 999px; padding: 7px 14px;
  transition: background .15s ease, border-color .15s ease;
}
.srch__chip:hover { background: #EFEBFD; border-color: var(--violet); }

.srch__item { display: flex; align-items: center; gap: 14px; padding: 10px; border-radius: 12px; color: var(--text); text-decoration: none; scroll-margin: 8px; }
.srch__item.is-active { background: #F3F0FE; }
.srch__ico {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, rgba(128, 98, 239, 0.16) 0%, rgba(162, 79, 150, 0.16) 100%); color: var(--violet-dark);
}
.srch__ico svg { width: 20px; height: 20px; }
.srch__item.is-active .srch__ico { background: linear-gradient(135deg, var(--violet) 0%, var(--magenta) 100%); color: #fff; }
.srch__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.srch__txt strong { font-weight: 700; font-size: 0.98rem; line-height: 1.3; color: var(--violet-dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srch__txt span { font-size: 0.85rem; line-height: 1.4; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srch__txt mark { background: none; color: var(--violet); box-shadow: inset 0 -2px 0 rgba(128, 98, 239, 0.35); }
.srch__go { color: var(--violet); font-weight: 700; opacity: 0; transition: opacity .15s ease; flex-shrink: 0; padding-right: 4px; }
.srch__item.is-active .srch__go { opacity: 1; }

.srch__empty { padding: 28px 12px 16px; text-align: center; color: var(--text-muted); }
.srch__empty strong { display: block; color: var(--violet-dark); font-size: 1.02rem; margin-bottom: 6px; }
.srch__empty p { margin: 0 0 14px; font-size: 0.92rem; }
.srch__empty .srch__chips { justify-content: center; }

.srch__foot {
  display: flex; gap: 18px; padding: 10px 20px; border-top: 1px solid var(--border); background: var(--bg-soft);
  font-size: 0.78rem; color: var(--text-muted); flex-shrink: 0;
}
.srch__foot kbd { font: inherit; border: 1px solid var(--border); background: #fff; border-radius: 4px; padding: 1px 5px; margin-right: 4px; }

/* Telefone — visas ekranas, laukas viršuje, „Atšaukti“ vietoj Esc. */
@media (max-width: 640px) {
  .srch { padding: 0; }
  .srch__panel { max-width: none; max-height: none; height: 100%; border-radius: 0; animation: srch-up .2s ease; }
  @keyframes srch-up { from { opacity: 0; transform: translateY(12px); } }
  .srch__bar { padding: 0 8px 0 16px; }
  .srch__input { height: 58px; font-size: 1.05rem; }
  .srch__close { border: 0; background: none; color: var(--violet); font-size: 0.95rem; font-weight: 600; padding: 10px 8px; }
  .srch__close .d { display: none; }
  .srch__close .m { display: inline; }
  .srch__body { padding: 4px 6px 24px; flex: 1; }
  .srch__foot { display: none; }
  .srch__txt strong { white-space: normal; }
  .srch__txt span { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}
