:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --ink: #1a1a1a;
  --muted: #5a5a5a;
  --line: #e3e1d8;
  --accent: #2b4a7a;
  --accent-soft: #e8eef6;
  --warn: #b06a2c;
  --max: 64rem;
  --gap: 1.5rem;
  --radius: 4px;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html { font-size: 17px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-serif);
  line-height: 1.2;
  margin: 0 0 0.5em;
  color: var(--ink);
}

h1 { font-size: 2.4rem; letter-spacing: -0.01em; }
h2 { font-size: 1.6rem; margin-top: 2.5rem; }
h3 { font-size: 1.2rem; margin-top: 1.5rem; }

p { margin: 0 0 1em; }

code, pre { font-family: var(--font-mono); font-size: 0.9rem; }
code { background: var(--accent-soft); padding: 0.05em 0.35em; border-radius: 3px; }
pre { background: #f1efe7; padding: 1rem; border-radius: var(--radius); overflow-x: auto; }
pre code { background: none; padding: 0; }

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

hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

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

.container { max-width: var(--max); margin: 0 auto; padding: 0 1.25rem; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}
.nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.nav a { color: var(--ink); text-decoration: none; font-size: 0.95rem; }
.nav a:hover { color: var(--accent); }
.nav a.active { color: var(--accent); }

.site-footer {
  border-top: 1px solid var(--line);
  margin-top: 4rem;
  padding: 2rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer .container { display: flex; flex-wrap: wrap; gap: 1.5rem; justify-content: space-between; }
.site-footer a { color: var(--muted); }

main { padding: 2rem 0 3rem; }

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

.hero {
  padding: 3rem 0 2rem;
}
.hero h1 {
  font-size: 2.6rem;
  max-width: 22ch;
}
.hero .sub {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 60ch;
  margin-bottom: 1.5rem;
}
.hero-figure {
  margin: 2rem 0;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.cta {
  display: inline-block;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--accent);
}
.cta-primary { background: var(--accent); color: #fff; }
.cta-primary:hover { background: #1f365b; }
.cta-secondary { background: transparent; color: var(--accent); }
.cta-secondary:hover { background: var(--accent-soft); }
.cta-caption {
  width: 100%;
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

/* ---- thumbnail strip ---- */

.thumb-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.thumb {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem;
  text-decoration: none;
  color: var(--ink);
  display: block;
}
.thumb:hover { border-color: var(--accent); }
.thumb svg { width: 100%; height: auto; }
.thumb-caption {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  margin-top: 0.5rem;
}

/* ---- triptych ---- */

.triptych {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 2rem;
  margin: 2rem 0;
}
.triptych h3 { margin-top: 0.5rem; }
.triptych p { color: var(--muted); margin: 0; }
.triptych .icon { width: 80px; height: 80px; }

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

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.lib-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
}
.lib-card.coming-soon {
  opacity: 0.6;
  background: transparent;
}
.lib-card h3 { margin-top: 0; font-family: var(--font-mono); font-size: 1.1rem; }
.lib-card .status {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.lib-card .status.released { color: var(--accent); }
.lib-card .status.unreleased { color: var(--warn); }
.langs { display: inline-flex; gap: 0.5rem; align-items: center; }
.lib-card .langs { display: flex; margin: 0.75rem 0; }
.langs img { height: 22px; width: auto; }
.lib-card .more { margin-top: auto; }

/* ---- ring-seq install badges ---- */

.install-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0 2rem;
}
.install-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--ink);
}
.install-badge:hover { border-color: var(--accent); }

/* ---- language code blocks side-by-side ---- */

.code-trio {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}
.code-trio figure { margin: 0; }
.code-trio figcaption {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

/* ---- blog ---- */

.post-list { list-style: none; padding: 0; }
.post-list li {
  border-bottom: 1px solid var(--line);
  padding: 1.25rem 0;
}
.post-list li:last-child { border-bottom: none; }
.post-meta { color: var(--muted); font-size: 0.85rem; margin: 0.25rem 0 0.5rem; }
.post-list h3 { margin: 0; }
.post-list h3 a { color: var(--ink); text-decoration: none; }
.post-list h3 a:hover { color: var(--accent); }

article.post header { margin-bottom: 2rem; }
article.post .post-meta { margin-bottom: 1rem; }

/* ---- notation page (sticky TOC) ---- */

.notation-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 900px) {
  .notation-layout { grid-template-columns: 12rem 1fr; }
}
.toc {
  font-size: 0.9rem;
  position: sticky;
  top: 1rem;
  align-self: start;
  border-left: 2px solid var(--line);
  padding-left: 1rem;
}
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { margin: 0.4rem 0; }
.toc a { color: var(--muted); text-decoration: none; }
.toc a:hover { color: var(--accent); }

.notation-figure {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 1rem;
  border-radius: var(--radius);
  margin: 1.5rem 0;
}
.notation-figure figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.5rem;
}

/* ---- audience bullets ---- */

.audience { padding-left: 1.25rem; }
.audience li { margin: 0.5rem 0; }

/* ---- editor page ---- */

.editor-logo {
  margin: 0 0 1.5rem;
}
.editor-logo img {
  max-width: 200px;
  height: auto;
}

.editor-screenshot {
  margin: 2rem 0;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.editor-screenshot img {
  max-width: 320px;
  margin: 0 auto;
}
.editor-screenshot figcaption {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

/* ---- editor guide (inline icons & keys) ---- */

.icon-inline {
  width: 1.1em;
  height: 1.1em;
  vertical-align: -0.18em;
  fill: currentColor;
  color: var(--accent);
  display: inline-block;
  margin: 0 0.15em;
}
kbd {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 3px;
  padding: 0.05em 0.45em;
  color: var(--ink);
  white-space: nowrap;
}

/* ---- placeholder note ---- */

.placeholder {
  border-left: 3px solid var(--warn);
  background: #fff7ed;
  padding: 0.75rem 1rem;
  margin: 1.5rem 0;
  font-size: 0.9rem;
  color: var(--muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}
