/* Research site house style v0 (first pass): a custom.css for Life Itself / SoR research sites on Flowershow.
   Brief: projects/2640-research-site-style.md. Built from the Claude Markdown previewer teardown
   (ux-patterns, "Claude Markdown previewer.md", 2edf79f): one sans for reading and headings, a 36em measure,
   hierarchy carried by space, warm greys with every border and fill a tint of the ink, one accent.
   The SoR touch: the page title in Restora and the "Built by Seeds of Renaissance" mark in the footer.
   Pair with house.js (footnote cards, contents rail), loaded through the site's head config.

   Deliberate differences from the viewer, which is a narrow app pane: body 16px not 15px; markdown h2 sits
   between the viewer's H1 and H2, since a page's sections are its top level. */

@import url("https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,400..650&family=JetBrains+Mono:wght@400;500&display=swap");

/* Restora, licensed (not tied to a domain): copy RestoraMedium/font.woff2 to the site's /fonts/Restora-Medium.woff2. */
@font-face { font-family: "Restora"; font-weight: 500; font-display: swap; src: url("/fonts/Restora-Medium.woff2") format("woff2"), url("../../fonts/restora/webfonts/RestoraMedium/font.woff2") format("woff2"); }

:root {
  --body: 16px;                        /* viewer: 15px in an app pane */
  --leading: 1.6;
  --measure: 36em;                     /* 36 × body: 576px, about 70 characters */
  --sans: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --title: "Restora", Georgia, serif;  /* the one SoR face in the page; set to var(--sans) for a plainer site */

  --ink: #0b0b0b;                      /* warm near-black */
  --ink-2: #52514e;                    /* secondary: captions, markers, notes */
  --ink-3: #898781;                    /* muted: read ticks, anchors */
  --accent: #184f95;                   /* links and the current tick: the only colour */
  --accent-bg: #e7f1fb;                /* the landing flash, the open footnote marker */
  --line: hsl(0 0% 4% / 10%);          /* every border is the ink at 10, 20 or 40% */
  --line-2: hsl(0 0% 4% / 20%);
  --line-3: hsl(0 0% 4% / 40%);
  --tint: hsl(0 0% 4% / 5%);           /* every fill is the ink at 5% */
  --tick: hsl(0 0% 4% / 25%);
  --paper: #fff;
  --gutter: clamp(1.25rem, 6vw, 4rem);

  /* Flowershow theme variables: one light look in both modes for now. */
  --color-l-background: var(--paper);
  --color-l-foreground: var(--ink);
  --color-l-accent: var(--accent);
  --color-d-background: var(--paper);
  --color-d-foreground: var(--ink);
  --color-d-accent: var(--accent);
  --font-heading: var(--sans);
  --font-body: var(--sans);
  --radius: 6px;
}

html { background: var(--paper); }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: var(--body); line-height: var(--leading); font-optical-sizing: auto; }
* { box-sizing: border-box; }
img { max-width: 100%; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ── Frame: navbar and footer, quiet ──────────────────────── */
.site-navbar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; max-width: 1120px; margin: 0 auto; padding: 18px var(--gutter); }
.site-navbar-site-title { font-family: var(--title); font-weight: 500; font-size: 20px; color: var(--ink); text-decoration: none; }
.site-navbar-links { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.site-navbar-link { font-size: 14px; color: var(--ink-2); text-decoration: none; }
.site-navbar-link:hover { color: var(--ink); }

.site-footer { max-width: calc(var(--measure) + 2 * var(--gutter)); margin: 4rem auto 0; padding: 1.5rem var(--gutter) 3rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; font-size: 13px; color: var(--ink-2); }
.site-footer-copyright { margin: 0; }
.sor-built { display: inline-flex; align-items: center; gap: 10px; color: var(--ink-2); text-decoration: none; font-size: 13px; }
.sor-built img { height: 26px; width: auto; display: block; }

/* ── Page header: fields, then the title ──────────────────── */
.page-main { container-type: inline-size; }
.page-header, .layout-inner { max-width: var(--measure); margin-inline: auto; box-sizing: content-box; padding-inline: var(--gutter); }
.page-header { padding-top: clamp(2rem, 6cqi, 3.5rem); }
.page-header-breadcrumbs { font-size: 13px; color: var(--ink-2); margin-bottom: 1.25rem; }
.page-header-breadcrumb-link { color: inherit; text-decoration: none; }
.page-header-breadcrumb-link:hover { color: var(--ink); }
.page-header-title { font-family: var(--title); font-weight: 500; font-size: clamp(30px, 5cqi, 40px); line-height: 1.12; letter-spacing: -0.012em; margin: 0 0 0.5em; text-wrap: balance; color: var(--ink); }
.page-header-description { font-size: 1.15em; line-height: 1.45; color: var(--ink-2); margin: 0 0 1.25em; text-wrap: balance; }
.sor-paper-meta { font-size: 13px; color: var(--ink-2); margin: 0; padding-bottom: 1.25em; border-bottom: 1px solid var(--line); }
.sor-paper-meta a { color: inherit; text-decoration-color: var(--line-3); text-underline-offset: 3px; }
.page-header-reading-time { white-space: nowrap; }

/* One column; the contents rail (house.js) replaces Flowershow's contents panel. */
.layout-inner { display: block; padding-bottom: 6rem; }
.layout-inner .toc { display: none; }

/* ── Prose ─────────────────────────────────────────────────── */
.rendered-mdx:not(.is-plain) { font-size: var(--body); line-height: var(--leading); max-width: none; overflow-wrap: break-word; padding-top: 2em; }
.rendered-mdx:not(.is-plain) :is(p, li, blockquote, figcaption) { text-wrap: pretty; }
.rendered-mdx:not(.is-plain) :is(h1, h2, h3, h4) { text-wrap: balance; color: var(--ink); font-family: var(--sans); letter-spacing: -0.01em; }
.rendered-mdx:not(.is-plain) > * { margin-block: 0; }
.rendered-mdx:not(.is-plain) > * + * { margin-block-start: 1em; }              /* the flow unit */

/* Same face, medium weights, sizes close to the body; space above grows with rank, two thirds of a line below. */
.rendered-mdx:not(.is-plain) h2 { font-size: 1.6em; line-height: 1.2; font-weight: 460; }
.rendered-mdx:not(.is-plain) h3 { font-size: 1.25em; line-height: 1.3; font-weight: 540; }
.rendered-mdx:not(.is-plain) h4 { font-size: 1.05em; line-height: 1.3; font-weight: 540; }
.rendered-mdx:not(.is-plain) * + h2 { margin-block-start: 2.75em; }
.rendered-mdx:not(.is-plain) * + h3 { margin-block-start: 2em; }
.rendered-mdx:not(.is-plain) * + h4 { margin-block-start: 1.667em; }
.rendered-mdx:not(.is-plain) :is(h2, h3, h4) + * { margin-block-start: 0.667em; }
.rendered-mdx:not(.is-plain) :is(h2, h3, h4) + :is(h3, h4) { margin-block-start: 0.9em; }
.rendered-mdx:not(.is-plain) :is(table, ul, ol, pre, figure) + * { margin-block-start: 1.5em; }

/* Heading anchor (house.js adds it): appears on hover, just after the text. */
.rendered-mdx .anchor { display: inline-flex; align-items: center; justify-content: center; width: 1.25rem; height: 1.25rem; margin-inline: 0.25rem -1.5rem; vertical-align: middle; color: var(--ink-3); text-decoration: none; border-radius: 4px; opacity: 0; font: 500 0.8em/1 var(--sans); }
.rendered-mdx :is(h2, h3, h4):hover .anchor, .rendered-mdx .anchor:focus-visible { opacity: 1; }
.rendered-mdx .anchor:hover { color: var(--ink); }
@media (hover: none) { .rendered-mdx .anchor { display: none; } }

/* Links: accent, always underlined, the underline lighter than the text. */
.rendered-mdx:not(.is-plain) a { color: var(--accent); font-weight: inherit; text-decoration-line: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); transition: text-decoration-color 60ms ease-out; }
.rendered-mdx:not(.is-plain) a:hover { text-decoration-color: currentColor; }
.rendered-mdx:not(.is-plain) :is(h2, h3, h4) a:not(.anchor) { color: inherit; text-decoration: none; }
.rendered-mdx:not(.is-plain) :is(strong, b) { font-weight: 600; }

.rendered-mdx:not(.is-plain) :is(ul, ol) { padding-inline-start: 2em; }
.rendered-mdx:not(.is-plain) li { padding-inline-start: 0.5em; }
.rendered-mdx:not(.is-plain) li + li { margin-block-start: 0.333em; }
.rendered-mdx:not(.is-plain) li::marker { color: var(--ink-2); }

/* Blockquotes stay in the argument: body colour and size, marked by a rule. */
.rendered-mdx:not(.is-plain) blockquote { margin-inline: 0; padding: 0 0 0 1.1em; border: 0; border-inline-start: 2px solid var(--line-3); font-style: normal; font-size: 1em; color: var(--ink); }
.rendered-mdx:not(.is-plain) blockquote p { margin: 0; }

.rendered-mdx:not(.is-plain) :not(pre) > code { font-family: var(--mono); font-size: calc(var(--body) - 2px); background: var(--tint); border: 0.5px solid var(--line-2); border-radius: 4px; padding: 0.12em 0.36em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.rendered-mdx:not(.is-plain) :not(pre) > code::before, .rendered-mdx:not(.is-plain) :not(pre) > code::after { content: none; }
.rendered-mdx:not(.is-plain) pre { font-family: var(--mono); font-size: calc(var(--body) - 2px); line-height: 1.54; background: var(--tint); border: 0.5px solid var(--line-2); border-radius: 9px; padding: 0.875rem; overflow-x: auto; tab-size: 2; color: var(--ink); }

/* Tables: thin outer border, tinted header, hairline rows, tabular figures; wide ones scroll. */
.rendered-mdx:not(.is-plain) table { display: block; max-width: 100%; overflow-x: auto; width: auto; border-collapse: separate; border-spacing: 0; border: 1px solid var(--line); border-radius: 6px; font-size: 0.9375em; line-height: 1.5; font-variant-numeric: tabular-nums lining-nums; }
.rendered-mdx:not(.is-plain) :is(th, td) { padding: 0.5em 0.875em; text-align: start; vertical-align: top; border: 0; }
.rendered-mdx:not(.is-plain) th { font-weight: 600; line-height: 1.3; vertical-align: bottom; background: var(--tint); box-shadow: inset 0 -1px var(--line); font-size: 1em; letter-spacing: 0; text-transform: none; color: var(--ink); }
.rendered-mdx:not(.is-plain) tbody tr + tr td { border-top: 1px solid var(--line); }

.rendered-mdx:not(.is-plain) hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.75em; }

/* Figures. */
.rendered-mdx .sor-fig { margin: 2em 0; }
.rendered-mdx .sor-fig img { display: block; width: 100%; height: auto; border-radius: 4px; }
.rendered-mdx .sor-fig figcaption { font-size: 0.875em; line-height: 1.5; color: var(--ink-2); margin-top: 0.6em; }

/* Callouts (> [!note]): a tinted box with a small heading, like the viewer's alerts. */
.rendered-mdx .callout { padding: 0.875em 1.1em; background: var(--tint); border: 0; border-inline-start: 2px solid var(--accent); border-radius: 0 6px 6px 0; }
.rendered-mdx .callout-title { font-weight: 600; font-size: 0.875em; color: var(--accent); margin-bottom: 0.25em; }
.rendered-mdx .callout-content p { margin: 0; }

/* Cite block. */
.rendered-mdx .sor-cite { margin-block-start: 3em; padding: 1em 1.1em; background: var(--tint); border-radius: 6px; font-size: 0.875em; }
.rendered-mdx .sor-cite .sor-label { font-weight: 600; color: var(--ink); margin: 0 0 0.25em; }
.rendered-mdx .sor-cite p { margin: 0; overflow-wrap: anywhere; }

/* ── Footnotes: small markers, a quiet section at the end; house.js opens them as cards ── */
.rendered-mdx sup { font-size: 0.75em; line-height: 0; }
.rendered-mdx sup a[data-footnote-ref] { color: var(--ink-2) !important; text-decoration-color: var(--line-3) !important; padding-inline: 0.15em; border-radius: 3px; font-weight: 500; }
.rendered-mdx sup a[aria-expanded="true"] { background: var(--accent-bg); }
.rendered-mdx .footnotes { margin-block-start: 3em; padding-block-start: 1em; border-top: 1px solid var(--line); font-size: 0.875em; color: var(--ink-2); }
.rendered-mdx .footnotes ol { margin: 0; padding-inline-start: 1.5em; }
.rendered-mdx .footnotes li + li { margin-block-start: 0.5em; }
.rendered-mdx .footnotes a { color: var(--ink-2); overflow-wrap: anywhere; }
.rendered-mdx .landed { animation: landed 1.6s ease-out; border-radius: 3px; }
@keyframes landed { from { background: var(--accent-bg); } to { background: transparent; } }
@media (prefers-reduced-motion: reduce) { .rendered-mdx .landed { animation: none; } }

.fn-pop { position: absolute; z-index: 20; width: 20rem; max-width: calc(100vw - 2rem); padding: 1rem; display: flex; flex-direction: column; align-items: flex-start; gap: 0.5rem; background: var(--paper); color: var(--ink); border: 0.5px solid var(--line-2); border-radius: 10px; box-shadow: 0 4px 20px hsl(0 0% 0% / 10%), 0 1px 3px hsl(0 0% 0% / 8%); font: 15px/1.55 var(--sans); }
.fn-pop p { margin: 0; overflow-wrap: anywhere; }
.fn-pop a { color: var(--accent); text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
.fn-pop button { font: 500 13px/1 var(--sans); color: var(--ink-2); background: none; border: 0; border-radius: 6px; padding: 6px 8px; margin: 0 -8px -6px; cursor: pointer; }
.fn-pop button:hover { background: var(--tint); color: var(--ink); }

/* ── Contents: a rail of ticks in the left gutter; hover opens the outline (house.js) ── */
.rail { position: fixed; top: 5rem; z-index: 5; font-family: var(--sans); }
.rail[hidden] { display: none; }
.rail .ticks { list-style: none; margin: 0; padding: 6px 0 6px 6px; width: 2rem; display: flex; flex-direction: column; }
.rail .ticks li { flex: 0 0 8px; display: flex; align-items: center; }
.rail .ticks span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--tick); transform-origin: 0; scale: 0.78 1; }
.rail .ticks li[data-level="1"] span { translate: 3px; scale: 0.5 1; }
.rail .ticks li[data-read] span { background: var(--ink-3); }
.rail .ticks li[data-current] span { background: var(--accent); translate: 0; scale: 1 1.5; }
.rail .outline { position: absolute; top: 0; left: -4px; width: 17rem; max-height: calc(100vh - 7rem); overflow-y: auto; padding: 5px 4px; border-radius: 8px; background: var(--paper); border: 0.5px solid var(--line-2); box-shadow: 0 4px 20px hsl(0 0% 0% / 10%); opacity: 0; visibility: hidden; transition: opacity 0.15s ease-out, visibility 0.15s; }
.rail:hover .outline, .rail:focus-within .outline { opacity: 1; visibility: visible; }
.rail .outline ol { list-style: none; margin: 0; padding: 0; }
.rail .outline button { width: 100%; min-height: 1.5rem; display: flex; align-items: center; gap: 8px; padding: 2px 8px 2px 6px; font: 13px/1.25 var(--sans); color: var(--ink-2); background: none; border: 0; border-radius: 6px; text-align: start; cursor: pointer; }
.rail .outline button:hover { background: var(--tint); color: var(--ink); }
.rail .outline .t { flex: none; width: 18px; display: flex; align-items: center; }
.rail .outline .t::before { content: ""; display: block; width: 14px; height: 2px; border-radius: 2px; background: var(--tick); }
.rail .outline li[data-level="1"] .t::before { width: 9px; margin-inline-start: 3px; }
.rail .outline li[data-read] .t::before { background: var(--ink-3); }
.rail .outline li[data-current] .t::before { background: var(--accent); width: 18px; height: 3px; margin: 0; }
.rail .outline li[data-current] button { color: var(--ink); font-weight: 500; }
.rail .outline .x { flex: 1; min-width: 0; }
.rail .outline li[data-level="1"] .x { padding-inline-start: 0.625rem; }

/* Below the rail's width: contents as an inline, collapsible block under the header (house.js). */
.inline-toc { margin-top: 1.5em; font-size: 14px; border: 1px solid var(--line); border-radius: 6px; }
.inline-toc summary { cursor: pointer; padding: 0.6em 0.9em; color: var(--ink-2); font-weight: 500; }
.inline-toc ol { list-style: none; margin: 0; padding: 0 0.9em 0.75em; }
.inline-toc li { margin-block: 0.35em; }
.inline-toc li[data-level="1"] { padding-inline-start: 1em; color: var(--ink-2); }
.inline-toc a { color: inherit; text-decoration: none; }
.inline-toc a:hover { color: var(--accent); }
.inline-toc[hidden] { display: none; }

@media print { .rail, .inline-toc, .fn-pop, .anchor { display: none !important; } }
