:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1b1b1a;
  --muted: #6b6b66;
  --border: #e3e3de;
  --accent: #3a5bd9;
  --accent-ink: #ffffff;
  --chip: #efefea;
  --live: #1f8a4c;
  --wip: #b7791f;
  --archived: #7a7a74;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111112;
    --surface: #1a1a1c;
    --text: #ececea;
    --muted: #9a9a95;
    --border: #2b2b2e;
    --accent: #8ea6ff;
    --accent-ink: #0d0d10;
    --chip: #252528;
    --live: #4cc584;
    --wip: #e2a94c;
    --archived: #8d8d88;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1; width: 100%; }
a { color: inherit; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

/* Header / footer */
.site-header { padding: 48px 0 24px; }
.site-header.slim { padding: 24px 0 8px; }
.site-header h1 { margin: 0; font-size: 28px; letter-spacing: -0.02em; }
.site-header h1 a { text-decoration: none; }
.lede { margin: 6px 0 0; color: var(--muted); }
.back { color: var(--muted); text-decoration: none; }
.site-footer {
  display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap;
  max-width: 1180px; width: 100%; margin: 48px auto 0; padding: 24px 16px 32px;
  color: var(--muted); font-size: 13px; border-top: 1px solid var(--border);
}

/* Controls */
.controls { position: sticky; top: 0; z-index: 2; background: var(--bg); padding: 12px 0; margin-bottom: 4px; }
.controls-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search { flex: 1 1 240px; }
.search input, .sort select {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border);
  border-radius: 10px; background: var(--surface);
}
.search input:focus, .sort select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { height: 36px; padding: 0 12px; border: 0; background: none; cursor: pointer; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button span { color: var(--muted); font-size: 12px; }
.seg button[aria-pressed='true'] { background: var(--text); color: var(--bg); }
.seg button[aria-pressed='true'] span { color: inherit; opacity: 0.7; }
.tag-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px;
  border: 1px solid transparent; background: var(--chip); font-size: 12.5px; cursor: pointer;
  text-decoration: none; line-height: 1.6;
}
.tag span { color: var(--muted); font-size: 11px; }
.tag:hover { border-color: var(--border); color: inherit; }
.tag[aria-pressed='true'], .card .tag.on { background: var(--accent); color: var(--accent-ink); }
.tag[aria-pressed='true'] span { color: inherit; opacity: 0.75; }
.clear { border: 0; background: none; color: var(--accent); cursor: pointer; font-size: 13px; }
.count { color: var(--muted); font-size: 13px; margin: 4px 0 12px; min-height: 1.5em; }
.empty { color: var(--muted); text-align: center; padding: 48px 0; }

/* Cards */
.projects.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.card[hidden] { display: none; }
.thumb { display: block; aspect-ratio: 16 / 9; background: var(--chip); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.card:hover .thumb img { transform: scale(1.02); }
.ph {
  display: grid; place-items: center; width: 100%; height: 100%;
  font: 600 32px/1 var(--font); letter-spacing: 0.02em; color: hsl(var(--h) 45% 30%);
  background: linear-gradient(135deg, hsl(var(--h) 70% 88%), hsl(calc(var(--h) + 40) 70% 80%));
}
@media (prefers-color-scheme: dark) {
  .ph { color: hsl(var(--h) 60% 85%); background: linear-gradient(135deg, hsl(var(--h) 35% 22%), hsl(calc(var(--h) + 40) 35% 16%)); }
}
.card-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 16px; flex: 1; }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-head h2 { margin: 0; font-size: 16px; line-height: 1.3; letter-spacing: -0.01em; flex: 1; }
.card-head h2 a { text-decoration: none; }
.fav { width: 16px; height: 16px; border-radius: 3px; flex: none; }
.star { color: var(--wip); }
.host { margin: 0; color: var(--muted); font: 12.5px/1.4 var(--mono); overflow-wrap: anywhere; }
.desc { margin: 2px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.status { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-live { color: var(--live); }
.s-wip { color: var(--wip); }
.s-archived { color: var(--archived); }
.card-foot { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin-top: auto; padding-top: 8px; font-size: 13px; }
.details { color: var(--muted); }
.links { display: flex; flex-wrap: wrap; gap: 4px 12px; list-style: none; margin: 0; padding: 0; }
.links a { color: var(--accent); text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* List view */
.projects.list { display: flex; flex-direction: column; gap: 8px; }
.projects.list .card { flex-direction: row; align-items: stretch; }
.projects.list .thumb { flex: 0 0 160px; aspect-ratio: 16 / 10; }
.projects.list .ph { font-size: 22px; }
.projects.list .card-body { padding: 10px 14px; gap: 3px; }
.projects.list .desc { -webkit-line-clamp: 2; }
@media (max-width: 560px) {
  .projects.list .thumb { flex-basis: 96px; }
  .projects.list .card-foot { display: none; }
}

/* Detail page */
.detail { max-width: 860px; }
.detail .thumb { border-radius: var(--radius); margin: 8px 0 20px; }
.detail-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.detail-head h1 { margin: 0; font-size: 32px; letter-spacing: -0.02em; }
.detail-head .fav { width: 24px; height: 24px; }
.detail .host { font-size: 14px; margin-top: 6px; }
.detail .desc { -webkit-line-clamp: unset; display: block; font-size: 17px; margin: 16px 0; }
.detail h2 { font-size: 15px; margin: 28px 0 8px; color: var(--muted); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 16px 0; }
.links.big { gap: 8px 20px; font-size: 15px; }
.button {
  display: inline-block; padding: 9px 16px; border-radius: 10px; background: var(--text); color: var(--bg);
  text-decoration: none; font-weight: 600;
}
.button:hover { color: var(--bg); opacity: 0.85; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-top: 28px; }
.gallery:first-child { margin-top: 0; }
.gallery a { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: var(--chip); }
.gallery img { width: 100%; height: 100%; object-fit: cover; aspect-ratio: 16 / 10; }
.gallery a:first-child { grid-column: 1 / -1; }
.gallery a:first-child img { aspect-ratio: auto; max-height: 520px; object-fit: contain; }
.notfound { padding: 96px 16px; text-align: center; }
