/* ============================================================
   Sift — team task inbox
   Flat, calm SaaS look. Local fonts only.
   ============================================================ */

@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 Sans";
  src: url("assets/dm-sans.ttf") format("truetype");
  font-weight: 100 1000;
  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 {
  --bg: #f4f6f4;
  --surface: #ffffff;
  --surface-sunken: #eef1ee;
  --ink: #17251f;
  --ink-soft: #46554d;
  --ink-mute: #5a6a60;
  --border: #dfe5df;
  --border-strong: #c4cec6;

  --primary: #0f766e;
  --primary-ink: #ffffff;
  --primary-soft: #e4f2f0;
  --primary-ring: #0f766e;

  --todo-ink: #1d4ed8;
  --todo-bg: #e4ebfe;
  --progress-ink: #9a5b08;
  --progress-bg: #fdedd3;
  --blocked-ink: #b42318;
  --blocked-bg: #fde5e2;
  --done-ink: #157f3d;
  --done-bg: #dcf3e2;

  --high-ink: #b42318;
  --high-bg: #fde5e2;

  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 18px;

  --font-body: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "DM Sans", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --speed: 160ms;
  --shadow-raise: 0 1px 2px rgba(23, 37, 31, 0.05), 0 8px 24px rgba(23, 37, 31, 0.07);
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background:
    linear-gradient(180deg, #eaf1ee 0%, var(--bg) 260px);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---------- focus & a11y ---------- */

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 60;
  background: var(--primary);
  color: var(--primary-ink);
  padding: 10px 16px;
  border-radius: var(--radius-s);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--speed) ease;
}
.skip-link:focus { top: 12px; }

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

/* ---------- header ---------- */

.app-header {
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(8px);
}

.app-header__inner {
  max-width: 1060px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

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

.brand__mark {
  width: 40px; height: 40px;
  border-radius: 11px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  flex: none;
}

.brand__text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.brand__tag {
  font-size: 12.5px;
  color: var(--ink-mute);
  letter-spacing: 0.02em;
}

.app-header__summary {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  text-align: right;
  white-space: nowrap;
}

/* ---------- workspace ---------- */

.workspace {
  max-width: 1060px;
  margin: 0 auto;
  padding: 28px 24px 96px;
}

.toolbar {
  margin-bottom: 20px;
}

.toolbar__heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.toolbar__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.toolbar__count {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-mute);
}

.toolbar__controls {
  display: flex;
  gap: 14px;
  align-items: flex-end;
}

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

.field--search { flex: 1 1 340px; max-width: 420px; }
.field--filter { flex: 0 1 230px; }

.field__label {
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.field__shell {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-m);
  transition: border-color var(--speed) ease, box-shadow var(--speed) ease;
}

.field__shell:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.field__icon,
.field__chevron {
  position: absolute;
  color: var(--ink-mute);
  pointer-events: none;
}
.field__icon { left: 12px; }
.field__chevron { right: 12px; }

.field__shell input,
.field__shell select {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--ink);
  padding: 10px 12px;
  min-height: 44px;
}
.field__shell input { padding-left: 38px; }
.field__shell select { padding-right: 38px; cursor: pointer; }
.field__shell input:focus,
.field__shell select:focus { outline: none; }
.field__shell input::placeholder { color: var(--ink-mute); }

/* status quick chips */

.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 9px 14px 9px 12px;
  min-height: 44px;
  cursor: pointer;
  transition: background var(--speed) ease, border-color var(--speed) ease, color var(--speed) ease;
}
.chip:hover { border-color: var(--primary); color: var(--primary); }
.chip[aria-pressed="true"] {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-ink);
}
.chip__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: none;
}
.chip__count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  opacity: 0.85;
}

/* ---------- task list ---------- */

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

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-m);
  transition: border-color var(--speed) ease, box-shadow var(--speed) ease, transform var(--speed) ease;
}

.task-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-raise);
}

.task-card__row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  width: 100%;
  padding: 14px 16px;
  background: none;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.task-card__main {
  flex: 1 1 auto;
  min-width: 0;
}

.task-card__title {
  appearance: none;
  display: block;
  width: 100%;
  background: none;
  border: 0;
  padding: 0;
  margin: 0 0 4px;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  text-align: left;
  border-radius: 4px;
  transition: color var(--speed) ease;
}
.task-card__title:hover { color: var(--primary); }

.task-card__summary {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-mute);
}

.task-card__meta-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.task-card__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  flex: none;
}

.task-card__go {
  color: var(--border-strong);
  transition: color var(--speed) ease, transform var(--speed) ease;
}
.task-card:hover .task-card__go { color: var(--primary); transform: translateX(2px); }

/* badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.badge__dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.badge--todo { color: var(--todo-ink); background: var(--todo-bg); }
.badge--in-progress { color: var(--progress-ink); background: var(--progress-bg); }
.badge--blocked { color: var(--blocked-ink); background: var(--blocked-bg); }
.badge--done { color: var(--done-ink); background: var(--done-bg); }

.badge--priority-high { color: var(--high-ink); background: var(--high-bg); }
.badge--priority-medium { color: var(--ink-soft); background: var(--surface-sunken); }
.badge--priority-low { color: var(--ink-mute); background: var(--surface-sunken); }

/* ---------- empty state ---------- */

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-l);
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
}
.empty-state svg { color: var(--ink-mute); }
.empty-state h2 {
  margin: 6px 0 0;
  font-family: var(--font-display);
  font-size: 19px;
  color: var(--ink);
}
.empty-state p { margin: 0 0 14px; max-width: 42ch; }

/* ---------- buttons ---------- */

.btn {
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-m);
  border: 1px solid transparent;
  padding: 10px 18px;
  min-height: 44px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background var(--speed) ease, color var(--speed) ease, border-color var(--speed) ease;
}

.btn--primary {
  background: var(--primary);
  color: var(--primary-ink);
}
.btn--primary:hover { background: #0b5d57; }

.btn--icon {
  background: none;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  width: 44px; height: 44px;
  padding: 0;
  border-radius: var(--radius-m);
  flex: none;
}
.btn--icon:hover { background: var(--surface-sunken); color: var(--ink); }

/* ---------- detail dialog ---------- */

.detail {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: none;
  max-height: none;
  width: min(520px, 100vw);
  height: 100vh;
  height: 100dvh;
  margin: 0 0 0 auto;
  outline: none;
}

.detail::backdrop {
  background: rgba(15, 26, 22, 0.44);
}

.detail__card {
  background: var(--surface);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  box-shadow: -24px 0 60px rgba(15, 26, 22, 0.18);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.detail__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 24px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}

.detail__kicker {
  margin: 0 0 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.detail__title {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.detail__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail__status-row {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--primary-soft);
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.field--status { flex: 1 1 220px; max-width: 280px; }
.field--status .field__label { color: var(--primary); }

.field--status .field__shell { background: var(--surface); }
.field__dot {
  position: absolute;
  left: 12px;
  width: 10px; height: 10px;
  border-radius: 50%;
  pointer-events: none;
}
.field--status select { padding-left: 34px; }

.detail__status-note {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  opacity: 0;
  transform: translateY(2px);
  transition: opacity var(--speed) ease, transform var(--speed) ease;
}
.detail__status-note.is-visible {
  opacity: 1;
  transform: none;
}

.detail__meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin: 0;
  padding: 6px 24px;
  border-bottom: 1px solid var(--border);
}

.detail__meta > div {
  padding: 12px 0;
  border-bottom: 1px dashed var(--border);
}
.detail__meta > div:nth-last-child(-n + 2) { border-bottom: 0; }

.detail__meta dt {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin: 0 0 2px;
}

.detail__meta dd {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink);
  font-weight: 500;
}

.detail__meta dd.mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

.detail__body {
  padding: 20px 24px 8px;
}

.detail__section-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

.detail__prose p {
  margin: 0 0 14px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink-soft);
}
.detail__prose strong { color: var(--ink); }

.detail__footer {
  margin-top: auto;
  padding: 16px 24px 22px;
  border-top: 1px solid var(--border);
}

.detail__hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-mute);
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 8px);
  z-index: 70;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-raise);
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--speed) ease, transform var(--speed) ease;
  max-width: calc(100vw - 32px);
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.toast svg { color: #6ee7b7; flex: none; }

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .app-header__inner { padding: 14px 16px; }
  .app-header__summary { display: none; }
  .workspace { padding: 20px 16px 80px; }
  .toolbar__controls { flex-direction: column; align-items: stretch; }
  .field--search, .field--filter { max-width: none; flex: 1 1 auto; }
  .task-card__row { flex-wrap: wrap; }
  .task-card__side {
    flex-direction: row;
    align-items: center;
    width: 100%;
    order: 3;
    margin-top: 4px;
  }
  .task-card__go { display: none; }
  .detail__meta { grid-template-columns: 1fr; }
  .detail__meta > div:nth-last-child(-n + 2) { border-bottom: 1px dashed var(--border); }
  .detail__meta > div:last-child { border-bottom: 0; }
}

@media (max-width: 560px) {
  .detail {
    width: 100vw;
  }
  .detail__card {
    border-left: 0;
  }
  .toast {
    left: 16px;
    right: 16px;
    transform: translateY(8px);
    justify-content: center;
  }
  .toast.is-visible { transform: translateY(0); }
}

/* ---------- reduced motion ---------- */

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