/* ============ channel menus + drag to reorder (design canvas "Channel menus") ============
   ChanMenu.razor: the right-click / press & hold menu (a pop-up at the cursor, a bottom sheet
   on phones). BoardMap.razor + boardmap.js: dragging chats, rooms and sections about. */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---- the menu ---- */
.cm-veil { position: fixed; inset: 0; z-index: 900; background: transparent; }
.cm-veil.dim { background: color-mix(in srgb, var(--gray-900) 45%, transparent); }
.cm {
    position: fixed; z-index: 901; box-sizing: border-box; display: flex; flex-direction: column;
    background: var(--paper); color: var(--ink); font-family: var(--font-hand);
    border: 2.5px solid var(--line);
}
.cm.cm-pop {
    width: 272px; padding: 6px; max-height: calc(100vh - 16px); overflow: auto;
    border-radius: 12px 18px 14px 16px / 16px 12px 18px 14px; box-shadow: 5px 6px 0 var(--line);
}
.cm.cm-sheet {
    left: 0; right: 0; bottom: 0; margin: 0 auto; width: 100%; max-width: 480px; max-height: 85vh; overflow: auto;
    padding: 0 10px calc(18px + env(safe-area-inset-bottom)); border-bottom: none;
    border-radius: 18px 22px 0 0; box-shadow: 0 -18px 40px color-mix(in srgb, var(--gray-900) 25%, transparent);
}
.cm-grab { display: flex; justify-content: center; padding: 8px 0 2px; }
.cm-grab span { width: 56px; height: 6px; border-radius: 4px; background: color-mix(in srgb, var(--ink) 35%, transparent); }

.cm-hd { display: flex; align-items: center; gap: 8px; padding: 6px 8px 8px; margin-bottom: 4px; border-bottom: 2px dashed color-mix(in srgb, var(--ink) 20%, transparent); }
.cm-sw { width: 30px; height: 30px; display: grid; place-items: center; flex-shrink: 0; border: 2px solid var(--line); border-radius: 9px 7px 10px 6px; background: var(--yellow-100); color: var(--gray-900); }
.cm-sw.v { background: var(--green-100); color: var(--green-700); }
.cm-sw.s { background: color-mix(in srgb, var(--ink) 10%, var(--paper)); color: var(--ink); }
.cm-sw.w { background: var(--amber-200); color: var(--gray-900); }
.cm-back { width: 36px; height: 36px; flex-shrink: 0; display: grid; place-items: center; padding: 0; border: none; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; }
.cm-back:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.cm-hd-t { min-width: 0; flex: 1; }
.cm-title { display: block; font-family: var(--font-marker); font-weight: 700; font-size: 1.5rem; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-sub { display: block; font-size: .82rem; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.cm-it {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 38px; padding: 2px 10px; box-sizing: border-box;
    border: none; border-radius: 10px; background: none; color: var(--ink); font: inherit; font-size: 1.03rem;
    text-align: left; line-height: 1.1; cursor: pointer;
}
.cm.cm-sheet .cm-it { min-height: 50px; font-size: 1.12rem; padding: 2px 12px; }
.cm-it:hover:not(:disabled), .cm-it:focus-visible { outline: none; background: var(--hi-yellow); color: var(--gray-900); box-shadow: inset 0 0 0 2px var(--line); }
.cm-it:disabled { color: var(--ink-faint); cursor: default; }
.cm-it .icon { flex-shrink: 0; }
.cm-l { flex: 1; min-width: 0; }
.cm-l small { display: block; font-size: .78rem; color: var(--ink-soft); }
.cm-it:hover:not(:disabled) .cm-l small, .cm-it:focus-visible .cm-l small { color: var(--gray-700); }
.cm-r { font-size: .82rem; color: var(--ink-soft); white-space: nowrap; }
.cm-it.bad { color: var(--danger-text); }
.cm-it.bad:hover:not(:disabled), .cm-it.bad:focus-visible { background: var(--red-100); color: var(--red-900); box-shadow: inset 0 0 0 2px var(--red-800); }
.cm-sep { display: flex; align-items: center; gap: 8px; margin: 6px 4px 4px; font-family: var(--font-marker); font-weight: 700; font-size: 1.12rem; color: var(--ink-soft); }
.cm-sep::after { content: ""; flex: 1; border-top: 2px dashed color-mix(in srgb, var(--ink) 20%, transparent); }
.cm-err { margin: 6px 8px 2px; font-size: .88rem; color: var(--danger-text); }

.cm-ask { padding: 6px 8px 4px; }
.cm-q { display: block; margin-bottom: 4px; font-family: var(--font-marker); font-size: 1.55rem; line-height: 1.05; }
.cm-ask p { margin: 0 0 6px; font-size: .95rem; line-height: 1.25; }
.cm-warn { margin: 6px 0; padding: 6px 10px; border: 2px solid var(--red-800); border-radius: 12px 9px 13px 8px; background: var(--red-100); color: var(--red-900); font-size: .9rem; line-height: 1.25; }
.cm-lbl { display: block; margin-bottom: 4px; font-family: var(--font-marker); font-weight: 700; font-size: 1.25rem; }
.cm-in {
    width: 100%; min-height: 44px; padding: 4px 12px; box-sizing: border-box; font: inherit; font-size: 1.05rem;
    color: var(--gray-900); background: var(--white); border: 2px solid var(--line);
    border-radius: 185px 25px 145px 20px / 20px 155px 25px 175px;
}
.cm-in:focus { outline: 3px solid var(--amber-500); outline-offset: 1px; }
.cm-in.err { border-color: var(--red-800); }
.cm-why { min-height: 16px; margin: 4px 4px 0; font-size: .82rem; color: var(--ink-soft); }
.cm-why.err { color: var(--danger-text); }
.cm-row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.cm-btn {
    display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 2px 14px; box-sizing: border-box;
    font: inherit; font-size: 1rem; color: var(--ink); background: var(--paper); cursor: pointer;
    border: 2.5px solid var(--line); border-radius: 255px 15px 225px 15px / 15px 225px 15px 255px; box-shadow: 2px 2px 0 var(--line);
}
.cm.cm-sheet .cm-btn { flex: 1; min-height: 48px; }
.cm-btn.primary { background: var(--navy); color: var(--amber-200); }
.cm-btn.ghost { background: transparent; border-style: dashed; box-shadow: none; }
.cm-btn.danger { background: var(--red-800); border-color: var(--red-900); color: var(--white); }
.cm-btn:disabled { opacity: .5; cursor: default; }

/* the thing a menu is open on: a dashed ink outline */
.map-row.menu, .map-sec-btn.menu { outline: 2.5px dashed var(--line); outline-offset: -2px; border-radius: 10px; }
.notepad-tab.menu { outline: 2.5px dashed var(--line); outline-offset: -4px; }
.sheet-tab.menu { outline: 2.5px dashed var(--line); outline-offset: -5px; }
.pin.menu { outline: 2.5px dashed var(--line); outline-offset: 4px; }

/* ---- drag to reorder in the board map ---- */
.board-map { position: relative; }
.map-row, .map-sec-btn { position: relative; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: pan-y; }
.map-grip { position: absolute; left: 1px; top: 50%; translate: 0 -50%; color: var(--ink-faint); opacity: 0; transition: opacity .12s; }
.map-row:hover .map-grip, .map-row:focus-visible .map-grip { opacity: 1; }
.map-sec { position: relative; }
.map-row.drop-b::before, .map-row.drop-a::after, .map-sec.drop-b::before, .map-sec.drop-a::after {
    content: ""; position: absolute; left: 8px; right: 8px; height: 3px; border-radius: 3px; background: var(--line); z-index: 2; pointer-events: none;
}
.map-row.drop-b::before, .map-sec.drop-b::before { top: -2px; }
.map-row.drop-a::after, .map-sec.drop-a::after { bottom: -2px; }
.map-sec-btn.drop-in { background: var(--hi-yellow); color: var(--gray-900); outline: 2.5px dashed var(--line); outline-offset: -2px; border-radius: 10px; }
.map-row.dragging, .map-sec.dragging { opacity: .35; }
.map-row.lift, .map-sec-btn.lift { background: var(--paper); box-shadow: 3px 4px 0 var(--line), inset 0 0 0 2px var(--line); rotate: -1deg; touch-action: none; }
.map-ghost {
    position: absolute; left: 18px; right: 18px; z-index: 5; pointer-events: none; box-sizing: border-box;
    background: var(--paper); color: var(--ink); border: 2.5px solid var(--line); border-radius: 10px 12px 9px 11px;
    box-shadow: 4px 5px 0 var(--line); rotate: -2deg;
}
.map-ghost .map-grip { display: none; }
body.map-dragging, body.map-dragging * { cursor: grabbing !important; }

@media (prefers-reduced-motion: reduce) {
    .map-grip { transition: none; }
    .map-row.lift, .map-sec-btn.lift, .map-ghost { rotate: none; }
}
