/* Relay — team task queue
   Type: Literata (documents) + Space Grotesk (controls & metadata)
   Palette: cool sage paper, green ink, one highlighter-amber signal */

@font-face {
  font-family: "Literata";
  src: url("assets/literata.ttf") format("truetype");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bone: #e9ebe4;
  --surface: #f7f8f4;
  --raised: #ffffff;
  --ink: #1b2620;
  --ink-2: #3d4a42;
  --ink-3: #55635a;
  --rule: #c9cec4;
  --rule-soft: #dde1d8;
  --signal: #d9a21b;
  --signal-soft: #f4e7bd;
  --signal-deep: #7a5a00;

  --st-todo: #5a6b7b;
  --st-progress: #1f5fc4;
  --st-blocked: #b23a2b;
  --st-done: #1f7a50;

  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Space Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;

  --shadow: 0 18px 40px -24px rgba(27, 38, 32, 0.45);
  --radius: 5px;
}

*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bone);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, dt, ul { margin: 0; }
ul { padding: 0; list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bone);
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 12px; }

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

/* ---------- App bar ---------- */

.app-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px 28px;
  padding: 14px 28px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-bottom: 2px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  color: var(--signal);
  flex: 0 0 auto;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-name {
  font-family: var(--serif);
  font-size: 23px;
  font-weight: 650;
  letter-spacing: -0.015em;
}
.brand-sub {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-3);
}

.controls {
  margin-left: auto;
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--ink-2);
}
.field input,
.field select {
  padding: 8px 11px;
  background: var(--raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
}
.field input { width: 232px; }
.field select { min-width: 148px; }
.field input::placeholder { color: var(--ink-3); }
.field input:focus,
.field select:focus {
  border-color: var(--ink-2);
}

/* ---------- Workspace ---------- */

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 760px);
  justify-content: center;
}
.workspace.has-detail {
  grid-template-columns: minmax(340px, 42%) minmax(0, 1fr);
  justify-content: stretch;
}

.queue {
  min-height: 0;
  overflow-y: auto;
  padding: 26px 26px 64px;
}
.workspace.has-detail .queue {
  border-right: 1px solid var(--rule);
}

.queue-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}
.queue-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 620;
  letter-spacing: -0.01em;
}
.queue-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ---------- Ledger list ---------- */

.task-list {
  border-top: 1px solid var(--rule);
}
.task-item {
  position: relative;
  border-bottom: 1px solid var(--rule-soft);
  --sc: var(--st-todo);
}
.task-item[data-status="in-progress"] { --sc: var(--st-progress); }
.task-item[data-status="blocked"] { --sc: var(--st-blocked); }
.task-item[data-status="done"] { --sc: var(--st-done); }

.task-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--sc);
}
.task-item.is-open {
  background: var(--raised);
}
.task-item.is-open::before { width: 6px; }

.open-item {
  display: block;
  width: 100%;
  padding: 14px 16px 15px 22px;
  text-align: left;
  background: transparent;
  border: 0;
  color: inherit;
  transition: background-color 0.12s ease;
}
.open-item:hover { background: rgba(27, 38, 32, 0.045); }
.task-item.is-open .open-item:hover { background: transparent; }

.row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 5px;
}
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--sc);
}
.status-tag::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--sc);
}

.priority {
  display: inline-flex;
  align-items: flex-end;
  height: 12px;
}
.priority .bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 100%;
}
.priority .bar {
  width: 3px;
  border-radius: 1px;
  background: var(--rule);
}
.priority .bar:nth-child(1) { height: 5px; }
.priority .bar:nth-child(2) { height: 8px; }
.priority .bar:nth-child(3) { height: 12px; }
.priority .bar.on { background: var(--ink-3); }
.priority[data-priority="high"] .bar.on { background: var(--st-blocked); }

.row-title {
  display: block;
  font-family: var(--serif);
  font-size: 17.5px;
  font-weight: 560;
  line-height: 1.32;
  letter-spacing: -0.005em;
  max-width: 60ch;
}
.task-item[data-status="done"] .row-title {
  color: var(--ink-2);
}
.row-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 7px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-3);
}
.row-meta > span { position: relative; }
.row-due { font-variant-numeric: tabular-nums; }
.row-tags {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
}

.task-item.is-updated {
  animation: row-flash 1.1s ease-out;
}
@keyframes row-flash {
  0% { background: var(--signal-soft); }
  100% { background: transparent; }
}

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

.empty-state {
  max-width: 46ch;
  padding: 44px 6px 8px;
}
.empty-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 620;
  margin-bottom: 7px;
}
.empty-text {
  font-size: 14px;
  color: var(--ink-3);
  margin-bottom: 18px;
}

.btn {
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  padding: 9px 15px;
  border: 1px solid var(--ink);
  transition: background-color 0.12s ease, color 0.12s ease;
}
.btn-solid {
  background: var(--ink);
  color: var(--bone);
}
.btn-solid:hover { background: #2c3a32; }

/* ---------- Detail (the task sheet) ---------- */

.detail {
  min-height: 0;
  overflow-y: auto;
  padding: 32px 40px 72px;
  --sc: var(--st-todo);
}
.detail[data-status="in-progress"] { --sc: var(--st-progress); }
.detail[data-status="blocked"] { --sc: var(--st-blocked); }
.detail[data-status="done"] { --sc: var(--st-done); }

.detail-sheet { max-width: 700px; }

.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.detail-project {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.015em;
  color: var(--ink-3);
}
.detail-top-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.detail-id {
  padding: 3px 8px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--ink-3);
}
.text-button {
  background: none;
  border: 0;
  padding: 4px 2px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  border-bottom: 1.5px solid var(--rule);
  border-radius: 0;
}
.text-button:hover {
  color: var(--ink);
  border-bottom-color: var(--ink);
}

.detail-title {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 620;
  line-height: 1.18;
  letter-spacing: -0.015em;
  max-width: 24ch;
  margin-bottom: 22px;
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 15px;
  margin-bottom: 24px;
  background: var(--raised);
  border: 1px solid var(--rule-soft);
  border-left: 4px solid var(--sc);
  border-radius: var(--radius);
  transition: border-left-color 0.18s ease;
}
.status-bar label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.status-bar select {
  min-width: 168px;
  padding: 7px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 4px;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 18px 20px;
  padding: 18px 0;
  margin-bottom: 26px;
  border-top: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
}
.fact dt {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--ink-3);
  margin-bottom: 4px;
}
.fact dd {
  font-size: 15px;
  font-weight: 560;
  color: var(--ink);
}
.fact-wide { grid-column: 1 / -1; }

.detail-body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.72;
  color: var(--ink-2);
  max-width: 64ch;
  white-space: pre-line;
  overflow-wrap: break-word;
}

/* ---------- Toast ---------- */

.toast-wrap {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: max-content;
  max-width: min(92vw, 460px);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px 11px 16px;
  background: var(--ink);
  color: var(--bone);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: auto;
}
.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.toast-text { line-height: 1.35; }
.toast-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 4px;
  background: rgba(233, 235, 228, 0.14);
  color: inherit;
  font-size: 16px;
  line-height: 1;
}
.toast-close:hover { background: rgba(233, 235, 228, 0.26); }

/* Give the panes their own scroll on wide screens, keeping the app bar fixed. */
@media (min-width: 881px) {
  body { height: 100dvh; overflow: hidden; }
}

/* ---------- Narrow screens ---------- */

@media (max-width: 880px) {
  .app-bar {
    align-items: stretch;
    padding: 12px 16px 14px;
  }
  .brand { align-items: flex-start; }
  .controls {
    margin-left: 0;
    width: 100%;
    gap: 12px;
  }
  .field { flex: 1 1 160px; }
  .field input,
  .field select { width: 100%; }

  .workspace,
  .workspace.has-detail {
    grid-template-columns: minmax(0, 1fr);
    justify-content: stretch;
  }
  .workspace.has-detail .queue { border-right: 0; }
  .queue { padding: 20px 16px 56px; }

  .detail {
    position: fixed;
    inset: 0;
    z-index: 50;
    padding: 18px 18px calc(56px + env(safe-area-inset-bottom));
    background: var(--bone);
    border: 0;
    animation: sheet-in 0.2s ease-out;
  }
  body.detail-open { overflow: hidden; }
  @keyframes sheet-in {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
  }
  .detail-title { font-size: 25px; max-width: none; }
  .detail-top {
    position: sticky;
    top: -18px;
    margin: -18px -18px 16px;
    padding: 16px 18px;
    background: var(--bone);
    border-bottom: 1px solid var(--rule-soft);
    z-index: 1;
  }
}

@media (max-width: 420px) {
  .brand-sub { display: none; }
  .row-meta { font-size: 12.5px; gap: 3px 12px; }
}

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