/* staccbook — brutalist mono. light base, near-black ink, sparing accents.
   modeled on proofofpotato's anti-design / ship-substance aesthetic. */

@import url("https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap");

:root {
  /* Dark by default — the user explicitly wants #191919, not pure black,
     for a softer terminal-paper look that pairs with the brutalist grid. */
  --bg: #191919;
  --bg-soft: #1f1f1e;
  --ink: #f4f4ee;
  --ink-soft: #d4d4c9;
  --muted: #8a8a82;
  --rule: #f4f4ee;
  --rule-soft: #353532;
  --soft: #232321;
  --accent: #9945ff;       /* solana purple */
  --accent-2: #14f195;     /* solana green */
  --warn: #ff7a18;         /* mission orange */
  --danger: #ff5b3a;
  --maxw: 1100px;
  --pad: clamp(20px, 4vw, 56px);
  --gap: clamp(20px, 3vw, 40px);
  --card-pad: clamp(20px, 2.4vw, 32px);
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Category accents — keyed by category id, used for left-edge stripes,
     dots in the sticky sub-nav, and the small cat-tag chip on each card. */
  --cat-flagship: #14f195;
  --cat-infra: #ff7a18;
  --cat-experimental: #9945ff;

  /* Status accents — same idea but per project status. */
  --status-live: #14f195;
  --status-mission: #ff7a18;
  --status-rnd: #9945ff;
  --status-archived: #8a8a82;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent-2); }

/* Shared container — keeps header/footer/sub-nav content aligned with the
   main grid (max-width 1100px). Without this, header text hugs the viewport
   edge while card content sits on the centered grid — looks broken on wide
   screens. */
.container {
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
}

/* ───────── header ───────── */
header.site {
  padding: 22px var(--pad);
  border-bottom: 2px solid var(--rule);
  position: sticky; top: 0; z-index: 11;
  background: var(--bg);
}

/* ───────── sticky sub-nav (scroll-spy) ───────── */
nav.sub-nav {
  position: sticky;
  top: 64px; /* under the main header */
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--rule);
  padding: 10px var(--pad);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 12.5px;
  overflow-x: auto;
}
/* The sub-nav contents share the same 1100px grid as cards/header — the
   nav element spans full width (so its bottom rule reaches the edges) but
   the inner anchors live inside a centered container. */
nav.sub-nav .container { padding: 0; gap: 4px 8px; }
nav.sub-nav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  border: 1px solid transparent;
  padding: 5px 10px;
  white-space: nowrap;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  transition: none;
}
nav.sub-nav a .dot {
  width: 8px;
  height: 8px;
  background: var(--muted);
  display: inline-block;
  flex: none;
}
nav.sub-nav a.cat-flagship .dot { background: var(--cat-flagship); }
nav.sub-nav a.cat-infra .dot { background: var(--cat-infra); }
nav.sub-nav a.cat-experimental .dot { background: var(--cat-experimental); }
nav.sub-nav a .count {
  margin-left: 4px;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
nav.sub-nav a:hover {
  border-color: var(--ink);
  color: var(--ink);
}
nav.sub-nav a.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
nav.sub-nav a.active .count { color: var(--bg); opacity: 0.7; }
nav.sub-nav a.active .dot { background: var(--bg); }
.brand {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
}
.brand-mark {
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
  text-decoration: none;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 1px;
}
.brand-mark:hover { color: var(--accent); border-color: var(--accent); }
.brand-tag {
  color: var(--muted);
  font-size: 13px;
}
nav.util {
  display: flex; gap: 18px; flex-wrap: wrap;
}
nav.util a {
  font-size: 13px;
  text-decoration: none;
  border-bottom: 1px dashed var(--ink);
  padding-bottom: 1px;
}

/* ───────── main wrapper ───────── */
main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ───────── hero ───────── */
.hero {
  padding: clamp(40px, 9vw, 96px) 0 clamp(28px, 5vw, 56px);
  border-bottom: 1px solid var(--rule);
}
.hero h1 {
  font-size: clamp(28px, 5.6vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  font-weight: 700;
  max-width: 18ch;
}
.hero-sub {
  max-width: 64ch;
  color: var(--ink);
  margin: 0 0 28px;
  font-size: clamp(14px, 1.4vw, 17px);
}
.hero-stats {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.hero-stats li {
  padding: 16px 12px;
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hero-stats li:last-child { border-right: none; }
.hero-stats .v {
  font-size: clamp(20px, 3vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
}
.hero-stats .l {
  font-size: 12px;
  color: var(--muted);
  text-transform: lowercase;
}
.hero-cta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}
.hero-cta a {
  text-decoration: none;
  border: 2px solid var(--ink);
  padding: 10px 16px;
  font-weight: 500;
  font-size: 13.5px;
  text-transform: lowercase;
  letter-spacing: 0.01em;
  background: var(--bg);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hero-cta a:hover {
  background: var(--ink);
  color: var(--bg);
}

/* ───────── category sections ───────── */
.cat {
  padding: clamp(36px, 6vw, 64px) 0 clamp(24px, 4vw, 48px);
  border-bottom: 1px solid var(--rule);
}
.cat-head {
  margin: 0 0 28px;
  display: flex;
  align-items: baseline;
  gap: 24px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--rule);
  padding-bottom: 14px;
}
.cat-head h2 {
  font-size: clamp(22px, 3vw, 30px);
  margin: 0;
  letter-spacing: -0.01em;
  font-weight: 700;
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
}
.cat-head h2::before {
  content: "// ";
  color: var(--muted);
  font-weight: 400;
}
.cat-head h2 .count {
  font-size: 14px;
  color: var(--muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.cat-flagship .cat-head h2 .count { color: var(--cat-flagship); }
.cat-infra .cat-head h2 .count { color: var(--cat-infra); }
.cat-experimental .cat-head h2 .count { color: var(--cat-experimental); }
.cat-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

/* ───────── card grid ───────── */
.cat .card + .card { margin-top: -1px; }
.card {
  border: 1px solid var(--rule);
  border-left-width: 4px;
  padding: var(--card-pad);
  background: var(--bg);
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  scroll-margin-top: 130px; /* clear sticky headers when anchor-scrolled */
}
.card.cat-flagship { border-left-color: var(--cat-flagship); }
.card.cat-infra { border-left-color: var(--cat-infra); }
.card.cat-experimental { border-left-color: var(--cat-experimental); }
.card:hover { background: #fff; }

/* Card meta row — first thing your eye hits. STATUS pill + cat tag. */
.card .card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: -2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.card .status {
  padding: 3px 8px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 1px;
  font-variant-numeric: tabular-nums;
}
.card .status.status-live { background: var(--status-live); color: #03240e; }
.card .status.status-mission { background: var(--status-mission); color: #2a1100; }
.card .status.status-rnd { background: var(--status-rnd); color: #fff; }
.card .status.status-archived {
  background: transparent;
  color: var(--status-archived);
  border: 1px solid var(--status-archived);
}
.card .cat-tag {
  color: var(--muted);
  font-size: 10.5px;
  letter-spacing: 0.1em;
}
.card .cat-tag::before { content: "// "; }

.card > header h3 {
  font-size: clamp(20px, 2.4vw, 26px);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.card > header h3::before {
  content: "▸ ";
  color: var(--accent);
}
.card.cat-flagship > header h3::before { color: var(--cat-flagship); }
.card.cat-infra > header h3::before { color: var(--cat-infra); }
.card.cat-experimental > header h3::before { color: var(--cat-experimental); }
.card .pin { color: var(--accent); font-size: 14px; }
.card .tagline {
  margin: 0 0 10px;
  color: var(--muted);
  font-style: italic;
}
.card .tags {
  list-style: none;
  margin: 0 0 4px;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.card .tags li {
  font-size: 11px;
  border: 1px solid var(--rule);
  padding: 2px 8px;
  background: var(--soft);
  text-transform: lowercase;
}
.card p {
  margin: 0;
  max-width: 72ch;
}
.card dl.facts {
  margin: 0;
  padding: 14px 16px;
  background: var(--soft);
  border: 1px dashed var(--rule-soft);
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  font-size: 13px;
}
.card dl.facts > div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 10px;
}
.card dl.facts dt {
  margin: 0;
  color: var(--muted);
  text-transform: lowercase;
}
.card dl.facts dd {
  margin: 0;
  word-break: break-word;
}
.card code.addr {
  font-size: 12.5px;
  background: var(--ink);
  color: #fff;
  padding: 1px 6px;
  border-radius: 2px;
  user-select: all;
}
.card code.addr:hover { background: var(--accent); }
.card ul.notes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 13.5px;
}
.card ul.notes li {
  padding-left: 14px;
  position: relative;
}
.card ul.notes li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--accent);
  font-weight: 700;
}
.card footer.links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  margin-top: 4px;
}
.card footer.links a {
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
}
.card footer.links a:hover { border-color: var(--accent); }

/* ───────── contribute ───────── */
.contribute {
  padding: clamp(32px, 5vw, 56px) 0;
}
.contribute h2 {
  font-size: clamp(20px, 2.4vw, 26px);
  margin: 0 0 12px;
  font-weight: 700;
}
.contribute h2::before { content: "// "; color: var(--muted); font-weight: 400; }
.contribute p {
  max-width: 72ch;
  margin: 0;
}

/* ───────── footer ───────── */
footer.site-foot {
  border-top: 2px solid var(--rule);
  margin-top: 16px;
  padding: 24px var(--pad);
  font-size: 13px;
  color: var(--muted);
}
footer.site-foot .container { gap: 16px; }
footer.site-foot .links { display: flex; gap: 16px; }
footer.site-foot a { text-decoration: none; border-bottom: 1px dashed currentColor; padding-bottom: 1px; }

/* ───────── responsive ───────── */
@media (max-width: 640px) {
  .card dl.facts > div { grid-template-columns: 1fr; gap: 2px; }
  .card dl.facts dt { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
  .hero-stats { grid-template-columns: repeat(2, 1fr); }
  .hero-stats li:nth-child(2n) { border-right: none; }
}

/* ───────── hero two-column (text + ASCII portrait) ───────── */
.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(24px, 4vw, 56px);
}
.hero .hero-text { min-width: 0; }
.hero .hero-art {
  margin: 0;
  padding: 16px 18px;
  background: var(--soft);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--accent-2);
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  white-space: pre;
  overflow-x: auto;
  align-self: start;
  max-width: 100%;
}
.hero .hero-art .prompt { color: var(--muted); }
.hero .hero-art .field { color: var(--accent-2); }
.hero .hero-art .field.mission { color: var(--warn); }
.hero .hero-art .field.archived { color: var(--muted); }
.hero .hero-art .quote { color: var(--ink); font-style: italic; }
.hero .hero-art .cursor {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  background: var(--accent-2);
  vertical-align: text-bottom;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@media (min-width: 880px) {
  .hero {
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr);
    align-items: end;
  }
}

/* ───────── intro / who's behind this ───────── */
.intro {
  padding: clamp(36px, 5vw, 56px) 0;
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
.intro h2 {
  font-size: clamp(20px, 2.4vw, 26px);
  margin: 0;
  font-weight: 700;
}
.intro h2::before { content: "// "; color: var(--muted); font-weight: 400; }
.intro .who { max-width: 64ch; }
.intro .who p { margin: 12px 0; color: var(--ink-soft); }
.intro .who p:first-of-type { margin-top: 0; }
.intro .featured {
  border: 1px solid var(--rule);
  border-left: 4px solid var(--warn);
  padding: 18px 20px;
  display: grid;
  gap: 8px;
  background: var(--soft);
}
.intro .featured .badge {
  font-size: 10.5px;
  color: var(--warn);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
}
.intro .featured .ep {
  font-size: clamp(16px, 1.8vw, 19px);
  font-weight: 700;
  letter-spacing: -0.01em;
}
.intro .featured .ep a {
  text-decoration: none;
  border-bottom: 2px solid var(--warn);
  padding-bottom: 2px;
}
.intro .featured .ep a:hover {
  background: var(--warn);
  color: var(--bg);
}
.intro .featured p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
}
.intro .featured .meta {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
@media (min-width: 880px) {
  .intro { grid-template-columns: 1.2fr 1fr; }
}

/* ───────── contribute (rebuilt — 3 action cards + accept list) ───────── */
.contribute {
  padding: clamp(36px, 5vw, 56px) 0;
}
.contribute > h2 {
  font-size: clamp(22px, 2.6vw, 28px);
  margin: 0 0 8px;
  font-weight: 700;
}
.contribute > h2::before { content: "// "; color: var(--muted); font-weight: 400; }
.contribute > p.lede {
  max-width: 64ch;
  color: var(--ink-soft);
  margin: 0 0 28px;
}
.contribute .actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 28px;
}
@media (min-width: 720px) {
  .contribute .actions { grid-template-columns: repeat(3, 1fr); }
}
.contribute .actions a {
  border: 1px solid var(--rule);
  border-left-width: 4px;
  padding: 18px 20px;
  text-decoration: none;
  display: grid;
  gap: 4px;
  background: var(--bg);
  transition: none;
}
.contribute .actions a:hover { background: var(--soft); }
.contribute .actions a .label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.contribute .actions a .name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.contribute .actions a .desc {
  font-size: 13px;
  color: var(--ink-soft);
}
.contribute .actions a.tg { border-left-color: var(--accent-2); }
.contribute .actions a.gh { border-left-color: var(--accent); }
.contribute .actions a.x { border-left-color: var(--warn); }
.contribute .actions a:hover .name { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.contribute .accepts {
  border-top: 1px dashed var(--rule-soft);
  padding-top: 20px;
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) {
  .contribute .accepts { grid-template-columns: 200px 1fr; }
}
.contribute .accepts h3 {
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}
.contribute .accepts ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--ink-soft);
}
.contribute .accepts ul li::before { content: "▸ "; color: var(--accent-2); font-weight: 700; }

/* ───────── light-mode override ───────── */
/* If the user explicitly prefers light, swap the palette. The default stays
   dark so the brutalist terminal aesthetic ships first-paint. */
@media (prefers-color-scheme: light) {
  :root {
    --bg: #fafaf7;
    --bg-soft: #ececea;
    --ink: #0a0a0a;
    --ink-soft: #2a2a2a;
    --muted: #6b6b6b;
    --rule: #1a1a1a;
    --rule-soft: #d6d6d2;
    --soft: #ececea;
  }
}
