/* Relay — team inbox
   Local fonts, warm paper palette, editorial type. */

@font-face {
  font-family: "Space Grotesk";
  src: url("./assets/space-grotesk.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "DM Sans";
  src: url("./assets/dm-sans.ttf") format("truetype");
  font-weight: 400 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 600;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f4f1ea;
  --paper-2: #ece7dd;
  --surface: #ffffff;
  --surface-soft: #faf8f4;
  --ink: #1b1a17;
  --ink-soft: #4a463f;
  --muted: #7a7468;
  --line: #e2dccf;
  --line-strong: #d3cbbb;
  --accent: #b5431f;
  --accent-dark: #933417;
  --accent-soft: #f6e3da;

  --todo: #5c6470;
  --todo-bg: #eae9e3;
  --progress: #a15c07;
  --progress-bg: #f7e8cf;
  --blocked: #a92c22;
  --blocked-bg: #f8e0dc;
  --done: #2f6b45;
  --done-bg: #dcece0;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(27, 26, 23, 0.05);
  --shadow-md: 0 10px 30px -12px rgba(27, 26, 23, 0.28),
    0 2px 6px rgba(27, 26, 23, 0.06);
  --shadow-lg: 0 30px 70px -30px rgba(27, 26, 23, 0.45),
    0 6px 18px rgba(27, 26, 23, 0.10);
  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background: var(--paper);
  background-image: radial-gradient(
      circle at 15% -10%,
      rgba(181, 67, 31, 0.06),
      transparent 45%
    ),
    radial-gradient(circle at 90% 0%, rgba(47, 107, 69, 0.05), transparent 40%);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}

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

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

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

/* ---------- Masthead ---------- */

.masthead {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 241, 234, 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.masthead-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  color: var(--ink);
  flex-shrink: 0;
}
.brand-mark {
  color: var(--accent);
  width: 34px;
  height: 34px;
  display: block;
}
.brand-mark svg {
  display: block;
  width: 100%;
  height: 100%;
}
.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}
.brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.03em;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-left: auto;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.field label,
.status-editor label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.search-field {
  width: clamp(220px, 32vw, 380px);
}
.filter-field {
  width: 172px;
}

.input-wrap,
.select-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.input-icon {
  position: absolute;
  left: 11px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.input-wrap input {
  width: 100%;
  padding: 10px 14px 10px 35px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input-wrap input::placeholder {
  color: #a49c8d;
}
.input-wrap input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.input-wrap input::-webkit-search-cancel-button {
  cursor: pointer;
}

.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  padding: 10px 34px 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.select-wrap select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.select-chevron {
  position: absolute;
  right: 11px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

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

.workspace {
  max-width: 1240px;
  margin: 0 auto;
  padding: 38px 28px 90px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 44px;
  align-items: start;
}

.rail {
  position: sticky;
  top: 104px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.rail-eyebrow,
.rail-label,
.list-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.rail-total {
  margin: 0;
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.04em;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rail-total-label {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}
.rail-block {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px 6px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--ink-soft);
  transition: border-color 0.15s ease, background 0.15s ease,
    transform 0.1s ease;
}
.chip:hover {
  border-color: var(--muted);
}
.chip .chip-count {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip[aria-pressed="true"] .chip-count {
  color: rgba(255, 255, 255, 0.7);
}
.rail-note {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}
.list-head h1 {
  font-size: 30px;
}
.list-eyebrow {
  margin-bottom: 4px;
}
.result-summary {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- Task list ---------- */

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.task-list:focus {
  outline: none;
}

.task-card {
  --stripe: var(--muted);
}
.task-card[data-status="todo"] {
  --stripe: var(--todo);
}
.task-card[data-status="in-progress"] {
  --stripe: var(--progress);
}
.task-card[data-status="blocked"] {
  --stripe: var(--blocked);
}
.task-card[data-status="done"] {
  --stripe: var(--done);
}

.task-open {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  text-align: left;
  padding: 16px 18px 16px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.14s ease, box-shadow 0.18s ease,
    border-color 0.18s ease;
}
.task-open::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--stripe);
}
.task-open:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.task-open:hover .task-chevron {
  transform: translateX(3px);
  color: var(--accent);
}

.task-body {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.task-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.task-title {
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-card[data-status="done"] .task-title {
  color: var(--ink-soft);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  flex-shrink: 0;
  color: var(--todo);
  background: var(--todo-bg);
}
.status-pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.s-todo {
  color: var(--todo);
  background: var(--todo-bg);
}
.status-pill.s-in-progress {
  color: var(--progress);
  background: var(--progress-bg);
}
.status-pill.s-blocked {
  color: var(--blocked);
  background: var(--blocked-bg);
}
.status-pill.s-done {
  color: var(--done);
  background: var(--done-bg);
}

.task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
}
.meta-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
}
.meta-assignee {
  color: var(--ink-soft);
}

.task-side {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}
.task-due {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
}
.priority-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.p-high {
  color: #98331c;
  background: #f8e0d6;
}
.p-medium {
  color: #8a5a12;
  background: #f6ecd4;
}
.p-low {
  color: #55606b;
  background: #e9ecef;
}
.task-chevron {
  width: 18px;
  height: 18px;
  color: var(--line-strong);
  transition: transform 0.16s ease, color 0.16s ease;
}
.task-chevron svg {
  display: block;
  width: 100%;
  height: 100%;
}

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

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-soft);
  padding: 58px 28px;
  text-align: center;
}
.empty-mark {
  width: 52px;
  height: 52px;
  margin: 0 auto 16px;
  color: var(--muted);
}
.empty-mark svg {
  width: 100%;
  height: 100%;
}
.empty-title {
  font-size: 21px;
  margin-bottom: 8px;
}
.empty-copy {
  max-width: 420px;
  margin: 0 auto 22px;
  color: var(--muted);
  font-size: 14px;
}
.btn-primary {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 6px 16px -8px rgba(181, 67, 31, 0.8);
  transition: background 0.15s ease, transform 0.12s ease;
}
.btn-primary:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

/* ---------- Detail dialog ---------- */

.detail {
  width: min(720px, calc(100vw - 48px));
  max-height: min(86vh, 860px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.detail::backdrop {
  background: rgba(27, 26, 23, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.detail-shell {
  display: flex;
  flex-direction: column;
  max-height: min(86vh, 860px);
}
.detail-head {
  padding: 24px 26px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.detail-head-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.detail-project {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.icon-btn {
  margin-left: auto;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: 10px;
  cursor: pointer;
  color: var(--ink-soft);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn svg {
  width: 18px;
  height: 18px;
}
.icon-btn:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.detail-title {
  font-size: clamp(22px, 3vw, 28px);
  line-height: 1.18;
  padding-right: 8px;
}

.detail-scroll {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  padding: 22px 26px 8px;
}

.detail-facts {
  margin: 0 0 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px 14px;
}
.fact dt {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 5px;
}
.fact dd {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 22px;
}
.tag {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink-soft);
  border: 1px solid var(--line);
}

.detail-body {
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.68;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.detail-body p {
  margin: 0 0 14px;
}
.detail-body p:last-child {
  margin-bottom: 0;
}

.detail-foot {
  padding: 16px 26px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.status-editor {
  display: flex;
  align-items: center;
  gap: 12px;
}
.status-editor label {
  white-space: nowrap;
}
.status-editor .select-wrap {
  width: 190px;
}
.status-feedback {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--done);
  min-height: 20px;
  flex: 1 1 200px;
}
.status-feedback.is-warn {
  color: var(--progress);
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 18px);
  z-index: 60;
  background: var(--ink);
  color: #fff;
  padding: 11px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  text-align: center;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}
.toast.show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}

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

@media (max-width: 900px) {
  .masthead-inner {
    flex-wrap: wrap;
    gap: 14px 20px;
    padding: 14px 20px;
  }
  .toolbar {
    width: 100%;
    margin-left: 0;
    align-items: flex-end;
  }
  .search-field {
    flex: 1 1 auto;
    width: auto;
  }
  .filter-field {
    width: 150px;
    flex-shrink: 0;
  }
  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
    padding: 26px 20px 80px;
  }
  .rail {
    position: static;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 18px 24px;
    align-items: center;
  }
  .rail-summary {
    display: flex;
    align-items: baseline;
    gap: 10px;
  }
  .rail-total {
    font-size: 30px;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
  }
  .rail-block {
    border-top: none;
    padding-top: 0;
  }
  .rail-block .rail-label {
    margin-bottom: 6px;
  }
  .rail-note {
    display: none;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 14.5px;
  }
  .masthead-inner {
    padding: 12px 16px;
  }
  .brand-sub {
    display: none;
  }
  .toolbar {
    gap: 12px;
  }
  .filter-field {
    width: 138px;
  }
  .workspace {
    padding: 22px 16px 70px;
  }
  .rail {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }
  .rail-summary {
    display: none;
  }
  .list-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .list-head h1 {
    font-size: 25px;
  }
  .task-open {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 15px 15px 15px 19px;
  }
  .task-side {
    width: 100%;
    justify-content: space-between;
  }
  .task-chevron {
    display: none;
  }
  .detail {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border: none;
    border-radius: 0;
  }
  .detail-shell {
    height: 100dvh;
    max-height: 100dvh;
  }
  .detail-head {
    padding: 18px 18px 16px;
  }
  .detail-scroll {
    padding: 18px 18px 8px;
  }
  .detail-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail-foot {
    padding: 14px 18px 18px;
    gap: 12px;
  }
  .status-editor {
    width: 100%;
    justify-content: space-between;
  }
  .status-editor .select-wrap {
    flex: 1 1 auto;
    width: auto;
  }
  .status-feedback {
    flex-basis: 100%;
  }
}

/* ---------- Motion preferences ---------- */

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