/* ==========================================================================
   Docket — the team’s shared desk.
   A print-works ticket rack: sage ledger paper, ink, one vermillion signal,
   ruled rows, stamped statuses. Oswald stamps, Space Grotesk voice, Plex Mono data.
   ========================================================================== */

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Oswald";
  src: url("assets/oswald.ttf") format("truetype");
  font-weight: 200 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 100 700;
  font-display: swap;
}

:root {
  --paper: #ECEEE6;          /* sage ledger ground */
  --paper-2: #F6F7F1;        /* raised panels and fields */
  --ink: #181C23;            /* near-black ink */
  --ink-2: #4B515B;          /* secondary ink */
  --rule: rgba(24, 28, 35, 0.16);
  --signal: #C2401A;         /* vermillion: brand stamp, focus, selection */
  --todo: #3D434D;           /* slate stamp */
  --prog: #1F5FA8;           /* cobalt stamp */
  --blocked: #A32C12;        /* brick stamp */
  --done: #2F6B45;           /* moss stamp */
  --sans: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --stamp-face: "Oswald", "Space Grotesk", sans-serif;
  --container: 1240px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-synthesis-weight: none;
}

::selection { background: var(--ink); color: var(--paper-2); }

body { scrollbar-width: thin; scrollbar-color: rgba(24, 28, 35, 0.4) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: rgba(24, 28, 35, 0.32); border-radius: 6px; border: 3px solid var(--paper); }
::-webkit-scrollbar-thumb:hover { background: rgba(24, 28, 35, 0.5); }

.sprite { display: none; }

.container { max-width: var(--container); margin: 0 auto; padding-inline: 28px; }
@media (max-width: 640px) { .container { padding-inline: 16px; } }

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

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 40;
  background: var(--ink); color: var(--paper-2);
  font-family: var(--mono); font-size: 12px;
  padding: 9px 14px; border-radius: 0 0 4px 4px;
  text-decoration: none; transition: top 0.15s var(--ease-out);
}
.skip-link:focus { top: 0; }

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

/* --------------------------------------------------------------------------
   Masthead — ink band, stamp logotype, status tallies
   -------------------------------------------------------------------------- */

.masthead { background: var(--ink); color: var(--paper-2); }
.masthead :focus-visible { outline-color: var(--paper-2); }

.masthead-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px 24px; flex-wrap: wrap; padding-block: 18px;
}

.brand { margin: 0; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.brand-mark { flex: none; align-self: center; display: inline-flex; }
.brand-mark svg { display: block; margin-top: 2px; }
.brand-name {
  font-family: var(--stamp-face); font-weight: 600;
  font-size: 27px; line-height: 1; letter-spacing: 0.055em; text-transform: uppercase;
}
.brand-desc {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.07em;
  text-transform: uppercase; color: rgba(242, 244, 236, 0.82);
}

.tallies { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tally {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.05em; text-transform: uppercase;
  color: rgba(242, 244, 236, 0.86);
  background: transparent; border: 1px solid rgba(242, 244, 236, 0.28);
  border-radius: 3px; padding: 7px 11px; cursor: pointer;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.tally:hover { border-color: rgba(242, 244, 236, 0.6); }
.tally .tally-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, currentColor); flex: none; }
.tally .tally-count { font-weight: 600; color: #fff; }
.tally[aria-pressed="true"] { background: var(--paper-2); color: var(--ink); border-color: var(--paper-2); }
.tally[aria-pressed="true"] .tally-count { color: var(--ink); }

/* --------------------------------------------------------------------------
   Toolbar — labeled search, status filter, count
   -------------------------------------------------------------------------- */

.toolbar { background: var(--paper); border-bottom: 1.5px solid var(--ink); }
.toolbar-inner { display: flex; align-items: flex-end; gap: 18px 28px; padding-block: 16px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 5px; }
.search-field { flex: 1 1 300px; max-width: 460px; position: relative; }
.filter-field { flex: 0 0 auto; }

.field-label {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
}
.field-icon {
  position: absolute; left: 11px; bottom: 11px; width: 17px; height: 17px;
  color: var(--ink-2); pointer-events: none;
}

input[type="search"], select {
  appearance: none; -webkit-appearance: none;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--rule); border-radius: 3px;
  padding: 9px 12px; caret-color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
#search { padding-left: 36px; width: 100%; }
#search::placeholder { color: rgba(24, 28, 35, 0.62); }
#search:focus-visible, select:focus-visible { outline-offset: 0; }

select {
  padding-right: 34px; min-width: 172px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 7.5 10 13l5-5.5' fill='none' stroke='%23181C23' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  background-size: 15px 15px;
}
select:hover, input[type="search"]:hover { border-color: rgba(24, 28, 35, 0.45); }

.count {
  margin: 0 0 0 auto; align-self: center;
  font-family: var(--mono); font-size: 12px; color: var(--ink-2);
  letter-spacing: 0.02em; white-space: nowrap;
}

/* --------------------------------------------------------------------------
   The docket — ruled ledger rows
   -------------------------------------------------------------------------- */

.sheet { padding-block: 6px 40px; }

.list-head, .row-btn {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 168px 96px 92px 138px 26px;
  align-items: center;
  gap: 0 18px;
}

.list-head {
  padding: 14px 18px 10px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.11em; text-transform: uppercase; color: var(--ink-2);
  border-bottom: 1.5px solid var(--ink);
}
.col-open { justify-self: end; }

.list { list-style: none; margin: 0; padding: 0; }

.row { border-bottom: 1px solid var(--rule); }
.row-btn {
  width: 100%; text-align: left; font: inherit; color: inherit;
  background: none; border: 0; padding: 15px 18px;
  cursor: pointer; align-items: center;
  transition: background-color 0.14s;
}
.row-btn:hover { background: rgba(24, 28, 35, 0.045); }
.row-btn:focus-visible { outline-offset: -3px; }
.row-btn:active { background: rgba(24, 28, 35, 0.07); }

.row-id { font-family: var(--mono); font-size: 12.5px; font-weight: 500; color: var(--ink-2); letter-spacing: 0.02em; }

.row-main { min-width: 0; display: grid; gap: 3px; }
.row-title { font-size: 15.5px; font-weight: 500; line-height: 1.35; letter-spacing: -0.005em; }
.row-sub {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-sub .sub-sep { margin: 0 5px; color: rgba(24, 28, 35, 0.38); }
.row-sub .sub-due, .row-sub .sub-comments { display: none; }
.row-sub .sub-comments svg { width: 13px; height: 13px; color: rgba(24, 28, 35, 0.55); }

.row-assignee { display: flex; align-items: center; gap: 9px; min-width: 0; font-size: 13.5px; }
.row-assignee .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.avatar {
  flex: none; width: 24px; height: 24px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--sans); font-size: 10px; font-weight: 700; letter-spacing: 0.02em;
  color: var(--ink); background: var(--tint, #E2E4DA);
  box-shadow: inset 0 0 0 1.5px var(--ring, rgba(24, 28, 35, 0.35));
}

.row-due { font-family: var(--mono); font-size: 12.5px; color: var(--ink-2); }

.row-comments {
  display: inline-flex; align-items: center; gap: 6px; justify-self: start;
  font-family: var(--mono); font-size: 12.5px; color: var(--ink-2);
}
.row-comments svg { width: 15px; height: 15px; color: rgba(24, 28, 35, 0.55); }

.row-status { justify-self: start; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--stamp-face); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.07em; text-transform: uppercase;
  padding: 3.5px 9px 3px; border-radius: 3px; white-space: nowrap;
  border: 1.5px solid currentColor;
  transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}
.chip svg { width: 11px; height: 11px; }
.chip-todo { color: var(--todo); }
.chip-in-progress { color: var(--prog); }
.chip-blocked { color: var(--blocked); }
.chip-done { color: var(--done); }

.row-open { justify-self: end; color: rgba(24, 28, 35, 0.38); transition: transform 0.15s var(--ease-out), color 0.15s; }
.row-open svg { width: 16px; height: 16px; display: block; }
.row-btn:hover .row-open { color: var(--signal); transform: translateX(2px); }

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

.empty { padding: 72px 24px 96px; text-align: center; display: grid; justify-items: center; gap: 12px; }
.empty[hidden] { display: none; }
.empty-icon { width: 46px; height: 46px; color: var(--ink-2); }
.empty-title { margin: 0; font-size: 21px; font-weight: 600; letter-spacing: -0.01em; }
.empty-note { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }

.btn {
  font: inherit; font-size: 14px; font-weight: 500;
  color: var(--paper-2); background: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 3px;
  padding: 9px 16px; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: #242A33; border-color: #242A33; }
.btn:active { transform: translateY(1px); }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.foot { border-top: 1.5px solid var(--ink); }
.foot p {
  margin: 0; padding-block: 16px;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-2);
  letter-spacing: 0.03em;
}

/* --------------------------------------------------------------------------
   Detail drawer — right panel on desktop, full screen on mobile
   -------------------------------------------------------------------------- */

.detail {
  border: 0; padding: 0;
  background: var(--paper-2);
  box-shadow: -18px 0 44px rgba(24, 28, 35, 0.16);
  border-left: 1.5px solid var(--ink);
  width: min(560px, calc(100vw - 72px));
  height: 100vh; height: 100dvh; max-height: none; max-width: none;
  margin: 0 0 0 auto;
  color: var(--ink);
}
.detail::backdrop { background: rgba(24, 28, 35, 0.3); }

.detail-inner { height: 100vh; height: 100dvh; overflow-y: auto; padding: 26px 32px 44px; }
.detail-inner { scrollbar-width: thin; scrollbar-color: rgba(24, 28, 35, 0.35) transparent; }

.detail-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.ticket-id {
  margin: 0; font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
  padding: 4px 9px; border: 1px solid var(--rule); border-radius: 3px;
}

.close-btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink); background: transparent;
  border: 1px solid var(--rule); border-radius: 3px;
  padding: 7px 12px; cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s;
}
.close-btn svg { width: 13px; height: 13px; }
.close-btn:hover { background: rgba(24, 28, 35, 0.06); border-color: rgba(24, 28, 35, 0.45); }

.detail-title {
  margin: 22px 0 0; font-size: 26px; font-weight: 600; line-height: 1.22;
  letter-spacing: -0.012em; text-wrap: balance;
}

.status-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-top: 20px; padding: 16px 0;
  border-block: 1px solid var(--rule);
}
.status-field { margin: 0; display: flex; flex-direction: column; gap: 5px; }
#status-control { font-size: 14px; }

.stamp-holder { margin: 0; display: flex; align-items: center; min-height: 38px; }
.stamp {
  display: inline-block;
  font-family: var(--stamp-face); font-size: 14px; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  padding: 4px 12px 3px; border-radius: 3px;
  border: 2px solid currentColor;
  transform: rotate(-3deg);
}
.stamp-todo { color: var(--todo); }
.stamp-in-progress { color: var(--prog); }
.stamp-blocked { color: var(--blocked); }
.stamp-done { color: var(--done); }

.stamp-thud { animation: stamp-thud 0.32s cubic-bezier(0.2, 1.6, 0.35, 1); }
@keyframes stamp-thud {
  0% { opacity: 0; transform: rotate(-9deg) scale(1.55); filter: blur(2.5px); }
  55% { opacity: 1; filter: blur(0); }
  100% { opacity: 1; transform: rotate(-3deg) scale(1); filter: blur(0); }
}

.status-feedback {
  flex-basis: 100%; margin: 0;
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); letter-spacing: 0.02em;
}

.detail-meta {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 20px;
  margin: 0; padding: 20px 0 4px;
}
.meta-cell { min-width: 0; }
.detail-meta dt {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-2);
  margin-bottom: 4px;
}
.detail-meta dd { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.meta-assignee { display: flex; align-items: center; gap: 8px; }

.priority-ticks { display: inline-flex; gap: 3px; margin-right: 8px; vertical-align: middle; }
.priority-ticks span { width: 13px; height: 4px; border-radius: 1px; background: var(--rule); }
.priority-ticks span.on { background: var(--ink); }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.03em;
  padding: 2.5px 8px; border: 1px solid var(--rule); border-radius: 3px;
  color: var(--ink-2); background: rgba(24, 28, 35, 0.03);
}

.detail-body { margin-top: 14px; border-top: 1.5px solid var(--ink); padding-top: 18px; }
.detail-body-heading {
  margin: 0 0 12px; font-family: var(--mono); font-size: 11px; font-weight: 500;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-2);
}
.detail-body-text p { margin: 0 0 14px; max-width: 66ch; font-size: 15px; line-height: 1.68; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1080px) {
  .list-head, .row-btn { grid-template-columns: 56px minmax(0, 1fr) 96px 92px 138px 26px; }
  .col-assignee, .row-assignee { display: none; }
  .row-sub .sub-assignee { display: inline; }
}
@media (min-width: 1081px) {
  .row-sub .sub-assignee { display: none; }
}

@media (max-width: 700px) {
  .masthead-inner { padding-block: 14px; }
  .brand-desc { display: none; }
  .tallies { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; scrollbar-width: none; }
  .tallies::-webkit-scrollbar { display: none; }
  .tally { flex: none; }

  .toolbar-inner { flex-direction: column; align-items: stretch; gap: 14px; padding-block: 14px; }
  .search-field { max-width: none; flex: 0 0 auto; }
  .filter-field select { width: 100%; }
  .count { margin: 0; align-self: flex-start; }

  .list-head { display: none; }
  .row-btn {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start; column-gap: 12px;
    padding: 14px 4px;
  }
  .row-id { display: none; }
  .row-main { grid-column: 1; display: grid; gap: 7px; }
  .row-status { grid-column: 2; align-self: start; margin-top: 1px; }
  .row-sub { white-space: normal; }
  .row-sub .sub-due, .row-sub .sub-comments { display: inline-flex; align-items: center; gap: 4px; }
  .sub-assignee { display: inline-flex !important; align-items: center; gap: 6px; }
  .sub-assignee .avatar { width: 17px; height: 17px; font-size: 8px; box-shadow: inset 0 0 0 1.2px var(--ring, rgba(24, 28, 35, 0.35)); }
  .col-due, .row-due, .col-comments, .row-comments, .col-open, .row-open { display: none; }

  .detail { width: 100vw; height: 100vh; height: 100dvh; margin: 0; border-left: 0; border-top: 1.5px solid var(--ink); }
  .detail-inner { padding: 20px 18px 40px; }
  .status-row .status-field { flex: 1 1 100%; }
  #status-control { width: 100%; }
  .detail-title { font-size: 22px; }
  .detail-meta { grid-template-columns: repeat(2, 1fr); }
  .stamp { font-size: 13px; }
}

/* --------------------------------------------------------------------------
   Motion — the stamp is the one authored moment; everything else stays quick
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .stamp-thud { animation: none; }
}
