/* --- Reset & base --- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --graphite: #2d2a26;
  --copper: #b5652b;
  --copper-light: #b5652b15;
  --ground: #f6f1eb;
  --grain: #ece5db;
  --pencil: #8a8078;
  --border: #b5652b26;
  --white: #ffffff;

  --display:
    "IBM Plex Sans Condensed", "Helvetica Neue", "Arial Narrow", sans-serif;
  --serif: "Source Serif 4", "Georgia", "Times New Roman", serif;
  --mono: "IBM Plex Mono", "SF Mono", "Menlo", "Consolas", monospace;
}

html {
  font-size: 17px;
  line-height: 1.55;
  color: var(--graphite);
  background: var(--ground);
}
body {
  font-family: var(--serif);
  max-width: 64rem;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --- Typography --- */
h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--copper);
  margin: 2rem 0 1rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.25;
  color: var(--graphite);
  margin: 2.5rem 0 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.3rem;
}
h3 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.25;
  color: var(--graphite);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 1.5rem 0 0.4rem;
}
h4 {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.3;
  color: var(--pencil);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 1.25rem 0 0.4rem;
}

p {
  margin: 0.75rem 0;
}
a {
  color: var(--copper);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:hover {
  text-decoration-thickness: 2px;
}

ul,
ol {
  margin: 0.75rem 0 0.75rem 1.5rem;
}
li {
  margin: 0.25rem 0;
}
strong {
  font-weight: 600;
}

/* --- Heading anchors --- */
h1 > a.header-anchor,
h2 > a.header-anchor,
h3 > a.header-anchor,
h4 > a.header-anchor {
  color: inherit;
  text-decoration: none;
}
h1 > a.header-anchor:hover,
h2 > a.header-anchor:hover,
h3 > a.header-anchor:hover,
h4 > a.header-anchor:hover {
  text-decoration: underline;
  text-decoration-color: var(--copper);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

/* --- Syntax highlighting (Prism) --- */
.token.property {
  color: #9e5019;
}
.token.string,
.token.url {
  color: #6e7d3a;
}
.token.number {
  color: #8b5e3c;
}
.token.keyword,
.token.selector {
  color: #7a4b8a;
}
.token.function,
.token.class-name {
  color: #b5652b;
}
.token.operator {
  color: var(--pencil);
}
.token.punctuation {
  color: #a09888;
}
.token.comment {
  color: var(--pencil);
  font-style: italic;
}
.token.namespace {
  opacity: 0.7;
}

/* --- Code --- */
code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--grain);
  padding: 0.15em 0.35em;
  color: var(--graphite);
}
pre {
  background: var(--grain);
  border-left: 3px solid #b5652b4d;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin: 1rem 0;
  line-height: 1.5;
}
pre code {
  background: none;
  padding: 0;
  font-size: 0.84rem;
}

/* --- Tables --- */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
  font-size: 0.95rem;
}
th,
td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #b5652b1a;
}
th {
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--pencil);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* --- Navigation --- */
.site-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.8rem;
}
.nav-logo {
  font-family: var(--display);
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--copper);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.nav-links {
  display: flex;
  gap: 1.25rem;
}
.nav-links a {
  font-family: var(--display);
  font-weight: 500;
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.78rem;
  color: var(--pencil);
}
.nav-links a:hover,
.nav-links a[aria-current] {
  color: var(--copper);
}
.nav-github {
  opacity: 0.6;
}
.nav-github:hover {
  opacity: 1;
}

/* --- Divider --- */
.divider {
  background: repeating-linear-gradient(
    to right,
    var(--copper) 0 6px,
    transparent 6px 12px
  );
  height: 6px;
  opacity: 0.3;
  margin: 0;
}

/* --- Footer --- */
.site-footer {
  margin-top: 4rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  font-family: var(--display);
  font-size: 0.78rem;
  color: var(--pencil);
  text-align: center;
  letter-spacing: 0.02em;
}
.site-footer a {
  color: var(--pencil);
}
.site-footer a:hover {
  color: var(--copper);
}

/* --- Hero --- */
.hero {
  padding: 3.5rem 0 2.5rem;
  border-bottom: none;
  margin-bottom: 0;
}
.hero h1 {
  font-size: 2.4rem;
  margin: 0 0 0.75rem;
  line-height: 1.1;
  letter-spacing: 0.14em;
}
.hero .tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.1rem;
  color: var(--pencil);
  margin: 0 0 1.5rem;
  max-width: 42rem;
  line-height: 1.5;
}
.hero-install {
  font-family: var(--mono);
  font-size: 0.9rem;
  background: var(--grain);
  border-left: 3px solid #b5652b4d;
  padding: 0.6rem 1rem;
  display: inline-block;
}
.hero-install .prompt {
  color: var(--pencil);
  user-select: none;
}
.hero + .divider {
  margin-bottom: 2rem;
}

/* --- Objects grid --- */
.objects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1.25rem;
  margin: 1.5rem 0;
}
.object-card {
  background: var(--grain);
  border: 1px solid var(--border);
  padding: 1.25rem;
}
.object-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  color: var(--copper);
  letter-spacing: 0.05em;
}
.object-card p {
  margin: 0;
  font-size: 0.92rem;
  color: var(--pencil);
}

/* --- Crate cards --- */
.crate-card {
  background: var(--grain);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  margin: 1.25rem 0;
}
.crate-card h3 {
  margin: 0 0 0.15rem;
  font-size: 0.95rem;
  color: var(--copper);
  letter-spacing: 0.03em;
}
.crate-card .version {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--pencil);
  margin-bottom: 0.5rem;
}
.crate-card .role {
  font-size: 0.92rem;
  color: var(--pencil);
  margin: 0.5rem 0;
}
.crate-links {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  font-family: var(--mono);
}

/* --- DAG diagram --- */
.dag-figure {
  background: var(--grain);
  border: 1px solid var(--border);
  padding: 1.5rem 1.5rem 1rem;
  margin: 1.25rem 0;
  overflow-x: auto;
}
.dag-svg {
  display: block;
  width: 100%;
  max-width: 680px;
  height: auto;
  margin: 0 auto;
}

/* --- Subtitle --- */
.subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.05rem;
  color: var(--pencil);
  margin-bottom: 2rem;
  line-height: 1.5;
}

/* --- Topographic illustrations --- */
.topo {
  display: block;
  pointer-events: none;
}
.topo-hero {
  width: clamp(200px, 40%, 380px);
  height: auto;
  flex-shrink: 0;
}
.topo-wide {
  width: 100%;
  height: auto;
  margin: 1rem 0;
}
.topo-float-right {
  float: right;
  width: 180px;
  height: auto;
  margin: 0 0 1rem 1.5rem;
}
.topo-float-right.topo-sm {
  width: 130px;
}

/* Hero layout with topo */
.hero {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.hero-content {
  flex: 1;
  min-width: 0;
}

/* --- Page title --- */
.page-title {
  margin-top: 2rem;
}

/* --- Responsive --- */
@media (max-width: 640px) {
  html {
    font-size: 16px;
  }
  .hero {
    flex-direction: column;
  }
  .hero h1 {
    font-size: 1.6rem;
  }
  .topo-hero {
    width: 80%;
    max-width: 300px;
  }
  .topo-float-right {
    float: none;
    width: 60%;
    max-width: 200px;
    margin: 1rem auto;
  }
  .site-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .objects {
    grid-template-columns: 1fr;
  }
}
