/* ============================================================
   Guest command palette (Cmd/Ctrl + K)
   Overlay search across the public shell. Built entirely on the shared
   guest tokens so it inherits light/dark without extra work.
   ============================================================ */

/* The palette has no header button. It is opened by Cmd/Ctrl+K, by the mega
   menu's "Search everything" row, or by any element marked data-gcp-open. */

/* ---------- Overlay ---------- */
.gcp {
    position: fixed;
    inset: 0;
    z-index: 1080;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: clamp(3rem, 12vh, 8rem) 1rem 2rem;
}

.gcp[hidden] { display: none; }

.gcp__backdrop {
    position: absolute;
    inset: 0;
    /* Lighter scrim, more blur (was 55% / 3px) — see the note on
       .gmm__backdrop in mega-menu.css. */
    background: color-mix(in srgb, var(--g-navy) 44%, transparent);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    animation: gcp-fade .14s var(--g-ease);
}

.gcp__dialog {
    position: relative;
    display: flex;
    width: min(40rem, 100%);
    /* Fixed, not just capped: the dialog keeps its size while the list
       filters down, so it doesn't jump as you type. Results scroll inside. */
    height: min(32rem, 76vh);
    max-height: min(32rem, 76vh);
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--g-border);
    border-radius: var(--g-r-lg);
    background: var(--g-surface);
    box-shadow: 0 32px 64px -28px color-mix(in srgb, var(--g-shadow-color) 34%, transparent);
    animation: gcp-rise .16s var(--g-ease);
}

[data-guest-theme="dark"] .gcp__dialog {
    box-shadow: 0 32px 64px -28px rgba(0, 0, 0, .62);
}

@keyframes gcp-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes gcp-rise {
    from { opacity: 0; transform: translateY(-6px) scale(.985); }
    to { opacity: 1; transform: none; }
}

/* ---------- Search field ---------- */
.gcp__field {
    display: flex;
    flex: none;
    align-items: center;
    gap: .6rem;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--g-border);
}

.gcp__field-icon {
    display: grid;
    flex: none;
    place-items: center;
    color: var(--g-text-faint);
    font-size: .95rem;
}

.gcp__input {
    flex: 1;
    min-width: 0;
    border: 0;
    background: transparent;
    color: var(--g-text);
    font-family: inherit;
    font-size: .95rem;
    outline: 0;
}

.gcp__input::placeholder { color: var(--g-text-faint); opacity: 1; }

.gcp__close {
    display: grid;
    width: 28px;
    height: 28px;
    flex: none;
    place-items: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--g-text-faint);
    font-size: .78rem;
    cursor: pointer;
    transition: background-color .16s var(--g-ease), color .16s var(--g-ease);
}

.gcp__close:hover { background: var(--g-surface-2); color: var(--g-text); }
.gcp__close:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 1px; }

/* ---------- Results ---------- */
.gcp__results {
    flex: 1;
    min-height: 0;
    padding: .4rem;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* Scrollbar styling is shared with the rest of the guest theme; see the
   Scrollbars block in guest.css, which lists .gcp__results explicitly. */

.gcp__group + .gcp__group { margin-top: .25rem; }
.gcp__group[hidden] { display: none; }

.gcp__group-label {
    padding: .5rem .65rem .3rem;
    color: var(--g-text-faint);
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
}
/* A quiet tint of the group's own hue, so each coloured group reads its colour
   even before a row is active; the neutral "Go to" group (no --gcp-hue) keeps
   the faint ink above. */
.gcp__group[style*="--gcp-hue"] > .gcp__group-label {
    color: color-mix(in srgb, var(--gcp-hue) 55%, var(--g-text-faint));
}

.gcp__item-form { margin: 0; }

/* Shared row for links and action buttons. */
.gcp__item {
    display: flex;
    width: 100%;
    align-items: center;
    gap: .7rem;
    padding: .55rem .65rem;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--g-text);
    font-family: inherit;
    font-size: .86rem;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
    /* No transition: the highlight (background/colour) snaps instantly on hover
       and keyboard selection. */
}

.gcp__item[hidden] { display: none; }

/* Hovering a row dims the other visible rows to put focus on the one under the
   pointer. */
/* No sibling-fade: the active row is marked purely by its own highlight
   (.gcp__item.is-active below). An opacity dim on the other rows — whether
   driven by hover or by the keyboard selection — read as a jerk as the
   selection moved, so it was removed. The highlight is INSTANT — no transition
   on background/colour — so hover and keyboard selection snap immediately. */
/* Respect reduced-motion: no opacity/background animation, just the end state. */
@media (prefers-reduced-motion: reduce) {
    .gcp__item,
    .gcp__item-icon { transition: none; }
}

.gcp__item-icon {
    display: grid;
    width: 30px;
    height: 30px;
    flex: none;
    place-items: center;
    border-radius: 8px;
    background: var(--g-surface-2);
    color: var(--g-text-muted);
    font-size: .82rem;
    /* Instant, like the row — the tile recolours on the same frame as the
       highlight, no transition. */
}

.gcp__item-text {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
    gap: .05rem;
}

.gcp__item-label {
    overflow: hidden;
    font-weight: 600;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gcp__item-hint {
    overflow: hidden;
    color: var(--g-text-faint);
    font-size: .74rem;
    line-height: 1.35;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Content search rows (Notices, Help Center) ---- */
/* Notice titles arrive in operator casing (often all caps); sentence case,
   as on the other notice lists. block + ::first-letter keeps the ellipsis. */
.gcp__item--notice .gcp__item-label { display: block; text-transform: lowercase; }
.gcp__item--notice .gcp__item-label::first-letter { text-transform: uppercase; }
/* Unread notice (notice-read.js sets .is-unread): the blue corner dot used in
   the mega menu and mobile bar, ringed in the dialog surface. */
.gcp__item--notice .gcp__item-icon { position: relative; }
.gcp__item--notice.is-unread .gcp__item-icon::after {
    content: "";
    position: absolute;
    top: -3px;
    right: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--g-accent);
    box-shadow: 0 0 0 2px var(--g-surface);
}
/* An empty Recent group (nothing opened yet) takes no space. */
.gcp__group[data-gcp-recent]:not(:has([data-gcp-item])) { display: none; }

/* Empty state "Did you mean": an inline option, highlightable from the
   keyboard like the buttons below it. */
.gcp__empty-suggest { margin: 0; }
.gcp__empty-suggest[hidden] { display: none; }
.gcp__empty-suggest-btn {
    padding: 0 .2rem;
    border: 0;
    border-radius: 4px;
    background: none;
    color: var(--g-accent-ink);
    font: inherit;
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}
.gcp__empty-suggest-btn.is-active,
.gcp__empty-suggest-btn:hover {
    background: color-mix(in srgb, var(--g-accent) 12%, var(--g-surface));
    color: var(--g-accent-strong);
}

/* "See all N …": a quiet link row, not another result. */
.gcp__item--more .gcp__item-label { color: var(--g-accent-ink); font-weight: 600; }
.gcp__item--more .gcp__item-icon { background: transparent; color: var(--g-accent-ink); }

.gcp__item-meta {
    flex: none;
    color: var(--g-text-faint);
    font-size: .74rem;
    opacity: 0;
    transition: opacity .13s var(--g-ease);
}

/* Active row. Driven by a class rather than :hover so the keyboard and the
   pointer share exactly one highlight, and the two can never both show.
   The highlight themes to the row's GROUP hue (--gcp-hue, set per .gcp__group
   in the view): a soft wash behind the row, a stronger tint on the icon tile,
   the icon and label in the hue's ink, so hovering/selecting a row colour-codes
   it to its section. --gcp-hue falls back to the plain accent if unset. */
/* Groups with a --gcp-hue theme to it; a group WITHOUT one (the "Go to" group)
   keeps the original neutral grey wash — these are the defaults below, which
   each hue rule overrides via --gcp-hue when present. */
.gcp__item.is-active {
    /* Soft neutral wash, a touch darker than --g-surface-2 (mixed toward the
       border) so the highlight reads a little more clearly while staying in the
       same neutral family as the search button / .g-btn-soft:hover.
       The icon tile steps one neutral stronger (--g-border). */
    background: color-mix(in srgb, var(--g-surface-2) 78%, var(--g-border));
    color: var(--g-text);
}
.gcp__item.is-active .gcp__item-icon {
    background: var(--g-border);
    color: var(--g-text);
}
.gcp__item.is-active .gcp__item-label { color: var(--g-text); }
.gcp__item.is-active .gcp__item-meta { opacity: 1; color: var(--g-text-muted); }
.gcp__item.is-active .gcp__item-hint { color: var(--g-text-muted); }

/* When the group carries a hue, the active row themes to it. Scoped to groups
   that actually set --gcp-hue so the neutral "Go to" group is unaffected. */
.gcp__group[style*="--gcp-hue"] .gcp__item.is-active {
    background: color-mix(in srgb, var(--gcp-hue) 10%, var(--g-surface));
    color: var(--gcp-hue);
}
.gcp__group[style*="--gcp-hue"] .gcp__item.is-active .gcp__item-icon {
    background: color-mix(in srgb, var(--gcp-hue) 18%, var(--g-surface));
    color: color-mix(in srgb, var(--gcp-hue) 85%, var(--g-text));
}
.gcp__group[style*="--gcp-hue"] .gcp__item.is-active .gcp__item-label { color: color-mix(in srgb, var(--gcp-hue) 70%, var(--g-text)); }
.gcp__group[style*="--gcp-hue"] .gcp__item.is-active .gcp__item-meta { color: color-mix(in srgb, var(--gcp-hue) 55%, var(--g-text-muted)); }
.gcp__group[style*="--gcp-hue"] .gcp__item.is-active .gcp__item-hint { color: color-mix(in srgb, var(--gcp-hue) 40%, var(--g-text-muted)); }

/* ---------- Plain navigation (data-guest-nav="plain") ----------
   When the visitor chooses the minimal/grey navigation look, every coloured
   group must render like the neutral "Go to" group (the one that emits NO
   --gcp-hue). Each hue-consuming rule above is re-stated here scoped to
   html[data-guest-nav="plain"], restoring the original neutral values so there
   is no per-section colour in either theme. Prefixing with the root attribute
   raises specificity above the .gcp__group[style*="--gcp-hue"] rules so these
   win cleanly, no !important. */
html[data-guest-nav="plain"] .gcp__group[style*="--gcp-hue"] > .gcp__group-label {
    color: var(--g-text-faint);
}
html[data-guest-nav="plain"] .gcp__group[style*="--gcp-hue"] .gcp__item.is-active {
    background: color-mix(in srgb, var(--g-surface-2) 78%, var(--g-border));
    color: var(--g-text);
}
html[data-guest-nav="plain"] .gcp__group[style*="--gcp-hue"] .gcp__item.is-active .gcp__item-icon {
    background: var(--g-border);
    color: var(--g-text);
}
html[data-guest-nav="plain"] .gcp__group[style*="--gcp-hue"] .gcp__item.is-active .gcp__item-label { color: var(--g-text); }
html[data-guest-nav="plain"] .gcp__group[style*="--gcp-hue"] .gcp__item.is-active .gcp__item-meta { color: var(--g-text-muted); }
html[data-guest-nav="plain"] .gcp__group[style*="--gcp-hue"] .gcp__item.is-active .gcp__item-hint { color: var(--g-text-muted); }

/* The row is reached by the roving highlight, so its own focus ring would
   double up; keep a ring only for forced-focus contexts. */
.gcp__item:focus { outline: 0; }
.gcp__item:focus-visible { outline: 2px solid var(--g-accent); outline-offset: -2px; }

/* Empty state: fills the fixed-height results area and centres in it. */
.gcp__empty {
    display: flex;
    min-height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    margin: 0;
    padding: 1.5rem 1rem 2rem;
    color: var(--g-text-muted);
    font-size: .85rem;
    text-align: center;
}
.gcp__empty[hidden] { display: none; }
.gcp__empty-icon {
    display: grid;
    width: 3rem;
    height: 3rem;
    margin-bottom: .5rem;
    place-items: center;
    border-radius: 14px;
    background: color-mix(in srgb, var(--g-accent) 10%, var(--g-surface-2));
    color: var(--g-accent-ink);
    font-size: 1.2rem;
}
.gcp__empty-title {
    max-width: 100%;
    margin: 0;
    overflow: hidden;
    color: var(--g-text);
    font-size: .95rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.gcp__empty-text { margin: 0; }
.gcp__empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin-top: .9rem;
}
.gcp__empty-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .42rem .8rem;
    border: 1px solid var(--g-border);
    border-radius: var(--g-r-md);
    background: var(--g-surface);
    color: var(--g-text);
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .16s var(--g-ease), border-color .16s var(--g-ease), color .16s var(--g-ease);
}
.gcp__empty-btn i { color: var(--g-text-muted); font-size: .8rem; }
/* Same soft accent hover as the dashboard's soft buttons. */
.gcp__empty-btn:hover {
    border-color: color-mix(in srgb, var(--g-accent) 28%, var(--g-border));
    background: color-mix(in srgb, var(--g-accent) 8%, var(--g-surface));
    color: var(--g-accent-strong);
}
.gcp__empty-btn:hover i { color: var(--g-accent-ink); }
/* Keyboard highlight (aria-activedescendant; focus stays in the input): the
   hover look with a crisp 1px accent edge, no glow. */
.gcp__empty-btn.is-active {
    border-color: color-mix(in srgb, var(--g-accent) 55%, var(--g-border));
    background: color-mix(in srgb, var(--g-accent) 8%, var(--g-surface));
    color: var(--g-accent-strong);
}
.gcp__empty-btn.is-active i { color: var(--g-accent-ink); }

/* Clear search is the "undo" action: soft red instead of the accent. */
.gcp__empty-btn[data-gcp-clear]:hover,
.gcp__empty-btn[data-gcp-clear].is-active {
    border-color: color-mix(in srgb, var(--g-danger) 40%, var(--g-border));
    background: color-mix(in srgb, var(--g-danger) 8%, var(--g-surface));
    color: var(--g-danger-ink);
}
.gcp__empty-btn[data-gcp-clear]:hover i,
.gcp__empty-btn[data-gcp-clear].is-active i { color: var(--g-danger-ink); }
.gcp__empty-btn:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }

/* ---------- Footer ---------- */
.gcp__foot {
    display: flex;
    flex: none;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .9rem;
    border-top: 1px solid var(--g-border);
    background: color-mix(in srgb, var(--g-surface-2) 45%, var(--g-surface));
    color: var(--g-text-faint);
    font-size: .7rem;
}

.gcp__hints {
    display: flex;
    flex-wrap: wrap;
    gap: .85rem;
}

.gcp__hints span {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
}

.gcp__foot kbd {
    min-width: 17px;
    padding: .05rem .25rem;
    border: 1px solid var(--g-border);
    border-radius: 4px;
    background: var(--g-surface);
    color: var(--g-text-muted);
    font-family: inherit;
    font-size: .66rem;
    line-height: 1.4;
    text-align: center;
}

.gcp__count { font-variant-numeric: tabular-nums; }

/* Prevent background scroll while the palette is open. Pad the body by the
   scrollbar width (measured in JS into --gcp-sbw) so hiding the scrollbar does
   not shift the page right. */
body.gcp-open { overflow: hidden; padding-right: var(--gcp-sbw, 0px); }

/* ---------- Responsive ---------- */
@media (max-width: 575.98px) {
    .gcp { padding-top: 1.25rem; }
    .gcp__dialog { height: 86vh; max-height: 86vh; }
    .gcp__field { padding: .7rem .8rem; }
    .gcp__input { font-size: .9rem; }
    /* Keyboard hints are meaningless on touch; the counter still reports. */
    .gcp__hints { display: none; }
    .gcp__foot { justify-content: flex-end; }
}
