/* ============================================================
   Baton — team task inbox
   Design tokens
   ============================================================ */
@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/ibm-plex-mono.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #ece9e0;
  --paper-2: #f7f4ec;
  --paper-3: #e2ded2;
  --ink: #1b211c;
  --ink-soft: #3c443b;
  --muted: #6e7266;
  --rule: #d3cfc2;
  --rule-strong: #b9b4a4;
  --pine: #2e4a3f;
  --pine-deep: #223930;

  --todo: #6e7a96;
  --in-progress: #be7614;
  --blocked: #a8432f;
  --done: #4e7a57;

  --font-sans: "Space Grotesk", "Helvetica Neue", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --radius: 10px;
  --shadow: 0 24px 60px -24px rgba(27, 33, 28, 0.45);
  --page-max: 1160px;
}

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

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

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

body.has-detail {
  overflow: hidden;
}

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 50;
  background: var(--ink);
  color: var(--paper);
  padding: 10px 16px;
  border-radius: 0 0 8px 8px;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
}

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.topbar__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: flex-end;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  text-decoration: none;
  flex: 0 0 auto;
}
.brand__mark {
  color: var(--pine);
  display: flex;
}
.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.brand__name {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.brand__tag {
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.01em;
}

.toolbar {
  display: flex;
  gap: 14px;
  margin-left: auto;
  flex: 1 1 auto;
  justify-content: flex-end;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field__label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.field__control {
  position: relative;
  display: flex;
  align-items: center;
}
.field__icon {
  position: absolute;
  left: 11px;
  color: var(--muted);
  pointer-events: none;
}

.field input[type="search"],
.field select {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--rule-strong);
  border-radius: 8px;
  padding: 8px 12px;
  min-height: 38px;
}
.field input[type="search"] {
  width: 100%;
  padding-left: 34px;
}
.field--search {
  flex: 0 1 320px;
}
.field--filter select {
  min-width: 150px;
  appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%236e7266' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  cursor: pointer;
}
.field input::placeholder {
  color: color-mix(in srgb, var(--muted) 80%, transparent);
}
.field input[type="search"]:focus,
.field select:focus {
  border-color: var(--pine);
}

/* ============================================================
   Page + relay distribution
   ============================================================ */
.page {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 34px 24px 80px;
}

.relay {
  margin-bottom: 22px;
}
.relay__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.relay__title {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}
.relay__count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

.relay__bar {
  display: flex;
  height: 8px;
  width: 100%;
  border-radius: 999px;
  overflow: hidden;
  background: var(--paper-3);
}
.relay__seg {
  height: 100%;
  min-width: 3px;
  transition: flex-grow 0.35s ease;
}

.relay__legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 13px 0 0;
  padding: 0;
}
.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  background: none;
  border: none;
  padding: 3px 0;
  cursor: pointer;
  font-family: inherit;
  border-bottom: 1.5px solid transparent;
}
.legend-item:hover {
  color: var(--ink);
}
.legend-item[aria-pressed="true"] {
  border-bottom-color: var(--ink);
  color: var(--ink);
  font-weight: 500;
}
.legend-item__dot {
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--s);
  flex: 0 0 auto;
}
.legend-item__count {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--muted);
}
.legend-item[aria-pressed="true"] .legend-item__count {
  color: var(--ink);
}

/* ============================================================
   Task list
   ============================================================ */
.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}

.task-item {
  position: relative;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
  padding: 20px 16px 20px 20px;
  border-bottom: 1px solid var(--rule);
  transition: background 0.15s ease;
}
.task-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--s);
}
.task-item:hover {
  background: color-mix(in srgb, var(--paper-2) 70%, transparent);
}
.task-item.is-open {
  background: var(--paper-2);
}

.task-item__who {
  padding-top: 1px;
}
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--paper-3);
  border: 1px solid var(--rule-strong);
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.task-item__main {
  min-width: 0;
}
.task-item__open {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font-family: inherit;
  font-size: 1.06rem;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.012em;
  color: var(--ink);
  cursor: pointer;
}
.task-item__open:hover {
  color: var(--pine);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1.5px;
}
.task-item.is-done .task-item__open {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--rule-strong);
}

.task-item__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
  margin-top: 7px;
  font-size: 0.82rem;
  color: var(--muted);
}
.meta-sep {
  width: 1px;
  height: 11px;
  background: var(--rule-strong);
  flex: 0 0 auto;
}
.pill {
  font-size: 0.72rem;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--rule-strong);
  color: var(--ink-soft);
}
.pill--high {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.task-item__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  text-align: right;
  white-space: nowrap;
}
.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.status-tag__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--s);
}
.task-item__due {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
}
.task-item__due.is-due-soon {
  color: var(--ink);
  font-weight: 500;
}

/* ============================================================
   Empty state
   ============================================================ */
.empty {
  text-align: center;
  padding: 72px 24px 80px;
  border-bottom: 1px solid var(--rule);
}
.empty__title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.empty__body {
  margin: 0 0 20px;
  color: var(--muted);
}
.btn {
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--rule-strong);
  background: var(--paper-2);
  color: var(--ink);
  cursor: pointer;
}
.btn:hover {
  border-color: var(--ink);
}
.btn--primary {
  background: var(--pine);
  border-color: var(--pine);
  color: var(--paper);
}
.btn--primary:hover {
  background: var(--pine-deep);
  border-color: var(--pine-deep);
}

/* ============================================================
   Detail drawer
   ============================================================ */
.detail {
  width: min(492px, 100vw);
  max-width: 100vw;
  height: 100%;
  max-height: 100%;
  margin: 0 0 0 auto;
  padding: 0;
  border: none;
  border-left: 1px solid var(--rule-strong);
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.detail[open] {
  animation: drawer-in 0.28s cubic-bezier(0.22, 0.7, 0.3, 1);
}
@keyframes drawer-in {
  from {
    transform: translateX(26px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}
.detail::backdrop {
  background: rgba(20, 24, 20, 0.36);
  animation: backdrop-in 0.28s ease;
}
@keyframes backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.detail__scroll {
  height: 100%;
  overflow-y: auto;
  padding: 22px 30px 48px;
}

.detail__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 22px;
}
.detail__who {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.detail__who-name {
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.detail__close {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 0.82rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 9px;
  cursor: pointer;
}
.detail__close:hover {
  background: var(--paper-3);
  color: var(--ink);
}

.detail__project {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
}
.detail__title {
  margin: 0 0 22px;
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.detail__status {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  padding: 16px 0 20px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.status-band {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--s) 13%, var(--paper-2));
  border: 1px solid color-mix(in srgb, var(--s) 38%, transparent);
  font-weight: 500;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.status-band__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--s);
}
.field--status {
  margin-left: auto;
}

.link-btn {
  font: inherit;
  color: var(--pine);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.link-btn:hover {
  color: var(--pine-deep);
}

.detail__feedback {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--done) 12%, var(--paper-2));
  border: 1px solid color-mix(in srgb, var(--done) 34%, transparent);
  font-size: 0.86rem;
  color: var(--ink-soft);
}
.detail__feedback[hidden] {
  display: none;
}
.detail__feedback::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--done);
  flex: 0 0 auto;
}

.detail__note {
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--in-progress) 12%, var(--paper-2));
  border: 1px solid color-mix(in srgb, var(--in-progress) 34%, transparent);
  font-size: 0.84rem;
  color: var(--ink-soft);
}

.facts {
  margin: 24px 0 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}
.facts__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
.facts dt {
  color: var(--muted);
  font-size: 0.8rem;
}
.facts dd {
  margin: 0;
  font-size: 0.86rem;
  text-align: right;
}

.detail__body {
  margin-top: 26px;
}
.detail__body p {
  margin: 0 0 1.1em;
  line-height: 1.72;
  max-width: 68ch;
}
.detail__body p:last-child {
  margin-bottom: 0;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  .topbar__inner {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    padding: 14px 18px;
  }
  .brand {
    justify-content: space-between;
  }
  .toolbar {
    margin-left: 0;
    flex-direction: column;
    gap: 10px;
  }
  .field--search {
    flex: 1 1 auto;
  }
  .field--filter select {
    width: 100%;
  }
  .page {
    padding: 24px 18px 72px;
  }
  .relay__title {
    font-size: 1.55rem;
  }

  .task-item {
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 12px;
    padding: 18px 8px 18px 16px;
  }
  .avatar {
    width: 28px;
    height: 28px;
    font-size: 0.66rem;
  }
  .task-item__side {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    white-space: normal;
    margin-top: 10px;
  }
  .detail {
    width: 100vw;
    border-left: none;
  }
  .detail__scroll {
    padding: 18px 18px 60px;
  }
  .facts {
    grid-template-columns: 1fr;
  }
}

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