/* Sortpost — team task inbox */

@font-face {
  font-family: "Literata";
  src: url("assets/literata.ttf") format("truetype");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "Work Sans";
  src: url("assets/work-sans.ttf") format("truetype");
  font-weight: 100 900;
  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 {
  --paper: #f4f1e8;
  --paper-deep: #ece7d9;
  --surface: #fffdf7;
  --ink: #26221a;
  --ink-soft: #4c463a;
  --muted: #7a7260;
  --line: #ddd5c2;
  --line-strong: #c9bfa6;
  --accent: #b04a24;
  --accent-deep: #8f3a1b;
  --accent-soft: #f6e3d8;

  --todo: #35618f;
  --todo-bg: #e3ecf6;
  --progress: #9a6a12;
  --progress-bg: #f7ecd4;
  --blocked: #ab3350;
  --blocked-bg: #f8e2e7;
  --done: #2e7a4e;
  --done-bg: #e1f0e5;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(48, 40, 24, 0.07), 0 6px 18px rgba(48, 40, 24, 0.06);
  --shadow-lift: 0 2px 4px rgba(48, 40, 24, 0.09), 0 14px 34px rgba(48, 40, 24, 0.12);
  --font-ui: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Literata", Georgia, serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SF Mono", monospace;
}

* { box-sizing: border-box; }

/* Author display values must not defeat the hidden attribute. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--ink);
  background:
    radial-gradient(1100px 420px at 85% -8%, rgba(176, 74, 36, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 12%, rgba(53, 97, 143, 0.06), transparent 55%),
    var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

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

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

.masthead {
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.9), rgba(255, 253, 247, 0.55));
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.masthead-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: inherit;
  border-radius: 10px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff8ef;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.18);
}

.brand-text { display: flex; flex-direction: column; }

.brand-name {
  font-family: var(--font-display);
  font-weight: 640;
  font-size: 22px;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.brand-tag {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.masthead-note {
  margin: 0;
  font-size: 13.5px;
  color: var(--ink-soft);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 16px;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.note-strong {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-deep);
}

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

.workspace {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 28px 56px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 252px;
  gap: 30px;
  align-items: start;
}

.list-pane { min-width: 0; }

.pane-head { margin-bottom: 18px; }

.pane-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0 0 4px;
}

.pane-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14.5px;
}

/* ---------- Toolbar ---------- */

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

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

.field-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.search-wrap { position: relative; }

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

input[type="search"],
select {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  border: 1.5px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="search"] { padding-left: 36px; }

input[type="search"]:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(176, 74, 36, 0.16);
  outline: none;
}

input[type="search"]::placeholder { color: #a49a86; }

select {
  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='%234c463a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  padding-right: 34px;
  cursor: pointer;
}

/* ---------- Status chips ---------- */

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

.chip {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 999px;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.chip:hover { border-color: var(--accent); color: var(--accent-deep); }

.chip[aria-pressed="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--surface);
}

.chip-count {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 1px 7px;
}

.chip[aria-pressed="true"] .chip-count { background: rgba(255, 255, 255, 0.22); }

.result-line {
  margin: 0 2px 10px;
  font-size: 13px;
  color: var(--muted);
}

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

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

.task-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--status-color, var(--line-strong));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 15px 18px 14px;
  transition: box-shadow 0.16s ease, transform 0.16s ease, border-color 0.16s ease;
}

.task-card:hover {
  box-shadow: var(--shadow-lift);
  transform: translateY(-1px);
}

.task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.open-item {
  font: inherit;
  font-family: var(--font-display);
  font-size: 17.5px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: left;
  color: var(--ink);
  background: none;
  border: none;
  padding: 2px 4px;
  margin: -2px -4px;
  border-radius: 6px;
  cursor: pointer;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.open-item:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1.5px; }

.comments {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

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

.task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.meta-item { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }

.meta-avatar {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.meta-dot { color: var(--line-strong); }

.tag {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--paper-deep);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1.5px 8px;
  color: var(--ink-soft);
}

.mono { font-family: var(--font-mono); }

/* ---------- Status pill ---------- */

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3.5px 11px;
  border-radius: 999px;
  background: var(--status-bg, var(--paper-deep));
  color: var(--status-color, var(--ink-soft));
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.priority { display: inline-flex; align-items: center; gap: 5px; }
.priority::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--prio-color, var(--muted));
}
.priority-high { --prio-color: var(--accent); }
.priority-medium { --prio-color: var(--progress); }
.priority-low { --prio-color: #9a9280; }

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

.empty-state {
  text-align: center;
  padding: 52px 24px;
  background: var(--surface);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
}

.empty-stamp { color: var(--line-strong); margin-bottom: 10px; }

.empty-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin: 0 0 6px;
}

.empty-text { color: var(--muted); margin: 0 0 18px; }

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: 10px;
  padding: 9px 18px;
  cursor: pointer;
  border: 1.5px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.btn-primary { background: var(--accent); color: #fff8ef; }
.btn-primary:hover { background: var(--accent-deep); }

.btn-ghost { background: none; border-color: var(--line-strong); color: var(--ink-soft); }
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }

/* ---------- Rail ---------- */

.rail {
  position: sticky;
  top: 92px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 14px;
}

.rail-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  margin: 0 0 12px;
}

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

.rail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13.5px;
}

.rail-count { font-family: var(--font-mono); font-weight: 600; color: var(--ink-soft); }

.rail-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--paper-deep);
  overflow: hidden;
  margin-top: 14px;
}

.rail-pct {
  margin: 7px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.rail-bar-fill {
  height: 100%;
  background: var(--done);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.rail-foot {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ---------- Colophon ---------- */

.colophon {
  border-top: 1px solid var(--line);
  padding: 18px 28px 26px;
  text-align: center;
  color: var(--muted);
  font-size: 12.5px;
}

.colophon p { margin: 0; }

/* ---------- Detail sheet ---------- */

.sheet-layer { position: relative; z-index: 40; }

.sheet {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(560px, 100%);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  border-left: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  box-shadow: -18px 0 50px rgba(48, 40, 24, 0.18);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.sheet::backdrop {
  background: rgba(38, 34, 26, 0.45);
  backdrop-filter: blur(2px);
}

.sheet-inner {
  padding: 22px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 100%;
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--line-strong);
}

.sheet-head-meta { display: flex; align-items: center; gap: 10px; min-width: 0; }

.sheet-id { font-size: 12px; color: var(--muted); }

.btn-close { padding: 6px 13px; font-size: 13.5px; }

.sheet-title {
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 620;
  letter-spacing: -0.015em;
  line-height: 1.25;
  margin: 0;
}

.status-row { display: flex; flex-direction: column; gap: 6px; max-width: 260px; }

.fact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin: 0;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.fact-grid > div { min-width: 0; }

.fact-grid dt {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

.fact-grid dd { margin: 0; font-size: 14px; color: var(--ink); }
.fact-tags { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 6px; }

.sheet-body p { margin: 0 0 14px; font-size: 15px; line-height: 1.65; color: var(--ink-soft); }
.sheet-body p:last-child { margin-bottom: 0; }
.sheet-body p:first-letter { color: var(--ink); }

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

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(8px);
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ink);
  color: var(--surface);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 18px;
  border-radius: 12px;
  box-shadow: var(--shadow-lift);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: min(92vw, 480px);
}

.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.toast-check {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--done);
  color: #fff;
  flex-shrink: 0;
}

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

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .rail { position: static; }
}

@media (max-width: 640px) {
  body { font-size: 15px; }

  .masthead-inner { padding: 12px 16px; gap: 12px; }
  .brand-mark { width: 40px; height: 40px; }
  .brand-name { font-size: 19px; }
  .brand-tag { display: none; }
  .masthead-note { font-size: 12.5px; padding: 6px 12px; }

  .workspace { padding: 20px 16px 44px; gap: 22px; }
  .pane-title { font-size: 28px; }

  .toolbar { grid-template-columns: 1fr; padding: 13px; gap: 12px; }

  .status-chips { gap: 6px; }
  .chip { padding: 5px 11px; font-size: 12.5px; }

  .task-card { padding: 13px 14px 12px; }
  .open-item { font-size: 16.5px; }
  .task-summary { -webkit-line-clamp: 3; }

  .sheet {
    inset: 0;
    width: 100%;
    border-left: none;
    box-shadow: none;
  }
  .sheet-inner { padding: 18px 18px 32px; }
  .sheet-title { font-size: 23px; }
  .fact-grid { grid-template-columns: 1fr 1fr; padding: 13px; }
}

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