:root {
  --bg: #0b0b0c;
  --bg-raised: #121214;
  --line: #232327;
  --line-strong: #3a3a40;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --dim: #63636b;
  --live: #7ee787;
  --local: #e3b341;
  --accent: #f4f4f5;
  --dot: #f4f4f5;
  --pixel: "Bitter", Georgia, serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}
:root[data-theme="dark"] { color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--bg);
  color: var(--text);
  font: 14px/1.6 var(--mono);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; }
.dim { color: var(--dim); }
kbd {
  font: inherit; font-size: 12px; padding: 0 5px; border: 1px solid var(--line-strong);
  border-radius: 4px; color: var(--muted);
}

.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
@media (min-width: 720px) { .wrap { padding: 32px 32px 80px; } }

/* top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: default; }

/* boot sequence */
.boot { margin: 48px 0 32px; }
.line { margin: 0; color: var(--muted); }
.prompt { color: var(--live); margin-right: 4px; }
.cursor {
  display: inline-block; width: 8px; height: 1.1em; vertical-align: -2px; margin-left: 2px;
  background: var(--text); animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.bootlog { color: var(--dim); font-size: 12px; margin: 8px 0 0; }
.bootlog div { white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.bootlog .ok { color: var(--live); }
.hero {
  font-family: var(--pixel); font-weight: 700; letter-spacing: -0.02em;
  margin: 0 0 8px; font-size: clamp(28px, 6vw, 48px); line-height: 1.1;
  letter-spacing: -0.03em; font-weight: 700;
}
.sub { margin: 0; color: var(--muted); max-width: 60ch; }

/* project grid */
.grid { display: flex; flex-direction: column; gap: 40px; }
.group[hidden] { display: none; }
.group-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 12px; }
.group-title { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .01em; }
.group-note { color: var(--dim); font-size: 12px; }
.group-grid { display: grid; grid-template-columns: 1fr; gap: 1px; background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }

.card {
  position: relative; background: var(--bg-raised); outline: 1px solid var(--line); padding: 20px; display: flex; flex-direction: column; gap: 12px;
}
.card[hidden] { display: none; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-num { color: var(--dim); font-size: 12px; }
.card-title { margin: 2px 0 0; font-family: var(--pixel); font-size: 18px; font-weight: 600; letter-spacing: -0.01em; }
.card-meta { color: var(--dim); font-size: 12px; }
.card-meta b { color: var(--muted); font-weight: 500; }
.card-sum { margin: 0; color: var(--muted); font-size: 13px; }

.links { list-style: none; margin: 4px 0 0; padding: 0; border-top: 1px dashed var(--line-strong); }
.links li { border-bottom: 1px dashed var(--line); }
.links li:last-child { border-bottom: 0; }
.link {
  display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: start;
  padding: 8px 0; text-decoration: none; font-size: 13px;
}
a.link:hover .link-label { text-decoration: underline; text-underline-offset: 3px; }
a.link:hover .arrow { transform: translate(2px, -2px); color: var(--text); }
.arrow { color: var(--dim); transition: transform .15s ease; display: flex; height: 1.6em; align-items: center; }
.ico { display: block; }
.link-label { color: var(--text); }
.link-note { display: block; color: var(--dim); font-size: 11px; }
span.link .link-label { color: var(--muted); }
.link-tags { display: flex; gap: 4px; white-space: nowrap; }
.tag { font-size: 11px; padding: 0 6px; border-radius: 4px; border: 1px solid var(--line-strong); color: var(--muted); }
.tag.live { color: var(--live); border-color: color-mix(in srgb, var(--live) 45%, transparent); }
.tag.local { color: var(--local); border-color: color-mix(in srgb, var(--local) 45%, transparent); }
.related { margin: 0; font-size: 12px; color: var(--dim); }
.related a { color: var(--muted); }

/* dot loaders */
.dots { display: inline-block; line-height: 0; }
.dots svg { display: block; }
.dots circle { fill: var(--dot); opacity: .14; }
.dots.is-on circle { animation: dot var(--loop, 1400ms) linear infinite; }
@keyframes dot {
  0% { opacity: 1; } 12% { opacity: .64; } 34% { opacity: .14; } 82% { opacity: .14; } 100% { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .dots.is-on circle { animation: none; opacity: .6; }
}

/* search */
.search[hidden] { display: none; }
.search { position: fixed; inset: auto 0 24px; display: flex; justify-content: center; padding: 0 16px; }
.search-box {
  display: flex; gap: 8px; align-items: center; width: min(520px, 100%);
  background: var(--bg-raised); border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35);
}
.search input { flex: 1; min-width: 0; font: inherit; color: var(--text); background: transparent; border: 0; outline: 0; }
.empty { background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; padding: 24px; color: var(--dim); grid-column: 1 / -1; }


/* list cards: one per row; details left, links right */
@media (min-width: 760px) {
  .card { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); column-gap: 40px; align-items: start; padding: 24px; }
  .card > .links { grid-column: 2; grid-row: 1 / span 3; margin: 0; border-top: 0; }
  .card > .related { grid-column: 1; }
  .card-sum { max-width: 60ch; }
}
.group-grid .card + .card { border-top: 1px solid var(--line-strong); }

/* sleeping cat (ASCII) */
.cat { display: flex; justify-content: center; margin: 72px 0 32px; cursor: pointer; }
.cat-inner { position: relative; padding-top: 28px; }
.cat-art { margin: 0; font: 13px/1.2 var(--mono); color: var(--muted); transform-origin: 50% 100%; animation: breathe 3.6s ease-in-out infinite; }
@keyframes breathe { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(1.05); } }
.zzz { position: absolute; left: 96px; top: 0; font-family: var(--mono); color: var(--dim); }
.zzz i { position: absolute; font-style: normal; opacity: 0; animation: zz 3.6s ease-out infinite; }
.zzz i:nth-child(2) { animation-delay: 1.2s; font-size: 15px; }
.zzz i:nth-child(3) { animation-delay: 2.4s; font-size: 18px; }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 18px); } 25% { opacity: 1; } 100% { opacity: 0; transform: translate(16px, -14px); } }
@media (prefers-reduced-motion: reduce) { .cat-art, .zzz i { animation: none; } .zzz i { opacity: .6; } }

/* loading: skeleton until fonts are ready, so the page never shifts */
.skeleton { display: none; }
.is-loading .skeleton { display: block; position: fixed; inset: 0; overflow: hidden; z-index: 5; }
.is-loading main.wrap { visibility: hidden; }
.sk { background: var(--line); border-radius: 6px; animation: sk 1.4s ease-in-out infinite; }
@keyframes sk { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.sk-brand { width: 120px; height: 16px; }
.sk-title { width: min(420px, 80%); height: clamp(30px, 6vw, 48px); margin-top: 48px; border-radius: 8px; }
.sk-sub { width: 200px; height: 14px; margin: 14px 0 32px; }
.sk-label { width: 180px; height: 12px; margin: 0 0 12px; }
.sk-card { border: 1px solid var(--line); border-radius: 12px; background: var(--bg-raised); padding: 20px; margin-bottom: 40px; display: flex; flex-direction: column; gap: 20px; }
.sk-card + .sk-card { margin-top: -41px; border-top-left-radius: 0; border-top-right-radius: 0; }
.sk-left, .sk-right { display: flex; flex-direction: column; gap: 10px; }
.sk-num { width: 90px; height: 11px; }
.sk-h { width: 240px; max-width: 80%; height: 18px; }
.sk-line { width: 100%; height: 11px; }
.sk-line.short { width: 60%; }
.sk-link { width: 100%; height: 14px; }
@media (min-width: 760px) {
  .sk-card { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 4fr); column-gap: 40px; padding: 24px; }
}
@media (prefers-reduced-motion: reduce) { .sk { animation: none; } }

/* warp screen saver */
.warp { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 50; background: #000; opacity: 0; pointer-events: none; transition: opacity .4s ease; }
.warp.is-on { opacity: 1; pointer-events: auto; cursor: none; }
.warp-caption {
  position: fixed; left: 50%; top: 50%; z-index: 51; margin: 0; width: min(560px, calc(100% - 32px));
  transform: translate(-50%, -50%); text-align: center; text-wrap: balance; pointer-events: none;
  font-family: var(--pixel); font-size: clamp(20px, 3.4vw, 30px); font-weight: 600; line-height: 1.3; color: #f4f4f5;
  text-shadow: 0 0 24px #000, 0 0 8px #000; opacity: 0; transition: opacity .6s ease;
}
.warp-caption.is-shown { opacity: 1; }
