/* Taevaskoja – header search + language modals (sandbox tvk-header-modals.php, js/header-modals.js).
   Also un-hides the header's search/language buttons and their dividers (Figma top bar:
   social icons | search | ET + globe). Ajax Search Pro overrides are scoped to #tvk-search-modal so they beat
   the plugin's per-instance CSS. */

/* ---------------------------------------------------------------- header triggers */
body .secondary-menu__actions .divider { display: block; }
body button.icon-button,
body .language-button { cursor: pointer; background: none; border: 0; padding: 0; color: inherit; }
body button.icon-button:hover,
body .language-button:hover { opacity: .75; }
body button.icon-button:focus-visible,
body .language-button:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; border-radius: 2px; }
html.tvk-modal-open { overflow: hidden; }

/* mobile header: language + search beside the burger (cloned from .mobile-nav__actions by header-modals.js) */
.mobile-quick { display: none; }
@media (max-width: 1150px) {
  .mobile-quick { display: flex; align-items: center; gap: 1rem; margin-left: auto; margin-right: 1.25rem; }
  .mobile-quick .divider { display: block; }
}

/* ---------------------------------------------------------------- dialog shell */
dialog.tvk-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 12vh 1.5rem 1.5rem;
  border: 0;
  background: rgba(6, 39, 11, .55);
  color: var(--g-text, #06270b);
  font-family: inherit;
  overflow-y: auto;
  overscroll-behavior: contain;
}
dialog.tvk-modal[open] {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  animation: tvk-modal-fade .2s ease-out both;
}
dialog.tvk-modal::backdrop { background: transparent; }

.tvk-modal__panel {
  display: flex;
  flex-direction: column;
  width: min(46rem, 100%);
  max-height: 76vh;
  padding: 1.25rem 1.5rem 1.75rem;
  background: var(--lg-100, #fffffa);
  border-radius: 1.25rem;
  box-shadow: 0 1.5rem 3.5rem rgba(6, 39, 11, .28);
  animation: tvk-modal-in .28s cubic-bezier(.2, .8, .2, 1) both;
}
.tvk-modal--lang .tvk-modal__panel { width: min(25rem, 100%); }

.tvk-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.tvk-modal__title {
  margin: 0;
  color: var(--g-text, #06270b);
  font-weight: 300;
  font-size: .75rem;
  line-height: normal;
  letter-spacing: .06875rem;
  text-transform: uppercase;
  opacity: .9;
}
.tvk-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  margin-right: -.5rem;
  padding: 0;
  color: var(--g-100, #113617);
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color .15s ease;
}
.tvk-modal__close:hover { background: rgba(17, 54, 23, .08); }
.tvk-modal__close:focus-visible { outline: 2px solid var(--g-100, #113617); outline-offset: 2px; }
.tvk-modal__close svg { width: 1.375rem; height: 1.375rem; }

.tvk-modal__body {
  min-height: 0;
  overflow-y: auto;
  margin: 0 -.5rem;
  padding: .25rem .5rem;
}

@keyframes tvk-modal-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes tvk-modal-in { from { opacity: 0; transform: translateY(-.75rem) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- language list */
.tvk-lang-list {
  display: grid;
  gap: .625rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tvk-lang {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 3.5rem;
  padding: .875rem 1.25rem;
  color: var(--g-100, #113617);
  text-decoration: none;
  background: var(--lg-100, #fffffa);
  border: 1px solid rgba(17, 54, 23, .2);
  border-radius: .9375rem;
  box-shadow: .125rem .125rem .15625rem rgba(148, 154, 149, .16);
  transition: background-color .15s ease, border-color .15s ease;
}
.tvk-lang:hover { color: var(--g-100, #113617); background: var(--lg-200, #f6f5e8); }
.tvk-lang:focus-visible { outline: 2px solid var(--g-100, #113617); outline-offset: 2px; }
.tvk-lang.is-current { background: var(--lg-300, #f4f3d8); border-color: var(--g-100, #113617); }
.tvk-lang__code {
  flex-shrink: 0;
  width: 2.25rem;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: .13rem;
}
.tvk-lang__name {
  display: flex;
  flex-direction: column;
  flex: 1;
  font-weight: 300;
  font-size: 1.0625rem;
}
.tvk-lang__note { font-size: .75rem; opacity: .7; }
.tvk-lang__mark { flex-shrink: 0; width: 1.125rem; height: 1.125rem; }

/* ---------------------------------------------------------------- Ajax Search Pro inside the modal */
#tvk-search-modal .asp_w_container { width: 100%; }
#tvk-search-modal div.asp_m { height: auto; margin: 0; padding: 0; }
#tvk-search-modal div.asp_m .probox { align-items: center; margin: 0; }
#tvk-search-modal div.asp_m .probox .promagnifier .innericon { display: flex; align-items: center; justify-content: center; height: 100%; }
#tvk-search-modal div.asp_m .probox .proinput input.orig,
#tvk-search-modal div.asp_m .probox .proinput input.autocomplete {
  padding-left: 1.25rem;
  font-family: inherit;
}
#tvk-search-modal div.asp_m .probox .proinput input.orig::placeholder { color: rgba(17, 54, 23, .55); opacity: 1; }
#tvk-search-modal div.asp_m .probox .promagnifier { width: 3.5rem; }
#tvk-search-modal div.asp_m .probox .promagnifier .innericon svg { width: 1.25rem; height: 1.25rem; }
#tvk-search-modal div.asp_m .probox .proclose svg { border-radius: 50%; }
#tvk-search-modal div.asp_m:focus-within { box-shadow: 0 0 0 2px var(--g-100, #113617); }

#tvk-search-modal div.asp_r {
  position: static !important;
  width: 100% !important;
  margin-top: .75rem;
  font-family: inherit;
}
#tvk-search-modal div.asp_r .results .item {
  align-items: center;
  padding: .75rem;
  border-radius: .9375rem;
  transition: background-color .15s ease;
}
#tvk-search-modal div.asp_r .results .item .asp_image {
  border-radius: .625rem;
  overflow: hidden;
}
#tvk-search-modal div.asp_r .results .item h3,
#tvk-search-modal div.asp_r .results .item h3 a {
  margin: 0;
  font-family: inherit;
  text-decoration: none;
}
#tvk-search-modal div.asp_r .results .item .asp_content { padding-left: .5rem; }
#tvk-search-modal div.asp_r .results .asp_spacer { margin: .25rem .75rem; }
#tvk-search-modal div.asp_r .results .asp_nores {
  padding: 1.5rem .75rem;
  font-family: inherit;
  font-weight: 300;
  color: var(--g-text, #06270b);
  background: transparent;
}
#tvk-search-modal div.asp_r .asp_res_loader { background: transparent; }

/* ---------------------------------------------------------------- phones */
@media (max-width: 767px) {
  dialog.tvk-modal { padding: .75rem; }
  .tvk-modal__panel {
    max-height: calc(100vh - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
    padding: 1rem 1rem 1.25rem;
    border-radius: 1rem;
  }
  #tvk-search-modal div.asp_r .results .item { padding: .625rem .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  dialog.tvk-modal[open], .tvk-modal__panel { animation: none; }
}
