/* Tile cards: the board, the expanded section list and the Inbox.
   Loaded after workshop.css. To go back, remove its link in
   index.php and restore TaskCard's template in board.js from before this
   change (git history): the markup and the look moved together.

   Sections have no panel behind them: a name, a count in a small square and
   the section colour as a line underneath. Cards are tiles: a ring that says
   their state (empty to do, half full busy, filled with a tick review), a
   bold title, and a darker footer strip for the details. Colour only where
   it means something. Works in both themes from the shared tokens, with the
   dark values from the preview pinned at the end. */

:root {
  --tc-bg: var(--panel);
  --tc-edge: var(--border);
  --tc-edge-hover: color-mix(in srgb, var(--border) 60%, var(--text));
  --tc-foot: var(--panel-2);
  --tc-line: var(--border);
  --tc-busy: var(--warn);
  --tc-review: var(--ok);
  --tc-busy-edge: color-mix(in srgb, var(--warn) 45%, var(--border));
  --tc-review-edge: color-mix(in srgb, var(--ok) 45%, var(--border));
  --tc-tick: #ffffff;
  --tc-count-bg: var(--panel-2);
}
.board.board-tile { gap: 20px; }

/* ---------- sections ---------- */
.board.board-tile .board-col {
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
}
.board.board-tile .board-col-head {
  align-items: center; gap: 10px;
  min-height: 40px; box-sizing: border-box;
  padding: 0 2px 8px;
  margin-bottom: 10px;
  border-bottom: 2px solid var(--col-color, #8a8f98);
}
.board.board-tile .board-col-label { align-items: center; gap: 10px; }
.board.board-tile .board-col-label::before { content: none; }
.board.board-tile .board-col-grip { display: none; }
.board.board-tile .board-col-head:hover .board-col-grip { display: inline-flex; margin: 0 -6px 0 -4px; }
.board.board-tile .board-col-head h3 {
  font-family: 'Work Sans', 'Inter', sans-serif;
  font-size: 16px; font-weight: 600; letter-spacing: -.01em; line-height: 1.3;
}
.board.board-tile .board-col-count {
  min-width: 22px; height: 22px; padding: 0 6px; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 4px; background: var(--tc-count-bg);
  font-family: 'Inter', system-ui, sans-serif; font-size: 12px; font-weight: 600;
  font-variant-numeric: tabular-nums; color: var(--text);
}
@media (hover: hover) and (pointer: fine) {
  .board.board-tile .board-col-actions { opacity: 0; transition: opacity .12s; }
  .board.board-tile .board-col:hover .board-col-actions,
  .board.board-tile .board-col-actions:focus-within { opacity: 1; }
}
.board.board-tile .board-col.drag-over,
.board.board-tile .board-col.col-drag-over {
  background: var(--accent-soft); outline-color: var(--accent); border-radius: 9px;
}
.board.board-tile .board-col-body { gap: 10px; }

/* ---------- cards ---------- */
.lc {
  position: relative;
  min-width: 0;
  background: var(--tc-bg);
  border: 1px solid var(--tc-edge);
  border-radius: 9px;
  overflow: hidden;
  color: var(--text);
  cursor: pointer;
  transition: border-color .12s ease;
}
.lc:hover { border-color: var(--tc-edge-hover); }
.lc.is-busy:not(.done) { border-color: var(--tc-busy-edge); }
.lc.is-review:not(.done) { border-color: var(--tc-review-edge); }
.lc.is-unread { background: var(--card-unread-bg) !important; border-color: var(--card-unread-edge); }
/* A chosen card colour: a strip across the top, as before. */
.lc.colored::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px; background: var(--card-accent);
}

.lc-body { display: flex; align-items: flex-start; gap: 10px; padding: 13px 12px 12px 14px; }

/* State ring. Hovering previews the colour of the next state. */
.lc-state {
  flex: none; display: inline-flex;
  width: 18px; height: 18px; margin-top: 1px; padding: 0;
  border: 0; border-radius: 50%; background: none;
  color: var(--muted); cursor: pointer;
  transition: transform .12s ease, color .12s ease;
}
.lc-state svg { width: 18px; height: 18px; }
.lc-state:hover { transform: scale(1.15); }
.lc-state.is-none:hover { color: var(--tc-busy); }
.lc-state.is-busy { color: var(--tc-busy); }
.lc-state.is-busy:hover { color: var(--tc-review); }
.lc-state.is-review,
.lc-state.is-done { color: var(--tc-review); }
.lc-state.is-done { opacity: .7; }
.lc-tick { stroke: var(--tc-tick); }
.lc-state:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.lc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.lc-top { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.lc-title {
  flex: 1; min-width: 0;
  font-size: 14px; font-weight: 600; line-height: 1.4; letter-spacing: -.005em;
  overflow-wrap: anywhere;
}
.lc.done .lc-title { color: var(--muted); text-decoration: line-through; font-weight: 500; }
.lc .card-title-edit { flex: 1; font-size: 14px; font-weight: 600; line-height: 1.4; padding: 2px 6px; }

.lc-tools { display: flex; gap: 2px; flex: none; margin: -3px -4px 0 0; }
.lc-tool {
  width: 24px; height: 24px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 4px; background: none;
  color: var(--muted); cursor: pointer;
}
.lc-tool svg { width: 14px; height: 14px; }
.lc-tool:hover { background: var(--tc-foot); color: var(--text); }
.lc-tool-done:hover { color: var(--ok); }
@media (hover: hover) and (pointer: fine) {
  .lc-tools { opacity: 0; transition: opacity .12s; }
  .lc:hover .lc-tools, .lc-tools:focus-within { opacity: 1; }
}

.lc-progress {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums;
}
.lc-bar { flex: 1; height: 4px; border-radius: 2px; background: var(--tc-line); overflow: hidden; }
.lc-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.lc.is-review .lc-bar i { background: var(--tc-review); }
.lc-sub-busy { color: var(--tc-busy); }
.lc-sub-review { color: var(--tc-review); }

/* Footer strip: the details, quiet unless they matter. */
.lc-foot {
  display: flex; align-items: center; gap: 10px;
  min-height: 36px; box-sizing: border-box;
  padding: 5px 10px 5px 14px;
  border-top: 1px solid var(--tc-line);
  background: var(--tc-foot);
}
.lc-meta {
  flex: 1; min-width: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 3px 10px;
  font-size: 12px; line-height: 1.4; color: var(--muted);
}
.lc-m-state { font-weight: 600; }
.lc.is-busy .lc-m-state { color: var(--tc-busy); }
.lc.is-review .lc-m-state { color: var(--tc-review); }
.lc-tag { padding: 1px 6px; border-radius: 3px; font-size: 11.5px; font-weight: 500; }
.lc-due { color: var(--text); font-weight: 500; }
.lc-due.due-today { color: var(--accent); }
.lc-due.due-overdue { color: var(--danger); font-weight: 600; }
.lc-prio.is-high { color: var(--danger); font-weight: 600; }
.lc-prio.is-medium { color: var(--warn); }
.lc-ping { color: var(--accent); font-weight: 600; }

.lc-side { display: flex; align-items: center; gap: 4px; flex: none; }
.lc-read { padding: 4px; }
.lc-read .card-read-icon svg { width: 13px; height: 13px; display: block; }
@media (hover: hover) and (pointer: fine) {
  .lc-read:not(.is-unread) { opacity: 0; transition: opacity .12s; }
  .lc:hover .lc-read, .lc-read:focus-visible { opacity: 1; }
}
.lc-avatar { width: 22px; height: 22px; font-size: 10px; }

/* ---------- add, empty, drag ---------- */
.board.board-tile .board-add { margin: 0; }
.board.board-tile .board-add input {
  width: 100%; box-sizing: border-box;
  min-height: 40px; padding: 0 14px;
  border: 1px dashed var(--tc-edge); border-radius: 9px;
  background: none; text-align: center;
  font-size: 12.5px; color: var(--text);
}
.board.board-tile .board-add input::placeholder { color: var(--muted); }
.board.board-tile .board-add input:hover { border-color: var(--tc-edge-hover); }
.board.board-tile .board-add input:focus {
  border-style: solid; border-color: var(--accent);
  background: var(--tc-bg); text-align: left; outline: none;
}
.board.board-tile .col-empty {
  padding: 14px 4px; border: 0; border-radius: 9px;
  text-align: left; font-size: 12.5px;
}
.board.board-tile .col-empty.over { padding: 14px; background: var(--accent-soft); }

/* A dragged card dims; a dashed space opens where it will land. */
.board.board-tile .board-col-body > .card-dragging { opacity: .4; }
.board.board-tile .board-col-body > .card-drop-target::before { border-radius: 9px; }

/* ---------- motion ---------- */
.lc.just-added { animation: cardEnter .22s cubic-bezier(.2,.8,.2,1) both; }
.lc-sweep .lc-state { animation: tcStatePop .3s cubic-bezier(.2,.8,.2,1); }
@keyframes tcStatePop {
  40% { transform: scale(1.3); }
  100% { transform: none; }
}
.card-settle .lc { animation: cardSettle .26s cubic-bezier(.2,.8,.2,1); }
.card-completing .lc-state { color: var(--ok); }
@media (prefers-reduced-motion: reduce) {
  .lc, .lc-state, .lc-tools, .lc-read, .board.board-tile .board-col-actions { transition: none; }
  .lc.just-added, .lc-sweep .lc-state, .card-settle .lc { animation: none; }
}

/* ---------- the expanded section list ---------- */
.lc.section-card { display: flex; flex-direction: column; padding: 0; gap: 0; }
.lc.section-card > .lc-body { flex: 1; }
.lc .section-card-excerpt {
  margin: 0; padding: 0; border: 0;
  font-size: 12.5px; line-height: 1.5; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lc.section-card .section-pick { top: 12px; right: 12px; z-index: 1; }
.density-compact .lc.section-card { padding: 0; }
.density-compact .lc-body { padding: 9px 12px 8px 14px; }
.density-compact .lc .section-card-excerpt,
.density-compact .lc-progress { display: none; }
.density-compact .lc-title {
  font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden;
}
.density-compact .lc-foot { min-height: 30px; padding-top: 3px; padding-bottom: 3px; }

/* ---------- Inbox: the whole card is one button, so the ring is a mark ---------- */
.lc.ws-inbox-card { display: block; flex: none; width: 100%; padding: 0; text-align: left; font: inherit; }
.lc-mark { cursor: inherit; }
.lc-mark:hover, .lc-mark.is-none:hover { transform: none; color: var(--muted); }
.lc-mark.is-busy:hover { color: var(--tc-busy); }
.lc-mark.is-review:hover { color: var(--tc-review); }
.lc.ws-inbox-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- dark: the values from the preview ---------- */
[data-theme="dark"] {
  --tc-bg: #232323;
  --tc-edge: #333333;
  --tc-edge-hover: #4a4a4a;
  --tc-foot: #202020;
  --tc-line: #2f2f2f;
  --tc-busy: #e0a458;
  --tc-review: #4fae7d;
  --tc-busy-edge: #5a4220;
  --tc-review-edge: #2c4a37;
  --tc-tick: #141414;
  --tc-count-bg: #262626;
}
[data-theme="dark"] .board.board-tile .board-col-count { color: #d6d6d3; }
[data-theme="dark"] .lc.is-busy .lc-m-state { color: #f2c78f; }
[data-theme="dark"] .lc.is-review .lc-m-state { color: #a6e0bd; }
[data-theme="dark"] .lc-due.due-overdue,
[data-theme="dark"] .lc-prio.is-high { color: #f2aaaa; }
[data-theme="dark"] .lc-prio.is-medium { color: #eeb77e; }
[data-theme="dark"] .lc.is-unread { background: #262a3a !important; border-color: #5b6ee1; }
