/* ============================================================
   Pigeonhole — a team task tray styled as a physical in-tray.
   Manila stock, ink stamps, folder-tab rows.
   ============================================================ */

@font-face {
  font-family: 'Oswald';
  src: url('assets/oswald.ttf') format('truetype');
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Literata';
  src: url('assets/literata.ttf') format('truetype');
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #2a2115;
  --ink-soft: #6a5a3b;
  --ink-faint: rgba(42, 33, 21, 0.22);
  --stock: #f0dba6;        /* folder fronts */
  --stock-deep: #e2c67f;   /* desk surface */
  --stock-light: #f6e7bd;  /* opened folder / detail sheet */
  --stock-bright: #faf0cd; /* fields, hover */

  --todo: #715e2e;
  --progress: #2b4fa8;
  --blocked: #b02f20;
  --done: #23663f;

  --spine-todo: #a98f55;
  --spine-progress: #3563c9;
  --spine-blocked: #c8402e;
  --spine-done: #2e8353;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { color-scheme: light; }

body {
  margin: 0;
  background: var(--stock-deep);
  color: var(--ink);
  font-family: 'Literata', Georgia, 'Times New Roman', serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
}

/* ---------- shared focus treatment ---------- */

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

::selection {
  background: var(--ink);
  color: var(--stock-bright);
}

/* ============================================================
   Placard header
   ============================================================ */

.placard {
  background: var(--ink);
  color: var(--stock);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 30px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark { color: var(--stock); flex: none; }

.wordmark {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 600;
  font-size: 21px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.placard-note {
  margin: 0;
  font-size: 13.5px;
  color: #e6d6ab;
  font-style: italic;
}

/* ============================================================
   Desk: rail + tray
   ============================================================ */

.desk {
  display: grid;
  grid-template-columns: 288px minmax(0, 1fr);
  gap: 44px;
  max-width: 1220px;
  margin: 0 auto;
  padding: 34px 40px 72px;
}

/* ---------- rail ---------- */

.rail { align-self: start; }

.field + .field { margin-top: 24px; }

.field label,
.rail-heading {
  display: block;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: 0.05em;
  color: var(--ink);
  margin: 0 0 7px;
}

.rail-heading { margin: 30px 0 10px; }

.search-slot { position: relative; }

#search,
#filter,
#status-control {
  width: 100%;
  background: var(--stock-bright);
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  font-family: 'Literata', Georgia, serif;
  font-size: 15px;
  padding: 9px 34px 9px 12px;
}

#search::placeholder { color: var(--ink-soft); }

#search::-webkit-search-cancel-button { -webkit-appearance: none; }

.clear-search {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 19px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 2px;
  cursor: pointer;
}

.clear-search:hover { color: var(--ink); }

.hint {
  margin: 7px 0 0;
  font-size: 12.5px;
  color: var(--ink-soft);
}

/* ---------- tallies ---------- */

.tallies ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.tally {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: 1.5px solid var(--ink-faint);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  padding: 7px 11px;
  cursor: pointer;
}

.tally .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  background: var(--ink-faint);
}

.tally[data-status="todo"] .dot { background: var(--spine-todo); }
.tally[data-status="in-progress"] .dot { background: var(--spine-progress); }
.tally[data-status="blocked"] .dot { background: var(--spine-blocked); }
.tally[data-status="done"] .dot { background: var(--spine-done); }

.tally .tally-count {
  margin-left: auto;
  font-family: 'Literata', Georgia, serif;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.tally[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--stock);
}
.tally[aria-pressed="true"] .tally-count { color: var(--stock); }
.tally[aria-pressed="true"] .dot { background: var(--stock); outline: 1.5px solid var(--stock); }

/* ============================================================
   Tray: heading + folder stack
   ============================================================ */

.tray-head {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 0 0 18px;
}

.tray-head h1 {
  margin: 0;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 27px;
  letter-spacing: 0.01em;
}

.tray-count {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
}

.stack {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- the folder row (signature element) ---------- */

.folder {
  position: relative;
  filter: drop-shadow(0 1.5px 0 rgba(42, 33, 21, 0.4));
}

.folder-shape {
  position: relative;
  background: var(--stock);
  clip-path: polygon(0 0, 150px 0, 173px 25px, 100% 25px, 100% 100%, 0 100%);
}

.folder-open {
  display: block;
  width: 100%;
  border: 0;
  padding: 34px 20px 17px 27px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
}

.folder-open:hover { background: rgba(255, 255, 255, 0.28); }

.folder-open:focus-visible {
  outline: none;
  background: var(--stock-bright);
  box-shadow: inset 0 0 0 3px var(--ink);
}

.spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 7px;
}

.spine[data-status="todo"] { background: var(--spine-todo); }
.spine[data-status="in-progress"] { background: var(--spine-progress); }
.spine[data-status="blocked"] { background: var(--spine-blocked); }
.spine[data-status="done"] { background: var(--spine-done); }

.tab {
  position: absolute;
  top: 5px;
  left: 17px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title {
  display: block;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 19px;
  line-height: 1.25;
  margin-bottom: 9px;
  padding-right: 4px;
}

.row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  font-size: 13.5px;
  color: var(--ink-soft);
}

.chip {
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.03em;
  border: 1.5px solid;
  border-radius: 2px;
  padding: 1.5px 9px;
}

.chip[data-status="todo"] { color: var(--todo); border-color: var(--todo); }
.chip[data-status="in-progress"] { color: var(--progress); border-color: var(--progress); }
.chip[data-status="blocked"] { color: var(--blocked); border-color: var(--blocked); }
.chip[data-status="done"] { color: var(--done); border-color: var(--done); }

.prio {
  display: inline-flex;
  align-items: flex-end;
  gap: 2.5px;
  height: 12px;
  margin-right: 6px;
  transform: translateY(1px);
}

.prio i {
  width: 3.5px;
  background: var(--ink-faint);
}
.prio i:nth-child(1) { height: 5px; }
.prio i:nth-child(2) { height: 8.5px; }
.prio i:nth-child(3) { height: 12px; }
.prio i.on { background: var(--ink-soft); }

/* ---------- empty state ---------- */

.empty {
  border: 1.5px dashed var(--ink-soft);
  border-radius: 2px;
  background: var(--stock);
  padding: 34px 30px;
  max-width: 900px;
}

.empty h2 {
  margin: 0 0 8px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 21px;
}

.empty p {
  margin: 0 0 18px;
  font-size: 15px;
  color: var(--ink-soft);
  max-width: 55ch;
}

.recover {
  background: var(--ink);
  color: var(--stock);
  border: 0;
  border-radius: 2px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: 0.03em;
  padding: 9px 16px;
  cursor: pointer;
}

.recover:hover { background: #443721; }

/* ============================================================
   Detail sheet
   ============================================================ */

.detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 100%);
  background: var(--stock-light);
  border-left: 3px solid var(--ink);
  z-index: 30;
  overflow-y: auto;
  transform: translateX(105%);
  visibility: hidden;
  transition: transform 0.26s cubic-bezier(0.2, 0.7, 0.25, 1), visibility 0s linear 0.26s;
}

.detail.open {
  transform: none;
  visibility: visible;
  transition: transform 0.26s cubic-bezier(0.2, 0.7, 0.25, 1);
}

.detail-top {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--stock-light);
  border-bottom: 1.5px solid var(--ink-faint);
  padding: 13px 22px;
}

.detail-close {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: transparent;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  color: var(--ink);
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: 0.02em;
  padding: 7px 13px;
  cursor: pointer;
}

.detail-close:hover { background: var(--stock-bright); }

.detail-main { padding: 26px 26px 48px; }

.stamp {
  display: inline-block;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 17.5px;
  letter-spacing: 0.05em;
  padding: 5px 15px 3px;
  border: 2.5px solid;
  outline: 1.5px solid;
  outline-offset: 3.5px;
  border-radius: 3px;
  transform: rotate(-2deg);
  margin: 6px 0 20px;
}

.stamp[data-status="todo"] { color: var(--todo); border-color: var(--todo); outline-color: var(--todo); }
.stamp[data-status="in-progress"] { color: var(--progress); border-color: var(--progress); outline-color: var(--progress); }
.stamp[data-status="blocked"] { color: var(--blocked); border-color: var(--blocked); outline-color: var(--blocked); }
.stamp[data-status="done"] { color: var(--done); border-color: var(--done); outline-color: var(--done); }

.detail h2 {
  margin: 0 0 22px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 600;
  font-size: 28px;
  line-height: 1.18;
}

.meta {
  display: grid;
  grid-template-columns: 104px 1fr;
  row-gap: 9px;
  column-gap: 16px;
  margin: 0 0 24px;
  border-top: 1.5px solid var(--ink-faint);
  border-bottom: 1.5px solid var(--ink-faint);
  padding: 16px 0;
}

.meta dt {
  font-size: 13.5px;
  color: var(--ink-soft);
  font-style: italic;
}

.meta dd { margin: 0; font-size: 15px; }

.tags { display: flex; flex-wrap: wrap; gap: 7px; }

.tag {
  font-size: 12.5px;
  color: var(--ink-soft);
  border: 1.5px solid var(--ink-soft);
  border-radius: 2px;
  padding: 1px 8px;
}

/* ---------- status control ---------- */

.status-block {
  display: flex;
  align-items: end;
  gap: 14px;
  margin: 0 0 28px;
}

.status-block .field-label {
  display: block;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 14.5px;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
}

.status-block #status-control { width: 240px; }

/* ---------- prose ---------- */

.prose p {
  margin: 0 0 15px;
  font-size: 16px;
  line-height: 1.62;
  max-width: 62ch;
}

.prose .outcome {
  border-left: 4px solid var(--spine-todo);
  padding-left: 15px;
  margin-top: 20px;
}

.ref {
  margin-top: 34px;
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%) translateY(0);
  background: var(--ink);
  color: var(--stock);
  font-family: 'Oswald', 'Arial Narrow', sans-serif;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.03em;
  padding: 10px 18px;
  border-radius: 2px;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  visibility: visible;
}

@media (prefers-reduced-motion: no-preference) {
  .toast {
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0s;
  }
  .toast:not(.show) { transform: translateX(-50%) translateY(8px); }
  .stamp.press { animation: press 0.28s ease; }
  @keyframes press {
    0% { transform: rotate(-2deg) scale(1.12); }
    100% { transform: rotate(-2deg) scale(1); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .detail, .detail.open { transition: none; }
}

/* ============================================================
   Mobile
   ============================================================ */

@media (max-width: 800px) {
  .placard { padding: 13px 18px; }
  .placard-note { display: none; }
  .wordmark { font-size: 18px; }

  .desk {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding: 20px 16px 60px;
  }

  .rail-heading { margin-top: 4px; }

  .tallies ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }

  .tally { width: auto; }
  .tally .tally-count { margin-left: 4px; }

  .tray-head { margin-bottom: 14px; }
  .tray-head h1 { font-size: 23px; }

  .folder-shape {
    clip-path: polygon(0 0, 118px 0, 141px 25px, 100% 25px, 100% 100%, 0 100%);
  }
  .tab { max-width: 100px; }
  .folder-open { padding: 32px 14px 15px 22px; }

  .detail { width: 100%; border-left: 0; }

  .status-block { flex-direction: column; align-items: stretch; }
  .status-block #status-control { width: 100%; }
}
