/* Skein — a shared inbox with a bookish ledger voice and one vivid cobalt field. */

@font-face {
  font-family: "Literata";
  src: url("assets/literata.ttf") format("truetype");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("assets/space-grotesk.ttf") format("truetype");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #f1efe6;
  --bone: #f8f5ec;
  --ink: #17211d;
  --muted: #59645c;
  --soft: #626c64;
  --line: rgba(23, 33, 29, 0.14);
  --line-strong: rgba(23, 33, 29, 0.3);
  --cobalt: #1f3fd1;
  --cobalt-deep: #1732b4;
  --todo: #4e5f66;
  --in-progress: #8a5000;
  --blocked: #9e2f24;
  --done: #255c42;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Space Grotesk", "Helvetica Neue", Arial, sans-serif;
}

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

[hidden] {
  display: none !important;
}

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

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

body.is-locked {
  overflow: hidden;
}

h1,
h2,
p,
dl,
dd,
ul {
  margin: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 100;
  padding: 12px 18px;
  background: var(--ink);
  color: var(--bone);
  font-size: 14px;
  text-decoration: none;
  border-radius: 3px;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 16px;
}

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

.masthead :focus-visible,
.masthead .brand:focus-visible {
  outline-color: var(--bone);
}

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

.masthead {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: var(--cobalt);
  color: var(--bone);
}

.masthead-inner {
  position: relative;
  z-index: 1;
  max-width: 1320px;
  margin: 0 auto;
  padding: 26px 48px 32px;
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--bone);
}

.brand-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
}

.wordmark {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
}

.masthead-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  padding-top: 4px;
  font-size: 12.5px;
  line-height: 1.4;
  color: rgba(248, 245, 236, 0.74);
  text-align: right;
}

.masthead-meta .meta-strong {
  color: var(--bone);
  font-weight: 500;
}

.hero {
  position: relative;
  z-index: 1;
  grid-column: 1 / -1;
  max-width: 920px;
  margin-top: 34px;
}

.hero h1 {
  max-width: none;
  font-family: var(--serif);
  font-size: clamp(38px, 4.2vw, 56px);
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.lede {
  max-width: 58ch;
  margin-top: 13px;
  font-size: 14.5px;
  line-height: 1.55;
  color: rgba(248, 245, 236, 0.82);
}

.thread {
  position: absolute;
  z-index: 0;
  right: -100px;
  bottom: -90px;
  width: min(440px, 34vw);
  height: auto;
  color: rgba(248, 245, 236, 0.24);
  pointer-events: none;
}

.thread path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: thread-draw 1.7s 0.12s cubic-bezier(0.3, 0.7, 0.2, 1) forwards;
}

@keyframes thread-draw {
  to {
    stroke-dashoffset: 0;
  }
}

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

.workspace {
  max-width: 1320px;
  margin: 0 auto;
  padding: 32px 48px 96px;
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 56px;
  align-items: start;
}

/* ---------- Status index ---------- */

.index {
  position: sticky;
  top: 30px;
}

.index h2 {
  margin-bottom: 14px;
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.index-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line-strong);
}

.index-btn {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 8px 10px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.index-btn:hover {
  background: rgba(31, 63, 209, 0.06);
}

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

.index-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, var(--ink));
}

.index-btn[aria-pressed="true"] .index-dot {
  background: var(--bone);
}

.index-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.index-btn[aria-pressed="true"] .index-count {
  color: rgba(248, 245, 236, 0.7);
}

.index-note {
  margin-top: 20px;
  max-width: 28ch;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}

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

.toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 196px;
  gap: 20px;
  align-items: end;
}

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

.field > label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--soft);
  pointer-events: none;
}

input[type="search"] {
  width: 100%;
  height: 48px;
  min-width: 0;
  padding: 0 44px 0 42px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: var(--bone);
  color: var(--ink);
  font-size: 15px;
  appearance: none;
}

input[type="search"]::placeholder {
  color: #66716a;
  opacity: 1;
}

input[type="search"]::-webkit-search-cancel-button {
  display: none;
}

input[type="search"]:focus,
select:focus {
  border-color: var(--cobalt);
}

.clear-search {
  position: absolute;
  right: 8px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--soft);
}

.clear-search:hover {
  background: rgba(23, 33, 29, 0.08);
  color: var(--ink);
}

.clear-search svg {
  width: 14px;
  height: 14px;
}

.field-filter select {
  height: 48px;
  width: 100%;
  padding: 0 38px 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background-color: var(--bone);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%2317211D' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 16px 16px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
}

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

.list-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  margin-top: 28px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
}

.result-count {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.list-note {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}

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

.task-list {
  list-style: none;
  padding: 0;
}

.loading-row {
  padding: 28px 4px;
  color: var(--muted);
  font-size: 14px;
}

.task {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) 132px;
  gap: 28px;
  align-items: start;
  padding: 19px 10px 19px 0;
  border-bottom: 1px solid var(--line);
  transition: background 0.16s ease;
}

.task:hover {
  background: rgba(31, 63, 209, 0.045);
}

.task[data-status="todo"],
.detail[data-status="todo"] {
  --status: var(--todo);
}

.task[data-status="in-progress"],
.detail[data-status="in-progress"] {
  --status: var(--in-progress);
}

.task[data-status="blocked"],
.detail[data-status="blocked"] {
  --status: var(--blocked);
}

.task[data-status="done"],
.detail[data-status="done"] {
  --status: var(--done);
}

.task-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 5px;
  color: var(--status);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
}

.knot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 0 3px rgba(23, 33, 29, 0.06);
}

.task-main {
  min-width: 0;
}

.open-item {
  display: inline-flex;
  align-items: flex-start;
  gap: 9px;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
}

.task-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.018em;
  text-wrap: balance;
  transition: color 0.15s ease;
}

.open-item:hover .task-title {
  color: var(--cobalt);
}

.open-item .go {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 6px;
  color: var(--cobalt);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.task:hover .go,
.open-item:focus-visible .go {
  opacity: 1;
  transform: none;
}

.task-summary {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-sub {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 10px;
  color: var(--soft);
  font-size: 12px;
}

.task-sub .project {
  color: var(--ink);
  font-weight: 500;
}

.task-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
  padding-top: 3px;
}

.due {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.due time {
  color: var(--ink);
  font-weight: 500;
}

.avatar {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--bone);
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ---------- Empty and error states ---------- */

.empty-state {
  max-width: 660px;
  padding: 54px 0 60px;
  border-bottom: 1px solid var(--line);
}

.empty-state h2 {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.empty-state p,
.empty-state .empty-copy {
  max-width: 48ch;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 22px;
  padding: 0 18px;
  border: 1px solid var(--cobalt);
  border-radius: 3px;
  background: var(--cobalt);
  color: var(--bone);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.primary-button:hover {
  background: var(--cobalt-deep);
  border-color: var(--cobalt-deep);
}

.empty-state .primary-button {
  margin-top: 22px;
}

.error-state h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
}

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

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(19, 28, 23, 0.36);
  animation: scrim-in 0.2s ease both;
}


.detail {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  width: min(560px, 100vw);
  border-left: 4px solid var(--cobalt);
  background: var(--bone);
  color: var(--ink);
  box-shadow: -24px 0 70px rgba(19, 28, 23, 0.24);
  animation: drawer-in 0.28s cubic-bezier(0.22, 0.85, 0.25, 1) both;
  overscroll-behavior: contain;
}


@keyframes scrim-in {
  from {
    opacity: 0;
  }
}


@keyframes drawer-in {
  from {
    transform: translateX(100%);
  }
}


.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px 16px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--bone);
}

.detail-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.detail-brand svg {
  width: 20px;
  height: 20px;
  color: var(--cobalt);
}

.close-detail {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 12px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.close-detail:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bone);
}

.close-detail svg {
  width: 13px;
  height: 13px;
}

.detail-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 30px 32px 56px;
}

.detail-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--status);
  font-size: 12.5px;
  font-weight: 500;
}

.detail h2 {
  margin-top: 12px;
  font-family: var(--serif);
  font-size: clamp(29px, 3.3vw, 38px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px 24px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}

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

.meta-grid dt {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.3;
}

.meta-grid dd {
  margin-top: 4px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.status-editor {
  margin-top: 26px;
  padding: 17px 18px 15px;
  border-left: 3px solid var(--cobalt);
  background: #e9e7dd;
}

.status-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.status-editor label {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.status-editor select {
  min-width: 168px;
  height: 44px;
  padding: 0 38px 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 3px;
  background-color: var(--bone);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='m4 6 4 4 4-4' stroke='%2317211D' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  background-size: 16px 16px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  appearance: none;
  cursor: pointer;
}

.status-feedback {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}

.status-feedback.is-updated {
  color: var(--done);
  font-weight: 500;
}

.prose {
  max-width: 62ch;
  margin-top: 28px;
  color: #243029;
  font-family: var(--serif);
  font-size: 16.5px;
  line-height: 1.72;
}

.prose p + p {
  margin-top: 15px;
}

.prose strong {
  font-weight: 700;
  color: var(--ink);
}

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

@media (max-width: 1000px) {
  .workspace {
    gap: 38px;
  }

  .task {
    grid-template-columns: 116px minmax(0, 1fr) 112px;
    gap: 20px;
  }
}

@media (max-width: 900px) {
  .masthead-inner {
    padding: 20px 22px 28px;
  }

  .brand-mark {
    width: 28px;
    height: 28px;
  }

  .wordmark {
    font-size: 26px;
  }

  .masthead-meta {
    font-size: 11.5px;
  }

  .hero {
    margin-top: 34px;
  }

  .hero h1 {
    max-width: 22ch;
    font-size: clamp(31px, 7.6vw, 42px);
    line-height: 1.08;
  }

  .lede {
    max-width: 38ch;
    margin-top: 14px;
    font-size: 13.5px;
    line-height: 1.55;
  }

  .thread {
    right: -60px;
    bottom: -50px;
    width: 240px;
    opacity: 0.6;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    padding: 26px 22px 72px;
  }

  .index {
    display: none;
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) 134px;
    gap: 12px;
  }

  .field > label {
    font-size: 12px;
  }

  .field-filter select {
    font-size: 13px;
    padding-left: 11px;
    padding-right: 30px;
    background-position: right 10px center;
  }

  input[type="search"] {
    font-size: 14px;
    padding-left: 38px;
  }

  .search-icon {
    left: 12px;
  }

  .list-bar {
    margin-top: 24px;
  }

  .result-count {
    font-size: 16px;
  }

  .list-note {
    font-size: 11px;
  }

  .task {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "status meta"
      "main main";
    gap: 9px 14px;
    padding: 18px 4px 20px 0;
  }

  .task-status {
    grid-area: status;
    padding-top: 0;
  }

  .task-main {
    grid-area: main;
  }

  .task-meta {
    grid-area: meta;
    padding-top: 0;
  }

  .task-title {
    font-size: 20px;
    line-height: 1.25;
  }

  .task-summary {
    margin-top: 5px;
    font-size: 13px;
  }

  .task-sub {
    margin-top: 8px;
    gap: 5px 13px;
    font-size: 11.5px;
  }

  .open-item .go {
    margin-top: 5px;
    opacity: 0.6;
    transform: none;
  }

  .empty-state {
    padding: 42px 0 50px;
  }

  .empty-state h2 {
    font-size: 23px;
  }

  .detail {
    width: 100vw;
    border-left: 0;
    border-top: 4px solid var(--cobalt);
    box-shadow: none;
  }

  .detail-top {
    padding: 14px 18px 12px 20px;
  }

  .detail-scroll {
    padding: 24px 22px calc(48px + env(safe-area-inset-bottom));
  }

  .meta-grid {
    grid-template-columns: 1fr 1fr;
    gap: 15px 20px;
  }

  .status-editor {
    margin-top: 24px;
  }
}

@media (max-width: 430px) {
  .toolbar {
    grid-template-columns: minmax(0, 1fr) 122px;
    gap: 10px;
  }

  .field-filter select {
    font-size: 12.5px;
    padding-left: 10px;
  }

  .list-note {
    display: none;
  }

  .status-editor-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .status-editor select {
    width: 100%;
    min-width: 0;
  }

  .meta-grid {
    grid-template-columns: 1fr 1fr;
    gap: 14px 16px;
  }
}

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

  .thread path {
    stroke-dashoffset: 0;
  }
}
