/* ==========================================================================
   Better RPC guides: shared stylesheet
   Tokens mirror docs/DESIGN.md (Neo-Brutalist Arcade). Mobile-first, dark.
   Linked by public/guides/index.html and every public/guides/<slug>/index.html.
   ========================================================================== */

:root {
  --blurple: #5865f2;
  --green: #35ed7e;
  --magenta: #ec48bd;
  --yellow: #fee75c;
  --red: #ed4245;
  --cyan: #00b0f4;

  --canvas: #23272a;
  --surface-indigo: #1e2353;
  --surface-black: #000000;

  --ink: #ffffff;
  --ink-soft: #e0e3f5;
  --ink-dark: #000000;

  --border: 3px solid #000000;
  --shadow: 6px 6px 0 #000000;
  --shadow-sm: 4px 4px 0 #000000;
  --shadow-hover: 2px 2px 0 #000000;

  --r-xs: 6px;
  --r-sm: 12px;
  --r-lg: 16px;

  --font-display: "Space Grotesk", "Bahnschrift", "DIN Alternate", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "JetBrains Mono", "Fira Code", Consolas, monospace;

  --nav-height: 64px;
  --container-max: 1100px;
  --measure: 68ch;
}

/* ---------- Reset and base ---------- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 16px);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  background-color: var(--canvas);
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 2px, transparent 2px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  /* Keep fallback fonts the same visual size while the web font loads (no layout shift). */
  font-size-adjust: from-font;
  overflow-x: clip;
}

img,
svg {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: var(--cyan);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

a:hover {
  color: var(--yellow);
}

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

.btn:focus-visible,
.site-footer :focus-visible {
  outline-color: var(--ink-dark);
}

::selection {
  background: var(--yellow);
  color: var(--ink-dark);
}

.skip-link {
  position: absolute;
  top: -120px;
  left: 16px;
  z-index: 999;
  background: var(--yellow);
  color: var(--ink-dark);
  font-family: var(--font-display);
  font-weight: 800;
  text-transform: uppercase;
  text-decoration: none;
  padding: 12px 18px;
  border: var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
}

.skip-link:focus {
  top: 16px;
  color: var(--ink-dark);
}

.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 16px;
}

.container--narrow {
  max-width: var(--measure);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.875rem;
  line-height: 1.1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  border: var(--border);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.btn:hover {
  transform: translate(2px, 2px);
  box-shadow: var(--shadow-hover);
}

.btn:active {
  transform: translate(4px, 4px);
  box-shadow: 0 0 0 var(--ink-dark);
}

.btn--green {
  background: var(--green);
  color: var(--ink-dark);
}

.btn--green:hover {
  color: var(--ink-dark);
}

.btn--white {
  background: var(--ink);
  color: var(--ink-dark);
}

.btn--white:hover {
  color: var(--ink-dark);
}

.btn--blurple {
  background: var(--blurple);
  color: var(--ink);
}

.btn--blurple:hover {
  color: var(--ink);
}

/* ---------- Header and navigation ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--canvas);
  border-bottom: var(--border);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  min-height: var(--nav-height);
  padding-top: 8px;
  padding-bottom: 8px;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
  min-height: 44px;
}

.nav__brand:hover {
  color: var(--ink);
}

.nav__brand img {
  width: 36px;
  height: 36px;
  border-radius: var(--r-xs);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.875rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink);
}

.nav__link:hover,
.nav__link[aria-current="page"] {
  color: var(--yellow);
}

/* ---------- Breadcrumb ---------- */

.breadcrumb {
  padding-top: 20px;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  list-style: none;
}

.breadcrumb li + li::before {
  content: "/";
  margin-right: 8px;
  color: var(--ink-soft);
}

.breadcrumb a {
  color: var(--ink-soft);
}

.breadcrumb a:hover {
  color: var(--yellow);
}

/* ---------- Article layout ---------- */

.article {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.article > * + * {
  margin-top: 1.1em;
}

.eyebrow {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  background: var(--yellow);
  color: var(--ink-dark);
  border: var(--border);
  border-radius: var(--r-xs);
  box-shadow: var(--shadow-sm);
  transform: rotate(-2deg);
}

.article h1,
.hub h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.875rem, 7vw, 2.875rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 var(--ink-dark);
  margin-top: 0.7em;
  text-wrap: balance;
}

.article h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.5rem, 4.5vw, 1.875rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  text-transform: uppercase;
  margin-top: 2.2em;
  padding-top: 0.5em;
  border-top: var(--border);
  text-wrap: balance;
}

.article h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.25;
  margin-top: 1.7em;
  color: var(--yellow);
}

.article h2 + *,
.article h3 + * {
  margin-top: 0.7em;
}

.lead {
  font-size: 1.1875rem;
  line-height: 1.55;
  font-weight: 500;
  color: var(--ink-soft);
}

.lead strong {
  color: var(--ink);
}

.meta {
  font-size: 0.875rem;
  color: var(--ink-soft);
}

.article p,
.article li {
  overflow-wrap: break-word;
}

.article strong {
  font-weight: 700;
}

.article ul,
.article ol {
  padding-left: 1.4em;
}

.article li + li {
  margin-top: 0.45em;
}

.article li::marker {
  color: var(--yellow);
  font-weight: 700;
}

/* ---------- Table of contents ---------- */

.toc {
  background: var(--surface-indigo);
  border: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
}

.toc__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow);
}

.toc ol {
  margin-top: 8px;
  padding-left: 1.4em;
}

.toc a {
  color: var(--ink);
}

.toc a:hover {
  color: var(--yellow);
}

/* ---------- Code ---------- */

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

:not(pre) > code {
  background: var(--surface-indigo);
  color: var(--yellow);
  padding: 0.1em 0.4em;
  border-radius: 4px;
  overflow-wrap: anywhere;
}

kbd {
  background: var(--ink);
  color: var(--ink-dark);
  padding: 0.1em 0.45em;
  border: 2px solid var(--ink-dark);
  border-radius: 4px;
  box-shadow: 2px 2px 0 var(--ink-dark);
}

pre {
  background: var(--surface-black);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
}

pre code {
  font-size: inherit;
  color: inherit;
  background: none;
}

pre:focus-visible {
  outline: 3px solid var(--yellow);
}

/* ---------- Callouts ---------- */

.callout {
  border: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 18px;
  background: var(--yellow);
  color: var(--ink-dark);
}

.callout__title {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.callout code,
.callout :not(pre) > code {
  background: rgba(0, 0, 0, 0.12);
  color: var(--ink-dark);
}

.callout a {
  color: var(--ink-dark);
}

.callout--note {
  background: var(--surface-indigo);
  color: var(--ink);
}

.callout--note :not(pre) > code {
  background: rgba(0, 0, 0, 0.35);
  color: var(--yellow);
}

.callout--note a {
  color: var(--cyan);
}

.callout--warn {
  background: var(--magenta);
  color: var(--ink-dark);
}

/* ---------- Chips (short lists of names) ---------- */

.article .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
}

.article .chips li {
  margin: 0;
  padding: 4px 12px;
  background: var(--surface-indigo);
  border: 2px solid var(--ink-dark);
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
}

/* ---------- Figures ---------- */

.figure {
  margin-top: 1.6em;
}

.figure img {
  border: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  background: var(--surface-black);
}

.figure--tall img {
  max-width: min(100%, 320px);
  margin-inline: auto;
}

.figure figcaption {
  margin-top: 14px;
  font-size: 0.875rem;
  color: var(--ink-soft);
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  border: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9375rem;
}

th,
td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 2px solid var(--ink-dark);
}

th {
  background: var(--surface-indigo);
  font-family: var(--font-display);
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

/* ---------- FAQ ---------- */

.faq {
  display: grid;
  gap: 14px;
}

.faq__item {
  background: var(--surface-indigo);
  border: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
}

.article .faq h3 {
  margin-top: 0;
  font-size: 1.125rem;
  color: var(--ink);
}

.faq__item p {
  margin-top: 8px;
}

/* ---------- Related guides and hub cards ---------- */

.guide-grid {
  display: grid;
  gap: 18px;
  list-style: none;
  padding: 0;
}

.article .guide-grid {
  padding: 0;
}

.article .guide-grid li + li {
  margin-top: 0;
}

.guide-card {
  display: block;
  height: 100%;
  background: var(--surface-indigo);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  text-decoration: none;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.guide-card:hover {
  color: var(--ink);
  transform: translate(4px, 4px);
  box-shadow: var(--shadow-hover);
}

.guide-card:active {
  transform: translate(6px, 6px);
  box-shadow: 0 0 0 var(--ink-dark);
}

.guide-card__title {
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1875rem;
  line-height: 1.2;
  text-transform: uppercase;
}

.guide-card__text {
  display: block;
  margin-top: 8px;
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.guide-card__more {
  display: inline-block;
  margin-top: 12px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8125rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--yellow);
}

.hub {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 24px 16px 56px;
}

.hub__lead {
  max-width: var(--measure);
  margin-top: 1em;
}

.hub .guide-grid {
  margin-top: 32px;
}

/* ---------- CTA band ---------- */

.cta-band {
  background: var(--blurple);
  color: var(--ink);
  border: var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}

.cta-band p {
  font-weight: 500;
}

.cta-band .btn {
  margin-top: 14px;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--yellow);
  color: var(--ink-dark);
  border-top: var(--border);
  padding: 32px 0 28px;
}

.site-footer a {
  color: var(--ink-dark);
  font-weight: 600;
}

.site-footer a:hover {
  color: var(--ink-dark);
  text-decoration-thickness: 4px;
}

.footer__top {
  display: grid;
  gap: 24px;
}

.footer__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.125rem;
  text-transform: uppercase;
}

.footer__brand img {
  width: 34px;
  height: 34px;
  border-radius: var(--r-xs);
}

.footer__desc {
  margin-top: 10px;
  max-width: 44ch;
  font-size: 0.9375rem;
  line-height: 1.5;
}

.footer__cols {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
}

.footer__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.footer__list {
  list-style: none;
}

.footer__list li + li {
  margin-top: 4px;
}

.footer__list a {
  display: inline-block;
  padding: 6px 0;
}

.footer__bottom {
  display: grid;
  gap: 4px;
  margin-top: 28px;
  padding-top: 16px;
  border-top: var(--border);
  font-size: 0.8125rem;
}

/* ---------- Wider screens ---------- */

@media (min-width: 640px) {
  .container {
    padding: 0 28px;
  }

  .article,
  .hub {
    padding-left: 28px;
    padding-right: 28px;
  }

  .nav__link {
    padding: 0 14px;
  }

  .btn {
    font-size: 0.9375rem;
    padding: 10px 22px;
  }

  .guide-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .figure--tall img {
    max-width: 340px;
  }
}

@media (min-width: 900px) {
  body {
    font-size: 1.125rem;
  }

  .footer__top {
    grid-template-columns: 1.2fr 1fr;
    align-items: start;
  }

  .footer__bottom {
    grid-template-columns: 1fr auto;
  }

  .hub .guide-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- Narrow phones: keep the nav on one row ---------- */

@media (max-width: 420px) {
  .nav__brand span {
    display: none;
  }
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .btn:hover,
  .btn:active,
  .guide-card:hover,
  .guide-card:active {
    transform: none;
  }
}

/* Long-form text: avoid orphans and ragged endings. */
.article p,
.article li,
.faq__item p {
  text-wrap: pretty;
}
