/* ==========================================================================
   Version A — palette.css (F3)
   Styles for ⌘K Command Palette (Strict token adherence)
   ========================================================================== */

.dialog.dialog--palette {
  --dialog-w: 640px;
  width: min(640px, calc(100vw - 32px));
  padding: 0;
  border-radius: var(--radius-xl);
  overflow: hidden;
  align-self: start;
  margin-top: 8vh;
  box-shadow: var(--shadow-modal);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
}

.dialog.dialog--palette .dialog__header {
  display: none;
}

.dialog.dialog--palette .dialog__body {
  padding: 0;
  overflow: hidden;
}

.palette {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.palette__search-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
}

.palette__search-icon {
  color: var(--text-2);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.palette__input.input,
.palette__input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: none;
  box-shadow: none;
  font-family: inherit;
  font-size: var(--fs-16);
  color: var(--text-1);
  padding: 0;
  height: 28px;
}

.palette__input.input:focus,
.palette__input.input:focus-visible,
.palette__input:focus,
.palette__input:focus-visible {
  box-shadow: none;
  border-color: transparent;
}

.palette__input::placeholder {
  color: var(--text-disabled);
}

.palette__kbd-esc {
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
}

.palette__results {
  max-height: min(64dvh, 520px);
  overflow-y: auto;
  padding: var(--space-2) 0;
  display: flex;
  flex-direction: column;
}

.palette__section-title {
  padding: var(--space-2) var(--space-5) 4px;
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  font-weight: var(--fw-medium);
  color: var(--text-3);
}

.palette__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 8px var(--space-5);
  cursor: pointer;
  user-select: none;
  transition: background-color var(--dur-fast) var(--ease);
}

.palette__item:hover,
.palette__item.is-active {
  background: var(--surface-3);
}

.palette__item.is-active {
  border-left: 3px solid var(--accent);
  padding-left: calc(var(--space-5) - 3px);
}

.palette__item-icon {
  color: var(--text-2);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.palette__item-icon--accent {
  color: var(--accent);
}

.palette__item-thumb {
  width: 28px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  background: var(--surface-1);
  flex-shrink: 0;
}

.palette__item-label {
  flex: 1;
  font-size: var(--fs-14);
  line-height: var(--lh-14);
  color: var(--text-1);
}

.palette__item-film-info,
.palette__item-person-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.palette__item-title {
  font-size: var(--fs-14);
  line-height: var(--lh-14);
  font-weight: var(--fw-medium);
  color: var(--text-1);
}

.palette__item-subtitle {
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  color: var(--text-2);
}

.palette__item-meta {
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  color: var(--text-3);
  flex-shrink: 0;
}

.palette__item-rating {
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  font-weight: var(--fw-semibold);
  color: var(--text-2);
  flex-shrink: 0;
}

.palette__item-badge {
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  font-weight: var(--fw-medium);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-2);
  flex-shrink: 0;
}

.palette__item-badge--accent {
  background: var(--accent-soft);
  color: var(--text-1);
}

.palette__item-shortcut {
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-2);
  font-family: inherit;
  flex-shrink: 0;
}

.palette__empty {
  padding: var(--space-6) var(--space-5);
  text-align: center;
  color: var(--text-2);
  font-size: var(--fs-14);
}

.palette__footer {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-5);
  border-top: 1px solid var(--border);
  background: var(--surface-1);
  flex-wrap: wrap;
}

.palette__hint {
  font-size: var(--fs-12);
  line-height: var(--lh-12);
  color: var(--text-3);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.palette__hint kbd {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  padding: 1px 5px;
  font-size: var(--fs-12);
  line-height: 1;
  color: var(--text-2);
  font-family: inherit;
}

@media (prefers-reduced-motion: reduce) {
  .palette__item {
    transition: none;
  }
}

/* Mobile full screen override */
@media (max-width: 899px), (max-height: 500px) and (orientation: landscape) and (pointer: coarse) {
  .dialog.dialog--palette {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    border: 0;
  }

  .palette {
    height: 100%;
  }

  .palette__results {
    max-height: none;
    flex: 1;
  }

  .palette__footer {
    display: none;
  }
}
