/* ============================================================
   Trellis — team task inbox
   Warm editorial identity: paper tones, terracotta accent,
   DM Serif Display for display, DM Sans for UI,
   IBM Plex Mono for meta, Literata for long-form reading.
   ============================================================ */

@font-face {
  font-family: 'DM Serif Display';
  src: url('assets/dm-serif.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('assets/dm-sans.ttf') format('truetype');
  font-weight: 100 900;
  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;
}
@font-face {
  font-family: 'Literata';
  src: url('assets/literata.ttf') format('truetype');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f5f1e8;
  --paper-deep: #ede7d9;
  --surface: #fffdf7;
  --surface-2: #faf6ec;
  --ink: #28231a;
  --ink-soft: #6e6553;
  --ink-faint: #7d7260;
  --line: #e4dcc9;
  --line-strong: #d3c9b2;

  --accent: #b4502a;
  --accent-deep: #8e3a1d;
  --accent-soft: #f3e0d6;

  --c-todo-text: #6f6552;
  --c-todo-bg: #ece7da;
  --c-todo-dot: #93876f;
  --c-prog-text: #8a5510;
  --c-prog-bg: #f4e4c4;
  --c-prog-dot: #c98a1b;
  --c-blocked-text: #93392b;
  --c-blocked-bg: #f5dbd3;
  --c-blocked-dot: #bb4030;
  --c-done-text: #2f6b44;
  --c-done-bg: #dde9da;
  --c-done-dot: #3c7a52;

  --font-ui: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'DM Serif Display', Georgia, 'Times New Roman', serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
  --font-read: 'Literata', Georgia, 'Times New Roman', serif;

  --radius: 14px;
  --radius-s: 10px;
  --shadow: 0 1px 2px rgba(40, 35, 25, 0.05), 0 10px 28px rgba(40, 35, 25, 0.09);
  --shadow-drawer: -28px 0 64px rgba(40, 35, 25, 0.22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--paper);
  background-image: radial-gradient(1200px 480px at 85% -10%, rgba(180, 80, 42, 0.07), transparent 60%);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body.detail-open { overflow: hidden; }

.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;
}

.skip-link {
  position: fixed;
  top: 10px; left: 10px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

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

/* ---------- Header ---------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--line-strong);
  background: transparent;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 34px; height: 34px;
  align-self: center;
  flex: none;
}
.mark-bg { fill: var(--accent); }
.mark-lines {
  stroke: var(--paper);
  stroke-width: 2.4;
  stroke-linecap: round;
  fill: none;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 30px;
  line-height: 1;
  letter-spacing: 0.2px;
}

.brand-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-left: 12px;
  border-left: 1px solid var(--line-strong);
  white-space: nowrap;
}

.team-cluster {
  display: flex;
  align-items: center;
}

.team-cluster .avatar {
  width: 30px; height: 30px;
  margin-left: -8px;
  font-size: 11px;
  border: 2px solid var(--paper);
}
.team-cluster .avatar:first-child { margin-left: 0; }

/* ---------- Avatars ---------- */

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  flex: none;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: #fffdf7;
  background: var(--avatar, var(--accent));
  letter-spacing: 0.02em;
}

/* ---------- Layout & toolbar ---------- */

.layout {
  max-width: 1120px;
  margin: 0 auto;
  padding: 26px 24px 72px;
}

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

.search-field {
  position: relative;
  flex: 1 1 320px;
  min-width: 0;
}
.search-icon {
  position: absolute;
  top: 50%; left: 14px;
  width: 18px; height: 18px;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}

input[type="search"],
.filter-field select,
#status-control {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  height: 46px;
}

input[type="search"] {
  width: 100%;
  padding: 0 40px 0 42px;
}
input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }
input[type="search"]:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.filter-field {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}
.filter-field > label,
.status-label {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  white-space: nowrap;
}

.filter-field select,
#status-control {
  min-width: 168px;
  padding: 0 38px 0 14px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236e6553' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 12px;
}
.filter-field select:focus,
#status-control:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ---------- Status strip ---------- */

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 6px;
}

.strip-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 13.5px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}
.strip-btn .strip-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex: none;
}
.strip-btn .strip-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  border-radius: 999px;
  padding: 1px 8px;
}
.strip-btn:hover { border-color: var(--line-strong); color: var(--ink); }
.strip-btn[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}
.strip-btn[aria-pressed="true"] .strip-count {
  background: rgba(245, 241, 232, 0.18);
  color: var(--paper);
}
.strip-btn[data-value="all"][aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }

/* ---------- List head ---------- */

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin: 26px 0 14px;
}
.list-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.1;
}
.result-count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  white-space: nowrap;
}

/* ---------- Task rows ---------- */

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

.task-row {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px 18px 15px 22px;
  box-shadow: 0 1px 2px rgba(40, 35, 25, 0.04);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.task-row::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--row-color, var(--c-todo-dot));
}
.task-row:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.row-main {
  flex: 1 1 340px;
  min-width: 0;
}

.row-title {
  margin: 0 0 3px;
  font-size: 16.5px;
  font-weight: 600;
  line-height: 1.35;
}

.open-item {
  font: inherit;
  color: var(--ink);
  background: none;
  border: 0;
  padding: 1px 2px;
  margin: -1px -2px;
  text-align: left;
  cursor: pointer;
  border-radius: 4px;
}
.open-item:hover {
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

.row-meta {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}
.row-project {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--accent-deep);
}
.row-meta .sep { color: var(--line-strong); }

.row-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
}
.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1.5px 9px;
}

.row-side {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: var(--ink-soft);
  font-size: 13px;
}

.assignee {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.assignee .avatar { width: 26px; height: 26px; font-size: 10px; }
.assignee .assignee-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.due {
  font-family: var(--font-mono);
  font-size: 12.5px;
  white-space: nowrap;
}
.due .due-label { color: var(--ink-faint); margin-right: 5px; }

.priority {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 1.5px 9px;
  white-space: nowrap;
}
.priority.p-high { color: var(--accent-deep); }
.priority.p-medium { color: #8a5510; }
.priority.p-low { color: var(--ink-faint); }

.comments {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  white-space: nowrap;
}
.comments svg { width: 15px; height: 15px; }

/* ---------- Status pills ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}
.status-pill::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.s-todo { color: var(--c-todo-text); background: var(--c-todo-bg); }
.status-pill.s-in-progress { color: var(--c-prog-text); background: var(--c-prog-bg); }
.status-pill.s-blocked { color: var(--c-blocked-text); background: var(--c-blocked-bg); }
.status-pill.s-done { color: var(--c-done-text); background: var(--c-done-bg); }

.task-row.s-todo { --row-color: var(--c-todo-dot); }
.task-row.s-in-progress { --row-color: var(--c-prog-dot); }
.task-row.s-blocked { --row-color: var(--c-blocked-dot); }
.task-row.s-done { --row-color: var(--c-done-dot); }

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

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 56px 24px;
  background: var(--surface);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  margin-top: 4px;
}
.empty-icon { width: 52px; height: 52px; color: var(--ink-faint); margin-bottom: 8px; }
.empty-state h2 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
}
.empty-state p { margin: 0 0 14px; color: var(--ink-soft); }

.btn-accent {
  font: inherit;
  font-weight: 600;
  color: var(--surface);
  background: var(--accent);
  border: 1px solid var(--accent-deep);
  border-radius: var(--radius-s);
  padding: 11px 20px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.btn-accent:hover { background: var(--accent-deep); }

/* ---------- Detail drawer ---------- */

.detail-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
}
.detail-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(40, 35, 25, 0.38);
}

.detail {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(600px, 100%);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-drawer);
}

.detail-header {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.detail-id {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.close-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.close-btn:hover { border-color: var(--ink); background: var(--paper); }
.close-btn svg { width: 14px; height: 14px; }

.detail-scroll {
  overflow-y: auto;
  padding: 26px 28px 48px;
  overscroll-behavior: contain;
}

.detail-project-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.project-chip {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 4px 12px;
}

.detail-title {
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 31px;
  line-height: 1.18;
  letter-spacing: 0.2px;
}

.status-control-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  margin-bottom: 24px;
}
.status-control-row select { height: 42px; min-width: 180px; }

.status-feedback {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-done-text);
  flex: 1 1 100%;
  min-height: 0;
}
.status-feedback:not(:empty)::before { content: "✓ "; }

.detail-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 20px;
  margin: 0 0 28px;
  padding: 0;
}
.detail-meta > div {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.detail-meta dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 3px;
}
.detail-meta dd {
  margin: 0;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}
.detail-meta .tags { gap: 6px; }

.detail-section-title {
  margin: 0 0 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.detail-body-text {
  font-family: var(--font-read);
  font-size: 16.5px;
  line-height: 1.68;
  color: #3b3529;
  max-width: 54ch;
}
.detail-body-text p { margin: 0 0 1em; }
.detail-body-text p:last-child { margin-bottom: 0; }
.detail-body-text p:first-child::first-letter {
  font-family: var(--font-display);
  font-size: 1.6em;
  line-height: 1;
  color: var(--accent-deep);
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(520px, calc(100vw - 32px));
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  padding: 12px 20px;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(40, 35, 25, 0.3);
  text-align: center;
}

/* ---------- Animations (guarded by reduced motion) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .detail-backdrop { animation: fade-in 0.18s ease both; }
  .detail { animation: drawer-in 0.24s cubic-bezier(0.2, 0.7, 0.3, 1) both; }
  .toast { animation: toast-in 0.22s ease both; }
  @keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
  }
  @keyframes drawer-in {
    from { transform: translateX(36px); opacity: 0.4; }
    to { transform: none; opacity: 1; }
  }
  @keyframes toast-in {
    from { transform: translate(-50%, 12px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
  }
}

/* ---------- Mobile ---------- */

@media (max-width: 860px) {
  .site-header { padding: 16px 18px 14px; }
  .brand-name { font-size: 25px; }
  .brand-tag { display: none; }
  .layout { padding: 18px 16px 64px; }

  .toolbar { gap: 10px; }
  .search-field { flex-basis: 100%; }

  .list-head { margin: 20px 0 12px; flex-wrap: wrap; gap: 4px 12px; }
  .list-head h1 { font-size: 25px; }

  .status-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }
  .strip-btn { flex: none; }

  .task-row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px 15px 13px 19px;
  }
  .row-main { flex: 0 0 auto; }
  .row-side {
    justify-content: space-between;
    gap: 8px 12px;
    border-top: 1px dashed var(--line);
    padding-top: 10px;
  }
  .due .due-label { display: none; }

  .detail { width: 100%; border-left: 0; }
  .detail-scroll { padding: 20px 18px 44px; }
  .detail-title { font-size: 25px; margin-bottom: 16px; }
  .detail-meta { grid-template-columns: 1fr; }
  .close-text { display: none; }
  .close-btn { padding: 9px; border-radius: 50%; }
}

@media (min-width: 861px) {
  .close-text { display: inline; }
}
