:root {
  /* the ANSI FORTRAN 77 (X3.9-1978) cover — faded sage-green, on pale green-cream paper */
  --bg: #20281c;            /* dark forest surround (the desk) framing the page */
  --paper: #f1f0e2;         /* the manual page — pale cream with a green cast */
  --panel: #e9ebd9;         /* hero band — faint celadon */
  --panel-soft: #e0e4cd;    /* feature-strip / table-head band — deeper celadon */
  --ink: #272a20;           /* body text — warm green-black */
  --ink-bright: #191c13;    /* headings — darkest ink */
  --ink-soft: #66684f;      /* secondary text — muted olive-grey */
  --line: #c6cdac;          /* faint sage paper rule */
  --accent: #4f6147;        /* faded sage green — the brand / masthead / accents */
  --accent-strong: #3d4f36; /* deeper green — links, hover */
  --gold: #b07a2b;          /* muted brass — focus ring, the author line (complements green) */
  --stamp: #ed2939;         /* the "beta" rubber stamp — bright stamp red (pops by hue on green) */
  --code: #e6e8d6;          /* code block — an inset pale celadon panel */
  --shadow: 0 18px 50px rgba(20, 28, 18, .35);
  --content: 76rem;
  --font-body: "Aptos", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-code: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-body);
  line-height: 1.6;
}

a {
  color: var(--accent-strong);
  text-underline-offset: .18em;
}

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

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

code,
pre {
  font-family: var(--font-code);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -5rem;
  z-index: 20;
  padding: .7rem 1rem;
  color: var(--paper);
  background: var(--accent);
  border-radius: .45rem;
  font-weight: 800;
}

.skip-link:focus {
  top: 1rem;
}

.page-shell {
  width: min(calc(100% - 1.5rem), var(--content));
  margin: 1.2rem auto;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 3vw, 2rem);
  background: var(--accent);            /* sage-green masthead — the white-on-green cover look */
  border-bottom: 1px solid #36422f;
}

.site-header--compact {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(79, 97, 71, .95);
  backdrop-filter: blur(10px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  color: var(--paper);                  /* cream wordmark on the green masthead */
  text-decoration: none;
  font-weight: 800;
}

.brand:hover {
  color: var(--paper);                  /* stay cream -- the generic a:hover (green) would
                                           vanish into the green masthead */
  opacity: .85;                         /* subtle dim as the hover affordance instead */
}

.brand__icon {
  width: 2.3rem;
  height: 2.3rem;
}

.brand__name {
  font-size: 1.08rem;
}

/* "beta" status stamp next to the brand, on every page (site.json -> "status") --
   a tilted, bright-red, inked rubber-stamp look: outlined box, no fill. */
.brand__badge {
  display: inline-block;
  margin-left: .6rem;
  padding: .12rem .4rem;
  border: 2.5px solid var(--stamp);
  border-radius: 3px;
  background: transparent;
  color: var(--stamp);
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  transform: rotate(-8deg);
  transform-origin: center;
  opacity: 1;
  vertical-align: middle;
}

.top-nav {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .85rem;
  font-weight: 700;
}

.top-nav a {
  color: rgba(241, 240, 226, .85);      /* cream nav on the green masthead */
  text-decoration: none;
}

.top-nav a:hover {
  color: var(--gold);
}

.hero {
  min-height: 33rem;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(20rem, .95fr);
  gap: clamp(2.5rem, 5vw, 5.5rem);
  align-items: center;
  padding: clamp(2rem, 5vw, 5rem) clamp(1rem, 4vw, 4rem);
  color: var(--ink-bright);
  background: var(--panel);
}

.eyebrow {
  margin: 0 0 .7rem;
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .78rem;
}

.hero h1 {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0;
}

/* the small qualifier under the headline (the dialects line) */
.hero__sub {
  display: block;
  margin-top: .55rem;
  font-size: clamp(.85rem, 1.5vw, 1rem);
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.35;
}

.hero__lede {
  max-width: 42rem;
  color: var(--ink-soft);
  font-size: 1.14rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.4rem;
}

.hero__attr {
  margin: 1rem 0 1.3rem;
}

.hero__attr p {
  margin: 0;
  font-size: .85rem;
  color: var(--ink-soft);
}

.hero__attr p:first-child {        /* the author line — the promotional one */
  font-size: .9rem;
  font-weight: 700;
  color: var(--gold);
  margin-bottom: .15rem;
}

/* keep a personal name (the author line) from breaking mid-name across a wrap */
.nowrap {
  white-space: nowrap;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: .72rem 1rem;
  border: 1px solid rgba(79, 97, 71, .4);
  color: var(--ink-bright);
  text-decoration: none;
  font-weight: 800;
}

.button--primary {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}

.hero__visual {
  position: relative;
  padding: 1.2rem;
  border: 1px solid rgba(79, 97, 71, .18);
  background: rgba(79, 97, 71, .04);
}

.flow {
  display: grid;
  gap: .5rem;
}

.flow__node {
  border: 1px solid rgba(79, 97, 71, .25);
  background: rgba(79, 97, 71, .06);
  padding: .8rem 1rem;
  text-align: center;
}

.flow__node span {
  display: block;
  color: var(--accent);
  font-size: .72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.flow__node strong {
  display: block;
  margin-top: .2rem;
  color: var(--ink-bright);
  font-size: 1rem;
  font-family: var(--font-code);
}

/* implementation-design note under each stage (tree-walker / AST / etc.) — muted, monospace */
.flow__node .flow__tech {
  display: block;
  margin-top: .35rem;
  color: var(--ink-soft);
  font-size: .66rem;
  font-family: var(--font-code);
  line-height: 1.35;
}

.flow__node--hub {
  border-color: var(--accent);
  background: rgba(79, 97, 71, .12);
}

.flow__arrow {
  text-align: center;
  color: var(--accent);
  font-size: 1.1rem;
  line-height: 1;
}

.flow__fan {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: .4rem;
  margin-top: .4rem;
}

.flow__fan span {
  display: grid;
  place-items: center;
  min-height: 3rem;
  border: 1px solid rgba(79, 97, 71, .3);
  color: var(--ink-bright);
  font-weight: 800;
  font-size: .78rem;
  font-family: var(--font-code);
}

.feature-strip,
.docs-panel {
  padding: clamp(1.5rem, 4vw, 3.5rem) clamp(1rem, 4vw, 4rem);
}

.feature-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
}

.feature-strip article,
.doc-card {
  border: 1px solid var(--line);
  background: var(--paper);
  padding: 1.1rem;
}

.feature-strip h2,
.doc-card h3 {
  margin: 0 0 .45rem;
  font-size: 1.05rem;
  color: var(--ink-bright);
}

.feature-strip p,
.doc-card p {
  margin: 0;
  color: var(--ink-soft);
}

.section-heading h2 {
  margin: 0 0 1.2rem;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.06;
  color: var(--ink-bright);
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
}

.doc-card__link {
  display: inline-block;
  margin-top: .9rem;
  font-weight: 800;
  color: var(--accent);
}

.docs-layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 4.8rem;
  max-height: calc(100vh - 5rem);
  overflow: auto;
  padding: 1rem;
  border-right: 1px solid var(--line);
}

.docs-sidebar__eyebrow {
  margin: 0 0 .75rem;
  color: var(--accent);
  font-weight: 900;
  text-transform: uppercase;
  font-size: .75rem;
}

.docs-article {
  min-width: 0;
  padding: clamp(1.2rem, 4vw, 3.5rem);
}

.docs-article__header {
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.5rem;
}

.docs-article h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 1;
  color: var(--ink-bright);
}

.docs-article__summary {
  max-width: 48rem;
  color: var(--ink-soft);
  font-size: 1.08rem;
}

.docs-article__source {
  margin: .5rem 0 0;
  color: var(--ink-soft);
  font-size: .9rem;
}

/* Left-rail "On this page" section nav. */
.section-nav__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: .1rem;
}

.section-nav__link {
  display: block;
  padding: .35rem .55rem;
  border-left: 2px solid transparent;
  color: var(--ink);
  text-decoration: none;
  font-size: .9rem;
  line-height: 1.3;
}

.section-nav__link--l3 {
  padding-left: 1.5rem;
  font-size: .84rem;
  color: var(--ink-soft);
}

.section-nav__link:hover {
  color: var(--accent);
}

.section-nav__link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--panel-soft);
}

/* Left-rail manual TOC: every chapter (L1), with the current chapter's in-page sections
   (the H2/H3 list) nested beneath it (L2). The rail header (docs-sidebar__eyebrow) links to
   the manual landing. */
.chapter-nav,
.chapter-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chapter-nav__home {
  color: inherit;            /* keep the eyebrow's accent for the manual-title header link */
  text-decoration: none;
}

.chapter-nav__home:hover {
  text-decoration: underline;
}

.chapter-nav__link {                 /* a chapter reads as a bold, dark heading row */
  display: block;
  padding: .4rem .55rem;
  border-left: 2px solid transparent;
  color: var(--ink-bright);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 600;
  line-height: 1.3;
}

.chapter-nav__link:hover {
  color: var(--accent);
}

.chapter-nav__link.is-active {
  color: var(--accent);
  border-left-color: var(--accent);
  background: var(--panel-soft);
  font-weight: 700;
}

/* the current chapter's sections, nested under it -- clearly subordinate: indented from the
   chapter, lighter, smaller, normal weight, with a connecting hairline */
.chapter-nav .section-nav__list {
  margin: .15rem 0 .65rem 1.15rem;
  padding-left: .55rem;
  border-left: 1px solid var(--line);
}

.chapter-nav .section-nav__link {
  padding: .2rem .5rem;
  font-size: .8rem;
  font-weight: 400;
  color: var(--ink-soft);
}

.chapter-nav .section-nav__link.is-active {
  background: none;                  /* don't echo the chapter's active block on sub-rows */
}

.prose [id] {
  scroll-margin-top: 5.5rem;  /* clear the sticky header when jumping to an anchor */
}

.prose {
  max-width: 54rem;
}

.prose h2 {
  margin-top: 2rem;
  font-size: 1.75rem;
  line-height: 1.14;
  color: var(--ink-bright);
}

.prose h3 {
  margin-top: 1.5rem;
  font-size: 1.22rem;
  color: var(--ink-bright);
}

.prose p,
.prose li {
  color: var(--ink);
}

.prose a {
  color: var(--accent-strong);
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: .94rem;
  display: block;
  overflow-x: auto;
}

.prose th,
.prose td {
  border: 1px solid var(--line);
  padding: .55rem .65rem;
  vertical-align: top;
}

.prose th {
  background: var(--panel-soft);
  color: var(--ink-bright);
  text-align: left;
}

.prose pre {
  overflow-x: auto;
  padding: 1rem;
  background: var(--code);
  color: var(--ink);
  border: 1px solid var(--line);
}

.prose code {
  font-size: .92em;
}

.prose :not(pre) > code {
  padding: .1rem .25rem;
  background: rgba(79, 97, 71, .1);
  color: var(--accent-strong);
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.25rem 0;
  border: 1px solid var(--line);
  border-radius: 3px;
}

@media (max-width: 900px) {
  .hero,
  .feature-strip {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 0;
  }
}

/* The docs chapter rail stays a left sidebar down to a much narrower width than the hero
   needs; only on a phone-width / very narrow pane does it stack on top. */
@media (max-width: 640px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: static;
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: 100%;
    margin: 0;
    border-left: 0;
    border-right: 0;
  }

  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hero h1 {
    font-size: 1.9rem;
  }

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

/* Breadcrumb trail (a band below the header on doc / page views) */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem clamp(1rem, 3vw, 2rem);
  border-bottom: 1px solid var(--line);
  font-size: .82rem;
  color: var(--ink-soft);
}

.breadcrumbs a {
  color: var(--ink-soft);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent);
}

.breadcrumbs [aria-current="page"] {
  color: var(--ink);
}

.breadcrumbs__sep {
  color: var(--line);
}

/* Copyright footer (foot of the page-shell card, on every page) */
.site-footer {
  padding: 1.25rem clamp(1rem, 3vw, 2rem);
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: .82rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

.site-footer__attr {
  margin-top: .55rem !important;
  font-size: .76rem;
  line-height: 1.5;
  opacity: .8;
}

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

.site-footer a:hover {
  color: var(--accent);
}
