/* Pigeonhole — team inbox
   Palette: sage paper, forest ink, single brass accent. Mailroom/notebook voice. */

@font-face {
  font-family: "Literata";
  src: url("assets/literata.ttf") format("truetype");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-weight: 100 1000;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper:   #E7EAE2;
  --paper-2: #DEE3D8;
  --paper-3: #D4DACD;
  --ink:     #1B2520;
  --ink-2:   #414B43;
  --muted:   #6E776E;
  --rule:    #C7D0C2;
  --rule-2:  #B6C0B0;

  --brass:      #9A6A1C;
  --brass-ink:  #5A3E12;
  --brass-soft: #ECDDB4;

  /* status hues, chosen to sit on the sage paper */
  --todo-c: #4E6B8C;     --todo-soft: #DCE4EA;
  --prog-c: #9A6A1C;     --prog-soft: #ECDDB4;
  --block-c: #A8453A;   --block-soft: #EFD6D1;
  --done-c: #3E6B47;    --done-soft: #D6E4D8;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 0 rgba(20,30,25,.04), 0 8px 24px -16px rgba(20,30,25,.28);
  --focus: 3px;

  --font-ui: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Literata", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* faint paper grid, restrained, only behind the workspace */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(27,37,32,.035) 1px, transparent 1px);
  background-size: 34px 100%;
  z-index: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  background: var(--ink);
  color: var(--paper);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 14px;
  z-index: 100;
  transition: top .15s ease;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: var(--focus) solid var(--brass);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- Top bar ---------- */
.topbar {
  position: relative;
  z-index: 2;
  max-width: 1040px;
  margin: 0 auto;
  padding: 26px 28px 18px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-areas:
    "brand tagline tally";
  align-items: center;
  gap: 18px 28px;
}
.brand { grid-area: brand; display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand .mark { display: inline-flex; }
.wordmark {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.01em;
  line-height: 1;
}
.tagline {
  grid-area: tagline;
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  max-width: 42ch;
}
.tally {
  grid-area: tally;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  justify-content: flex-end;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
}
.tally .t {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.tally .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}
.tally .t b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- Workspace ---------- */
.workspace {
  position: relative;
  z-index: 2;
  max-width: 1040px;
  margin: 0 auto;
  padding: 6px 28px 64px;
}

.board-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule-2);
  margin-bottom: 14px;
}
.board-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 26px;
  margin: 0;
  letter-spacing: -0.01em;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 18px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label {
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 500;
}
.search-field input,
.filter-field select,
#status-control {
  font-family: var(--font-ui);
  font-size: 15px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--rule-2);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  transition: border-color .15s ease, background .15s ease;
}
.search-field input { width: clamp(220px, 30vw, 320px); }
.filter-field select { width: auto; min-width: 150px; padding-right: 30px; }
.search-field input::placeholder { color: var(--muted); }
.search-field input:focus,
.filter-field select:focus,
#status-control:focus {
  outline: var(--focus) solid var(--brass);
  outline-offset: 1px;
  border-color: var(--brass);
  background: #FBFBF7;
}
.filter-field { position: relative; }
.filter-field::after {
  content: "";
  position: absolute;
  right: 12px; bottom: 14px;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--ink-2);
  border-bottom: 1.5px solid var(--ink-2);
  transform: rotate(45deg);
  pointer-events: none;
}
.filter-field select { appearance: none; -webkit-appearance: none; }

.count {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  align-self: flex-end;
  padding-bottom: 11px;
  font-variant-numeric: tabular-nums;
}

/* ---------- Task list ---------- */
.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.item {
  --edge: var(--todo-c);
  --edge-soft: var(--todo-soft);
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-left: none;
  border-radius: var(--radius);
  padding: 14px 18px 14px 22px;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background .14s ease, transform .14s ease, border-color .14s ease;
}
.item::before {
  /* colored file-tab edge */
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  background: var(--edge);
  border-top-left-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
}
.item:hover { background: #E3E8DC; border-color: var(--rule-2); }
.item:active { transform: translateY(1px); }
.item[data-status="todo"]        { --edge: var(--todo-c);  --edge-soft: var(--todo-soft); }
.item[data-status="in-progress"] { --edge: var(--prog-c);  --edge-soft: var(--prog-soft); }
.item[data-status="blocked"]     { --edge: var(--block-c); --edge-soft: var(--block-soft); }
.item[data-status="done"]        { --edge: var(--done-c);  --edge-soft: var(--done-soft); }

.item-main { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.item-id {
  font-size: 11.5px;
  letter-spacing: .04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}
.item-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  line-height: 1.3;
  color: var(--ink);
  flex: 1 1 auto;
}
.item.is-done .item-title { color: var(--muted); }

.item-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 7px;
  font-size: 13px;
  color: var(--ink-2);
}
.item-line .sep {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--rule-2);
}
.item-line .who { font-weight: 500; color: var(--ink); }
.item-line .due { font-variant-numeric: tabular-nums; }
.item-line .due.overdue { color: var(--block-c); font-weight: 600; }
.item-line .comments {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--edge);
  background: var(--edge-soft);
  padding: 3px 10px 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  line-height: 1.4;
}
.chip::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--edge);
}
.chip[data-status="todo"]        { --edge: var(--todo-c);  --edge-soft: var(--todo-soft); }
.chip[data-status="in-progress"] { --edge: var(--prog-c);  --edge-soft: var(--prog-soft); }
.chip[data-status="blocked"]     { --edge: var(--block-c); --edge-soft: var(--block-soft); }
.chip[data-status="done"]        { --edge: var(--done-c);  --edge-soft: var(--done-soft); }

/* ---------- Empty state ---------- */
.empty-state {
  margin-top: 28px;
  border: 1px dashed var(--rule-2);
  border-radius: var(--radius);
  background: rgba(255,255,255,.35);
  padding: 30px 26px;
  text-align: left;
  max-width: 520px;
}
.empty-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 19px;
  margin: 0 0 6px;
  color: var(--ink);
}
.empty-body { margin: 0 0 16px; color: var(--ink-2); font-size: 14.5px; max-width: 46ch; }
.recover {
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--brass-ink);
  background: var(--brass-soft);
  border: 1px solid color-mix(in srgb, var(--brass) 40%, transparent);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  cursor: pointer;
  transition: background .14s ease;
}
.recover:hover { background: #F2E6C6; }

/* ---------- Detail dialog ---------- */
dialog {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  width: 100%;
  height: 100%;
  max-width: none; max-height: none;
  color: var(--ink);
  opacity: 0;
  transform: translateX(24px);
  transition: opacity .22s ease, transform .22s ease, display .22s ease allow-discrete;
}
dialog[open] { opacity: 1; transform: none; }
@starting-style { dialog[open] { opacity: 0; transform: translateX(40px); } }

dialog::backdrop {
  background: rgba(15,25,20,.36);
  backdrop-filter: blur(2px);
}

.detail-panel {
  margin-left: auto;
  height: 100%;
  width: min(462px, 100%);
  background: var(--paper);
  border-left: 1px solid var(--rule-2);
  box-shadow: -28px 0 60px -24px rgba(15,25,20,.34);
  display: flex;
  flex-direction: column;
}

.detail-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--rule);
  flex: 0 0 auto;
}
.detail-id {
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.close-detail {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--rule-2);
  border-radius: 999px;
  padding: 7px 14px 7px 30px;
  cursor: pointer;
  position: relative;
  transition: background .14s ease;
}
.close-detail::before {
  content: "";
  position: absolute;
  left: 13px; top: 50%;
  width: 11px; height: 11px;
  transform: translateY(-50%) rotate(45deg);
  border-left: 1.5px solid var(--ink-2);
  border-top: 1.5px solid var(--ink-2);
}
.close-detail:hover { background: #E3E8DC; }

.detail-scroll {
  overflow-y: auto;
  padding: 22px 24px 30px;
  flex: 1 1 auto;
}
.detail-overline { margin: 0 0 14px; }
.detail-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 25px;
  line-height: 1.22;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.detail-meta {
  margin: 0 0 22px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
  padding: 16px 18px;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
}
.detail-meta dt {
  font-size: 11.5px;
  color: var(--muted);
  margin-bottom: 2px;
}
.detail-meta dd {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 500;
}

.detail-status-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 16px;
  border: 1px solid var(--brass);
  background: var(--brass-soft);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}
.status-control-label {
  font-size: 12.5px;
  color: var(--brass-ink);
  font-weight: 600;
}
#status-control {
  width: auto;
  min-width: 168px;
  flex: 0 0 auto;
  background: var(--paper);
  border-color: color-mix(in srgb, var(--brass) 50%, transparent);
  color: var(--brass-ink);
  font-weight: 600;
}
.status-hint {
  margin: 0;
  font-size: 13px;
  color: var(--brass-ink);
  flex: 1 1 140px;
}

.detail-body { margin-top: 4px; }
.body-heading {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 10px;
  letter-spacing: .03em;
  text-transform: none;
}
.body-content {
  font-size: 15.5px;
  line-height: 1.62;
  color: var(--ink);
  max-width: 62ch;
}
.body-content p { margin: 0 0 12px; }
.body-content p:last-child { margin-bottom: 0; }
.body-content p.expected {
  font-style: normal;
  display: block;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 14.5px;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--paper);
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 30px -12px rgba(15,25,20,.5);
  opacity: 0;
  pointer-events: none;
  z-index: 200;
  transition: opacity .18s ease, transform .18s ease;
  max-width: min(90vw, 460px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast b { color: var(--brass-soft); font-weight: 600; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .topbar {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "brand brand"
      "tagline tagline"
      "tally tally";
    padding: 20px 18px 14px;
    gap: 10px;
  }
  .tagline { font-size: 14px; }
  .tally { justify-content: flex-start; }
  .workspace { padding: 4px 18px 56px; }
  .board-title { font-size: 23px; }
  .search-field input { width: 100%; min-width: 0; }
  .filter-field select { flex: 1 1 160px; min-width: 0; }
  .controls { width: 100%; }
  .count { width: 100%; padding-bottom: 0; }

  .item { padding: 13px 15px 13px 18px; }
  .item-title { font-size: 17px; }
  .item-line .comments { margin-left: 0; }

  .detail-panel { width: 100%; border-left: 0; }
  .detail-meta { grid-template-columns: 1fr; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
  dialog { transform: none; }
  @starting-style { dialog[open] { opacity: 0; transform: none; } }
}
