/* pi-tooling docs: white ink on black, matching the mascot family.
   Archivo (wide, heavy) display · Archivo body · IBM Plex Mono utility · no accent hue */

:root {
  --ink: #000;          /* page, identical to the mascot plates so they sit seamless */
  --paper: #f7f7f2;     /* primary text, ink white */
  --graphite: #a8a8a3;  /* secondary text, ~8.9:1 on ink */
  --dim: #8c8c87;       /* tertiary labels, ~6.3:1 on ink */
  --rule: #2b2b2b;      /* dividers */
  --panel: #111;        /* hover and code surfaces */
  --display: "Archivo", "Arial Black", sans-serif;
  --sans: "Archivo", -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
  /* Stamped-ink speckle for the hero title. Tuning knob: the alpha row "-16 12".
     Raise 12 toward 13 for fewer holes, lower toward 11 for a rougher stamp. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='280' height='280'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -16 12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15.5px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }

.skip {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  padding: 8px 12px;
}
.skip:focus { top: 12px; }

/* ---------- top nav ---------- */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--rule);
}
.topnav .logo {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 115%;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.topnav .logo .pi { margin-right: 2px; }
.topnav nav { display: flex; gap: 22px; }
.topnav nav a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--graphite);
}
.topnav nav a:hover { color: var(--paper); text-decoration: underline; text-underline-offset: 4px; }

/* ---------- framed content ---------- */
.frame {
  max-width: 1160px;
  margin: 0 auto;
  border-left: 1px solid var(--rule);
  border-right: 1px solid var(--rule);
  min-height: calc(100vh - 110px);
}

/* ---------- hero ---------- */
.hero { padding: 72px 60px 64px; }
h1.display {
  font-family: var(--display);
  font-weight: 850;
  font-stretch: 125%;
  font-size: clamp(2rem, 10vw, 7.5rem);
  line-height: 0.88;
  letter-spacing: -0.035em;
  -webkit-mask-image: var(--grain);
  mask-image: var(--grain);
  -webkit-mask-size: 280px;
  mask-size: 280px;
}
h1.display span { display: inline-block; white-space: nowrap; }
.lede {
  max-width: 560px;
  margin-top: 32px;
  color: var(--graphite);
  font-size: 17px;
  line-height: 1.55;
}
.lede a { color: var(--paper); text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 3px; }
.lede a:hover { text-decoration-color: var(--paper); }

/* ---------- section intros ---------- */
.section-intro { padding: 40px 60px 32px; border-top: 3px solid var(--paper); }
.section-intro h2 {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 115%;
  font-size: clamp(1.75rem, 3.4vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.section-intro h2 + p { margin-top: 10px; max-width: 560px; color: var(--graphite); }

/* ---------- personal picks ---------- */
.pick {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
  gap: 56px;
  align-items: center;
  padding: 48px 60px 56px;
  border-top: 1px solid var(--rule);
}
.pick:nth-of-type(even) .pick-art { order: 2; }
.pick-art img { display: block; width: 100%; max-width: 440px; height: auto; margin: 0 auto; }
.pick-copy { min-width: 0; }
.pick-name {
  font-family: var(--display);
  font-weight: 850;
  font-stretch: 125%;
  font-size: clamp(2rem, 4.4vw, 3.25rem);
  line-height: 1;
  letter-spacing: -0.03em;
  margin: 10px 0 20px;
}
.pick-name a:hover { text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 6px; }
.pitch { font-size: 21px; line-height: 1.35; font-weight: 500; max-width: 30ch; }
.what { margin-top: 14px; color: var(--graphite); max-width: 52ch; }
.install {
  margin-top: 22px;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 11px 14px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 12.5px;
}
.install code::before { content: "$ "; color: var(--dim); }
.read {
  display: inline-block;
  margin-top: 22px;
  padding: 8px 12px;
  margin-left: -12px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.read:hover { background: var(--paper); color: var(--ink); }

/* ---------- directory ---------- */
.directory { margin-top: 24px; }
.shelf {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 24px;
  padding: 22px 60px 26px;
  border-top: 1px solid var(--rule);
}
.shelf-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--graphite);
  padding-top: 11px;
}
.shelf-list { list-style: none; }
.row {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 18px;
  padding: 10px 12px;
  margin: 0 -12px;
}
.row:hover { background: var(--panel); }
.row:hover .name { text-decoration: underline; text-underline-offset: 4px; }
.row:focus-visible { outline-offset: -2px; }
.row .name { font-weight: 700; font-stretch: 110%; }
.row .desc { color: var(--graphite); font-size: 14.5px; line-height: 1.5; }

/* ---------- footer ---------- */
footer {
  border-top: 1px solid var(--rule);
  margin-top: 48px;
  padding: 22px 60px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--dim);
}
footer a { color: var(--graphite); }
footer a:hover { color: var(--paper); text-decoration: underline; }

/* ---------- project page layout ---------- */
.doc-layout {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: calc(100vh - 110px);
}
.sidebar {
  border-right: 1px solid var(--rule);
  padding: 36px 0;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
}
.sidebar .side-label {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.12em;
  color: var(--dim);
  padding: 0 24px;
  margin: 22px 0 8px;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.05em;
  color: var(--graphite);
  padding: 8px 24px;
  border-left: 3px solid transparent;
}
.sidebar a:hover { color: var(--paper); background: var(--panel); }
.sidebar a:focus-visible { outline-offset: -2px; }
.sidebar a.current {
  color: var(--paper);
  background: var(--panel);
  border-left-color: var(--paper);
}
.sidebar a .marker { color: var(--dim); font-size: 10px; }

/* ---------- article / rendered markdown ---------- */
article.prose {
  padding: 56px 64px 96px;
  max-width: 820px;
  min-width: 0;
}
.doc-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 26px;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
}
.doc-meta .cat { color: var(--paper); border: 1px solid var(--dim); padding: 3px 9px; }
.doc-meta .repo-link, .doc-meta .site-link { color: var(--graphite); }
.doc-meta .repo-link:hover, .doc-meta .site-link:hover { color: var(--paper); text-decoration: underline; }

.prose .md a { text-decoration: underline; text-decoration-color: var(--dim); text-underline-offset: 3px; }
.prose .md a:hover { text-decoration-color: var(--paper); }
.prose h1, .prose h2 {
  font-family: var(--display);
  font-stretch: 112%;
  line-height: 1.15;
  letter-spacing: -0.015em;
  margin: 1.6em 0 0.5em;
}
.prose > h1:first-child, .prose .md > h1:first-child { margin-top: 0; }
.prose h1 { font-size: 34px; font-weight: 850; }
.prose h2 { font-size: 23px; font-weight: 750; padding-top: 0.6em; border-top: 1px solid var(--rule); }
.prose h3 { font-size: 17px; font-weight: 700; margin: 1.5em 0 0.4em; }
.prose h4 { font-size: 14.5px; font-weight: 700; margin: 1.3em 0 0.3em; }
.prose p { margin: 0.75em 0; color: #d9d9d3; }
.prose li { color: #d9d9d3; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0.75em 0; }
.prose li + li { margin-top: 0.35em; }
.prose strong { color: var(--paper); }
.prose blockquote {
  border-left: 3px solid var(--paper);
  padding: 2px 0 2px 18px;
  margin: 1em 0;
  color: var(--graphite);
}
.prose code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 1.5px 5px;
  border-radius: 3px;
}
.prose pre {
  background: var(--panel);
  border: 1px solid var(--rule);
  padding: 16px 18px;
  overflow-x: auto;
  margin: 1em 0;
}
.prose pre code { background: none; border: none; padding: 0; font-size: 12.5px; line-height: 1.55; color: #d9d9d3; }
.prose img { max-width: 100%; height: auto; }
.prose table {
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 13.5px;
  display: block;
  overflow-x: auto;
}
.prose th, .prose td { border: 1px solid var(--rule); padding: 8px 13px; text-align: left; }
.prose th {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite);
  background: var(--panel);
}
.prose hr { border: none; border-top: 1px solid var(--rule); margin: 2em 0; }

/* ---------- one load moment: the title stamps down ---------- */
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .hero { animation: stamp 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
  @keyframes stamp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
  }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .topnav { padding: 12px 20px; }
  .hero { padding: 44px 22px 40px; }
  h1.display { font-stretch: 112%; }
  .section-intro, .pick, .shelf, footer { padding-left: 22px; padding-right: 22px; }
  .pick { grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 32px; padding-bottom: 40px; }
  .pick:nth-of-type(even) .pick-art { order: 0; }
  .pick-art img { max-width: 300px; margin: 0; }
  .pitch { font-size: 19px; }
  .pick-name { overflow-wrap: anywhere; }
  .shelf { grid-template-columns: 1fr; gap: 4px; }
  .shelf-label { padding-top: 0; }
  .row { grid-template-columns: 1fr; gap: 2px; }
  footer { flex-direction: column; }
  .doc-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; border-right: none; border-bottom: 1px solid var(--rule); padding: 16px 0; }
  article.prose { padding: 32px 22px 64px; }
}

@media (max-width: 420px) {
  .topnav { flex-wrap: wrap; gap: 10px; }
  .topnav .logo { font-size: 14px; width: 100%; }
  .topnav nav { gap: 20px; }
}
