/* Neurorehab Gist public page. Same theme as the personal site (siva82kb.github.io,
   src/styles/global.css): white page, Inter, teal accent, flat lists divided by rules. */
@font-face { font-family: "Inter Variable"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(inter.woff2) format("woff2-variations"); }
:root {
  --bg: #ffffff; --ink: #16202a; --muted: #46525e; --rule: #dfe3e8; --soft: #f3f5f7;
  --accent: #0f5c5c; --accent-ink: #ffffff; --btn: #16202a; --btn-ink: #ffffff; --bad: #b91c1c;
  --font: "Inter Variable", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* Type scale, as on the personal site: every font size is one of these six. */
  --fs-h1: clamp(28px, 3.4vw, 40px); --fs-h2: 21px; --fs-h3: 17px; --fs-body: 15px; --fs-small: 13px; --fs-label: 12px;
  --wide: 1120px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1519; --ink: #e7ebee; --muted: #a8b3bd; --rule: #27323b; --soft: #172027;
    --accent: #6fc7bd; --accent-ink: #0f1519; --btn: #e7ebee; --btn-ink: #0f1519; --bad: #f08a8a;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: var(--fs-body)/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -0.02em; }
p { margin: 0; }
.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 32px; }
@media (max-width: 600px) { .wrap { padding: 0 20px; } }

/* Top bar: the personal site's menu. */
.site-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 24px; padding: 20px 0; }
.brand { display: flex; flex-direction: column; font-size: var(--fs-h3); font-weight: 600; line-height: 1.1; letter-spacing: -0.01em; color: var(--ink); text-decoration: none; }
.brand b { font-weight: 800; color: var(--accent); margin-right: 0.03em; }
.nav-links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px; font-size: var(--fs-body); font-weight: 500; }
.nav-links a { color: var(--muted); text-decoration: none; padding: 6px 0; }
.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--ink); }
.nav-links a[aria-current="page"] { box-shadow: 0 2px 0 var(--accent); }
.nav-links a.cv, .nav-links a.cv:hover { color: var(--accent-ink); background: var(--accent); padding: 9px 16px; border-radius: 4px; }

/* Page head */
.masthead { padding: 20px 0 36px; }
.masthead h1 { font-size: var(--fs-h1); font-weight: 700; letter-spacing: -0.025em; }
.masthead h1 span { color: var(--accent); }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.tagline { padding-left: 20px; border-left: 1px solid var(--rule); font-size: var(--fs-body); line-height: 1.35; color: var(--muted); }
@media (max-width: 600px) { .tagline { padding-left: 0; border-left: 0; flex-basis: 100%; } .tagline br { display: none; } }
.credit { margin: 16px 0 18px; font-size: var(--fs-small); color: var(--muted); }
.credit b { font-weight: 600; color: var(--ink); }
.disclosure { margin-bottom: 20px; padding: 12px 16px; background: var(--soft); border-left: 3px solid var(--accent); border-radius: 4px; font-size: var(--fs-small); color: var(--muted); }
.disclosure b { color: var(--ink); }
.disclosure p + p, .disclosure ul + p { margin-top: 8px; }
.disclosure ul { margin: 4px 0 0; padding-left: 18px; }
.disclosure li { margin-bottom: 2px; }
.subscribe { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 8px; font-size: var(--fs-small); font-weight: 600; }
/* One per way to follow: an icon and a word. */
.way { display: inline-flex; align-items: center; gap: 7px; padding: 8px 13px; border: 1px solid var(--rule); border-radius: 4px; color: var(--ink); text-decoration: none; }
.way svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; color: var(--accent); }
.way:hover { border-color: var(--accent); color: var(--accent); }
.way.primary { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.way.primary svg { color: inherit; }
.way.primary:hover { opacity: 0.88; color: var(--btn-ink); }
.btn { display: inline-block; font-size: var(--fs-small); font-weight: 600; text-decoration: none; padding: 10px 18px; border-radius: 4px; border: 1px solid var(--btn); background: var(--btn); color: var(--btn-ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn:hover { opacity: 0.88; }

/* Layout: papers on the left, filters in a column on the right that stays put while scrolling.
   Text above and below (notice, about) is as wide as the paper column. Narrow screens: one
   column, filters first. */
:root { --side: 288px; --gap: 56px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) var(--side); gap: 0 var(--gap); align-items: start; }
.layout::before { content: ""; grid-column: 1 / -1; border-top: 1px solid var(--rule); margin-bottom: 28px; }
.side { position: sticky; top: 24px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.filters label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.filters .wide, .quick { grid-column: 1 / -1; }
.filters input, .filters select, .quick button { width: 100%; min-width: 0; height: 38px; font: var(--fs-small) var(--font); padding: 0 8px; border: 1px solid var(--rule); border-radius: 4px; background: var(--bg); color: var(--ink); }
.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; }
.quick button { cursor: pointer; font-weight: 500; }
.quick button:hover { border-color: var(--accent); color: var(--accent); }
.summary { font-size: var(--fs-small); color: var(--muted); }
.summary a { font-weight: 600; }
@media (min-width: 901px) { .disclosure { max-width: calc(100% - var(--side) - var(--gap)); } }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; order: -1; margin-bottom: 20px; }
  .layout::before { order: -2; }
  .quick { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 480px) { .quick { grid-template-columns: 1fr 1fr; } }

/* Issues: one section per day; papers are rows divided by rules, as in the publication list. */
.issue { margin-top: 40px; }
.summary + #issues .issue:first-child { margin-top: 24px; }
.issue h2 { font-size: var(--fs-h3); font-weight: 700; display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 12px; }
.issue h2 span { font-size: var(--fs-small); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.missed { margin: -4px 0 10px; font-size: var(--fs-label); color: var(--bad); }

.paper { padding: 16px 0; border-top: 1px solid var(--rule); }
.kicker { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); overflow-wrap: anywhere; }
.badge { margin-left: 8px; padding: 1px 7px; border-radius: 3px; border: 1px solid var(--rule); color: var(--muted); letter-spacing: 0; text-transform: none; font-weight: 500; }
.badge.late { color: var(--bad); border-color: var(--bad); }
.paper h3 { margin: 4px 0 2px; font-size: var(--fs-body); font-weight: 400; line-height: 1.4; letter-spacing: -0.005em; overflow-wrap: anywhere; }
.paper h3 a, .row h3 a { color: var(--ink); text-decoration: none; }
.paper h3 a:hover, .row h3 a:hover { color: var(--accent); text-decoration: underline; }
.authors { font-size: var(--fs-small); color: var(--muted); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: var(--fs-label); padding: 1px 8px; border-radius: 3px; background: var(--soft); color: var(--muted); }
.tag.type { background: transparent; box-shadow: inset 0 0 0 1px var(--accent); color: var(--accent); font-weight: 600; }
.topics { margin-top: 6px; font-size: var(--fs-label); color: var(--muted); }
.empty { margin: 36px 0; color: var(--muted); }

/* Compact view (index.html, the default; cards.html is the card view): one row per paper, title then a single line of details. */
[data-view="compact"] .issue { margin-top: 32px; }
[data-view="compact"] .issue h2 { margin-bottom: 8px; }
.row { padding: 10px 0; border-top: 1px solid var(--rule); }
.row h3 { font-size: var(--fs-body); font-weight: 400; line-height: 1.4; letter-spacing: 0; overflow-wrap: anywhere; }
.row .details { margin-top: 1px; font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.row .badge { font-size: var(--fs-label); }
.row .kind { color: var(--accent); font-weight: 600; }
/* The details line: authors grey, journal blue, date brown, study type teal. */
.row .journal { color: var(--c-journal); }
.row .date { color: var(--c-date); }

/* About and footer */
.about { margin-top: 56px; padding: 28px 0 12px; border-top: 1px solid var(--rule); font-size: var(--fs-body); color: var(--muted); }
.about h2 { margin: 20px 0 8px; font-size: var(--fs-h2); font-weight: 700; color: var(--ink); }
.about h2:first-child { margin-top: 0; }
.about ul { margin: 0; padding-left: 20px; }
.about li { margin-bottom: 6px; }
.about b { color: var(--ink); font-weight: 600; }
code { font-family: var(--mono); font-size: 0.9em; padding: 2px 5px; border-radius: 3px; background: var(--soft); }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; margin-top: 24px; padding-top: 28px; padding-bottom: 40px; font-size: var(--fs-small); color: var(--muted); }
.foot::before { content: ""; flex-basis: 100%; border-top: 1px solid var(--rule); margin-bottom: 16px; }
.foot a { color: var(--muted); }

/* Missed paper box in About: DOI, name, and a button that opens the reader's mail program. */
.about p { margin: 0 0 10px; }
.suggest { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 8px; margin: 0 0 12px; }
.suggest input, .suggest button { height: 38px; min-width: 0; font: var(--fs-small) var(--font); padding: 0 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--bg); color: var(--ink); }
.suggest button { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); font-weight: 600; cursor: pointer; }
.suggest button:hover { opacity: 0.88; }
@media (max-width: 600px) { .suggest { grid-template-columns: 1fr; } }

/* ---------- How it works (how.html): a flowchart whose boxes open their details ---------- */
:root { --by-code: #5b6672; --by-ai: #a15c00; --by-human: var(--accent); }
:root { --c-journal: #35568f; --c-date: #8a5a1c; }
@media (prefers-color-scheme: dark) { :root { --c-journal: #9db7e6; --c-date: #d9b27a; } }
@media (prefers-color-scheme: dark) { :root { --by-code: #9aa6b1; --by-ai: #e3b062; } }
.by-code { --by: var(--by-code); } .by-ai { --by: var(--by-ai); } .by-human { --by: var(--by-human); }
.how .back { margin-bottom: 14px; font-size: var(--fs-small); font-weight: 500; }
.how .back a { color: var(--muted); text-decoration: none; }
.how .back a:hover { color: var(--accent); }
.how .lede { margin-top: 16px; font-size: var(--fs-h3); color: var(--muted); }
.funnel { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 22px; font-size: var(--fs-small); color: var(--muted); }
.funnel b { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.02em; color: var(--ink); margin-right: 4px; font-variant-numeric: tabular-nums; }
.funnel span + span:not(.since)::before { content: "→"; margin-right: 14px; color: var(--rule); }
.funnel .since { font-size: var(--fs-small); }
.key { display: flex; flex-wrap: wrap; gap: 6px 22px; padding: 18px 0 22px; border-top: 1px solid var(--rule); font-size: var(--fs-small); color: var(--muted); }
.key i, .node .by::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: var(--by); }

.flow { position: relative; display: grid; grid-template-columns: 30px minmax(0, 1fr); }
.loop { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; }
.loop path { fill: none; stroke: var(--by-human); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
#loop-path { stroke-dasharray: 2 5; }
.node { grid-column: 2; position: relative; display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 16px 13px 14px; text-align: left; font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-left: 3px solid var(--by); border-radius: 6px; cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.node:not(:first-of-type) { margin-top: 26px; }
/* The arrow from the box above. */
.node:not(:first-of-type)::before { content: ""; position: absolute; left: 27px; top: -24px; height: 20px; border-left: 1.5px solid var(--muted); opacity: 0.55; }
.node:not(:first-of-type)::after { content: ""; position: absolute; left: 23.5px; top: -11px; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); opacity: 0.55; }
.node:hover { border-color: var(--by); }
.node.on { background: var(--soft); border-color: var(--by); }
.node .num { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; font-size: var(--fs-small); font-weight: 700; color: var(--by); border: 1.5px solid var(--by); font-variant-numeric: tabular-nums; }
.node.on .num { background: var(--by); color: var(--bg); }
.node .text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.35; }
.node .text b { font-size: var(--fs-body); font-weight: 650; letter-spacing: -0.01em; }
.node .text span { font-size: var(--fs-small); color: var(--muted); }
.node .by { flex: none; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }

.detail { grid-column: 2; margin: 10px 0 0; padding: 4px 0 6px 20px; border-left: 3px solid var(--by, var(--rule)); font-size: var(--fs-body); color: var(--muted); }
.flow.js .detail:not(.on) { display: none; }
.detail .eyebrow { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--by); }
.detail h2 { margin: 6px 0 12px; font-size: var(--fs-h2); font-weight: 700; color: var(--ink); }
.detail p { margin: 0 0 12px; }
.detail ul { margin: 0 0 14px; padding-left: 20px; }
.detail li { margin-bottom: 7px; }
.detail b { color: var(--ink); font-weight: 600; }
.detail code { font: var(--fs-small) var(--mono); padding: 1px 5px; background: var(--soft); border-radius: 3px; }
.detail .limit { padding: 11px 14px; background: var(--soft); border-radius: 4px; font-size: var(--fs-small); }
.detail .to { white-space: nowrap; font-size: var(--fs-small); color: var(--by-human); font-weight: 600; }
.detail details { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--rule); }
.detail summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.detail details > p { margin-top: 12px; }
.detail .query { margin: 8px 0 0; padding: 0 0 0 14px; border-top: 0; }
.detail .query summary { font-weight: 500; font-size: var(--fs-small); }
.detail .query code { display: block; margin-top: 8px; padding: 10px 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--fs-label); line-height: 1.55; }
/* Each detail takes its own step's colour from its eyebrow class. */
#step-score { --by: var(--by-ai); } #step-review, #step-learn { --by: var(--by-human); }
#step-search, #step-merge, #step-list, #step-publish { --by: var(--by-code); }

/* Wide screens: the chart on the left, the open step's details beside it. */
@media (min-width: 901px) {
  .flow.js { grid-template-columns: 30px minmax(0, 390px) minmax(0, 1fr); grid-template-rows: repeat(7, auto) 1fr; column-gap: 0; }
  .flow.js .detail { grid-column: 3; grid-row: 1 / span 8; align-self: stretch; margin: 0 0 0 44px; padding: 26px 30px 22px; border: 1px solid var(--rule); border-top: 3px solid var(--by); border-radius: 6px; }
  /* A notch joining the open box to its details. */
  .flow.js .node.on .by::after { content: ""; position: absolute; right: -45px; top: 50%; width: 44px; border-top: 1.5px solid var(--by); }
}
@media (max-width: 480px) { .node .by { display: none; } .flow { grid-template-columns: 24px minmax(0, 1fr); } }
.processing { margin: -4px 0 10px; font-size: var(--fs-label); color: var(--muted); }

/* ---------- Weekly pages (week-YYYY-MM-DD.html): the week's papers with citations ---------- */
.eyebrow { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }
.week .back { margin-bottom: 14px; font-size: var(--fs-small); font-weight: 500; }
.week .back a { color: var(--muted); text-decoration: none; }
.week .masthead h1 { margin-top: 4px; }
.week .lede { margin-top: 14px; font-size: var(--fs-h3); color: var(--muted); }
.week-nav { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 18px; font-size: var(--fs-small); font-weight: 600; }
.note { margin-bottom: 28px; padding: 18px 22px 8px; background: var(--soft); border-left: 3px solid var(--accent); border-radius: 4px; }
.note p { margin: 8px 0 12px; }
.note h2 { margin: 16px 0 8px; font-size: var(--fs-body); font-weight: 700; }
.note ul { margin: 0 0 12px; padding-left: 20px; }
.note li { margin-bottom: 8px; color: var(--muted); }
.note li a { color: var(--ink); font-weight: 600; }
.week .paper h3 { margin-top: 0; }
.cite { font-size: var(--fs-small); color: var(--muted); overflow-wrap: anywhere; }
.acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin-top: 10px; font-size: var(--fs-small); }
.acts button { font: var(--fs-small) var(--font); font-weight: 500; padding: 4px 10px; border: 1px solid var(--rule); border-radius: 4px; background: var(--bg); color: var(--ink); cursor: pointer; }
.acts button:hover { border-color: var(--accent); color: var(--accent); }
.acts a { margin-left: 6px; font-weight: 600; }
.flabel { display: block; margin-bottom: 4px; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.quick button.on { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.weeks { list-style: none; padding: 0; }
.paper[hidden], .issue[hidden] { display: none; }

/* The archive of weekly issues (weeks/): one row per week, by year. */
.archive-list { padding-bottom: 24px; }
.archive-list::before { content: ""; display: block; border-top: 1px solid var(--rule); margin-bottom: 20px; }
.year { margin-top: 36px; }
.year h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 8px; font-size: var(--fs-h2); font-weight: 700; }
.year h2 span { font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.week-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 24px; padding: 13px 0; border-top: 1px solid var(--rule); color: var(--ink); text-decoration: none; }
.week-row:hover .when { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.week-row .when { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; }
.week-row .when small { margin-left: 10px; font-size: var(--fs-small); font-weight: 400; color: var(--muted); letter-spacing: 0; }
.week-row .what { font-size: var(--fs-small); color: var(--muted); }
.week-row .what b { color: var(--accent); font-weight: 600; }
.week-row.now { padding: 14px 18px; border: 1px solid var(--rule); border-left: 3px solid var(--accent); border-radius: 4px; background: var(--soft); }
/* The calendar: the twelve months as columns across the page, each month's weeks stacked under it. */
.months { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px 6px; padding-top: 10px; border-top: 1px solid var(--rule); }
.month { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.mname { padding-bottom: 4px; font-size: var(--fs-label); font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.month.none .mname { opacity: 0.45; }
.wk { display: flex; flex-direction: column; padding: 4px 7px; border: 1px solid var(--rule); border-radius: 4px; line-height: 1.3; color: var(--ink); text-decoration: none; white-space: nowrap; overflow: hidden; }
.wk:hover { border-color: var(--accent); color: var(--accent); }
.wk b { font-size: var(--fs-small); font-weight: 600; }
.wk small { font-size: 11px; color: var(--muted); }
.wk.noted { border-left: 3px solid var(--accent); padding-left: 5px; }
.legend { display: flex; align-items: center; gap: 8px; margin-top: 18px; font-size: var(--fs-small); color: var(--muted); }
.wk.demo { width: 22px; height: 18px; padding: 0; }
@media (max-width: 900px) { .months { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 520px) { .months { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Year buttons above the calendar: each year has its own address (weeks/<year>/). */
.years { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.years a { padding: 6px 16px; border: 1px solid var(--rule); border-radius: 4px; font-size: var(--fs-body); font-weight: 600; color: var(--ink); text-decoration: none; }
.years a:hover { border-color: var(--accent); color: var(--accent); }
.years a.on { background: var(--btn); border-color: var(--btn); color: var(--btn-ink); }
.years + .year { margin-top: 20px; }
