/**
 * Search modal — ⌘K command palette
 *
 * Ported from the v3 prototype with two adaptations:
 *   1. Site tokens (--site-color-*) instead of the prototype's --accent.
 *   2. Plus Jakarta Sans (already loaded) instead of Manrope.
 *
 * Header search button restyle is included so the trigger and modal
 * read as a single component.
 */

/* ─── HEADER SEARCH PILL ────────────────────────────────────────────── */

.doghouse-header__search {
  appearance: none;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--site-color-border);
  border-radius: 999px;
  color: var(--site-color-text-lead);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  height: 42px;
  min-height: 44px;
  padding: 0 8px 0 14px;
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.doghouse-header__search:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--site-color-border-bright);
  color: var(--site-color-text-white);
}

.doghouse-header__search:focus-visible {
  outline: 2px solid var(--site-color-coral);
  outline-offset: 2px;
}

.doghouse-header__search svg {
  flex: none;
}

.doghouse-header__search-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: none;
}

.doghouse-header__kbd {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--site-color-border-bright);
  border-radius: 5px;
  color: var(--site-color-text-lead);
  display: inline-flex;
  font-family: var(--site-font-sans);
  font-size: 11px;
  font-weight: 600;
  height: 22px;
  justify-content: center;
  line-height: 1;
  min-width: 22px;
  padding: 0 6px;
}

/* Hide ⌘K hint on touch devices, or when the header is too narrow to fit
   it alongside logo + burger. (max-width covers desktop browsers that
   report hover but are zoomed or in a narrow window.) */
@media (hover: none), (max-width: 480px) {
  .doghouse-header__search-hint {
    display: none;
  }
  .doghouse-header__search {
    padding: 0;
    width: 44px;
    justify-content: center;
  }
}

/* ─── MODAL ROOT ────────────────────────────────────────────────────── */

.sm-root {
  align-items: flex-start;
  display: flex;
  inset: 0;
  justify-content: center;
  opacity: 0;
  padding: 14vh 24px 24px;
  pointer-events: none;
  position: fixed;
  transition: opacity 0.18s ease;
  z-index: var(--site-z-modal);
}

.sm-root.is-open {
  opacity: 1;
  pointer-events: auto;
}

.sm-scrim {
  background: rgba(6, 7, 14, 0.62);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  inset: 0;
  position: absolute;
}

.sm-panel {
  background: linear-gradient(180deg, #14172e 0%, #0f1226 100%);
  border: 1px solid var(--site-color-border-bright);
  border-radius: 18px;
  box-shadow:
    0 40px 100px -20px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  max-width: 760px;
  overflow: hidden;
  position: relative;
  transform: translateY(-10px) scale(0.985);
  transition: transform 0.26s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.26s ease;
  width: 100%;
}

.sm-root.is-open .sm-panel {
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  .sm-root,
  .sm-panel {
    transition: none;
  }
  .sm-root.is-open .sm-panel {
    transform: none;
  }
}

/* ─── INPUT ROW ─────────────────────────────────────────────────────── */

.sm-input-row {
  align-items: center;
  border-bottom: 1px solid var(--site-color-border);
  display: flex;
  gap: 16px;
  padding: 22px 22px 22px 26px;
}

.sm-input-icon {
  color: var(--site-color-text-lead);
  flex: none;
  height: 22px;
  width: 22px;
}

/* Overrides base.css input rules: this is a chromeless inline input,
 * not a form field, so it should not paint a border or focus ring. */
.sm-input,
input[type='text'].sm-input {
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  color: var(--site-color-text-white);
  flex: 1;
  font-family: var(--site-font-sans);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.3;
  min-width: 0;
  outline: 0;
  padding: 0;
}

.sm-input::placeholder {
  color: var(--site-color-text-label);
  font-weight: 500;
}

.sm-input:focus,
input[type='text'].sm-input:focus,
.sm-input:focus-visible {
  border: 0;
  box-shadow: none;
  outline: none;
}

/* Override base.css `button {}` which would otherwise apply teal background
 * and 1rem 2rem padding. The clear button is an icon-only round affordance. */
button.sm-clear {
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 0;
  border-radius: 50%;
  color: var(--site-color-text-lead);
  cursor: pointer;
  display: grid;
  flex: none;
  height: 30px;
  min-width: 0;
  padding: 0;
  place-items: center;
  transition: background-color 0.15s ease, color 0.15s ease;
  width: 30px;
}

button.sm-clear:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--site-color-text-white);
}

button.sm-clear:focus-visible {
  outline: 2px solid var(--site-color-coral);
  outline-offset: 2px;
}

button.sm-clear[hidden] {
  display: none;
}

.sm-kbd {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--site-color-border-bright);
  border-radius: 5px;
  color: var(--site-color-text-lead);
  font-family: var(--site-font-sans);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1;
  padding: 4px 8px;
  text-transform: uppercase;
}

.sm-kbd-esc {
  flex: none;
  margin-left: 4px;
}

/* ─── BODY ──────────────────────────────────────────────────────────── */

.sm-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 12px;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  scrollbar-width: thin;
}

.sm-body::-webkit-scrollbar {
  width: 8px;
}

.sm-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.sm-section-h {
  align-items: center;
  color: var(--site-color-text-lead);
  display: flex;
  font-family: var(--site-font-sans);
  font-size: 12px;
  font-weight: 600;
  gap: 10px;
  letter-spacing: 0.18em;
  padding: 16px 14px 10px;
  text-transform: uppercase;
}

.sm-section-h-jump {
  color: var(--site-color-coral);
  padding-top: 22px;
}

.sm-section-h svg {
  flex: none;
}

.sm-count {
  color: var(--site-color-text-label);
  font-size: 11px;
  margin-left: auto;
}

/* Type badges */
.sm-type {
  background: transparent;
  border: 1px solid currentColor;
  border-radius: 4px;
  font-family: var(--site-font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  padding: 4px 9px;
  text-transform: uppercase;
}

.sm-type-service   { color: #b2bbff; }
.sm-type-product   { color: #8feacb; }
.sm-type-solution  { color: #ffcb7d; }
.sm-type-casestudy { color: #ff9da1; }
.sm-type-page      { color: var(--site-color-text-lead); }

/* ─── EMPTY & HELLO STATES ──────────────────────────────────────────── */

.sm-hello {
  padding: 32px 24px 24px;
  text-align: center;
}

.sm-hello-h {
  color: var(--site-color-text-white);
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 6px;
}

.sm-hello-sub {
  color: var(--site-color-text-lead);
  font-size: 14px;
  margin: 0;
}

.sm-empty {
  padding: 40px 24px 32px;
  text-align: center;
}

.sm-empty-h {
  color: var(--site-color-text-lead);
  font-size: 17px;
  font-weight: 500;
  margin: 0 0 8px;
}

.sm-empty-h b {
  color: var(--site-color-text-white);
  font-weight: 700;
}

.sm-empty-sub {
  color: var(--site-color-text-lead);
  font-size: 14px;
  margin: 0;
}

/* ─── RESULT ROWS ───────────────────────────────────────────────────── */

.sm-group + .sm-group {
  margin-top: 6px;
}

.sm-result {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  gap: 16px;
  min-height: 50px;
  padding: 14px 16px;
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.sm-result + .sm-result {
  margin-top: 3px;
}

.sm-result:focus-visible {
  outline: 2px solid var(--site-color-coral);
  outline-offset: 2px;
}

.sm-result.is-active {
  background: rgba(254, 74, 73, 0.10);
  border-color: rgba(254, 74, 73, 0.30);
}

.sm-result-text {
  flex: 1;
  min-width: 0;
}

.sm-result-title {
  color: var(--site-color-text-white);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sm-result-desc {
  color: var(--site-color-text-lead);
  font-size: 13.5px;
  line-height: 1.4;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sm-result mark {
  background: rgba(254, 74, 73, 0.28);
  border-radius: 3px;
  color: var(--site-color-text-white);
  padding: 0 2px;
}

.sm-result-go {
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  color: var(--site-color-text-lead);
  display: grid;
  flex: none;
  height: 28px;
  opacity: 0;
  place-items: center;
  transform: translateX(-4px);
  transition: opacity 0.15s ease, transform 0.15s ease, color 0.15s ease, background-color 0.15s ease;
  width: 28px;
}

.sm-result-go svg {
  height: 14px;
  width: 14px;
}

.sm-result.is-active .sm-result-go {
  background: var(--site-color-coral);
  color: var(--site-color-text-white);
  opacity: 1;
  transform: translateX(0);
}

/* ─── QUICK-JUMP GRID ───────────────────────────────────────────────── */

.sm-jump {
  padding: 6px 14px 18px;
}

.sm-jump-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
}

.sm-jump-card {
  align-items: center;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--site-color-border);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 16px;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.sm-jump-card:hover,
.sm-jump-card:focus-visible {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--site-color-border-bright);
  outline: none;
  transform: translateY(-1px);
}

.sm-jump-card:focus-visible {
  outline: 2px solid var(--site-color-coral);
  outline-offset: 2px;
}

.sm-jump-card-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.sm-jump-card-label {
  color: var(--site-color-text-white);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
}

.sm-jump-card-sub {
  color: var(--site-color-text-lead);
  font-family: var(--site-font-sans);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sm-jump-card-arr {
  color: var(--site-color-text-lead);
  flex: none;
  height: 11px;
  transition: color 0.15s ease, transform 0.2s ease;
  width: 20px;
}

.sm-jump-card:hover .sm-jump-card-arr {
  color: var(--site-color-coral);
  transform: translateX(2px);
}

.sm-jump-card.is-primary {
  background: var(--site-color-coral);
  border-color: transparent;
  box-shadow: 0 10px 24px -10px rgba(254, 74, 73, 0.6);
}

.sm-jump-card.is-primary .sm-jump-card-label,
.sm-jump-card.is-primary .sm-jump-card-arr,
.sm-jump-card.is-primary .sm-jump-card-sub {
  color: var(--site-color-text-white);
}

.sm-jump-card.is-primary .sm-jump-card-sub {
  opacity: 0.85;
}

.sm-jump-card.is-primary:hover {
  background: var(--site-color-red);
  border-color: transparent;
}

/* ─── FOOTER KEYBOARD HINTS ─────────────────────────────────────────── */

.sm-foot {
  align-items: center;
  background: rgba(0, 0, 0, 0.18);
  border-top: 1px solid var(--site-color-border);
  color: var(--site-color-text-lead);
  display: flex;
  font-family: var(--site-font-sans);
  font-size: 12px;
  gap: 22px;
  letter-spacing: 0.06em;
  padding: 13px 20px;
}

.sm-foot-grp {
  align-items: center;
  display: inline-flex;
  gap: 7px;
}

/* ─── RESPONSIVE ────────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .sm-root {
    padding: 8vh 14px 14px;
  }
  .sm-input-row {
    padding: 18px 16px 18px 18px;
  }
  .sm-input {
    font-size: 18px;
  }
  .sm-jump-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sm-foot {
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px 16px;
  }
}
