/* Pigeonhole: a dark, board-style team inbox.
   Type: system faces only (condensed display, grotesque body, mono for ids and dates).
   Shape: 6px radius on controls and cards; circles only for avatars.
   Accent: one orange, used for focus, selection, primary actions and urgent priority. */

:root {
  color-scheme: dark;
  --bg: #111316;
  --rail: #0c0e10;
  --surface: #181b1f;
  --raised: #1f2328;
  --line: #2b3036;
  --line-strong: #3a4149;
  --text: #e8eaed;
  --muted: #a0a8b1;
  --accent: #ff8a4c;
  --accent-ink: #1c0e05;
  --accent-wash: rgb(255 138 76 / 0.12);
  --r: 6px;
  --font-body: "Helvetica Neue", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: "Avenir Next Condensed", "DIN Condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { background: var(--bg); }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 40;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: var(--r); font-weight: 600;
}
.skip:focus { top: 12px; }

/* ---------- Shell ---------- */

.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100dvh; }

.rail {
  position: sticky; top: 0; align-self: start;
  height: 100dvh;
  display: flex; flex-direction: column; gap: 32px;
  padding: 24px 16px;
  background: var(--rail);
  border-right: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; padding: 0 8px; border-radius: var(--r); }
.mark { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: 30px; height: 30px; flex: none; }
.mark i { border: 1.5px solid var(--line-strong); border-radius: 3px; }
.mark i.on { background: var(--accent); border-color: var(--accent); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name { font: 700 24px/1 var(--font-display); letter-spacing: 0.01em; }
.brand-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }

.views ul { display: flex; flex-direction: column; gap: 2px; }
.view {
  width: 100%; min-height: 40px;
  display: grid; grid-template-columns: 16px 1fr auto; align-items: center; gap: 12px;
  padding: 8px 12px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r);
  color: var(--muted); text-align: left;
  transition: background-color 0.15s, color 0.15s;
}
.view:hover { background: var(--surface); color: var(--text); }
.view[aria-pressed="true"] { background: var(--accent-wash); border-color: rgb(255 138 76 / 0.45); color: var(--text); }
.view[aria-pressed="true"] .glyph { color: var(--accent); }
.view-count { font: 500 13px/1 var(--font-mono); color: var(--muted); }
.view[aria-pressed="true"] .view-count { color: var(--text); }
.glyph { flex: none; }

.rail-note { margin-top: auto; padding: 0 12px; font: 13px/1.4 var(--font-mono); color: var(--muted); }

.main { padding: 32px 40px 64px; max-width: 1360px; width: 100%; }

.top { display: flex; align-items: baseline; gap: 16px; margin-bottom: 20px; }
.top h1 { font: 700 44px/1 var(--font-display); letter-spacing: 0.005em; }
.summary { font: 13px/1.4 var(--font-mono); color: var(--muted); }

/* ---------- Tools ---------- */

.tools {
  display: flex; gap: 16px; align-items: end;
  padding-bottom: 24px; margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.grow { flex: 1 1 auto; max-width: 520px; }
.field label { font-size: 13px; font-weight: 600; color: var(--muted); }

input[type="search"], select {
  min-height: 44px; width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  color: var(--text);
}
input[type="search"]::placeholder { color: #8b949e; opacity: 1; }
input[type="search"]:hover, select:hover { border-color: #55606b; }
input[type="search"]:focus-visible, select:focus-visible { outline-offset: 0; border-color: var(--accent); }
select { min-width: 190px; padding-right: 32px; }

/* ---------- Board ---------- */

.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; align-items: start; }
.board:focus { outline: none; }
.board[data-cols="1"] { grid-template-columns: minmax(0, 1fr); }
.board[data-cols="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.board[data-cols="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.board[data-cols="1"] .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.load-error { color: var(--muted); }

.col-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.col-head h2 { display: flex; align-items: center; gap: 10px; font: 700 19px/1.1 var(--font-display); letter-spacing: 0.02em; text-transform: uppercase; }
.col-count { font: 500 13px/1 var(--font-mono); color: var(--muted); }
.col-blocked .col-head {
  background: repeating-linear-gradient(135deg, var(--surface) 0 8px, #1d2126 8px 16px);
  border-color: var(--line-strong);
}
.col-in-progress .col-head h2 .glyph { color: var(--accent); }

.cards { display: flex; flex-direction: column; gap: 12px; }

.card {
  position: relative;
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 14px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color 0.15s, background-color 0.15s, transform 0.15s;
}
.card:hover { border-color: #55606b; background: var(--raised); }
.card:has(.open:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.card:active { transform: translateY(1px); }

.card-top { display: flex; align-items: center; justify-content: space-between; }
.tid { font: 500 12px/1 var(--font-mono); color: var(--muted); letter-spacing: 0.02em; }

.card-title { font-size: 16px; line-height: 1.3; font-weight: 600; }
.open {
  padding: 0; margin: 0; background: none; border: 0;
  text-align: left; font: inherit; color: inherit;
}
.open:focus-visible { outline: none; }
.open::after { content: ""; position: absolute; inset: 0; border-radius: var(--r); }
.card-project { font-size: 13px; color: var(--muted); }

.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 4px; padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px; color: var(--muted);
}
.who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.due { font-family: var(--font-mono); font-size: 12.5px; white-space: nowrap; }

.av {
  display: inline-grid; place-items: center; flex: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--raised); border: 1px solid var(--line-strong);
  font: 600 10px/1 var(--font-body); color: var(--text); letter-spacing: 0.02em;
}

/* priority: three bars, filled count shows urgency */
.prio { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; margin-right: 8px; vertical-align: -1px; }
.prio i { width: 3px; background: var(--line-strong); border-radius: 1px; }
.prio i:nth-child(1) { height: 5px; }
.prio i:nth-child(2) { height: 8px; }
.prio i:nth-child(3) { height: 12px; }
.prio i.on { background: var(--muted); }
.prio-high i.on { background: var(--accent); }
.card .prio { margin-right: 0; }

.card.st-done .card-title { color: var(--muted); font-weight: 500; }
.card.st-blocked { border-left: 3px solid var(--line-strong); }

.card.flash { animation: flash 1.4s ease-out; }
@keyframes flash {
  0% { border-color: var(--accent); background: var(--accent-wash); }
  100% { border-color: var(--line); background: var(--surface); }
}

/* ---------- Empty ---------- */

.empty {
  max-width: 460px; margin-top: 24px; padding: 28px;
  border: 1px dashed var(--line-strong); border-radius: var(--r);
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
}
.empty h2 { font: 700 28px/1.1 var(--font-display); }
.empty p { color: var(--muted); margin-bottom: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 8px 16px;
  border-radius: var(--r); border: 1px solid var(--line-strong);
  background: var(--surface); font-weight: 600;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: var(--raised); border-color: #55606b; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #ff9d68; border-color: #ff9d68; }
.btn.ghost { background: transparent; }

/* ---------- Detail ---------- */

.detail {
  position: fixed; inset: 0 0 0 auto;
  margin: 0; padding: 0; border: 0; border-left: 1px solid var(--line-strong);
  width: min(560px, 100vw); height: 100dvh; max-width: none; max-height: none;
  background: var(--surface); color: var(--text);
}
.detail::backdrop { background: rgb(6 7 9 / 0.66); }
.detail-inner { height: 100%; overflow-y: auto; padding: 24px 32px 48px; }

.detail-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.detail-title { font: 700 36px/1.05 var(--font-display); letter-spacing: 0.005em; text-wrap: balance; }
.detail-project { margin: 8px 0 24px; color: var(--muted); }

.status-block {
  padding: 16px; margin-bottom: 24px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  display: flex; flex-direction: column; gap: 12px;
}
.status-block.st-blocked { background: repeating-linear-gradient(135deg, var(--bg) 0 8px, #15181c 8px 16px); }
.status-block select { width: 100%; }

.feedback { min-height: 24px; display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); }
.feedback:empty::before { content: "Changes apply to the board right away."; }
.feedback .glyph { color: var(--accent); }
.feedback strong { color: var(--text); }
.feedback.pulse { animation: pulse 0.9s ease-out; }
@keyframes pulse { 0% { background: var(--accent-wash); } 100% { background: transparent; } }
.link {
  margin-left: auto; min-height: 32px; padding: 4px 10px;
  background: transparent; border: 1px solid var(--line-strong); border-radius: var(--r);
  color: var(--accent); font-weight: 600;
}
.link:hover { border-color: var(--accent); }

.meta { display: grid; grid-template-columns: 1fr 1fr; gap: 0; border-top: 1px solid var(--line); margin-bottom: 20px; }
.meta > div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.meta > div:nth-child(odd) { padding-right: 16px; }
.meta dt { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.meta dd { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.meta .prio { margin-right: 0; }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.tags li { padding: 3px 10px; border: 1px solid var(--line-strong); border-radius: var(--r); font-size: 13px; color: var(--muted); }

.body { white-space: pre-wrap; max-width: 62ch; font-size: 16px; line-height: 1.6; }

@media (prefers-reduced-motion: no-preference) {
  .detail[open] { animation: slide-in 0.22s cubic-bezier(0.16, 1, 0.3, 1); }
  .detail[open]::backdrop { animation: fade-in 0.22s ease-out; }
  @keyframes slide-in { from { transform: translateX(32px); opacity: 0; } to { transform: none; opacity: 1; } }
  @keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Mid widths ---------- */

@media (max-width: 1180px) {
  .board, .board[data-cols="3"], .board[data-cols="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .board[data-cols="1"] { grid-template-columns: minmax(0, 1fr); }
  .main { padding-inline: 28px; }
}

/* ---------- Mobile ---------- */

@media (max-width: 820px) {
  .shell { display: block; }
  .rail {
    position: static; height: auto; gap: 14px;
    padding: 16px 16px 14px;
    border-right: 0; border-bottom: 1px solid var(--line);
  }
  .brand { padding: 0; }
  .rail-note { display: none; }
  .views { margin-inline: -16px; }
  .views ul { flex-direction: row; gap: 8px; overflow-x: auto; padding: 2px 16px 4px; scroll-snap-type: x proximity; }
  .views li { flex: none; scroll-snap-align: start; }
  .view { width: auto; min-height: 44px; grid-template-columns: 16px auto auto; gap: 8px; padding: 8px 12px; border-color: var(--line); white-space: nowrap; }

  .main { padding: 20px 16px 48px; }
  .top { margin-bottom: 16px; }
  .top h1 { font-size: 36px; }

  .tools { flex-direction: column; align-items: stretch; gap: 12px; padding-bottom: 20px; margin-bottom: 20px; }
  .field.grow { max-width: none; }
  select { min-width: 0; }

  .board, .board[data-cols] { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .board[data-cols="1"] .cards { display: flex; }

  .detail { width: 100vw; border-left: 0; }
  .detail-inner { padding: 16px 16px 40px; }
  .detail-title { font-size: 32px; }
  .btn.primary { width: 100%; justify-content: center; }
}
