/* css/modules/circle-field.css — the Circle Field (docs/internal/CIRCLE_FIELD_PLAN.md):
   the full-screen character-set picker for desktop, js/features/circle-field.js.
   Self-contained: remove this file and its <link> and the feature's styles are
   gone. Tokens only (ground, ink, the chat's own doodle), so the theme flips
   with html.light-mode by itself; the ONE light rule below mirrors what
   styles.css does to the same doodle on paper. The field is a canvas — nothing
   here styles a set. No outlines, no hairlines, no dropdown. */

.circle-field {
    position: fixed;
    inset: 0;
    z-index: 1050;   /* above the toolbar (1000) and the panels (1001); below hints (1100) and modals (2000+) */
    background-color: var(--background-primary);
    color: var(--text-primary);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    outline: none;
    overflow: hidden;
    -webkit-user-select: none;
            user-select: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .22s ease, visibility 0s linear .22s;
}
.circle-field.open { visibility: visible; pointer-events: auto; transition: opacity .22s ease; }
.circle-field.shown { opacity: 1; }

/* A stage on the chat's own background: the doodle is faintly there at the
   centre and gone at the rim. */
.circle-field::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--chat-bg-image);
    background-repeat: repeat;
    background-size: var(--chat-bg-tile-size) var(--chat-bg-tile-size);
    opacity: var(--chat-bg-opacity);
    -webkit-mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, .18) 0%, rgba(0, 0, 0, .05) 55%, rgba(0, 0, 0, .015) 100%);
            mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, .18) 0%, rgba(0, 0, 0, .05) 55%, rgba(0, 0, 0, .015) 100%);
    pointer-events: none;
}
/* white strokes → dark strokes on paper, exactly as .chat-column::before */
html.light-mode .circle-field::before { filter: invert(0.85); opacity: 0.05; }

/* The field is one canvas. Every set is drawn each frame from its animated
   position, scale and alpha; nothing in the DOM is touched per frame. */
.circle-field-canvas {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    display: block;
    z-index: 1;
    cursor: default;
    touch-action: none;
}

/* ---------- the top bar ---------- */
/* Solid ground colour, full width. Sets pass under it and vanish.
   Left: the search box. Centre: the views. Right: Manage and close. */
.circle-field-bar {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 56px;
    z-index: 5;
    background: var(--background-primary);
}

/* one flat row of words: what sits closest to the centre, the genres, Recenter */
.circle-field-menu {
    position: absolute;
    left: 50%;
    top: 0;
    height: 56px;
    width: max-content;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 13px;
    white-space: nowrap;
}
.circle-field-menu button {
    all: unset;
    cursor: pointer;
    padding: 3px 2px;
    color: var(--text-tertiary);
    transition: color .15s;
}
.circle-field-menu button:hover { color: var(--text-primary); }
.circle-field-menu button.on { color: var(--text-primary); font-weight: 500; }
.circle-field-menu button.genre { font-size: 12.5px; }
.circle-field-menu button.off,
.circle-field-menu button.off:hover { color: var(--text-tertiary); opacity: .45; cursor: default; }
.circle-field-menu .gap { width: 14px; }
.circle-field-menu button.recenter { color: var(--text-primary); opacity: .55; }
.circle-field-menu button.recenter:hover { opacity: 1; }

.circle-field-side {
    position: absolute;
    right: 18px;
    top: 0;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.circle-field-manage {
    all: unset;
    cursor: pointer;
    padding: 3px 2px;
    font-size: 13px;
    color: var(--text-tertiary);
    transition: color .15s;
}
.circle-field-close {
    all: unset;
    cursor: pointer;
    height: 56px;
    width: 36px;
    display: grid;
    place-items: center;
    color: var(--text-tertiary);
    transition: color .15s;
}
.circle-field-manage:hover,
.circle-field-close:hover { color: var(--text-primary); }

/* The search box: a real input, the panel's borderless fill (.avatar-search) —
   on the bar's ground it takes the surface colour so it can be seen. The caret
   sits in it while the field is open, and a key pressed anywhere lands in it.
   The match count shows inside its right end while something is typed. */
.circle-field-search {
    position: absolute;
    left: 28px;
    top: 13px;
    width: clamp(168px, 16vw, 232px);
    height: 30px;
}
.circle-field-input {
    all: unset;
    box-sizing: border-box;
    display: block;
    width: 100%;
    height: 30px;
    padding: 0 10px;
    background: var(--background-secondary);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    line-height: 30px;
    cursor: text;
    -webkit-user-select: text;
            user-select: text;
}
.circle-field-input::placeholder { color: var(--text-tertiary); opacity: 1; }
.circle-field-search.has-count .circle-field-input { padding-right: 82px; }
.circle-field-count {
    position: absolute;
    right: 10px;
    top: 0;
    height: 30px;
    display: flex;
    align-items: center;
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
    pointer-events: none;
}

/* Hint pills live on a layer above the field. While it is open only the
   field's own pills show; the chat's come back when it closes. */
body.circle-field-open .hint-layer .hint:not([data-area="field"]) { visibility: hidden; }

@media (prefers-reduced-motion: reduce) {
    .circle-field,
    .circle-field.open { transition: none; }
}
