/* Chaincraft 1.0.0 site — voxel brand, readable type */

@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=IBM+Plex+Sans:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --bg: #0d0f12;
  --bg-elevated: #14181e;
  --bg-card: #1b2128;
  --stone: #8b939e;
  --grass: #6ecf4a;
  --grass-dim: #4a9e32;
  --dirt: #8b6914;
  --accent: #7ee05a;
  --text: #e8ecef;
  --text-muted: #a7b0b8;
  --border: #2a323c;
  --code-bg: #0a0c0e;
  --pixel-shadow: 3px 3px 0 #000;
  --measure: 40rem;
  --content: 52rem;
  --wide: 64rem;
  --font-sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --font-pixel: "Press Start 2P", cursive;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  scroll-padding-top: 4.25rem;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image:
    linear-gradient(rgba(110, 207, 74, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 207, 74, 0.035) 1px, transparent 1px);
  background-size: 28px 28px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding: 0.7rem 1.5rem;
  background: rgba(13, 15, 18, 0.94);
  border-bottom: 2px solid var(--border);
  backdrop-filter: blur(10px);
}

.logo-link {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  text-decoration: none;
}

.logo-link:hover {
  text-decoration: none;
}

.logo-link img {
  height: 32px;
  width: auto;
  image-rendering: pixelated;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem 1rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.site-nav a {
  color: var(--text-muted);
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--accent);
  text-decoration: none;
}

/* Hero */
.hero {
  max-width: var(--content);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 4rem;
  text-align: center;
}

.hero-logo {
  display: block;
  width: min(200px, 52vw);
  margin: 0 auto 1.75rem;
  image-rendering: pixelated;
  filter: drop-shadow(6px 6px 0 rgba(0, 0, 0, 0.45));
}

.hero h1 {
  font-family: var(--font-pixel);
  font-size: clamp(0.95rem, 2.4vw, 1.2rem);
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 1.25rem;
}

.hero .tagline {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-weight: 400;
  color: var(--text-muted);
  max-width: 38rem;
  margin: 0 auto 1.75rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.btn {
  display: inline-block;
  padding: 0.7rem 1.1rem;
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  line-height: 1.3;
  text-transform: uppercase;
  border: 2px solid var(--grass);
  background: var(--grass-dim);
  color: #0d0f12;
  box-shadow: var(--pixel-shadow);
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.1s;
}

.btn:hover {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #000;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--grass);
}

/* Sections — full-bleed background, inner measure */
section {
  width: 100%;
  max-width: none;
  padding: 3.5rem 1.5rem;
}

section > * {
  max-width: var(--content);
  margin-left: auto;
  margin-right: auto;
}

section > .module-table,
section > .diagram-wrap,
section > .why-grid,
section > .hello-steps,
section > .pill-grid,
section > .code-block,
section > pre {
  max-width: var(--wide);
}

section h2 {
  font-family: var(--font-pixel);
  font-size: 0.9rem;
  line-height: 1.55;
  margin: 0 0 0.9rem;
  color: var(--grass);
}

section .section-lead {
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin: 0 0 1.75rem;
  max-width: var(--measure);
}

section p {
  margin: 0 0 1rem;
}

/* Cards */
.why-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.1rem;
}

.why-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  padding: 1.25rem 1.35rem;
  box-shadow: var(--pixel-shadow);
}

.why-card h3 {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 0.55rem;
  color: var(--accent);
}

.why-card p {
  margin: 0 0 0.85rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.why-card h3 a {
  color: var(--accent);
}

.why-card h3 a:hover {
  text-decoration: underline;
}

.card-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.55rem;
}

.card-links a {
  display: inline-block;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--accent);
}

.card-links a:hover {
  border-color: var(--grass);
  text-decoration: none;
}

/* Tables */
.module-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
  margin: 1.25rem auto;
}

.module-table th,
.module-table td {
  border: 1px solid var(--border);
  padding: 0.65rem 0.9rem;
  text-align: left;
  vertical-align: top;
}

.module-table th {
  background: var(--bg-card);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--grass);
}

.module-table code {
  font-size: 0.85em;
  color: var(--accent);
}

/* Architecture diagram */
.diagram-wrap {
  background: var(--bg-card);
  border: 2px solid var(--border);
  padding: 1.5rem;
  margin: 1.5rem auto;
  overflow-x: auto;
  box-shadow: var(--pixel-shadow);
}

.diagram-wrap svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

/* Hello World steps */
.hello-steps {
  counter-reset: step;
}

.hello-step {
  position: relative;
  margin-bottom: 2.25rem;
  padding-left: 3rem;
  border-left: 3px solid var(--grass-dim);
}

.hello-step::before {
  counter-increment: step;
  content: counter(step);
  position: absolute;
  left: -1.05rem;
  top: 0.1rem;
  width: 1.9rem;
  height: 1.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  background: var(--grass);
  color: #0d0f12;
  border: 2px solid #000;
}

.hello-step h3 {
  font-family: var(--font-sans);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 0 0 0.55rem;
  color: var(--text);
}

.hello-step h4 {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin: 1.1rem 0 0.5rem;
  color: var(--grass);
}

.hello-step p {
  margin: 0 0 0.85rem;
  font-size: 0.975rem;
  color: var(--text-muted);
}

pre,
.code-block {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 0.9rem 1.05rem;
  overflow-x: auto;
  font-size: 0.84rem;
  line-height: 1.55;
  margin: 0 auto 1rem;
  box-shadow: inset 0 0 0 1px rgba(110, 207, 74, 0.08);
}

pre.code-block code.hljs {
  display: block;
  padding: 0;
  background: transparent;
  font-family: var(--font-mono);
  font-size: inherit;
  line-height: inherit;
}

.hljs {
  color: var(--text);
  background: transparent;
}

.hljs-comment,
.hljs-quote {
  color: var(--stone);
  font-style: italic;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in {
  color: var(--grass);
}

.hljs-string,
.hljs-regexp,
.hljs-symbol,
.hljs-bullet {
  color: #9cdcfe;
}

.hljs-number,
.hljs-literal {
  color: #d19a66;
}

.hljs-title,
.hljs-section,
.hljs-name,
.hljs-type,
.hljs-class .hljs-title,
.hljs-function .hljs-title {
  color: var(--accent);
}

.hljs-attr,
.hljs-attribute,
.hljs-variable,
.hljs-template-variable,
.hljs-params {
  color: #e8ecef;
}

.hljs-meta,
.hljs-meta .hljs-keyword {
  color: var(--dirt);
}

.note {
  font-size: 0.9rem;
  color: var(--stone);
  border-left: 3px solid var(--dirt);
  padding-left: 0.9rem;
  margin: 1rem auto;
}

.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.85rem auto 1.25rem;
}

.pill {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  padding: 0.3rem 0.6rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.pill-gossip { border-color: #5b8def; }
.pill-bft { border-color: #ef5b8d; }
.pill-pow { border-color: var(--dirt); }
.pill-dag { border-color: #9b5bef; }

.site-footer {
  border-top: 2px solid var(--border);
  padding: 2.25rem 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer img {
  height: 40px;
  margin-bottom: 0.75rem;
  opacity: 0.9;
  image-rendering: pixelated;
}

.site-footer p {
  margin: 0.35rem 0;
}

.alt-bg {
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

@media (max-width: 800px) {
  .site-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 1rem;
  }

  .site-nav {
    justify-content: flex-start;
    gap: 0.4rem 0.85rem;
  }

  .hero {
    padding: 2.5rem 1rem 3rem;
  }

  section {
    padding: 2.75rem 1rem;
  }
}

@media (max-width: 640px) {
  .hello-step {
    padding-left: 1rem;
    border-left-width: 2px;
  }

  .hello-step::before {
    position: static;
    margin-bottom: 0.6rem;
  }

  .module-table {
    font-size: 0.85rem;
  }
}
