/* T-005 "Follow a topic" and "Change a topic's priority" (tp-*). Tokens only, so light and dark both work. */

/* ───────── Topics list ───────── */
.tp-tag { height: 20px; padding: 0 8px; margin-left: 8px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; color: var(--ink-2); vertical-align: 1px; }
.tp-pin { display: inline-flex; align-items: center; color: var(--ink-3); margin-left: -2px; }
.tp-pin .ico { width: 13px; height: 13px; }
.tp-pending { margin-top: 16px; }
.tp-hidden-row { margin-top: 10px; }
.tp-hidden-link { min-height: 32px; color: var(--ink-3); font-size: var(--t-xs); }
.tp-hidden-link:hover { color: var(--ink); }
.tp-more { flex: none; margin: -2px -4px 0 0; }
.card-head > .tp-more { align-self: flex-start; }

/* ───────── Priority tile ───────── */
.tp-prio-cell { text-align: left; font: inherit; color: inherit; position: relative; display: block; }
.tp-prio-cell .v { flex-wrap: nowrap; }
.tp-prio { cursor: pointer; transition: background-color var(--t-fast) var(--ease-std), border-color var(--t-fast) var(--ease-std), box-shadow var(--t-fast) var(--ease-std); }
@media (hover: hover) { .tp-prio:hover { border-color: var(--line-2); background: var(--surface); } }
.tp-prio[aria-expanded="true"] { background: var(--surface); border-color: var(--ink-3); box-shadow: var(--shadow-1); }
.tp-prio:focus-visible { outline: 2px solid var(--focus, var(--brand)); outline-offset: 2px; }
.tp-prio-edit { position: absolute; top: 10px; right: 8px; color: var(--ink-3); display: inline-flex; transform: rotate(90deg); }
.tp-set { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line-2); display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tp-set span { font-size: var(--t-xs); font-weight: 600; color: var(--ink-2); }
.tp-set small { font-size: var(--t-xs); font-weight: 400; color: var(--ink-3); display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* ───────── Popovers (More menu, priority on desktop) ───────── */
.tp-pop {
  position: fixed; z-index: 50; left: 0; top: 0;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--r-md);
  box-shadow: var(--shadow-3); color: var(--ink);
}
@media (prefers-reduced-motion: no-preference) {
  .tp-pop { animation: tpPop var(--t-med) var(--ease-out) both; }
}
@keyframes tpPop { from { opacity: 0; transform: translate3d(0, -4px, 0); } to { opacity: 1; transform: none; } }
.tp-menu { min-width: 200px; padding: 6px; display: flex; flex-direction: column; }
.tp-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px;
  border-radius: var(--r-sm); font-size: var(--t-sm); font-weight: 500; color: var(--ink); text-align: left;
  transition: background-color var(--t-fast) var(--ease-std);
}
.tp-item .ico { color: var(--ink-3); flex: none; }
.tp-item:hover, .tp-item:focus-visible { background: color-mix(in srgb, var(--ink) 6%, transparent); outline: 0; }
.tp-item:focus-visible { box-shadow: inset 0 0 0 2px var(--focus, var(--brand)); }
.tp-prio-pop { width: min(320px, calc(100vw - 16px)); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.tp-pop-h { font-size: var(--t-micro); font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; font-family: var(--f-mono); color: var(--ink-3); }
.tp-prio-body { display: flex; flex-direction: column; gap: 12px; }
.tp-why { margin: 0; font-size: var(--t-xs); color: var(--ink-3); text-wrap: pretty; }
.tp-levels { display: flex; flex-direction: column; gap: 6px; }
.tp-level {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px;
  border-radius: var(--r-sm); font-size: var(--t-sm); font-weight: 500; color: var(--ink); text-align: left;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-2);
  transition: background-color var(--t-fast) var(--ease-std), box-shadow var(--t-fast) var(--ease-std);
}
.tp-level small { margin-left: auto; font-size: var(--t-xs); font-weight: 400; color: var(--ink-3); }
@media (hover: hover) { .tp-level:not([aria-disabled="true"]):hover { background: var(--surface-2); } }
.tp-level[aria-checked="true"] { font-weight: 600; background: color-mix(in srgb, var(--brand) 10%, var(--surface)); box-shadow: inset 0 0 0 1.5px var(--brand); }
.tp-level[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.tp-level:focus-visible { outline: 2px solid var(--focus, var(--brand)); outline-offset: 2px; }
.tp-floor { display: flex; gap: 6px; align-items: center; margin: -4px 0 0; font-size: var(--t-xs); color: var(--ink-2); }
.tp-floor .ico { color: var(--ink-3); flex: none; }
.tp-prio-body .fl small { font-weight: 400; }
.tp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ───────── Follow drawer ───────── */
.tp-words { display: flex; flex-wrap: wrap; gap: 6px; min-height: 32px; align-items: center; }
.tp-words-empty { font-size: var(--t-xs); color: var(--ink-3); font-weight: 400; }
.tp-chip { height: 32px; padding: 0 4px 0 12px; gap: 2px; font-size: var(--t-sm); color: var(--ink); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 30%, transparent); }
.tp-chip-x { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; color: var(--ink-3); position: relative; }
.tp-chip-x::after { content: ""; position: absolute; inset: -4px; }
.tp-chip-x:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.tp-chip-x:focus-visible { outline: 2px solid var(--focus, var(--brand)); outline-offset: 1px; }
.tp-add { display: flex; gap: 8px; align-items: stretch; }
.tp-add .input { flex: 1; }
.tp-sugg { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tp-sugg:empty { display: none; }
.tp-sugg-l { font-size: var(--t-xs); color: var(--ink-3); font-weight: 400; margin-right: 2px; }
.tp-found { display: flex; flex-direction: column; gap: 2px; }
.tp-count { font-size: var(--t-md); font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.tp-found span { font-size: var(--t-xs); color: var(--ink-3); }
.tp-stats .v { font-size: var(--t-md); font-variant-numeric: tabular-nums; }
.tp-quote-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; font-size: var(--t-xs); }
.tp-err { margin: 0; }
.tp-hidden-item { align-items: center; gap: 12px; }

/* Toolbar: the extra button must not push "Send top 3" onto a second row; the note gives way first */
@media (min-width: 768px) {
  .toolbar:has(.tp-follow-btn) > .grow { display: none; }
  .toolbar:has(.tp-follow-btn) > .toolbar-note { flex: 1 1 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .toolbar:has(.tp-follow-btn) > .btn { flex: none; }
}

/* ───────── Phone: one thumb, 44 px targets ───────── */
@media (max-width: 767px) {
  .tp-follow-btn, .tp-hidden-link { min-height: 44px; }
  .toolbar:has(.tp-follow-btn) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: stretch; }
  .toolbar:has(.tp-follow-btn) > [data-seg="themeLens"], .toolbar:has(.tp-follow-btn) > .toolbar-note { grid-column: 1 / -1; }
  .toolbar:has(.tp-follow-btn) > .btn { width: 100%; justify-content: center; min-height: 44px; margin-left: 0; }
  .tp-more { width: 44px; height: 44px; margin: -8px -8px 0 0; }
  .tp-item { min-height: 44px; }
  .tp-chip { height: 44px; padding-left: 14px; font-size: var(--t-sm); }
  .tp-chip-x { width: 36px; height: 36px; }
  .tp-add .btn { min-height: 44px; padding: 0 16px; }
  .tp-actions .btn, .tp-form .reply-actions .btn { min-height: 44px; }
  .tp-sugg-b { min-height: 44px; }
  .tp-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tp-stats .meta-cell { padding: 10px; }
  .tp-hidden-item .btn { min-height: 44px; }
  .drawer .tp-prio-body { padding-bottom: 4px; }
}
