/* tedderland.com — light, typographic, code-forward.
 *
 * Design notes, so the next edit knows what it is working with:
 *
 * TYPE FIRST. This is a text-and-code site; typography is the whole impression,
 * so the budget goes there: a large comfortable measure, a real type scale, and
 * code that looks deliberate rather than tolerated.
 *
 * NO WEBFONT. A font request is a third-party dependency in the critical render
 * path, and this site's stated priority is robustness. Modern system stacks are
 * good enough that the trade is not close: nothing to fetch, nothing to fail,
 * no layout shift, no third party learning who reads the page.
 *
 * WARM NEUTRALS, NOT STARK WHITE. #fff against dark text is harsh over long
 * reading; a faint warm paper tone reads as considered. Text is near-black
 * rather than black for the same reason.
 *
 * ONE ACCENT, USED SPARINGLY. A single deep indigo carries links, the CTA and
 * the rules that mark structure. Colour means something here, so it is not
 * spent on decoration.
 */

:root {
  /* paper + ink */
  --bg:        #fbfaf8;
  --surface:   #ffffff;
  --surface-2: #f4f2ee;
  --text:      #14161a;
  --text-soft: #4a5058;
  --muted:     #6b7280;

  /* one accent */
  --accent:      #2f4bd8;
  --accent-deep: #1f34a3;
  --accent-wash: #eef1fd;

  --rule:      #e5e2dc;
  --rule-soft: #efece7;

  --code-bg:     #f7f5f1;
  --code-border: #e3dfd7;

  --radius: 10px;
  --radius-lg: 14px;

  --measure: 68ch;   /* comfortable reading line length */
  /* A FIXED counterpart to --measure, for elements whose font-size differs
   * from body copy. `ch` is relative to the element's OWN font, so 68ch on a
   * 1.6rem heading is ~1000px where the same token on a 1rem paragraph is
   * ~660px -- capping a heading with --measure aligns it with nothing. Use
   * --measure for body copy and this for anything that heads it. */
  --measure-fixed: 41rem;
  --shell:   1080px;

  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
          "Helvetica Neue", "Noto Sans", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code",
          "Source Code Pro", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---------- links ---------------------------------------------------- */

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-deep); text-decoration: underline; text-underline-offset: 2px; }
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ---------- header / footer ------------------------------------------ */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--rule);
  padding: 0 24px;
}
.site-header > * {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 16px 0;
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.site-header .brand {
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  font-size: 1.02rem;
}
.site-header .brand:hover { text-decoration: none; color: var(--accent); }
.site-header .proj-name {
  color: var(--muted);
  font-size: 0.95rem;
}
.site-header .proj-name::before {
  content: "/";
  color: var(--rule);
  margin-right: 12px;
}

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 80px;
  padding: 28px 24px 48px;
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer p { max-width: var(--shell); margin: 0 auto; }

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

.shell {
  max-width: var(--shell);
  margin: 0 auto;
  padding: 8px 24px 24px;
}

/* Prose is narrower than the shell: the shell exists so cards, code and
 * figures can breathe wider than the text they explain. */
.project .body > p,
.project .body > ul,
.project .body > ol,
.project .tagline,
.hero .bio,
.hero .eyebrow { max-width: var(--measure); }

/* ---------- headings ------------------------------------------------- */

h1, h2, h3 {
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 660;
  color: var(--text);
}

h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.1rem);
  margin: 40px 0 12px;
}

h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.6rem);
  margin: 64px 0 20px;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
}
/* The first heading after the lede should not carry a rule into the hero. */
.project .body > h2:first-child { border-top: 0; padding-top: 0; margin-top: 40px; }

h3 { font-size: 1.08rem; margin: 32px 0 8px; }

p { margin: 0 0 20px; }

/* ---------- project head --------------------------------------------- */

.project .tagline {
  font-size: 1.22rem;
  line-height: 1.55;
  color: var(--text-soft);
  margin: 0 0 8px;
  font-weight: 400;
}

.lede {
  font-size: 1.1rem;
  color: var(--text-soft);
}

/* ---------- the stats strip ------------------------------------------ */

.stats {
  list-style: none;
  margin: 36px 0;
  padding: 24px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 28px;
}
.stats li { margin: 0; }
.stats b {
  display: block;
  font-size: clamp(1.8rem, 3.4vw, 2.3rem);
  font-weight: 660;
  letter-spacing: -0.03em;
  color: var(--accent);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stats span {
  display: block;
  margin-top: 6px;
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--muted);
}

/* ---------- code ------------------------------------------------------
 * The hero content of a language site. A tinted panel, a hairline, and an
 * accent rule down the left so a block reads as a specimen rather than as an
 * indented paragraph. */

pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 24px 0;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.65;
  tab-size: 4;
}
pre code {
  font-family: var(--mono);
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: var(--text);
  white-space: pre;
}

/* inline code */
code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--rule-soft);
  border-radius: 5px;
  padding: 0.12em 0.36em;
  overflow-wrap: break-word;
}

/* Output/annotation under a code block: an aside, not body copy. */
.out {
  margin: -12px 0 28px;
  padding: 0 0 0 16px;
  border-left: 2px solid var(--rule);
  font-size: 0.94rem;
  color: var(--text-soft);
  max-width: var(--measure);
}
.out code { font-size: 0.84em; }

/* ---------- callouts -------------------------------------------------- */

.callout {
  background: var(--accent-wash);
  border: 1px solid #d7dcfa;
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin: 28px 0;
}
.callout p { margin: 0 0 12px; }
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--accent-deep); }

.note, .muted {
  color: var(--muted);
  font-size: 0.93rem;
}

/* ---------- figures --------------------------------------------------- */

.chart-demo {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin: 28px 0;
  overflow-x: auto;
}
.chart-demo svg { display: block; max-width: 100%; height: auto; }

.project .shot {
  margin: 24px 0 32px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--surface-2);
}
.project .shot img { width: 100%; height: auto; display: block; }

/* ---------- landing hero ---------------------------------------------- */

.hero { padding: 48px 0 8px; }
.hero .eyebrow {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-size: 0.76rem;
  font-weight: 600;
  margin: 0 0 14px;
}
.hero h1 { margin: 0 0 20px; }
.hero .bio p { color: var(--text-soft); font-size: 1.08rem; }
.hero .cta { margin-top: 28px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 550;
  font-size: 0.95rem;
  padding: 11px 22px;
  border-radius: 8px;
  transition: background .14s ease;
}
.btn:hover { background: var(--accent-deep); color: #fff; text-decoration: none; }

/* ---------- cards ------------------------------------------------------ */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  color: var(--text);
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}
.card:hover {
  text-decoration: none;
  border-color: #c9cdf0;
  box-shadow: 0 6px 22px rgba(20, 22, 26, 0.07);
  transform: translateY(-2px);
}
.card h3 { margin: 0 0 8px; font-size: 1.06rem; }
.card p {
  margin: 0 0 14px;
  color: var(--text-soft);
  font-size: 0.92rem;
  line-height: 1.6;
}
.card .lang {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-wash);
  border-radius: 999px;
  padding: 3px 11px;
}

.featured .feature-cards {
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
}
.card.feature { padding: 0; overflow: hidden; }
.card.feature .shot {
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
  margin: 0;
  border-radius: 0;
  border-left: 0; border-right: 0; border-top: 0;
}
.card.feature .shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card.feature .feature-body { padding: 20px 22px; }
.card.feature .feature-body h3 { margin: 0 0 8px; }

/* ---------- downloads --------------------------------------------------- */

.downloads { margin-top: 56px; }
.download-list { list-style: none; padding: 0; margin: 20px 0; }
.download-list li {
  border: 1px solid var(--rule);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 10px;
}

.repo-link { margin-top: 32px; }

/* ---------- lists ------------------------------------------------------- */

.project .body ul { padding-left: 22px; }
.project .body li { margin-bottom: 10px; }

/* ---------- tables (used by some project pages) ------------------------- */

table {
  border-collapse: collapse;
  width: 100%;
  margin: 24px 0;
  font-size: 0.93rem;
  display: block;
  overflow-x: auto;
}
th, td { border-bottom: 1px solid var(--rule); padding: 10px 12px; text-align: left; }
th { font-weight: 600; color: var(--text-soft); }

/* ---------- responsive -------------------------------------------------- */

@media (max-width: 640px) {
  body { font-size: 16px; }
  .shell { padding: 4px 18px 20px; }
  .site-header { padding: 0 18px; }
  .site-footer { padding: 24px 18px 40px; }
  .hero { padding: 32px 0 4px; }
  h2 { margin-top: 48px; }
  pre { padding: 14px 15px; font-size: 0.84rem; border-radius: 8px; }
  .stats { gap: 20px; padding: 20px 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover { transform: none; }
}

/* ---------- print ------------------------------------------------------- */

@media print {
  body { background: #fff; }
  .site-header, .site-footer, .cta { display: none; }
  pre { border-left-color: #999; }
  a { color: #000; text-decoration: underline; }
}

/* ---------- 2026-08-25 refinement pass ---------------------------------
 *
 * The first light version was clean but read as unfinished, and the cause
 * was layout rather than colour. Screenshotted at 1280 wide, three faults
 * accounted for nearly all of it:
 *
 *   1. RAGGED CARDS. `.card` was `display:block`, so a card's height was
 *      whatever its blurb happened to need and the language tags sat at
 *      different heights across a row. Four featured projects in a grid
 *      that fits three left one card alone beside two empty slots -- the
 *      single most visibly unfinished thing on the page.
 *   2. RULES WIDER THAN THE TEXT THEY DIVIDE. Prose is capped at
 *      `--measure` (~68ch) and section rules spanned `--shell` (1080px),
 *      so every heading rule overhung its own content by a third of the
 *      viewport and the page looked shoved against the left edge.
 *   3. FEATURED LOOKED LIKE EVERYTHING ELSE, so the word "Featured"
 *      carried no visual weight at all.
 */

/* 1. Cards are equal-height columns; the language tag is pinned to the
 *    bottom so tags line up across a row however long a blurb runs. */
.card,
.card .feature-body { display: flex; flex-direction: column; }
.card .feature-body { flex: 1 1 auto; }
.card > .lang,
.card .feature-body > .lang { margin-top: auto; align-self: flex-start; }
.card > p,
.card .feature-body > p { margin-bottom: 16px; }

/* 2. A rule that divides text should not be wider than the text. Section
 *    headings now measure with their content; the card grids keep the
 *    full shell, which is the one place the extra width is earned. */
.featured > h2,
.directory > h2 { max-width: var(--measure); }

/* 3. Featured is two-up and larger, so it reads as a promotion rather
 *    than as the same list twice. Four projects then make a tidy 2x2
 *    instead of a row of three and an orphan. */
.featured .feature-cards {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 22px;
}
.card.feature .feature-body { padding: 26px 28px; }
.card.feature .feature-body h3 { font-size: 1.22rem; }
.card.feature .feature-body p { font-size: 1rem; }

/* A quiet accent edge: enough to separate the promoted set from the
 * directory without spending colour on decoration. */
.card.feature { border-top: 2px solid var(--accent); }

/* 4. Depth. Flat borders alone read as a wireframe; a small resting
 *    shadow and a real lift on hover read as a surface. */
.card {
  box-shadow: 0 1px 2px rgba(20, 22, 26, 0.04);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(20, 22, 26, 0.10);
}

/* 5. The stats row on a project page had the same orphan problem: three
 *    figures in a grid that fits two. */
.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* 6. The hero was the last thing reading as unfinished: prose capped at
 *    ~68ch, left-aligned in a 1080px shell, left a third of the viewport
 *    empty beside it while the section rules below spanned the full width.
 *    Empty space on ONE side reads as a mistake; the same space split
 *    evenly reads as composition. So the hero block is centred while its
 *    text stays left-aligned and at its comfortable measure -- nothing
 *    about readability changes, only where the column sits. */
.hero { text-align: center; }
.hero .eyebrow,
.hero .bio { margin-left: auto; margin-right: auto; text-align: left; }
.hero h1 { text-align: center; }

/* The eyebrow was breaking mid-phrase ("... DATABASES — THE / SYSTEMS
 * OTHER SOFTWARE RUNS ON."). Give it the room to break at the dash. */
.hero .eyebrow {
  max-width: 62ch;
  text-align: center;
}

/* The call to action belongs under the centred column, not flush left. */
.hero .cta, .hero .button, .hero a.btn { margin-left: auto; margin-right: auto; }

/* 7. The eyebrow was still breaking mid-phrase, at "DATABASES — THE /
 *    SYSTEMS ...". It is uppercase with letter-spacing, so it occupies far
 *    more width than its character count suggests and the 62ch cap was
 *    cutting it. It fits the shell on one line; let it. */
.hero .eyebrow { max-width: none; }

/* 8. The header was a wordmark alone on a white strip -- structurally the
 *    weakest thing on the page, because it read as a placeholder rather
 *    than as the top of a site. It cannot gain links without a template
 *    change, so instead it earns its keep by BEHAVING like a header:
 *    it sticks, and it grows a hairline shadow once the page scrolls
 *    under it, which is the cue that tells a reader the chrome is real. */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  /* Slightly translucent so text passing beneath is felt, not hidden. */
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
}
@supports not (backdrop-filter: blur(1px)) {
  .site-header { background: var(--surface); }
}
.site-header .brand { letter-spacing: -0.01em; }

/* 9. A card whose blurb is short left a pocket of empty space under it,
 *    because the tag is pinned to the bottom of an equal-height column.
 *    Cap how far that can stretch so a terse project does not look like
 *    a card with something missing. */
.card.feature .feature-body p { margin-bottom: 18px; }
/* NOT `align-items: start` -- that was tried and reverted: letting cards
 * size to their own content brings back the uneven row this pass existed
 * to fix. A short blurb leaving a pocket above its tag is the lesser
 * fault, and it is the one every card grid worth copying accepts. */

/* 10. The same overhang on a project page. `h2` carries a `border-top`
 *     that spanned the shell while the prose beneath it sat at the
 *     measure -- so a heading rule crossed a third of the viewport with
 *     nothing under it, and the stats block right above it drew ITS rules
 *     at the text width. Two rule widths on one page is what makes a
 *     layout look accidental. Headings now measure with their prose; the
 *     card grids and code blocks still take the full shell, which is the
 *     width they actually use. */
.project .body > h2 { max-width: var(--measure); }

/* 11. ...and the fix above did not work, for a reason worth writing down.
 *     `--measure: 68ch` is relative to the FONT SIZE OF THE ELEMENT USING
 *     IT: 68ch on a 1rem paragraph is about 660px, but on a 1.6rem heading
 *     it is about 1000px. So capping a heading at `--measure` capped it at
 *     a completely different width from the prose it heads, which is why
 *     the rule still overhung after being "constrained".
 *
 *     Headings therefore measure in a FIXED unit chosen to match what the
 *     body text actually renders at, and `ch` is left to the place it is
 *     correct: body copy, where it tracks the reading measure as the font
 *     changes. */
.project .body > h2,
.featured > h2,
.directory > h2 { max-width: var(--measure-fixed); }

/* 12. The documentation index (`.doc-index`), and where the room for it
 *     came from. The shell is 1080px but prose caps at the measure --
 *     ~656px -- so every project page already carried about 370px of
 *     deliberate empty margin on the right. The index moves into space the
 *     design was leaving blank rather than taking any from the text: the
 *     prose column is unchanged at every width, which is why nothing above
 *     needed adjusting to make room.
 *
 *     DOM order is content-first and the index is PLACED into column two,
 *     not floated ahead of the body. That matters on a phone, where the
 *     grid collapses and source order is what a reader gets: a
 *     twenty-entry link list before the first paragraph would bury the
 *     page it is meant to serve.
 *
 *     Sticky, because the pages it appears on are long and an index you
 *     have to scroll back up to reach is a table of contents pretending to
 *     be navigation. `top` clears the sticky site header (57px) with a
 *     little air. */
.with-aside.has-aside {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  gap: 48px;
  align-items: start;
}
.with-aside.has-aside > .body { grid-column: 1; }

.doc-index {
  grid-column: 2;
  position: sticky;
  top: 73px;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
  overscroll-behavior: contain;
  font-size: 0.9rem;
  padding: 18px 4px 18px 20px;
  border-left: 1px solid var(--rule);
}
.doc-index h2 {
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
  padding: 0;
  border: 0;
  max-width: none;
}
.doc-index h3 {
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--text);
  margin: 20px 0 8px;
  padding: 0;
  border: 0;
}
.doc-index h3:first-of-type { margin-top: 0; }
.doc-index ul { list-style: none; margin: 0; padding: 0; }
.doc-index li { margin: 0 0 10px; line-height: 1.35; }
.doc-index a {
  display: block;
  font-weight: 550;
  color: var(--text);
  text-decoration: none;
  border-bottom: 0;
}
.doc-index a:hover { color: var(--accent); }
/* The blurb is the reason this is an index and not a menu: a reader
 * choosing between eight cookbooks needs to know which one answers their
 * question, and a bare filename does not say. */
.doc-index a span {
  display: block;
  font-weight: 400;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}
.doc-index a:hover span { color: var(--text-soft); }

/* Below the point where two columns stop paying for themselves, the index
 * becomes an ordinary block at the end of the prose -- unstuck, full
 * width, and no longer competing with the text for a narrow viewport. */
@media (max-width: 960px) {
  .with-aside.has-aside { display: block; }
  .doc-index {
    position: static;
    max-height: none;
    overflow: visible;
    margin-top: 48px;
    padding: 24px 0 0;
    border-left: 0;
    border-top: 1px solid var(--rule);
    max-width: var(--measure-fixed);
  }
}

/* A link list is navigation, not content: printing it wastes a page. */
@media print {
  .doc-index { display: none; }
}
