/* Search (teklanodiscovery): dialog and results page in the shop's design system.
   Cards mirror the catalogue miniature, controls mirror the shop buttons and fields. */

html body :is(.td-widget, .td-results-page) {
  --td-ink: var(--tk-ink);
  --td-muted: var(--tk-muted);
  --td-purple: var(--tk-mint-deep);
  --td-line: var(--tk-line);
  font-family: Manrope, Arial, sans-serif;
}

html body :is(.td-dialog, .td-results-page) svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Dialog ---------- */
html body .td-dialog {
  inset: calc(var(--tk-header-offset, 118px) + 8px) 0 auto;
  width: min(1180px, calc(100vw - clamp(32px, 4vw, 80px)));
  max-height: calc(100dvh - var(--tk-header-offset, 118px) - 32px);
  padding: clamp(22px, 3vw, 40px) clamp(20px, 3vw, 44px) 0;
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius);
  background: var(--tk-paper);
  box-shadow: 0 28px 70px rgba(17, 19, 17, .16);
}

html body .td-dialog::backdrop {
  background: rgba(17, 19, 17, .38);
  backdrop-filter: blur(3px);
}

html body .td-dialog-head {
  margin-bottom: 18px;
}

html body :is(.td-dialog, .td-results-page) .td-kicker {
  margin: 0;
  color: var(--tk-mint-text, #1f6f60);
  font: 700 10px/1.3 'Space Mono', monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
}

html body .td-dialog .td-close {
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--tk-line);
  border-radius: 50%;
  background: transparent;
  color: var(--tk-ink);
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}

html body .td-dialog .td-close:is(:hover, :focus-visible) {
  border-color: var(--tk-ink);
  background: var(--tk-ink);
  color: var(--tk-paper);
}

/* Query field: one pill with the submit inside, like the 404 search. */
html body :is(.td-dialog, .td-results-page) .td-query-form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 14px;
  padding: 6px;
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius-pill);
  background: #fff;
  transition: border-color .2s ease;
}

html body :is(.td-dialog, .td-results-page) .td-query-form:focus-within {
  border-color: var(--tk-ink);
}

html body :is(.td-dialog, .td-results-page) .td-query-form .td-query {
  min-height: 52px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--tk-radius-pill);
  background: transparent;
  color: var(--tk-ink);
  font: 700 clamp(18px, 1.8vw, 24px)/1.2 Manrope, Arial, sans-serif;
  letter-spacing: -.02em;
  outline: none;
  box-shadow: none;
}

html body :is(.td-dialog, .td-results-page) .td-query::placeholder {
  color: color-mix(in srgb, var(--tk-muted) 70%, transparent);
}

html body :is(.td-dialog, .td-results-page) .td-query::-webkit-search-cancel-button {
  display: none;
}

html body :is(.td-dialog, .td-results-page) .td-submit.btn {
  display: inline-flex;
  flex: 0 0 auto;
  min-height: 52px;
  padding: 0 24px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--tk-ink);
  border-radius: var(--tk-radius-pill);
  background: var(--tk-ink);
  color: var(--tk-paper);
  font: 800 13px/1 Manrope, Arial, sans-serif;
  text-transform: none;
  box-shadow: none;
}

html body :is(.td-dialog, .td-results-page) .td-submit.btn:is(:hover, :focus-visible) {
  border-color: var(--tk-mint-deep);
  background: var(--tk-mint-deep);
  color: var(--tk-ink);
}

html body :is(.td-dialog, .td-results-page) .td-status {
  min-height: 22px;
  margin: 0 0 22px 20px;
  color: var(--tk-muted);
  font-size: 13px;
}

html body .td-dialog .td-discovery {
  grid-template-columns: 220px minmax(0, 1fr);
  gap: clamp(20px, 3vw, 40px);
}

html body .td-dialog .td-aside {
  padding-right: 24px;
  border-right: 1px solid var(--tk-line);
}

html body :is(.td-dialog, .td-results-page) :is(.td-aside h2, .td-products-title, .td-facets-head h2) {
  margin: 0 0 14px;
  color: var(--tk-ink);
  font: 700 10px/1.3 'Space Mono', monospace;
  letter-spacing: .05em;
  text-transform: uppercase;
}

html body .td-dialog .td-aside a {
  margin-bottom: 10px;
  color: var(--tk-ink);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

html body .td-dialog .td-aside a:is(:hover, :focus-visible) {
  color: var(--tk-mint-text, #1f6f60);
}

html body .td-dialog .td-all {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 22px 0;
  padding: 0;
  color: var(--tk-ink) !important;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

html body .td-dialog .td-all::after {
  content: "";
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--tk-icon-arrow) center / contain no-repeat;
  mask: var(--tk-icon-arrow) center / contain no-repeat;
}

html body .td-dialog .td-all:is(:hover, :focus-visible) {
  color: var(--tk-mint-text, #1f6f60) !important;
}

html body .td-dialog .td-dialog-footer {
  margin-top: 8px;
  padding: 16px 0;
  border-top: 1px solid var(--tk-line);
  color: var(--tk-muted);
  font-size: 12px;
}

/* ---------- Product cards (same as the catalogue miniature) ---------- */
html body :is(.td-dialog, .td-results-page) .td-products {
  gap: 16px;
}

html body :is(.td-dialog, .td-results-page) .td-product {
  position: relative;
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius-card);
  background: var(--tk-card-cream);
  box-shadow: none;
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

html body :is(.td-dialog, .td-results-page) .td-product:is(:hover, :focus-within) {
  border-color: var(--tk-ink);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(17, 19, 17, .08);
}

html body :is(.td-dialog, .td-results-page) .td-product-link {
  display: flex;
  flex-direction: column;
  height: 100%;
  color: var(--tk-ink) !important;
}

html body :is(.td-dialog, .td-results-page) .td-product img {
  width: calc(100% - 20px);
  height: auto;
  margin: 10px 10px 0;
  padding: 0;
  aspect-ratio: 1.25;
  border-radius: 11px;
  background: #e5eae7;
  object-fit: cover;
}

html body :is(.td-dialog, .td-results-page) .td-product-body {
  display: grid;
  flex: 1;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto 1fr auto;
  align-items: end;
  gap: 0 12px;
  padding: 14px 16px 16px;
}

html body :is(.td-dialog, .td-results-page) .td-product h3 {
  grid-column: 1 / -1;
  align-self: start;
  grid-row: 1;
  margin: 0 0 12px;
  color: var(--tk-ink);
  font-size: clamp(16px, 1.3vw, 20px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -.045em;
}

html body :is(.td-dialog, .td-results-page) .td-stock {
  display: none;
}

/* Divider above price and arrow, aligned to the bottom like the catalogue card. */
html body :is(.td-dialog, .td-results-page) .td-product-body::before {
  content: "";
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: end;
  margin-bottom: 12px;
  border-top: 1px solid var(--tk-line);
}

html body :is(.td-dialog, .td-results-page) .td-price {
  grid-column: 1;
  grid-row: 3;
  align-self: center;
  margin: 0;
  color: var(--tk-ink);
  font-size: 17px;
  font-weight: 800;
}

/* "Zobacz moduł" becomes the round arrow used on every card. */
html body :is(.td-dialog, .td-results-page) .td-card-cta {
  position: relative;
  grid-column: 2;
  grid-row: 3;
  display: grid;
  width: 38px;
  height: 38px;
  margin: 0;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--tk-ink);
  color: transparent;
  font-size: 0;
  transition: background-color .2s ease;
}

html body :is(.td-dialog, .td-results-page) .td-card-cta::after {
  content: "";
  width: 17px;
  height: 17px;
  background: var(--tk-paper);
  -webkit-mask: var(--tk-icon-arrow) center / contain no-repeat;
  mask: var(--tk-icon-arrow) center / contain no-repeat;
}

html body :is(.td-dialog, .td-results-page) .td-product:hover .td-card-cta {
  background: var(--tk-mint-deep);
}

html body :is(.td-dialog, .td-results-page) .td-product:hover .td-card-cta::after {
  background: var(--tk-ink);
}

html body :is(.td-dialog, .td-results-page) .td-banner {
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius-card);
  background: var(--tk-card-cream);
}

/* ---------- Results page ---------- */
body#module-teklanodiscovery-results #wrapper > .container > .row {
  margin: 0;
}

body#module-teklanodiscovery-results #content-wrapper {
  width: 100%;
  padding: 0;
  float: none;
}

body#module-teklanodiscovery-results #main .page-content,
body#module-teklanodiscovery-results #content {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

body#module-teklanodiscovery-results #main .page-footer {
  display: none;
}

html body .td-results-page {
  max-width: none;
  margin: 0 0 clamp(60px, 7vw, 110px);
  padding: 0;
}

html body .td-results-page .td-results-head {
  margin: clamp(8px, 1.5vw, 20px) 0 clamp(24px, 3vw, 40px);
}

html body .td-results-page .td-results-head .td-kicker {
  margin-bottom: 14px;
}

html body .td-results-page .td-results-title {
  margin: 0;
  color: var(--tk-ink);
  font-size: clamp(40px, 5vw, 72px);
  font-weight: 800;
  line-height: .94;
  letter-spacing: -.075em;
}

html body .td-results-page .td-query-form {
  max-width: 820px;
}

html body .td-results-page .td-toolbar {
  gap: 12px 16px;
  margin: 8px 0 28px;
  padding: 18px 0;
  border-top: 1px solid var(--tk-line);
  border-bottom: 1px solid var(--tk-line);
}

html body .td-results-page .td-toolbar label {
  margin: 0;
  color: var(--tk-muted);
  font: 700 10px/1.3 'Space Mono', monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
}

html body .td-results-page .td-toolbar :is(select, input) {
  height: 48px;
  margin-top: 8px;
  padding: 0 14px;
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius-field);
  background-color: #fff;
  color: var(--tk-ink);
  font: 600 14px Manrope, Arial, sans-serif;
  letter-spacing: 0;
  text-transform: none;
}

html body .td-results-page .td-toolbar :is(select, input):focus {
  border-color: var(--tk-ink);
  outline: none;
}

html body .td-results-page .td-facets {
  padding: 20px;
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius-card);
  background: var(--tk-card-cream);
}

html body .td-results-page .td-facet summary {
  color: var(--tk-ink);
  font-size: 13px;
  font-weight: 800;
}

html body .td-results-page .td-facet-option input {
  accent-color: var(--tk-ink);
}

html body .td-results-page .td-facets-clear.btn {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius-pill);
  background: transparent;
  color: var(--tk-ink);
  font-size: 11px;
  font-weight: 800;
}

html body .td-results-page .td-pagination {
  justify-content: space-between;
  margin: 36px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--tk-line);
}

html body .td-results-page .td-pagination .btn {
  display: inline-flex;
  min-height: 44px;
  padding: 0 18px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--tk-line);
  border-radius: var(--tk-radius-pill);
  background: transparent;
  color: var(--tk-ink);
  font: 800 12px/1 Manrope, Arial, sans-serif;
  text-transform: none;
}

html body .td-results-page .td-pagination .btn:is(:hover, :focus-visible):not(:disabled) {
  border-color: var(--tk-ink);
  background: var(--tk-ink);
  color: var(--tk-paper);
}

html body .td-results-page .td-pagination .btn:disabled {
  opacity: .35;
}

html body .td-results-page .td-page-number {
  color: var(--tk-muted);
  font: 700 10px/1.3 'Space Mono', monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
}

@media (max-width: 800px) {
  html body .td-dialog .td-discovery {
    grid-template-columns: minmax(0, 1fr);
  }

  html body .td-dialog .td-aside {
    padding-right: 0;
    border-right: 0;
  }
}

@media (max-width: 550px) {
  html body .td-dialog {
    inset: 0;
    width: 100%;
    max-height: 100dvh;
    border-radius: 0;
  }

  html body :is(.td-dialog, .td-results-page) .td-submit.btn {
    width: 52px;
    padding: 0;
    justify-content: center;
  }

  html body :is(.td-dialog, .td-results-page) .td-submit.btn span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  html body :is(.td-dialog, .td-results-page) .td-status {
    margin-left: 6px;
  }
}

body#module-teklanodiscovery-results :is(#content-wrapper, #main, #content, .page-content) {
  margin-inline: 0;
  padding-inline: 0;
}

html body .td-results-page .td-toolbar label {
  text-align: left;
}

html body .td-results-page .td-toolbar select {
  appearance: none;
  padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--tk-muted) 50%), linear-gradient(135deg, var(--tk-muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
