/* Arcology Labs Research — shared styles for the research index and every paper.
   Warm "printed-paper" body (cream page + floating white page-card, serif,
   restrained maroon accent) inside the site brand shell. The paper-card
   itself deliberately keeps this serif "printed paper" register in both
   themes — only the brand shell (.brandbar) matches the site-wide sans
   header used on landing/index.html and its siblings. */
:root {
  --max-w: 78rem;
  --gutter: clamp(1.25rem, 0.5rem + 3vw, 3rem);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
}
:root {
  color-scheme: light;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #e3dfd5;      /* warm hairline */
  --edge: #d8d4c8;
  --accent: #7a1f1f;    /* restrained maroon */
  --on-accent: #ffffff;
  --link: #7a1f1f;
  --bg: #f6f5f1;        /* cream page */
  --paper: #ffffff;     /* the page-card */
  --soft: #f0efe9;      /* warm callout */
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --ink: #f2f1ec;
    --muted: #aeb4bf;
    --line: #33313a;
    --edge: #3d3b44;
    --accent: #ff6a5a;
    --on-accent: #14161a;
    --link: #ff9d8f;
    --bg: #181b21;
    --paper: #1e2129;
    --soft: #262932;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --line: #e3dfd5;
  --edge: #d8d4c8;
  --accent: #7a1f1f;
  --on-accent: #ffffff;
  --link: #7a1f1f;
  --bg: #f6f5f1;
  --paper: #ffffff;
  --soft: #f0efe9;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2f1ec;
  --muted: #aeb4bf;
  --line: #33313a;
  --edge: #3d3b44;
  --accent: #ff6a5a;
  --on-accent: #14161a;
  --link: #ff9d8f;
  --bg: #181b21;
  --paper: #1e2129;
  --soft: #262932;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.62;
}

/* --- brand shell (site chrome, sans) ---
   Matches the header on the rest of agnts.social: brand lockup, pill nav,
   sticky translucent bar. The paper-card below deliberately keeps its serif
   "printed paper" treatment — that is the right register for a research
   paper and is not part of the site-wide sans redesign. */
.brandbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0 max(var(--gutter), (100% - var(--max-w)) / 2);
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
}
@supports not (backdrop-filter: blur(4px)) {
  .brandbar { background: var(--bg); }
}
.brandbar-inner {
  width: 100%;
  min-height: 72px;
  padding: 10px 0;
  display: flex;
  align-items: center;
  gap: 8px 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
  margin-right: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.02em;
}
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 34px;
  height: auto;
  display: block;
  flex: 0 0 auto;
}
.brand-mark .mark-tri,
.brand-mark .mark-dot { fill: #ff3b30; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .brand-mark .mark-dot { fill: #ffffff; }
}
html[data-theme="dark"] .brand-mark .mark-dot { fill: #ffffff; }
.brand-word {
  height: 13px;
  width: auto;
  display: block;
  flex: 0 0 auto;
  color: var(--ink);
}
@media (min-width: 960px) {
  .brand-word { height: 16px; }
}
.brandnav {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 15px;
  font-weight: 500;
  overflow-x: auto;
  min-width: 0;
  scrollbar-width: none;
  margin-right: auto;
}
.brandnav::-webkit-scrollbar { display: none; }
.brandnav a { color: var(--muted); text-decoration: none; padding: 7px 11px; border-radius: 8px; white-space: nowrap; }
.brandnav a:hover { color: var(--ink); background: var(--soft); }
.brandnav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.theme-picker { display: inline-flex; align-items: center; border: 0; padding: 0; }
.theme-toggle {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease;
}
.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--ink);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.theme-icon { display: none; width: 20px; height: 20px; }
.theme-icon svg { display: block; width: 100%; height: 100%; }
.theme-toggle[data-active-theme="system"] .theme-icon[data-theme-icon="system"],
.theme-toggle[data-active-theme="light"] .theme-icon[data-theme-icon="light"],
.theme-toggle[data-active-theme="dark"] .theme-icon[data-theme-icon="dark"] {
  display: block;
}
@media (max-width: 60rem) {
  .brandnav { order: 3; width: 100%; margin: 0; padding-bottom: 6px; }
  .brandbar-inner { flex-wrap: wrap; padding-top: 10px; }
  .brand { margin-right: auto; }
}
@media (max-width: 28rem) {
  .brandbar-inner { gap: 9px; }
  .brandnav { gap: 10px 14px; font-size: 12px; }
}

/* --- the paper-card --- */
main {
  max-width: 800px;
  margin: 36px auto 40px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  padding: 56px 64px;
}
.eyebrow {
  font-family: var(--sans);
  font-variant: small-caps;
  letter-spacing: 0.08em;
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 10px;
}
.eyebrow a { color: var(--muted); text-decoration: none; }
.eyebrow a:hover { color: var(--accent); }
h1 { font-size: 28px; line-height: 1.25; letter-spacing: -0.01em; margin: 0 0 10px; }
.subtitle { font-size: 19px; font-style: italic; color: var(--muted); margin: 0 0 18px; }
.byline { font-family: var(--sans); font-size: 14.5px; margin: 0; }
.byline .aff { color: var(--muted); }
.stamp {
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--muted);
  font-variant: small-caps;
  letter-spacing: 0.04em;
  margin: 6px 0 0;
}
.rule { border: 0; border-top: 2px solid var(--ink); margin: 22px 0 4px; }

h2 { font-size: 19px; line-height: 1.3; margin: 34px 0 8px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
h3 { font-size: 16.5px; margin: 22px 0 6px; color: color-mix(in srgb, var(--ink) 90%, var(--bg) 10%); }
p { margin: 10px 0; }
strong { color: var(--ink); }
a { color: var(--link); }
ul { margin: 10px 0; padding-left: 22px; }
li { margin: 6px 0; }
li + li { margin-top: 6px; }

.abstract { background: var(--soft); border: 1px solid var(--line); padding: 18px 22px; margin: 20px 0 8px; font-size: 16.5px; }
.abstract .lbl {
  display: block;
  font-family: var(--sans);
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-size: 12.5px;
  margin-bottom: 6px;
}
blockquote { margin: 14px 0; padding: 12px 20px; border-left: 3px solid var(--accent); background: var(--soft); font-size: 17px; }

.tablewrap { overflow-x: auto; margin: 16px 0; }
table { width: 100%; border-collapse: collapse; font-family: var(--sans); font-size: 14px; }
th, td { padding: 7px 9px; text-align: left; border-bottom: 1px solid var(--line); }
thead th { border-bottom: 1.5px solid var(--ink); font-size: 12.5px; }
tbody tr:last-child td { border-bottom: 1px solid var(--ink); }
td:not(:first-child), th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

footer {
  font-family: var(--sans);
  max-width: 800px;
  margin: 0 auto;
  padding: 4px 24px 44px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: center;
}
footer a { color: var(--link); }
.foot-note { font-style: italic; margin-top: 8px; }

/* --- research index (list of papers) --- */
.lede { font-size: 18px; color: var(--muted); margin: 6px 0 4px; }
.paperlist { list-style: none; padding: 0; margin: 26px 0 0; }
.paper-item { border-top: 1px solid var(--line); padding: 22px 0; }
.paper-item:last-child { border-bottom: 1px solid var(--line); }
.paper-item h2 { border: 0; margin: 0 0 5px; padding: 0; font-size: 21px; line-height: 1.3; }
.paper-item h2 a { color: var(--ink); text-decoration: none; }
.paper-item h2 a:hover { color: var(--accent); }
.paper-meta {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 8px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.tag {
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
  color: color-mix(in srgb, var(--accent) 60%, var(--ink) 40%);
}
.paper-item p { margin: 0; font-size: 16.5px; }

/* --- references (paper §9) --- */
ol.refs { margin: 14px 0 0; padding-left: 26px; font-size: 14.5px; color: color-mix(in srgb, var(--ink) 85%, var(--bg) 15%); }
ol.refs li { margin: 8px 0; line-height: 1.5; }
ol.refs cite { font-style: italic; }
ol.refs a { color: var(--link); }

@media (max-width: 640px) {
  body { font-size: 16.5px; }
  h1 { font-size: 23px; }
  .brandnav { gap: 14px; }
  main { margin: 0; padding: 28px 20px 40px; border: 0; box-shadow: none; }
  footer { text-align: left; }
}
@media print {
  body { background: #fff; font-size: 11.5pt; line-height: 1.5; }
  .brandbar { border-color: #bbb; }
  .brandnav { display: none; }
  main { max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; }
  h2 { border-bottom: 1px solid #bbb; }
  .abstract, blockquote { background: #f2f2f2; }
  h2, h3 { break-after: avoid; }
  table, blockquote, .abstract { break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}
