/* ==========================================================================
   palette.css — the search dialog (js/command-palette.js)
   --------------------------------------------------------------------------
   Its own file since 2026-11: the dialog used to live in main.css, which only
   the homepage and three other pages load, so search existed on one page.
   js/chrome.js now loads this file and the script the first time a visitor
   opens search on any page; the homepage links it up front.

   Self-contained, like chrome.css: every var() carries the token's value as a
   fallback, so the dialog looks the same on a page that paints its own
   palette and never loaded tokens.css.
   ========================================================================== */

/* Overlay */
.cmd-palette {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: flex-start;
    justify-content: center;
    padding-top: min(20vh, 160px);
}

.cmd-palette.active {
    display: flex;
}

.cmd-palette-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 17, 14, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: cmdFadeIn 150ms ease;
}

/* Container */
.cmd-palette-container {
    position: relative;
    width: 560px;
    max-width: calc(100vw - 2rem);
    max-height: min(480px, 60vh);
    background: var(--color-bg-elevated, #241b13);
    border: 1px solid var(--color-border-hover, #4a3b28);
    border-radius: var(--radius-lg, 10px);
    box-shadow:
        0 24px 48px rgba(0, 0, 0, 0.4),
        0 0 0 1px rgba(236, 225, 204, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: cmdSlideIn 200ms var(--ease-out-back, cubic-bezier(0.34, 1.56, 0.64, 1));
}

/* Input area */
.cmd-palette-input-wrap {
    display: flex;
    align-items: center;
    padding: var(--space-md, 1rem) var(--space-lg, 1.5rem);
    border-bottom: 1px solid var(--color-border, #3a2f26);
    gap: var(--space-sm, 0.5rem);
}

.cmd-palette-input-wrap svg {
    width: 18px;
    height: 18px;
    stroke: var(--color-text-muted, #a0926f);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    flex-shrink: 0;
}

/* Written as .cmd-palette input.cmd-palette-input, and every box property set,
   because pages style their own fields: /labs/alien-math/ has
   input[type=text] { border; background; padding; 13px }, which outranks a
   single class and put a box around this field on ten pages. */
.cmd-palette input.cmd-palette-input {
    flex: 1;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    color: var(--color-text, #ece1cc);
    font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', 'Consolas', monospace);
    font-size: 14px;
    outline: none;
    min-width: 0;
    width: auto;
}

.cmd-palette-input::placeholder {
    color: var(--color-text-muted, #a0926f);
}

.cmd-palette input.cmd-palette-input:focus-visible {
    outline: 2px solid var(--color-accent, #d9a441);
    outline-offset: 2px;
}

.cmd-palette-input-wrap kbd {
    font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', 'Consolas', monospace);
    font-size: 0.6875rem;
    padding: 2px 6px;
    background: var(--color-surface, #332719);
    border: 1px solid var(--color-border, #3a2f26);
    border-radius: var(--radius-sm, 4px);
    color: var(--color-text-muted, #a0926f);
    line-height: 1.4;
}

/* Results list */
.cmd-palette-results {
    overflow-y: auto;
    flex: 1;
    padding: var(--space-xs, 0.25rem) 0;
}

.cmd-palette-group-label {
    padding: var(--space-xs, 0.25rem) var(--space-lg, 1.5rem) var(--space-xs, 0.25rem);
    font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', 'Consolas', monospace);
    font-size: 9.5px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--color-brass, #c9a86a);
}

.cmd-palette-item {
    display: flex;
    align-items: center;
    gap: var(--space-md, 1rem);
    padding: 8px var(--space-lg, 1.5rem);
    cursor: pointer;
    transition: background var(--transition-fast, 150ms ease);
    border-left: 2px solid transparent;
}

.cmd-palette-item.active {
    background: rgba(201, 168, 106, 0.08);
    border-left-color: var(--color-brass, #c9a86a);
}

.cmd-palette-item-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface, #332719);
    border-radius: var(--radius-md, 8px);
    font-size: 1rem;
    flex-shrink: 0;
}

.cmd-palette-item.active .cmd-palette-item-icon {
    background: var(--color-primary-muted, rgba(138, 168, 107, 0.15));
}

.cmd-palette-item-text {
    flex: 1;
    min-width: 0;
}

.cmd-palette-item-label {
    font-family: var(--font-serif, 'Fraunces', Georgia, serif);
    font-size: 15px;
    font-weight: 400;
    color: var(--color-text, #ece1cc);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmd-palette-item-desc {
    font-size: 0.75rem;
    color: var(--color-text-muted, #a0926f);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cmd-palette-item-badge {
    font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', 'Consolas', monospace);
    font-size: 9px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    background: transparent;
    border: 1px solid var(--color-border, #3a2f26);
    color: var(--color-text-muted, #a0926f);
    border-radius: 999px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Footer hints */
.cmd-palette-footer {
    display: flex;
    gap: var(--space-lg, 1.5rem);
    padding: var(--space-sm, 0.5rem) var(--space-lg, 1.5rem);
    border-top: 1px solid var(--color-border, #3a2f26);
    font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', 'Consolas', monospace);
    font-size: 0.625rem;
    letter-spacing: 0.06em;
    color: var(--color-text-muted, #a0926f);
}

.cmd-palette-footer kbd {
    font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', 'Consolas', monospace);
    font-size: 0.625rem;
    padding: 1px 4px;
    background: var(--color-surface, #332719);
    border: 1px solid var(--color-border, #3a2f26);
    border-radius: 3px;
    color: var(--color-text-muted, #a0926f);
    margin-right: 3px;
}

/* Empty state */
.cmd-palette-empty {
    padding: var(--space-2xl, 3rem) var(--space-lg, 1.5rem);
    text-align: center;
    color: var(--color-text-muted, #a0926f);
    font-family: var(--font-serif, 'Fraunces', Georgia, serif);
    font-style: normal;
    font-size: 0.875rem;
}

/* Animations */
@keyframes cmdFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cmdSlideIn {
    from { opacity: 0; transform: scale(0.96) translateY(-8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

/* Responsive */
@media (max-width: 768px) {
        .cmd-palette {
        padding-top: 10vh;
    }

    .cmd-palette-container {
        max-height: 70vh;
    }
}
