@font-face {
  font-family: "DM Serif Display";
  src: url("assets/dm-serif.ttf") format("truetype");
  font-weight: 400;
  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: 400;
  font-display: swap;
}

:root {
  --paper: #f6f3ec;
  --paper-2: #fffdf7;
  --ink: #1d2b29;
  --ink-soft: #4c5e5b;
  --ink-faint: #6d7f7c;
  --line: #e2d9c8;
  --teal: #0e6b5e;
  --teal-deep: #0a4a42;
  --amber: #f2b441;
  --amber-soft: #fdf0d2;
  --rose: #c2452d;
  --sky: #2563eb;
  --sage: #e7efe4;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(29, 43, 41, 0.06), 0 10px 30px -18px rgba(29, 43, 41, 0.35);
  --shadow-lg: 0 24px 70px -20px rgba(10, 74, 66, 0.45);
  --focus: 0 0 0 3px #f6f3ec, 0 0 0 6px #0e6b5e;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  background-image:
    radial-gradient(1100px 380px at 85% -80px, rgba(242, 180, 65, 0.22), transparent 60%),
    radial-gradient(900px 420px at -10% 0%, rgba(14, 107, 94, 0.12), transparent 55%);
  background-attachment: fixed;
}

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

.skip-link {
  position: absolute;
  left: 1rem; top: -4rem;
  background: var(--teal-deep);
  color: #fff;
  padding: 0.6rem 1rem;
  border-radius: 999px;
  z-index: 200;
  transition: top 0.15s ease;
  text-decoration: none;
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* Header */
.site-header {
  background: var(--teal-deep);
  color: #f3efe4;
  border-bottom: 4px solid var(--amber);
}
.header-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.75rem; }
.brand-name {
  display: block;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.6rem;
  letter-spacing: 0.01em;
  line-height: 1;
}
.brand-sub {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  opacity: 0.75;
}
.header-meta { display: flex; align-items: center; gap: 1rem; }
.header-tagline { margin: 0; font-size: 0.9rem; opacity: 0.85; max-width: 26ch; }
.avatar-stack {
  list-style: none;
  display: flex;
  margin: 0; padding: 0;
}
.avatar-stack li {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--amber);
  color: #3d2c05;
  font-size: 0.68rem;
  font-weight: 800;
  display: grid;
  place-items: center;
  border: 2px solid var(--teal-deep);
  margin-left: -8px;
}
.avatar-stack li:first-child { margin-left: 0; }
.avatar-stack li:nth-child(2n) { background: #9fd3c7; color: #0a3a34; }
.avatar-stack li:nth-child(3n) { background: #f6f3ec; color: #0a4a42; }

/* Page */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}
.intro { max-width: 62ch; }
.eyebrow {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 0.4rem;
  font-weight: 600;
}
.intro h1 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2rem, 4.5vw, 3rem);
  line-height: 1.05;
  margin: 0 0 0.6rem;
  letter-spacing: -0.01em;
}
.lede { color: var(--ink-soft); font-size: 1.05rem; margin: 0 0 1.4rem; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 0 0 1.6rem;
}
.stat {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--amber);
}
.stat[data-status="todo"]::after { background: #b98a1d; }
.stat[data-status="in-progress"]::after { background: var(--sky); }
.stat[data-status="blocked"]::after { background: var(--rose); }
.stat[data-status="done"]::after { background: var(--teal); }
.stat dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  font-weight: 700;
}
.stat dd {
  margin: 0.1rem 0 0;
  font-family: "DM Serif Display", Georgia, serif;
  font-size: 1.7rem;
  line-height: 1;
}

/* Toolbar */
.toolbar {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0.75rem;
  z-index: 30;
}
.toolbar-row {
  display: grid;
  grid-template-columns: 1.6fr 1fr auto;
  gap: 0.8rem;
  align-items: end;
}
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}
.input-wrap, .select-wrap { position: relative; display: block; }
.input-wrap svg {
  position: absolute;
  left: 0.8rem; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}
.input-wrap input {
  width: 100%;
  padding: 0.7rem 0.9rem 0.7rem 2.4rem;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  font: inherit;
  color: var(--ink);
}
.select-wrap select {
  width: 100%;
  appearance: none;
  padding: 0.7rem 2.2rem 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1.5px solid var(--line);
  background: #fff;
  font: inherit;
  color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%231d2b29' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 14px;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}
.result-line { margin: 0.7rem 0 0; font-size: 0.9rem; color: var(--ink-soft); }

/* Buttons */
.btn {
  font: inherit;
  font-weight: 700;
  border-radius: 999px;
  border: 1.5px solid transparent;
  padding: 0.65rem 1.15rem;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-deep); }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
  white-space: nowrap;
}
.btn-ghost:hover { border-color: var(--teal); color: var(--teal-deep); }

/* Cards */
.card-grid {
  list-style: none;
  margin: 1.4rem 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}
.card {
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.05rem 1.05rem 1rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  border: 1.5px solid transparent;
}
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.badge-todo { background: #fbf3da; color: #7a5a0a; border-color: #e8d48a; }
.badge-in-progress { background: #e3edff; color: #1d4ed8; border-color: #b9cdf7; }
.badge-blocked { background: #fbe4dd; color: #a02c12; border-color: #f0b7a4; }
.badge-done { background: #dcf0e7; color: #0a5c44; border-color: #a9d8c2; }
.priority {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
}
.priority.high { color: var(--rose); font-weight: 700; }
.card h3 { margin: 0; font-size: 1.12rem; line-height: 1.3; letter-spacing: -0.01em; }
.card .summary { margin: 0; color: var(--ink-soft); font-size: 0.94rem; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.9rem;
  font-size: 0.83rem;
  color: var(--ink-soft);
  margin: 0;
}
.card-meta strong { color: var(--ink); font-weight: 700; }
.tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin: 0; padding: 0; list-style: none; }
.tags li {
  font-size: 0.75rem;
  background: var(--sage);
  color: #2c4a38;
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  font-weight: 600;
}
.open-btn {
  margin-top: auto;
  align-self: flex-start;
  background: var(--ink);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}
.open-btn:hover { background: var(--teal-deep); }

/* Empty state */
.empty {
  text-align: center;
  background: var(--paper-2);
  border: 1.5px dashed var(--line);
  border-radius: 20px;
  padding: 3rem 1.5rem;
  margin-top: 1.4rem;
  color: var(--ink-soft);
}
.empty-icon { color: var(--teal); }
.empty h3 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: 1.6rem;
  color: var(--ink);
  margin: 0.6rem 0 0.3rem;
}
.empty p { margin: 0 0 1.2rem; }

/* Detail overlay */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(20, 32, 30, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  justify-content: flex-end;
}
.overlay[hidden] { display: none; }
.detail-panel {
  background: var(--paper-2);
  width: min(560px, 100%);
  height: 100%;
  overflow-y: auto;
  padding: 1.4rem 1.5rem 2.5rem;
  box-shadow: var(--shadow-lg);
  border-left: 1px solid var(--line);
  animation: slide-in 0.22s ease;
}
@keyframes slide-in {
  from { transform: translateX(30px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.detail-crumb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}
.detail-crumb span {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.close-btn {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}
.close-btn:hover { border-color: var(--ink); }
.detail-panel h2 {
  font-family: "DM Serif Display", Georgia, serif;
  font-weight: 400;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  line-height: 1.12;
  margin: 0.4rem 0 0.8rem;
}
.detail-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 1.1rem 0;
}
.detail-grid > div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.6rem 0.8rem;
}
.detail-grid dt {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-faint);
  font-weight: 700;
}
.detail-grid dd { margin: 0.15rem 0 0; font-weight: 600; }
.detail-body { color: var(--ink); }
.detail-body p { margin: 0 0 0.8rem; }
.status-box {
  margin-top: 1.3rem;
  background: var(--teal-deep);
  color: #f3efe4;
  border-radius: 16px;
  padding: 1rem 1.1rem 1.15rem;
}
.status-box label {
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
  color: var(--amber);
}
.status-box select {
  width: 100%;
  font: inherit;
  font-weight: 700;
  padding: 0.65rem 2.2rem 0.65rem 0.9rem;
  border-radius: 10px;
  border: none;
  appearance: none;
  background-color: #fff;
  color: var(--ink);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%231d2b29' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.8rem center;
  background-size: 14px;
}
.status-hint { margin: 0.55rem 0 0; font-size: 0.85rem; opacity: 0.85; }

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.2rem;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 0.75rem 1.2rem;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  max-width: min(92vw, 560px);
  text-align: center;
  border: 2px solid var(--amber);
}
.toast[hidden] { display: none; }

.site-footer {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--line);
  color: var(--ink-faint);
  font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 900px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .page { padding: 1.4rem 1rem 2.5rem; }
  .header-tagline { display: none; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .toolbar { position: static; }
  .toolbar-row { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .overlay { align-items: flex-end; }
  .detail-panel {
    width: 100%;
    height: min(92dvh, 720px);
    border-radius: 22px 22px 0 0;
    border-left: none;
    animation: sheet-up 0.22s ease;
  }
  @keyframes sheet-up {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
  .detail-grid { grid-template-columns: 1fr 1fr; }
}

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