/* Research Notes — restrained editorial styles */
:root {
  color-scheme: light;
  --page: #fbfaf7;
  --surface: #f2f0ea;
  --surface-strong: #e9e6de;
  --ink: #222521;
  --muted: #656a62;
  --faint: #858980;
  --line: #deded5;
  --accent: #376b5a;
  --accent-hover: #244d40;
  --accent-ink: #ffffff;
  --focus: #b45c24;
  --body-font: Georgia, "Times New Roman", serif;
  --ui-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --content-width: 720px;
  --wide-width: 900px;
  --radius: 4px;
  --shadow: 0 1px 2px rgb(25 30 25 / 4%);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #171918;
  --surface: #202421;
  --surface-strong: #292e2a;
  --ink: #e9ece6;
  --muted: #b0b7ae;
  --faint: #8d968c;
  --line: #363d37;
  --accent: #91c5ae;
  --accent-hover: #b6dfcb;
  --accent-ink: #142019;
  --focus: #f1b27c;
  --shadow: 0 1px 2px rgb(0 0 0 / 18%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #171918; --surface: #202421; --surface-strong: #292e2a;
    --ink: #e9ece6; --muted: #b0b7ae; --faint: #8d968c; --line: #363d37;
    --accent: #91c5ae; --accent-hover: #b6dfcb; --accent-ink: #142019;
    --focus: #f1b27c; --shadow: 0 1px 2px rgb(0 0 0 / 18%);
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 6rem; }
body { margin: 0; background: var(--page); color: var(--ink); font-family: var(--body-font); font-size: 18px; line-height: 1.7; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent-hover); }
button, input { font: inherit; }
button { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
::selection { color: var(--accent-ink); background: var(--accent); }
.skip-link { position: absolute; z-index: 20; top: .5rem; left: .5rem; padding: .6rem .85rem; transform: translateY(-160%); background: var(--ink); color: var(--page); font: 600 .9rem var(--ui-font); }
.skip-link:focus { transform: translateY(0); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.site-header { border-bottom: 1px solid var(--line); font-family: var(--ui-font); }
.header-inner { max-width: var(--wide-width); min-height: 76px; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; gap: 1.6rem; }
.wordmark { flex: 0 0 auto; color: var(--ink); text-decoration: none; font-size: 1.08rem; font-weight: 750; letter-spacing: -.08em; }
.wordmark span { color: var(--accent); }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: clamp(.8rem, 2.5vw, 1.8rem); }
.site-nav a { color: var(--muted); font-size: .79rem; text-decoration: none; white-space: nowrap; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--ink); }
.theme-toggle { width: 2.35rem; height: 2.35rem; display: grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 50%; background: transparent; cursor: pointer; font-size: 1.1rem; }
.theme-toggle:hover { background: var(--surface); }
.page-shell { width: min(100% - 3rem, var(--wide-width)); margin: 0 auto; }
.intro { max-width: var(--content-width); padding: clamp(4rem, 10vw, 7rem) 0 3.6rem; }
.eyebrow { margin: 0 0 .9rem; color: var(--accent); font: 700 .69rem/1.5 var(--ui-font); letter-spacing: .13em; }
h1, h2, h3 { color: var(--ink); font-family: var(--ui-font); font-weight: 620; letter-spacing: -.04em; line-height: 1.2; }
h1 { margin: 0; font-size: clamp(2.5rem, 7vw, 4.25rem); letter-spacing: -.065em; }
.intro-copy { max-width: 640px; margin: 1.6rem 0 1.3rem; color: var(--muted); font-size: 1.14rem; line-height: 1.75; }
.intro-meta { display: flex; flex-wrap: wrap; gap: .35rem .55rem; color: var(--faint); font: .77rem/1.6 var(--ui-font); }
.posts-section { padding: 2.1rem 0 3.5rem; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 1.5rem; margin-bottom: 1.2rem; }
.section-heading .eyebrow { margin-bottom: .45rem; }
h2 { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); }
.search-box { width: min(100%, 230px); display: flex; align-items: center; gap: .5rem; padding: .45rem .65rem; border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); }
.search-box > span { font: 1.2rem var(--ui-font); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); font: .8rem var(--ui-font); }
.search-box:focus-within { outline: 2px solid var(--focus); outline-offset: 2px; }
.filter-list { display: flex; flex-wrap: wrap; gap: .45rem; margin: 1.1rem 0 .5rem; }
.filter-chip { padding: .34rem .7rem; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; font: .72rem/1.4 var(--ui-font); }
.filter-chip:hover { border-color: var(--accent); color: var(--ink); }
.filter-chip.is-active { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.filter-chip:disabled { cursor: default; opacity: .7; }
.results-status { min-height: 1.2rem; margin: .65rem 0 0; color: var(--faint); font: .72rem var(--ui-font); }
.post-list { border-top: 1px solid var(--line); margin-top: .5rem; }
.post-row { padding: 1.65rem 0 1.8rem; border-bottom: 1px solid var(--line); animation: appear .3s ease both; }
.post-date { margin: 0 0 .55rem; color: var(--faint); font: .73rem/1.6 var(--ui-font); letter-spacing: .01em; }
.post-date span { margin: 0 .25rem; }
.post-row h3 { margin: 0; font-size: clamp(1.25rem, 3vw, 1.55rem); }
.post-row h3 a { color: var(--ink); text-decoration: none; }
.post-row h3 a:hover { color: var(--accent); }
.post-summary { max-width: 620px; margin: .55rem 0 .8rem; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.tag-list { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0; margin: .6rem 0 0; list-style: none; }
.tag-list li { padding: .18rem .48rem; border-radius: 2px; background: var(--surface); color: var(--muted); font: .67rem/1.5 var(--ui-font); }
.empty-state, .noscript-note { padding: 1rem; background: var(--surface); color: var(--muted); font-size: .95rem; }
.empty-state[hidden] { display: none; }
.small-about { max-width: var(--content-width); padding: 2.4rem 0 4.2rem; border-top: 1px solid var(--line); }
.small-about > p:not(.eyebrow) { max-width: 620px; color: var(--muted); }
.text-link { font: 600 .82rem/1.6 var(--ui-font); text-decoration: none; }
.text-link span { display: inline-block; transition: transform .15s ease; }
.text-link:hover span { transform: translateX(3px); }
.site-footer { border-top: 1px solid var(--line); font: .72rem/1.6 var(--ui-font); color: var(--faint); }
.site-footer > div { max-width: var(--wide-width); margin: 0 auto; padding: 1.3rem 1.5rem; display: flex; justify-content: space-between; gap: 1rem; }
.article-shell { max-width: var(--content-width); padding-top: clamp(2.4rem, 6vw, 4rem); padding-bottom: 3.5rem; }
.article-header { padding-bottom: 2rem; }
.back-link { display: inline-block; margin-bottom: 1.6rem; }
.article-header .post-date { margin-bottom: .8rem; }
.article-header h1, .page-title h1 { font-size: clamp(2.2rem, 6vw, 3.5rem); }
.article-deck, .lede { margin: 1.1rem 0 1rem; color: var(--muted); font-size: 1.15rem; line-height: 1.7; }
.toc-box { padding: 1.1rem 1.25rem; margin: 1rem 0 2.5rem; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.toc-box h2 { font: 650 .82rem var(--ui-font); letter-spacing: 0; }
.toc-box ol { margin: .75rem 0 0; padding-left: 1.25rem; color: var(--muted); font: .8rem/1.8 var(--ui-font); }
.toc-box li { padding-left: .15rem; }
.toc-box a { text-decoration: none; }
.toc-box .toc-subitem { margin-left: .8rem; list-style-type: circle; }
.prose { font-size: 1.08rem; line-height: 1.78; overflow-wrap: break-word; }
.prose h2 { margin: 2.65rem 0 .9rem; font-size: 1.55rem; letter-spacing: -.035em; scroll-margin-top: 5.5rem; }
.prose h3 { margin: 2rem 0 .7rem; font-size: 1.22rem; scroll-margin-top: 5.5rem; }
.prose p { margin: 0 0 1.2rem; }
.prose ul, .prose ol { padding-left: 1.4rem; margin: .2rem 0 1.35rem; }
.prose li { padding-left: .22rem; margin: .35rem 0; }
.prose strong { font-weight: 700; }
.prose blockquote { margin: 1.7rem 0; padding: .25rem 0 .25rem 1.2rem; border-left: 3px solid var(--accent); color: var(--muted); }
.prose blockquote p { margin: 0; }
.prose figure { margin: 1.8rem 0; }
.prose figcaption { margin-top: .65rem; color: var(--faint); font: .75rem/1.6 var(--ui-font); }
.content-note { padding: 1rem 1.1rem; background: var(--surface); border-left: 2px solid var(--accent); font-size: .98rem; }
.concept-diagram { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 1.2rem; align-items: center; padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); }
.diagram-column { display: flex; align-items: center; flex-direction: column; gap: .7rem; text-align: center; font: .8rem var(--ui-font); }
.diagram-label { color: var(--muted); font-weight: 650; }
.diagram-node { width: 100%; padding: .65rem .3rem; border: 1px solid var(--accent); border-radius: var(--radius); background: var(--page); color: var(--ink); }
.diagram-node--soft { border-color: var(--line); background: var(--surface-strong); }
.diagram-arrow { color: var(--muted); font-size: .7rem; }
.diagram-divider { width: 1px; height: 100%; background: var(--line); }
.prose pre { position: relative; overflow-x: auto; padding: 1.2rem; margin: 1.4rem 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); font: .82rem/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 2; }
.prose pre code { font: inherit; white-space: pre; }
.copy-button { position: absolute; top: .5rem; right: .5rem; padding: .3rem .55rem; border: 1px solid var(--line); border-radius: 3px; background: var(--page); color: var(--muted); cursor: pointer; font: .68rem var(--ui-font); }
.copy-button:hover { color: var(--ink); border-color: var(--accent); }
.math-block { overflow-x: auto; padding: 1.2rem .5rem; margin: 1.4rem 0; text-align: center; background: var(--surface); border-radius: var(--radius); }
.arabic-summary { margin: 2.4rem 0; border: 1px solid var(--line); border-radius: var(--radius); }
.arabic-summary summary { padding: .9rem 1rem; color: var(--accent); cursor: pointer; font: 650 .83rem var(--ui-font); list-style-position: inside; }
.arabic-summary summary span { float: right; }
.arabic-content { padding: .3rem 1.1rem 1rem; font-family: Tahoma, Arial, sans-serif; line-height: 2; }
.arabic-content p { margin: .7rem 0; }
.references { font-size: .92rem; }
.references li { margin-bottom: .75rem; }
.references a { overflow-wrap: anywhere; }
.post-pagination { display: flex; justify-content: space-between; gap: 1.5rem; padding: 1.3rem 0; margin-top: 2rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font: .72rem/1.6 var(--ui-font); }
.post-pagination a { display: flex; flex-direction: column; gap: .25rem; text-decoration: none; }
.post-pagination strong { color: var(--ink); font-size: .84rem; }
.page-title { padding-bottom: 1.2rem; }
.page-title .eyebrow { margin-bottom: .75rem; }
.external-links { list-style: none; padding: 0 !important; }
.external-links li { border-bottom: 1px solid var(--line); margin: 0 !important; }
.external-links a { display: flex; justify-content: space-between; padding: .65rem 0; text-decoration: none; }
.muted-note { padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.back-link:has(.text-link) { margin-top: 1rem; }
.reading-progress { position: fixed; z-index: 30; inset: 0 0 auto; height: 3px; pointer-events: none; }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--accent); }
@keyframes appear { from { opacity: .75; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 620px) {
  .header-inner { min-height: 66px; padding: 0 1rem; gap: .8rem; }
  .site-nav { gap: .75rem; }
  .site-nav a { font-size: .72rem; }
  .site-nav a:last-child { display: none; }
  .theme-toggle { width: 2.1rem; height: 2.1rem; }
  .page-shell { width: min(100% - 2rem, var(--wide-width)); }
  .intro { padding-top: 3.8rem; }
  .desktop-break { display: none; }
  .section-heading { align-items: stretch; flex-direction: column; gap: 1rem; }
  .search-box { width: 100%; }
  .site-footer > div { padding: 1.2rem 1rem; flex-direction: column; gap: .25rem; }
  .concept-diagram { gap: .65rem; padding: .85rem; }
  .diagram-column { font-size: .7rem; }
  .diagram-node { overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media print {
  :root, :root[data-theme="dark"] { color-scheme: light; --page: #fff; --surface: #f4f4f4; --surface-strong: #eee; --ink: #111; --muted: #444; --faint: #666; --line: #ccc; --accent: #244d40; }
  body { background: white; color: black; font-size: 11pt; }
  .site-header, .site-footer, .theme-toggle, .reading-progress, .back-link, .copy-button, .post-pagination { display: none !important; }
  .page-shell { width: 100%; max-width: none; padding: 0; }
  .article-header h1 { font-size: 26pt; }
  .toc-box { break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
  .prose pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  .arabic-summary { break-inside: avoid; }
  details:not([open]) > *:not(summary) { display: block !important; }
  @page { margin: 1.8cm; }
}
