/* After42 site — qinglu (jade and blossom) palette, institutional layout.
   Garamond for display (wordmark, headings), Source Serif 4 for running
   text, Fira Code for meta. Sticky top bar. Jade does structural work
   (links, ledger edges, note boxes, status chips); blossom pink marks
   small accents (h2 ticks, dates, labels, active items);
   gold underlines links. */

@import url('https://fonts.googleapis.com/css2?family=EB+Garamond:ital,wght@0,400;0,500;0,600;1,400;1,500&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&family=Fira+Code:wght@400;500&display=swap');

:root {
  --bg: #fdfcf9;            /* rice paper */
  --bg-card: #eff6f2;       /* jade wash */
  --ink: #1f2f2a;
  --ink-soft: #53655e;
  --green: #3f8f74;         /* jade */
  --green-deep: #2e6e66;    /* qing: links and primary actions */
  --green-tint: rgba(63, 143, 116, 0.10);
  --blossom: #dc9a98;
  --blossom-deep: #a5525a;  /* text-safe pink */
  --blossom-soft: #f9e9e6;
  --gold-line: rgba(196, 165, 90, 0.65);
  --rule: rgba(31, 60, 50, 0.20);
  --rule-soft: rgba(31, 60, 50, 0.11);
  --shadow: rgba(31, 60, 50, 0.07);
  --serif: "EB Garamond", "Adobe Garamond Pro", Garamond, Georgia, serif;
  --text: "Source Serif 4", Charter, "Iowan Old Style", Georgia, serif;
  --mono: "Fira Code", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --reading-width: 50rem;
  --reading-gutter: 1.5rem;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  overflow-x: hidden; /* KaTeX's hidden MathML copy can bleed a few px past the viewport */
  background: var(--bg);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.03rem;
  line-height: 1.68;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--reading-width);
  margin: 0 auto;
  padding: 2.5rem var(--reading-gutter) 5rem;
}
.contribute-wrap { max-width: 47rem; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--rule-soft);
}

/* keep anchor jumps clear of the fixed bar */
[id] { scroll-margin-top: 4.6rem; }
.topbar-inner {
  max-width: 78rem;
  margin: 0 auto;
  padding: 0.95rem 1.6rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.4rem 1.5rem;
}
/* Legacy header sizing; After42 dimensions are defined in the shared brand rules below. */
a.wordmark { display: inline-block; line-height: 1; text-decoration: none; }
a.wordmark img {
  display: inline-block;
  height: 30px;
  width: auto;
  vertical-align: baseline;
  margin-bottom: -9px;   /* the swash G descends 30% of the height below the baseline */
}
a.wordmark:hover img { opacity: 0.82; }

nav.site-nav {
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.5rem;
}
nav.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  margin: 0;
}
nav.site-nav a:hover { color: var(--green-deep); text-decoration: underline; }
nav.site-nav a.active { color: var(--green-deep); }

/* ---------- page hero (main page) ---------- */

.hero {
  min-height: 56vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 3rem 1.5rem 2.5rem;
}
h1.page-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  line-height: 1.18;
  max-width: 62rem;
  margin: 0 0 1.6rem;
  text-wrap: balance;
}
.hero .lede { max-width: 44rem; margin: 0 auto; line-height: 1.7; text-wrap: pretty; }
@media (max-width: 560px) {
  .hero { min-height: 44vh; padding: 2rem 1.1rem 1.5rem; }
}

/* ---------- prose ---------- */

h1, h2, h3, h4 { font-family: var(--serif); color: var(--ink); }
h2 { font-weight: 600; font-size: 1.5rem; margin: 2.7rem 0 0.8rem; }
h2::before {
  content: '';
  display: block;
  width: 1.4rem;
  border-top: 3px solid var(--blossom);
  margin-bottom: 0.55rem;
}
h3 { font-weight: 600; font-size: 1.26rem; margin: 1.8rem 0 0.6rem; }

a { color: var(--green-deep); text-decoration: underline; text-decoration-color: var(--gold-line); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--blossom); }
::selection { background: var(--blossom-soft); }

.lede {
  font-size: 1.14rem;
  line-height: 1.6;
}

.dateline {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
}

code, .mono { font-family: var(--mono); font-size: 0.82em; }
code {
  background: var(--bg-card);
  border: 1px solid var(--rule-soft);
  border-radius: 4px;
  padding: 0.08em 0.35em;
}
pre {
  background: var(--bg-card);
  border: 1px solid var(--rule-soft);
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
}
pre code { background: none; border: none; padding: 0; }

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

.name-note {
  margin-top: 3.5rem;
  font-size: 0.92rem;
  color: var(--ink-soft);
}
.name-note + footer { margin-top: 1.2rem; }

footer {
  margin-top: 4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--rule-soft);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

/* ---------- news list (main page) ---------- */

.news {
  background: var(--bg-card);
  border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0;
  padding: 0.5rem 1.3rem;
  margin: 1rem 0;
}
.news p { margin: 0.75rem 0; }
.news .tag {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--blossom-deep);
  margin-right: 0.35rem;
}

/* ---------- pipeline steps ---------- */

ol.pipeline { padding-left: 1.3rem; }
ol.pipeline li { margin: 0.55rem 0; }
ol.pipeline b { font-weight: 600; color: var(--green-deep); }

/* ---------- field / subfield sidebar ---------- */

.browser-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.2rem;
  align-items: start;
  margin-top: 1.8rem;
}

.field-toc {
  font-size: 0.86rem;
  line-height: 1.45;
  border-bottom: 1px solid var(--rule-soft);
  padding-bottom: 1.1rem;
}
.field-toc .toc-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  margin: 0 0 0.6rem 0.9rem;
}
.field-toc button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-left: 2px solid var(--rule-soft);
  font: inherit;
  color: var(--ink-soft);
  padding: 0.32rem 0.4rem 0.32rem 0.9rem;
  cursor: pointer;
}
.field-toc button:hover { color: var(--green-deep); }
.field-toc button.active {
  color: var(--green-deep);
  border-left-color: var(--blossom);
}
.field-toc button.toc-sub, .field-toc .toc-empty {
  padding-left: 1.7rem;
  font-size: 0.8rem;
}
.field-toc .toc-empty {
  border-left: 2px solid var(--rule-soft);
  padding-block: 0.32rem;
  color: var(--ink-soft);
  font-style: italic;
}

.browser-main { min-width: 0; }
.browser-main > #field-meta > p:first-child { margin-top: 0; }

/* Match the blog contents sidebar without narrowing the reading column. */
@media (min-width: 1400px) {
  .field-toc {
    position: fixed;
    top: 6.5rem;
    left: max(1.5rem, calc(50% - 42.5rem));
    width: 14rem;
    max-height: calc(100vh - 9rem);
    overflow-y: auto;
    border-bottom: none;
    padding-bottom: 0;
  }
}

/* ---------- question cards ---------- */

.question {
  background: #fff;
  border: 1px solid var(--rule-soft);
  border-radius: 10px;
  padding: 1.5rem 1.7rem 1.2rem;
  margin: 1.6rem 0;
  box-shadow: 0 1px 3px var(--shadow);
}
.question h3 { margin: 0 0 0.35rem; font-size: 1.32rem; }

.list-count {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-align: center;
  margin: 2.2rem 0 0;
}
.list-count b { font-weight: 500; }

.status {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.16em 0.6em;
  border-radius: 999px;
  border: 1px solid var(--green);
  vertical-align: 1px;
}
.st-open { color: var(--green-deep); background: var(--green-tint); }
.st-partial { color: #7a5b12; border-color: #b08d2e; background: rgba(176, 141, 46, 0.12); }
.st-solved { color: var(--bg); border-color: var(--green-deep); background: var(--green-deep); }
.status-link { font-family: var(--mono); font-size: 0.74rem; }

.qlink {
  font-size: 0.85em;
  text-decoration: none;
  color: var(--ink-soft);
  margin-left: 0.4rem;
  opacity: 0.35;
}
.question h3:hover .qlink, .qlink:hover { opacity: 1; }
.question.targeted { border-color: var(--green); box-shadow: 0 0 0 1px var(--green); }

pre.bibtex { font-size: 0.78rem; margin: 0.4rem 0 0.6rem; }
button.copy-bib {
  font-family: var(--mono);
  font-size: 0.74rem;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--rule);
  border-radius: 5px;
  padding: 0.25em 0.7em;
  cursor: pointer;
}
button.copy-bib:hover { color: var(--green-deep); border-color: var(--green); }

.q-meta {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  color: var(--ink-soft);
  margin: 0 0 0.9rem;
}

.expert-note {
  border-left: 3px solid var(--green);
  background: var(--bg-card);
  border-radius: 0 6px 6px 0;
  margin: 1rem 0;
  padding: 0.6rem 1rem 0.6rem 1rem;
}
.expert-note .label {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--blossom-deep);
  display: block;
  margin-bottom: 0.3rem;
}
.expert-note p { margin: 0.3rem 0; font-size: 0.98rem; }
.expert-note.pending p { color: var(--ink-soft); font-style: italic; }

.question details { margin: 0.8rem 0 0; border-top: 1px solid var(--rule-soft); padding-top: 0.7rem; }
.question details summary {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--ink-soft);
  cursor: pointer;
}
.question details summary:hover { color: var(--green-deep); }
.question details[open] summary { color: var(--green-deep); margin-bottom: 0.5rem; }

.statement { font-size: 0.99rem; }
.statement h1, .statement h2 { font-size: 1.15rem; margin: 1.2rem 0 0.5rem; }
.statement h2::before { display: none; }
.statement .katex-display { overflow-x: auto; padding: 0.2rem 0; }
.statement > :first-child { margin-top: 0; }
.statement > :last-child { margin-bottom: 0.2rem; }
.sec-problem .stmt-body { border-left: 3px solid var(--green); padding: 0.05rem 0 0.05rem 1rem; }


/* ---------- FAQ (main page) ---------- */

.faq { margin: 1.1rem 0 0; counter-reset: faq; }
.faq details { margin: 0.4rem 0; }
.faq summary {
  counter-increment: faq;
  cursor: pointer;
  list-style: none;
  color: var(--ink);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::before {
  content: counter(faq) ".";
  font-family: var(--mono);
  font-size: 0.82rem;
  color: var(--blossom-deep);
  margin-right: 0.6rem;
}
.faq summary:hover, .faq details[open] summary { color: var(--green-deep); }
.faq details p {
  margin: 0.3rem 0 0.7rem 1.5rem;
  font-size: 0.96rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.faq details p a { color: inherit; }
.faq .status { vertical-align: 0.1em; }

/* ---------- contributors & contact ---------- */

ul.team {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(13.5rem, 1fr));
  gap: 1rem 1rem;
}
ul.team li { margin: 0; line-height: 1.35; }
ul.team .name { display: block; font-weight: 600; color: var(--green-deep); }
ul.team a.name { text-decoration: none; }
ul.team a.name:hover { text-decoration: underline; text-decoration-color: var(--blossom); }
ul.team .role { display: block; margin-top: 0.15rem; color: var(--ink-soft); font-size: 0.82rem; opacity: 0.85; }
.tba { color: var(--ink-soft); font-style: italic; margin-top: 0.6rem; }
.authors sup { font-size: 0.68em; line-height: 0; }
.author-line { font-size: 1.08rem; line-height: 1.7; margin-bottom: 0.6rem; }
.author-line .author { white-space: nowrap; }
.author-line .author.emph { font-weight: 600; color: var(--green-deep); }
.author-affils { color: var(--ink-soft); font-size: 0.98rem; margin: 0 0 0.4rem; }

ul.emails { list-style: none; padding: 0; margin: 0.6rem 0; display: flex; flex-wrap: wrap; gap: 0.7rem; }
ul.emails li { margin: 0; }
ul.emails code { font-size: 0.88em; padding: 0.18em 0.5em; }

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

.post-list .post-item { margin: 1.6rem 0; }
.post-list h3 { margin: 0 0 0.25rem; }
.post-list p { margin: 0.25rem 0 0; color: var(--ink-soft); }

.post-body h2 { font-size: 1.4rem; }

@media (max-width: 560px) {
  body { font-size: 0.99rem; }
  :root { --reading-gutter: 1.1rem; }
  .wrap { padding: 1.8rem var(--reading-gutter) 4rem; }
  .topbar-inner { padding: 0.8rem 1.1rem; }
  a.wordmark img { height: 26px; margin-bottom: -7.8px; }
  h1.page-title { font-size: 1.55rem; }
  .question { padding: 1.1rem 1.1rem 0.9rem; }
}

/* ---------- After42: concept 03, in the existing qinglu palette ---------- */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.brand-wordmark {
  position: relative; display: inline-block; width: 3.744em; height: 0.82em;
  vertical-align: -0.035em; margin-inline: 0.035em;
  background: url('logo.svg') center / contain no-repeat;
}
/* Match the After42 cap height and baseline, allowing the g descender. */
.brand-wordmark--agent {
  width: 4.129702em; height: 1.118085em; vertical-align: -0.333085em;
  background-image: url('agent42.svg');
}
a.wordmark img { width: auto; height: 32px; vertical-align: middle; margin-bottom: 0; }
.topbar-inner { align-items: center; min-height: 76px; }
nav.site-nav { font-size: 0.78rem; gap: 0.4rem 1.65rem; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--green-deep); outline-offset: 5px;
}
.home-hero {
  position: relative;
  max-width: 78rem; margin: 0 auto; padding: 3.2rem 1.6rem 2.7rem;
  display: grid; grid-template-columns: 1.42fr 1fr; align-items: center; gap: 2.5rem;
}
.eyebrow {
  margin: 0 0 1.45rem; font: 0.76rem/1.6 var(--mono); letter-spacing: 0.22em;
  text-transform: uppercase; color: var(--blossom-deep);
}
.home-hero h1.page-title {
  font-size: clamp(2.7rem, 4.55vw, 3.85rem); line-height: 1.06; letter-spacing: -0.025em;
  margin: 0 0 1.5rem; max-width: none; text-wrap: balance;
}
.hero-story { max-width: 37rem; }
.hero-story p { font-size: 1.15rem; line-height: 1.6; color: var(--ink-soft); margin: 0; }
.hero-story cite { font-style: italic; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.85rem; margin-top: 2rem; }
a.button {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 1.4rem;
  padding: 0.7rem 1.2rem; border: 1px solid var(--green-deep); border-radius: 3px;
  font: 1.1rem/1.4 var(--serif); text-decoration: none; transition: background-color 150ms;
}
a.button-primary { background: var(--green-deep); color: var(--bg); }
a.button-primary:hover { background: var(--ink); }
a.button-secondary { color: var(--ink); }
a.button-secondary:hover { background: var(--bg-card); }
.button-arrow {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round;
}
.hero-scroll {
  position: absolute; bottom: 1rem; left: 50%; transform: translateX(-50%);
  display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  color: rgba(46, 110, 102, 0.28); text-decoration: none; border-radius: 50%;
  transition: color 150ms;
}
.hero-scroll svg {
  width: 22px; height: 22px; fill: none; stroke: currentColor;
  stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round;
}
.hero-scroll:hover, .hero-scroll:focus-visible { color: var(--green-deep); }
.hero-art img { display: block; width: 100%; height: auto; }
.project-opening { max-width: var(--reading-width); margin: 0 auto; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule-soft); }
.opening-inner { padding: 2.7rem var(--reading-gutter) 2.8rem; }
.opening-inner p { font: 1.1rem/1.8 var(--text); margin: 0; }
.post-list h3 a { text-decoration: none; color: var(--ink); }
.post-list h3 a:hover { text-decoration: underline; text-decoration-color: var(--blossom); }
footer .brand-wordmark { font-size: 1rem; vertical-align: -0.13em; margin-right: 0.2em; }
/* Let the wide hero fill the first screen without enlarging its artwork. */
@media (min-width: 761px) {
  .home-hero { min-height: calc(100svh - 76px); }
}
@media (max-width: 1000px) {
  .home-hero { gap: 1.5rem; grid-template-columns: 1.35fr 1fr; }
  .home-hero h1.page-title { font-size: clamp(2.5rem, 4.9vw, 3.4rem); }
  nav.site-nav { gap: 0.4rem 1rem; }
}
@media (max-width: 760px) {
  .topbar-inner { align-items: center; gap: 0.8rem 1.5rem; padding-block: 0.9rem; }
  .home-hero { grid-template-columns: 1fr; padding-top: 2.2rem; gap: 2rem; }
  .hero-scroll { bottom: 0.15rem; height: 1.5rem; }
  .home-hero h1.page-title { font-size: clamp(2.6rem, 7.7vw, 3.6rem); max-width: 36rem; }
  .hero-story p { font-size: 1.08rem; }
  .hero-art { max-width: 27rem; width: 100%; justify-self: center; }
  .hero-art img { aspect-ratio: 1.5; object-fit: contain; background: var(--blossom-soft); }
  .opening-inner { padding-block: 2rem; }
  .opening-inner p { font-size: 1.05rem; line-height: 1.75; }
}
@media (max-width: 560px) {
  .topbar-inner { padding: 0.8rem 1.1rem; }
  a.wordmark img { height: 28px; margin: 0; }
  nav.site-nav { width: 100%; justify-content: space-between; gap: 0.3rem; font-size: 0.72rem; }
  .home-hero { padding: 2rem 1.1rem 1.8rem; }
  .eyebrow { font-size: 0.66rem; margin-bottom: 1rem; }
  .home-hero h1.page-title { font-size: clamp(2.3rem, 8.2vw, 2.8rem); margin-bottom: 1rem; }
  .hero-actions { gap: 0.65rem; margin-top: 1.4rem; }
  a.button { font-size: 1rem; padding: 0.65rem 0.9rem; gap: 0.7rem; }
  .opening-inner { padding-block: 1.8rem; }
  .hero-art { max-width: 22rem; }
}
