@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: "DM Serif Display";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --ground: #e2e7e2;
  --ground-deep: #d4dcd5;
  --paper: #f8f9f4;
  --paper-2: #eef1e8;
  --ink: #16211c;
  --ink-soft: #4f5f56;
  --ink-faint: #5d6c63;
  --line: #c8d1c8;
  --line-strong: #9fada3;
  --accent: #2438b8;
  --accent-deep: #1a2b91;
  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
  --serif: "DM Serif Display", Georgia, serif;

  --status-todo-tint: #e3e9ef;
  --status-todo-ink: #334e6c;
  --status-todo-dot: #334e6c;
  --status-progress-tint: #f3e5c2;
  --status-progress-ink: #744b00;
  --status-progress-dot: #a66a00;
  --status-blocked-tint: #f7deda;
  --status-blocked-ink: #92261c;
  --status-blocked-dot: #b43024;
  --status-done-tint: #deebe2;
  --status-done-ink: #22603f;
  --status-done-dot: #2d6a4a;
}

[data-status="todo"] {
  --status-tint: var(--status-todo-tint);
  --status-ink: var(--status-todo-ink);
  --status-dot: var(--status-todo-dot);
}

[data-status="in-progress"] {
  --status-tint: var(--status-progress-tint);
  --status-ink: var(--status-progress-ink);
  --status-dot: var(--status-progress-dot);
}

[data-status="blocked"] {
  --status-tint: var(--status-blocked-tint);
  --status-ink: var(--status-blocked-ink);
  --status-dot: var(--status-blocked-dot);
}

[data-status="done"] {
  --status-tint: var(--status-done-tint);
  --status-ink: var(--status-done-ink);
  --status-dot: var(--status-done-dot);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ground);
}

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

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3,
p,
dl,
dd,
dt,
ul,
ol {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

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

::selection {
  background: var(--accent);
  color: #fff;
}

.skip-link {
  position: absolute;
  top: 10px;
  left: 10px;
  transform: translateY(-160%);
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  text-decoration: none;
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

/* Masthead */

.masthead {
  max-width: 1440px;
  margin: 0 auto;
  padding: 26px 40px 22px;
  border-bottom: 1px solid var(--line-strong);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
}

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

.brand-mark {
  width: 44px;
  height: 44px;
  flex: none;
  color: var(--accent);
}

.brand-mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.brand-mark circle {
  fill: currentColor;
}

.brand-copy h1 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 46px;
  line-height: 0.95;
  letter-spacing: -0.015em;
}

.brand-copy p {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.controls {
  display: flex;
  align-items: flex-end;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
}

.search-field {
  width: 290px;
}

.filter-field {
  width: 190px;
}

.input-frame,
.select-frame {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
}

.input-frame {
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  width: 17px;
  height: 17px;
  color: var(--ink-soft);
  pointer-events: none;
}

.input-icon circle,
.input-icon path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.input-frame input {
  width: 100%;
  height: 44px;
  padding: 0 12px 0 37px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  font-size: 14.5px;
}

.input-frame input::placeholder {
  color: #6e7d73;
}

.input-frame:focus-within,
.select-frame:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

.input-frame input:focus-visible,
.select-frame select:focus-visible {
  outline: none;
}

.select-frame select {
  width: 100%;
  height: 44px;
  padding: 0 34px 0 12px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  appearance: none;
  font-size: 14.5px;
  cursor: pointer;
}

.select-chevron {
  position: absolute;
  right: 11px;
  top: 50%;
  width: 16px;
  height: 16px;
  transform: translateY(-50%);
  color: var(--ink-soft);
  pointer-events: none;
}

.select-chevron path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: square;
}

/* Page and queue intro */

.page {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 40px 64px;
}

.queue-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 24px 0 20px;
}

.queue-intro-copy h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.queue-intro-copy p {
  margin-top: 5px;
  max-width: 58ch;
  color: var(--ink-soft);
  font-size: 13.5px;
}

.meter-block {
  flex: none;
  width: 390px;
  max-width: 100%;
}

.meter {
  display: flex;
  gap: 2px;
  height: 9px;
  padding: 1px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
}

.meter-segment {
  display: block;
  min-width: 0;
  background: var(--status-dot);
}

.meter-legend {
  display: grid;
  grid-template-columns: repeat(4, auto);
  justify-content: space-between;
  gap: 6px 12px;
  margin-top: 8px;
}

.meter-legend li {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.meter-legend .status-dot {
  align-self: center;
}

.meter-legend strong {
  color: var(--ink);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.status-dot {
  display: inline-block;
  flex: none;
  width: 8px;
  height: 8px;
  background: var(--status-dot);
}

/* Workspace */

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: 28px;
  align-items: start;
}

.queue {
  min-width: 0;
}

.queue-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 10px;
}

.result-count {
  color: var(--ink-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.text-button,
.inline-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-button:hover,
.inline-button:hover {
  color: var(--accent-deep);
}

.column-head {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) 160px 106px 18px;
  gap: 16px;
  padding: 9px 18px;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line-strong);
  background: var(--ground);
  color: var(--ink-faint);
  font-size: 12.5px;
}

.task-list {
  border-bottom: 1px solid var(--line-strong);
}

.task-item + .task-item {
  border-top: 1px solid var(--line);
}

.item-open {
  display: grid;
  width: 100%;
  grid-template-columns: 116px minmax(0, 1fr) 160px 106px 18px;
  gap: 16px;
  align-items: center;
  padding: 15px 18px;
  border: 0;
  background: transparent;
  text-align: left;
  color: var(--ink);
  scroll-margin-top: 46px;
  transition: background-color 0.14s ease;
}

.item-open:hover {
  background: var(--paper-2);
}

.item-open:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--paper-2);
}

.task-item.is-current .item-open {
  background: var(--paper-2);
  box-shadow: inset 3px 0 0 var(--accent);
}

.task-item.is-current .item-open:hover {
  background: var(--paper-2);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  padding: 4px 8px;
  border-radius: 2px;
  background: var(--status-tint);
  color: var(--status-ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}

.status-pill .status-dot {
  width: 6px;
  height: 6px;
}

.item-main {
  display: block;
  min-width: 0;
}

.item-title {
  display: block;
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.006em;
}

.item-sub {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-sub > * + *::before {
  content: " / ";
  color: var(--line-strong);
}

.item-owner {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.owner-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.item-due {
  color: var(--ink-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.item-due time {
  color: var(--ink);
}

.chev {
  color: var(--ink-faint);
}

.chev svg {
  width: 16px;
  height: 16px;
}

.chev path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.task-item.is-updated .item-open {
  animation: row-change 1.1s ease-out;
}

@keyframes row-change {
  0% {
    background: var(--status-tint);
  }
  100% {
    background: transparent;
  }
}

/* Empty state */

.empty-state {
  padding: 52px 24px 56px;
  border-bottom: 1px solid var(--line-strong);
}

.empty-mark {
  width: 46px;
  height: 46px;
  margin-bottom: 16px;
  color: var(--line-strong);
}

.empty-mark path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: square;
}

.empty-state h3 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.15;
}

.empty-state p {
  margin-top: 7px;
  max-width: 46ch;
  color: var(--ink-soft);
  font-size: 14px;
}

.primary-button {
  margin-top: 20px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 2px;
  background: var(--accent);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
}

.primary-button:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}

/* Inspector and detail */

.inspector {
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-top: 2px solid var(--ink);
  background: var(--paper);
  scrollbar-width: thin;
}

.inspector-placeholder {
  padding: 28px 26px 30px;
}

.inspector-placeholder h2 {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 29px;
  line-height: 1.1;
  letter-spacing: -0.01em;
}

.placeholder-copy {
  margin-top: 9px;
  max-width: 34ch;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
}

.placeholder-rule {
  height: 1px;
  margin: 24px 0 19px;
  background: var(--line);
}

.legend-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
}

.status-legend {
  margin-top: 10px;
}

.status-legend > div {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.status-legend > div:last-child {
  border-bottom: 1px solid var(--line);
}

.status-legend dt {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
}

.status-legend dd {
  color: var(--ink-soft);
  font-size: 12.5px;
}

.detail {
  padding: 18px 26px 30px;
}

.detail-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0 10px;
  background: var(--paper);
}

.detail-context {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding-top: 7px;
  font-size: 12.5px;
  color: var(--ink-soft);
}

.detail-project {
  font-weight: 500;
  color: var(--ink);
}

.priority {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.priority::before {
  content: "";
  width: 6px;
  height: 6px;
  background: currentColor;
}

.close-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink);
  transition: background-color 0.14s ease, border-color 0.14s ease;
}

.close-button:hover {
  border-color: var(--ink);
  background: var(--paper-2);
}

.close-button svg {
  width: 18px;
  height: 18px;
}

.close-button path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: square;
}

.detail-title {
  margin-top: 10px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: -0.012em;
  overflow-wrap: break-word;
}

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

.detail-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0 0;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.detail-meta dt {
  color: var(--ink-faint);
  font-size: 11.5px;
}

.detail-meta dd {
  margin-top: 2px;
  font-size: 13.5px;
  font-weight: 500;
  overflow-wrap: break-word;
}

.status-block {
  margin-top: 20px;
  padding: 15px 16px 16px;
  border: 1px solid var(--line);
  background: var(--paper-2);
}

.status-block > label {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 500;
}

.status-block .select-frame {
  background: var(--paper);
}

.status-help {
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 12px;
}

.status-feedback {
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--status-ink, var(--accent));
  background: var(--status-tint, var(--paper));
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.status-feedback:empty {
  display: none;
}

.status-feedback.is-new {
  animation: feedback-in 0.24s ease-out;
}

@keyframes feedback-in {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.filter-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.45;
}

.filter-note .inline-button {
  display: block;
  margin-top: 4px;
  font-size: 12.5px;
}

.detail-body {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  max-width: 62ch;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.65;
  white-space: pre-line;
  overflow-wrap: break-word;
}

.detail-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 11.5px;
}

.task-reference {
  flex: none;
  color: var(--ink-faint);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

/* Responsive */

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 22px;
  }

  .column-head,
  .item-open {
    grid-template-columns: 104px minmax(0, 1fr) 56px 96px 18px;
    gap: 13px;
  }

  .owner-name {
    display: none;
  }

  .item-owner {
    justify-content: flex-start;
  }
}

@media (max-width: 1080px) {
  .masthead,
  .page {
    padding-left: 28px;
    padding-right: 28px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
  }

  .meter-block {
    width: 330px;
  }

  .meter-legend {
    gap: 6px 8px;
  }

  .meter-legend li {
    font-size: 11.5px;
  }
}

@media (max-width: 980px) {
  .workspace {
    display: block;
  }

  .queue-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
  }

  .meter-block {
    width: 100%;
  }

  .inspector {
    display: none;
  }

  .inspector.is-open {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 50;
    max-height: none;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-top: 2px solid var(--ink);
    background: var(--paper);
  }

  body.detail-open {
    overflow: hidden;
  }

  .detail {
    padding: 16px 28px calc(32px + env(safe-area-inset-bottom));
  }

  .detail-top {
    padding-top: 2px;
    padding-bottom: 10px;
  }

  .detail-title {
    font-size: 32px;
  }
}

@media (max-width: 860px) {
  .masthead {
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  .controls {
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
  }

  .search-field {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  .filter-field {
    flex: none;
    width: 190px;
  }
}

@media (max-width: 700px) {
  .masthead {
    padding: 20px 18px 18px;
    flex-direction: column;
    align-items: stretch;
    gap: 18px;
  }

  .page {
    padding-left: 18px;
    padding-right: 18px;
    padding-bottom: 40px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .brand-copy h1 {
    font-size: 40px;
  }

  .controls {
    flex-direction: row;
    align-items: flex-end;
    gap: 12px;
  }

  .search-field {
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
  }

  .filter-field {
    flex: none;
    width: 138px;
  }

  .queue-intro {
    padding: 20px 0 16px;
  }

  .queue-intro-copy h2 {
    font-size: 26px;
  }

  .meter-legend {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: start;
    gap: 7px 18px;
  }

  .column-head {
    display: none;
  }

  .task-list {
    border-top: 2px solid var(--ink);
  }

  .item-open {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "status due"
      "main main"
      "owner owner";
    gap: 6px 12px;
    align-items: start;
    padding: 15px 14px;
  }

  .status-pill {
    grid-area: status;
    margin-top: 1px;
    padding: 4px 6px;
    font-size: 11px;
  }

  .item-main {
    grid-area: main;
  }

  .item-title {
    font-size: 15.5px;
  }

  .item-sub {
    margin-top: 3px;
    font-size: 12px;
  }

  .item-owner {
    grid-area: owner;
    margin-top: 1px;
    gap: 6px;
    font-size: 12.5px;
  }

  .owner-name {
    display: inline;
  }

  .avatar {
    width: 22px;
    height: 22px;
    font-size: 9px;
  }

  .item-due {
    grid-area: due;
    margin-top: 3px;
    text-align: right;
    font-size: 12.5px;
  }

  .chev {
    display: none;
  }

  .item-tags {
    display: none;
  }

  .detail {
    padding: 14px 20px calc(30px + env(safe-area-inset-bottom));
  }

  .detail-title {
    font-size: 28px;
  }

  .detail-meta {
    margin-top: 17px;
  }

  .status-block {
    padding: 14px;
  }

  .detail-body {
    margin-top: 21px;
    padding-top: 17px;
    font-size: 14.5px;
  }

  .empty-state {
    padding: 42px 14px 46px;
  }
}

@media (max-width: 380px) {
  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .search-field,
  .filter-field {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
