185 lines
4.4 KiB
CSS
185 lines
4.4 KiB
CSS
/* selection-popup.css — Custom text-selection toolbar */
|
|
|
|
/* ============================================================
|
|
CONTAINER
|
|
Inverted: --text as background, --bg as foreground.
|
|
This gives a dark pill in light mode and a light pill in dark
|
|
mode — same contrast relationship as the page selection colour.
|
|
============================================================ */
|
|
|
|
.selection-popup {
|
|
position: absolute;
|
|
z-index: 700;
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 0.25rem;
|
|
gap: 0;
|
|
|
|
background: var(--text);
|
|
border-radius: 4px;
|
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.22);
|
|
|
|
opacity: 0;
|
|
visibility: hidden;
|
|
transform: translateY(5px);
|
|
transition: opacity 0.13s ease, visibility 0.13s ease, transform 0.13s ease;
|
|
|
|
pointer-events: none;
|
|
user-select: none;
|
|
-webkit-user-select: none;
|
|
}
|
|
|
|
.selection-popup.is-visible {
|
|
opacity: 1;
|
|
visibility: visible;
|
|
transform: translateY(0);
|
|
pointer-events: auto;
|
|
}
|
|
|
|
/* Caret pointing down (popup is above selection) */
|
|
.selection-popup::after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 100%;
|
|
left: calc(var(--caret-left, 50%) - 5px);
|
|
border: 5px solid transparent;
|
|
border-top-color: var(--text);
|
|
pointer-events: none;
|
|
}
|
|
|
|
/* Flip: caret pointing up (popup is below selection) */
|
|
.selection-popup.is-below::after {
|
|
top: auto;
|
|
bottom: 100%;
|
|
border-top-color: transparent;
|
|
border-bottom-color: var(--text);
|
|
}
|
|
|
|
|
|
/* ============================================================
|
|
BUTTONS
|
|
============================================================ */
|
|
|
|
.selection-popup-btn {
|
|
background: none;
|
|
border: none;
|
|
color: var(--bg);
|
|
font-family: var(--font-sans);
|
|
font-size: 0.72rem;
|
|
font-weight: 500;
|
|
letter-spacing: 0.025em;
|
|
padding: 0.38rem 0.6rem;
|
|
cursor: pointer;
|
|
border-radius: 3px;
|
|
white-space: nowrap;
|
|
line-height: 1;
|
|
transition: background 0.1s ease;
|
|
}
|
|
|
|
.selection-popup-btn:hover,
|
|
.selection-popup-btn:focus-visible {
|
|
background: rgba(128, 128, 128, 0.2);
|
|
outline: none;
|
|
}
|
|
|
|
/* Placeholder buttons — visually present but muted, not interactive */
|
|
.selection-popup-btn--placeholder {
|
|
opacity: 0.4;
|
|
cursor: default;
|
|
pointer-events: none;
|
|
}
|
|
|
|
|
|
/* ============================================================
|
|
SEPARATOR
|
|
============================================================ */
|
|
|
|
.selection-popup-sep {
|
|
display: block;
|
|
width: 1px;
|
|
height: 1rem;
|
|
background: var(--bg);
|
|
opacity: 0.2;
|
|
margin: 0 0.15rem;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
|
|
/* ============================================================
|
|
ANNOTATION FORM MODE
|
|
Replaces the button row with a compact form: colour swatches,
|
|
optional note textarea, Save / Cancel.
|
|
============================================================ */
|
|
|
|
.selection-popup.is-form-mode {
|
|
flex-direction: column;
|
|
align-items: stretch;
|
|
padding: 0.5rem;
|
|
gap: 0.4rem;
|
|
min-width: 13rem;
|
|
}
|
|
|
|
.selection-popup-ann-form {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 0.4rem;
|
|
}
|
|
|
|
/* ── Colour swatches ── */
|
|
|
|
.ann-swatches {
|
|
display: flex;
|
|
gap: 0.4rem;
|
|
padding: 0 0.1rem;
|
|
}
|
|
|
|
.ann-swatch {
|
|
width: 1.05rem;
|
|
height: 1.05rem;
|
|
border-radius: 50%;
|
|
border: 2px solid transparent;
|
|
cursor: pointer;
|
|
padding: 0;
|
|
flex-shrink: 0;
|
|
transition: border-color 0.1s ease, transform 0.1s ease;
|
|
}
|
|
|
|
.ann-swatch:hover { transform: scale(1.15); }
|
|
.ann-swatch.is-selected { border-color: var(--bg); }
|
|
|
|
.ann-swatch--amber { background: #f59e0b; }
|
|
.ann-swatch--sage { background: #6b9e78; }
|
|
.ann-swatch--steel { background: #7096b8; }
|
|
.ann-swatch--rose { background: #c87474; }
|
|
|
|
/* ── Note textarea ── */
|
|
|
|
.ann-note-input {
|
|
background: rgba(128, 128, 128, 0.15);
|
|
border: 1px solid rgba(255, 255, 255, 0.18);
|
|
border-radius: 3px;
|
|
color: var(--bg);
|
|
font-family: var(--font-sans);
|
|
font-size: 0.72rem;
|
|
line-height: 1.4;
|
|
padding: 0.3rem 0.45rem;
|
|
resize: none;
|
|
width: 100%;
|
|
box-sizing: border-box;
|
|
outline: none;
|
|
}
|
|
|
|
.ann-note-input::placeholder { opacity: 0.45; }
|
|
.ann-note-input:focus { border-color: rgba(255, 255, 255, 0.35); }
|
|
|
|
/* ── Save / Cancel row ── */
|
|
|
|
.ann-form-actions {
|
|
display: flex;
|
|
gap: 0.3rem;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
/* Reduce motion */
|
|
[data-reduce-motion] .ann-swatch { transition: none; }
|