/* cbell.dev — page-level styles layered on design/styles.css + components.css */

html, body { margin: 0; padding: 0; }
* { box-sizing: border-box; }

.cb-page {
  min-height: 100vh;
  background: var(--surface-page);
  font-family: var(--font-sans);
  color: var(--text-body);
}

a { color: inherit; }

/* Floating bar (blog pages) */
.floating-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  transform: translateY(-105%);
  transition: transform .25s ease;
  background: color-mix(in srgb, var(--surface-page) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-hairline);
}
.floating-bar.is-visible { transform: translateY(0); }
.floating-bar-inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 32px;
  height: 46px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mark-lockup { display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.mark-lockup .cb-mark { font-size: 14px; }
.mark-name { font-weight: 600; font-size: 14px; letter-spacing: -0.02em; color: var(--text-heading); }

.nav-mono, .masthead-nav, .site-bar-nav {
  display: flex;
  font-family: var(--font-mono);
}
.nav-mono { gap: 18px; font-size: 11px; }
.masthead-nav { gap: 22px; font-size: 12px; }
.site-bar-nav { gap: 20px; font-size: 11px; }

.nav-mono-link, .masthead-nav-link, .site-bar-nav-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color .15s ease;
}
.nav-mono-link:hover, .masthead-nav-link:hover, .site-bar-nav-link:hover { color: var(--accent); }
.nav-mono-link.is-active, .masthead-nav-link.is-active, .site-bar-nav-link.is-active { color: var(--accent); }

/* Blog container */
.blog-container {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 56px 32px 88px;
  display: flex;
  flex-direction: column;
}

.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: var(--rule-strong);
  padding-bottom: 14px;
}
.masthead-name {
  font-weight: 600;
  font-size: 19px;
  letter-spacing: var(--track-tight);
  color: var(--text-heading);
  text-decoration: none;
}

.intro {
  font-size: 19px;
  line-height: 1.6;
  margin: 44px 0 0;
  max-width: 54ch;
  color: var(--text-heading);
  text-wrap: pretty;
}
.intro-accent { color: var(--accent-2); }

.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 8px;
}

.post-index { margin-top: 52px; display: flex; flex-direction: column; }
.post-row {
  display: block;
  text-decoration: none;
  padding: 20px 0;
  border-top: 1px solid var(--border-hairline);
}
.post-index .post-row:last-of-type,
.standard-page .post-row:last-of-type { border-bottom: 1px solid var(--border-hairline); }
.post-row-meta {
  display: flex;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.post-row-tag { color: var(--accent-2); }
.post-row-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: var(--track-tight);
  line-height: 1.25;
  color: var(--text-heading);
  margin-top: 6px;
  transition: color .15s ease;
}
.post-row:hover .post-row-title { color: var(--accent); }

.subscribe { margin-top: 52px; }
/* cb-btn is designed for <button>; an <a> needs its underline stripped explicitly */
a.cb-btn { text-decoration: none; }
.subscribe-hint { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin-top: 8px; }

.site-footer { margin-top: 72px; }
.site-footer-row { display: flex; justify-content: space-between; align-items: baseline; }
.site-footer-signoff { font-size: 14px; }
.site-footer-links { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.site-footer-link { color: inherit; text-decoration: none; transition: color .15s ease; }
.site-footer-link:hover { color: var(--accent); }

/* Post / term / page article */
.post { margin-top: 48px; }
.post-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
}
.meta-sep { color: var(--text-faint); }
.meta-tag { color: var(--accent-2); }

.post-title {
  font-size: 40px;
  font-weight: 600;
  letter-spacing: var(--track-tight);
  line-height: 1.12;
  color: var(--text-heading);
  margin: 14px 0 28px;
  text-wrap: pretty;
}

.backlinks { margin-top: 56px; }

/* Cite: a <details> disclosure inline in the post meta row, not a standing section */
.cite-toggle { position: relative; }
.cite-toggle-summary {
  cursor: pointer;
  color: var(--accent-2);
  list-style: none;
  transition: color .15s ease;
}
.cite-toggle-summary::-webkit-details-marker { display: none; }
.cite-toggle-summary::marker { content: ''; }
.cite-toggle-summary:hover { color: var(--accent); }
.cite-toggle[open] .cite-toggle-summary { color: var(--accent); }

.cite-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: min(420px, calc(100vw - 64px));
  background: var(--surface-card);
  border: 1px solid var(--border-hairline);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.09);
  padding: 16px 18px;
  z-index: 100;
}
.cite-bibtex {
  background: var(--surface-panel);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  padding: 14px 16px;
  margin: 0 0 10px;
  overflow-x: auto;
  white-space: pre;
  color: var(--text-body);
}
.cite-orcid { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.cite-orcid .cb-link { color: var(--accent); }

/* Prose (essay/term body) */
.prose { font-size: var(--text-base); line-height: var(--leading-body); max-width: var(--measure); }
.prose p { margin: 0 0 22px; text-wrap: pretty; }
.prose h2, .prose h3, .prose h4, .prose h5, .prose h6 {
  font-weight: 600;
  letter-spacing: var(--track-tight);
  color: var(--text-heading);
  margin: 40px 0 14px;
}
.prose h2 { font-size: 24px; line-height: 1.35; }
.prose h3 { font-size: 20px; }
.prose h4, .prose h5, .prose h6 { font-size: 17px; }
.prose blockquote {
  border-left: var(--rule-strong);
  margin: 0 0 22px;
  padding: 2px 0 2px 22px;
  font-style: italic;
  color: var(--text-muted);
}
.prose pre {
  background: var(--surface-panel);
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.6;
  padding: 16px 20px;
  margin: 0 0 22px;
  overflow-x: auto;
  color: var(--text-body);
}
.prose code {
  background: var(--surface-panel);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 2px 6px;
}
.prose pre code { background: none; padding: 0; }
/* Lists: markers are hand-drawn via ::before with `list-style: none` on the <ol>/<ul>,
   never the browser's native ::marker. Safari mis-renders native markers (overlapping/garbled
   numbers) whenever a list item's subtree contains a `position: absolute` descendant — which
   every list item with a footnote does, via `cb-sidenote-col`/`cb-notecard`. Don't reintroduce
   `list-style-type` on an <ol>/<ul> that can contain a footnote; render the marker yourself. */
.prose ul, .prose ol, .standard-doc ul, .standard-doc ol {
  list-style: none;
  margin: 0 0 22px;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.standard-doc ul, .standard-doc ol { margin: 0 0 20px; font-size: 16.5px; line-height: 1.7; }

.prose ol > li, .standard-doc ol > li {
  position: relative;
  padding-left: 28px;
}
.prose ol > li::before, .standard-doc ol > li::before {
  /* data-num is stamped at build time (src/lib/lists.js numberOrderedLists) — plain string
     attr() rather than CSS counters, so an <ol start="N"> is honored without relying on
     attr()'s typed-value form, which isn't reliably supported. */
  content: attr(data-num) '.';
  position: absolute;
  left: 0;
  top: 0;
  font-variant-numeric: tabular-nums;
}

.prose ul > li, .standard-doc ul > li {
  position: relative;
  padding-left: 20px;
}
.prose ul > li::before, .standard-doc ul > li::before {
  content: '–';
  position: absolute;
  left: 0;
  top: 0;
  color: var(--text-faint);
}
.prose a:not(.cb-wikilink) { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; transition: color .15s ease; }
.prose a:not(.cb-wikilink):hover { color: var(--accent-hover); }
.cb-sn-anchor { position: relative; }
.prose .footnote-ref { display: none; }

/* Standard reproduction */
.standard-page { background: var(--surface-page); }
.standard-shell { min-height: 100vh; }

.site-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  box-sizing: border-box;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: color-mix(in srgb, var(--surface-page) 92%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-hairline);
}
.site-bar .cb-mark { font-size: 15px; }

.standard-sidebar {
  position: fixed;
  top: 52px; left: 0; bottom: 0;
  width: 224px;
  box-sizing: border-box;
  background: var(--surface-page);
  border-right: 1px solid var(--border-hairline);
  overflow-y: auto;
  padding: 22px 18px 40px;
}
.standard-sidebar-head { display: flex; justify-content: space-between; align-items: center; }
.standard-sidebar-id {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: var(--track-caps);
  text-transform: uppercase;
  color: var(--text-muted);
}
.theme-toggle { text-transform: uppercase; letter-spacing: var(--track-caps); font-size: 10px; padding: 5px 9px; }

.standard-toc { display: flex; flex-direction: column; gap: 2px; }
.toc-row {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 8px;
  align-items: baseline;
  text-decoration: none;
  padding: 6px 8px 6px 6px;
  margin-left: -8px;
  border-left: 2px solid transparent;
  transition: background-color .15s ease, border-color .15s ease;
}
.toc-row:hover { background: var(--surface-panel); }
.toc-row.is-active { background: var(--surface-panel); border-left-color: var(--accent); }
.toc-row--1 { margin-top: 14px; }
.toc-row--1 .toc-num { font-size: 11px; color: var(--text-muted); }
.toc-row--1 .toc-title { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-heading); }
.toc-row--2 .toc-num { font-size: 11px; color: var(--accent-2); }
.toc-row--2 .toc-title { font-size: 12.5px; color: var(--text-body); }
.toc-row--3 { grid-template-columns: 34px 1fr; padding-left: 16px; }
.toc-row--3 .toc-num { font-size: 10.5px; color: var(--text-faint); }
.toc-row--3 .toc-title { font-size: 12px; color: var(--text-muted); }

.standard-main { margin-left: 224px; padding: 118px 80px 120px; box-sizing: border-box; }
.standard-doc { max-width: 720px; }

.standard-eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
}
.standard-title {
  font-size: 52px;
  font-weight: 600;
  letter-spacing: var(--track-tight);
  line-height: 1.08;
  color: var(--text-heading);
  margin: 20px 0 0;
  text-wrap: pretty;
}
.standard-lede {
  font-size: 20px;
  font-style: italic;
  line-height: 1.55;
  color: var(--text-muted);
  margin: 26px 0 0;
  max-width: 54ch;
  text-wrap: pretty;
}
.standard-rule { margin: 36px 0 24px; }
.authors-row {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-body);
  line-height: 2;
}
.authors-name { white-space: nowrap; }
.authors-sep { color: var(--text-faint); }

.standard-idline {
  display: flex;
  gap: 16px;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 14px;
}
.standard-idline-short { color: var(--text-muted); }

.keyword-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.keyword-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: lowercase;
  color: var(--accent);
  background: var(--surface-panel);
  padding: 5px 10px;
}

.standard-abstract {
  border-left: var(--rule-strong);
  padding: 4px 0 4px 24px;
  margin-top: 44px;
}
.standard-abstract p { font-size: 15px; line-height: 1.65; margin: 0; text-wrap: pretty; }

.standard-doc section { scroll-margin-top: 76px; }
.cb-sec { scroll-margin-top: 76px; }
.cb-sec-1 { font-size: 32px; font-weight: 600; letter-spacing: var(--track-tight); line-height: 1.15; color: var(--text-heading); margin: 0 0 20px; }
.cb-sec-2 { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-heading); margin: 36px 0 14px; }
.cb-sec-3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-heading); margin: 28px 0 10px; }
.cb-sec-4 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-heading); margin: 24px 0 8px; }

.cb-sec-num-1 { font-family: var(--font-mono); font-size: 18px; font-weight: 400; color: var(--accent); margin-right: 14px; }
.cb-sec-num-2 { font-family: var(--font-mono); font-size: 13px; font-weight: 400; color: var(--accent); margin-right: 12px; }
.cb-sec-num-3 { font-family: var(--font-mono); font-size: 12px; font-weight: 400; color: var(--accent-2); margin-right: 12px; }
.cb-sec-num-4 { font-family: var(--font-mono); font-size: 11px; font-weight: 400; color: var(--text-faint); margin-right: 10px; }

.standard-doc p { font-size: 16.5px; line-height: 1.7; margin: 0 0 20px; text-wrap: pretty; }
.standard-doc table { border-collapse: collapse; font-size: 15px; line-height: 1.6; margin: 0 0 20px; width: 100%; }
.standard-doc th, .standard-doc td { text-align: left; padding: 8px 16px 8px 0; border-bottom: 1px solid var(--border-hairline); vertical-align: top; }
.standard-doc th { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); font-weight: 500; }
.standard-doc pre {
  background: var(--surface-panel);
  font-family: var(--font-mono);
  font-size: 13.5px;
  padding: 16px 20px;
  margin: 0 0 20px;
  overflow-x: auto;
}
.standard-doc code { background: var(--surface-panel); font-family: var(--font-mono); font-size: 14px; padding: 2px 6px; }
.standard-doc pre code { background: none; padding: 0; }
.standard-doc blockquote {
  border-left: var(--rule-strong);
  margin: 0 0 20px;
  padding: 6px 0 6px 22px;
  font-style: italic;
  color: var(--text-muted);
}
.standard-doc .footnote-ref { display: none; }

.standard-footer { margin-top: 88px; }
.standard-footer-row { display: flex; justify-content: space-between; align-items: baseline; }
.standard-disclaimer { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

/* Sidenote column: block-level span holding one or more stacked Tufte notes */
.cb-sidenote-col {
  position: absolute;
  left: calc(100% + 44px);
  top: 4px;
  width: 220px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.cb-sidenote-col .cb-sidenote { position: static; width: auto; left: auto; top: auto; }

@media (max-width: 1200px) {
  .cb-sidenote-col {
    position: static;
    width: auto;
    display: block;
    margin: 12px 0 0;
    padding: 10px 14px;
    background: var(--surface-panel);
  }
  .cb-sidenote-col .cb-sidenote { margin: 0 0 10px; }
  .cb-sidenote-col .cb-sidenote:last-child { margin-bottom: 0; }
}

@media (max-width: 900px) {
  .standard-sidebar { display: none; }
  .standard-main { margin-left: 0; }
}

/* Standards: margin notes only once the fixed 224px sidebar + 720px doc genuinely leaves
   room to the right (224 + 80*2 padding + 720 doc + 44 gap + 220 note ≈ 1368px); below that,
   fall back to the hover notecard. Both are always rendered — this just picks one. */
.standard-doc .cb-sidenote-col { display: none; }
@media (min-width: 1400px) {
  .standard-doc .cb-sidenote-col { display: flex; }
  .standard-doc .cb-noteref .cb-notecard { display: none; }
}

/* Notecard viewport clamping — client.js sets --card-dx and toggles the flip class */
.cb-noteref { --card-dx: 0px; }
.cb-noteref .cb-notecard { left: calc(-14px + var(--card-dx)); }
.cb-noteref--flip .cb-notecard {
  top: auto;
  bottom: calc(100% + 10px);
}
