/* NetHGL project page. Brain Stimulation Lab palette (bsl_style.sty) and the panel tints of the paper's figures. */
:root {
  --teal: #008fa8;
  --teal-ink: #006b7e;
  --red: #a31317;
  --amber: #f7b719;
  --ink: #1b2530;
  --muted: #57626f;
  --line: #dde5ea;
  --pale: #f1f8f9;
  --panel-b: #e9f4f1;
  --b-ink: #1d5a52;
  --dep: #8e3a34;
  --bg: #ffffff;
  --nav-h: 59px;   /* header row (58px) plus its bottom border */
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 14px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal-ink); text-underline-offset: 2px; }
a:hover { color: var(--teal); }
sup, sub { font-size: 0.68em; line-height: 0; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

.wrap { max-width: 1080px; margin-inline: auto; padding-inline: 20px; }
.narrow { max-width: 760px; margin-inline: auto; }
.narrow-text, .desc { max-width: 62em; }

/* ---------- header ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.navrow { display: flex; align-items: center; gap: 18px; height: 58px; }
.brand { flex: none; display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 1.2rem; font-weight: 700; letter-spacing: -0.01em; text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand .mark { flex: none; width: 30px; height: 30px; border-radius: 7px; }
.navlinks { display: flex; align-items: stretch; gap: 4px; margin-left: auto; align-self: stretch; overflow-x: auto; scrollbar-width: none; }
.navlinks::-webkit-scrollbar { display: none; }
/* when the links do not fit they scroll sideways, and fade out at whichever end has more (classes set in page.js) */
.navlinks {
  --fade-l: 0px; --fade-r: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
  mask-image: linear-gradient(to right, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
}
.navlinks.more-l { --fade-l: 24px; }
.navlinks.more-r { --fade-r: 24px; }
.navlinks a {
  display: inline-flex; align-items: center; padding: 0 12px; white-space: nowrap;
  color: var(--muted); font-size: 0.97rem; font-weight: 500; text-decoration: none;
  border-bottom: 2.5px solid transparent; border-top: 2.5px solid transparent;
}
.navlinks a:hover { color: var(--ink); }
.navlinks a[aria-current] { color: var(--ink); border-bottom-color: var(--teal); }
.navbtn {
  flex: none; padding: 8px 18px; border-radius: 8px; background: var(--ink); color: #fff;
  font-size: 0.97rem; font-weight: 700; text-decoration: none;
}
.navbtn:hover { background: var(--teal-ink); color: #fff; }

/* ---------- first screen: title block and overview figure ---------- */
.first { display: flex; flex-direction: column; padding-block: 22px 18px; }
.hero { text-align: center; }
.hero .name { display: block; font-size: clamp(2.2rem, 5vw, 3.1rem); font-weight: 700; letter-spacing: -0.02em; line-height: 1; color: var(--teal-ink); }
.hero .expand { display: block; margin-top: 6px; font-size: 0.92rem; letter-spacing: 0.02em; color: var(--muted); }
.hero .expand b { color: var(--ink); }
.hero h1 { margin: 12px auto 0; max-width: 40em; font-size: clamp(1.08rem, 2vw, 1.3rem); font-weight: 600; line-height: 1.3; text-wrap: balance; }
.authors { margin: 14px 0 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 22px; font-weight: 600; }
.affil { margin: 4px 0 0; color: var(--muted); font-size: 0.92rem; }
.affil.note { margin-top: 0; font-size: 0.84rem; }
.links { margin-top: 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; padding: 7px 17px;
  border: 1.5px solid var(--ink); border-radius: 999px; background: var(--ink); color: #fff;
  font-size: 0.93rem; font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--teal-ink); border-color: var(--teal-ink); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--pale); color: var(--ink); }
.btn.off { background: transparent; color: var(--muted); border-color: var(--line); border-style: dashed; }
.first .fig { margin-top: 16px; padding: 10px 12px; }
.first .fig figcaption { margin-top: 8px; font-size: 0.85rem; line-height: 1.45; }
@media (min-width: 760px) and (min-height: 540px) {
  /* the section is never taller than the screen below the header: the figure gives up height first */
  .first { max-height: calc(100vh - var(--nav-h)); max-height: calc(100svh - var(--nav-h)); }
  .first .fig { flex: 0 1 auto; min-height: 0; display: flex; flex-direction: column; }
  .first .fig img { flex: 0 1 auto; min-height: 0; width: 100%; object-fit: contain; }
  .first .hero, .first .fig figcaption { flex: none; }
}

/* ---------- sections ---------- */
section { padding-block: 44px; }
h2 { margin: 0 0 14px; font-size: 1.55rem; line-height: 1.25; letter-spacing: -0.01em; }
h2.sub { margin-top: 40px; font-size: 1.25rem; }
h3 { margin: 0 0 8px; font-size: 1.1rem; line-height: 1.3; }
p { margin: 0 0 14px; }
.lede { font-size: 1.08rem; }
.kicker { margin: 0 0 6px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--teal-ink); }
.band { background: var(--panel-b); }
.band .kicker { color: var(--b-ink); }

figure { margin: 0; }
.fig { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 14px; }
.fig figcaption { margin-top: 12px; font-size: 0.9rem; line-height: 1.5; color: var(--muted); }
.fig figcaption b { color: var(--ink); }
.abstractsec { padding-top: 30px; }

/* ---------- method: text beside the figure, the whole section within one screen ---------- */
#method { padding-block: 26px; }
.methodgrid { display: grid; grid-template-columns: minmax(0, 0.58fr) minmax(0, 1fr); gap: 28px; align-items: center; }
.mtext h2 { font-size: 1.4rem; text-wrap: balance; }
.mtext .desc { margin: 0; font-size: 0.97rem; line-height: 1.55; }
#method .fig { padding: 10px 12px; }
#method .fig figcaption { margin-top: 8px; font-size: 0.85rem; line-height: 1.45; }
@media (min-width: 900px) and (min-height: 540px) {
  #method .fig { max-height: calc(100vh - var(--nav-h) - 52px); max-height: calc(100svh - var(--nav-h) - 52px); display: flex; flex-direction: column; }
  #method .fig img { flex: 0 1 auto; min-height: 0; width: 100%; object-fit: contain; }
  #method .fig figcaption { flex: none; }
}

.facts { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.facts li { border-top: 3px solid var(--teal); background: var(--pale); padding: 12px 14px; border-radius: 0 0 8px 8px; }
.facts b { display: block; font-size: 1.5rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.facts span { font-size: 0.86rem; color: var(--muted); }

.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-top: 14px; }
.three article { border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.three h3 { margin: 0 0 6px; font-size: 1.02rem; }
.three p { margin: 0; font-size: 0.94rem; color: var(--muted); }
.three article:nth-child(1) { border-top: 3px solid var(--teal); }
.three article:nth-child(2) { border-top: 3px solid var(--amber); }
.three article:nth-child(3) { border-top: 3px solid var(--red); }

/* ---------- results tables ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 14px; }
.tablewrap table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
caption { caption-side: top; text-align: left; padding: 12px 14px 10px; font-size: 0.9rem; color: var(--muted); }
caption b { color: var(--ink); }
.tablewrap th, .tablewrap td { padding: 7px 10px; text-align: center; border-top: 1px solid var(--line); white-space: nowrap; }
.tablewrap thead th { border-top: 0; border-bottom: 1.5px solid var(--ink); font-size: 0.84rem; background: #fafcfd; }
.tablewrap tbody th { text-align: left; font-weight: 500; }
td small { display: block; font-size: 0.72rem; color: var(--muted); margin-top: -1px; }
td.best { background: #e3f1f4; font-weight: 700; }
td.second { background: #fdf3d6; }
td.second span { text-decoration: underline; text-underline-offset: 2px; }
tr.ours th { font-weight: 700; }
tr.ours th, tr.ours td { border-top: 1.5px solid var(--ink); }
td.delta { color: var(--dep); font-weight: 600; }

/* ---------- findings: tabs, then text beside the figure; the whole section within one screen ---------- */
#findings { padding-block: 22px; }
#findings .wrap { display: flex; flex-direction: column; }
.fhead { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr); gap: 26px; align-items: end; }
.fhead h2 { margin: 0; text-wrap: balance; }
.fhead .desc { margin: 0; font-size: 0.86rem; line-height: 1.45; color: #3c5a54; }
.tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.tabs button {
  display: flex; align-items: center; gap: 9px; text-align: left;
  padding: 8px 11px; border-radius: 10px; border: 1.5px solid #c5ddd6; background: rgba(255, 255, 255, 0.6);
  color: var(--b-ink); font: inherit; font-size: 0.93rem; font-weight: 600; line-height: 1.22; cursor: pointer;
}
.tabs button:hover { background: #fff; }
.tabs button b { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 0.82rem; }
.tabs button[aria-selected="true"] { background: var(--b-ink); border-color: var(--b-ink); color: #fff; }
.tabs button[aria-selected="true"] b { background: #fff; border-color: #fff; color: var(--b-ink); }

.finding { display: grid; grid-template-columns: minmax(0, 0.7fr) minmax(0, 1fr); gap: 22px; margin-top: 12px; padding: 16px 18px; background: #fff; border: 1px solid #cfe3dd; border-radius: 12px; }
.finding[hidden] { display: none; }
.finding.tall { grid-template-columns: minmax(0, 0.5fr) minmax(0, 1fr); }   /* tall figures: narrower text, larger plot */
.finding > * { min-width: 0; }
.finding h3 { font-size: 1.14rem; color: var(--b-ink); margin-bottom: 8px; text-wrap: balance; }
.finding .ftext p { font-size: 0.95rem; line-height: 1.5; margin-bottom: 10px; }
.finding .ftext p:last-child { margin-bottom: 0; }
.finding .fig { padding: 8px 10px; align-self: start; }
.finding .fig figcaption { margin-top: 6px; font-size: 0.82rem; line-height: 1.4; }
.zoom { display: block; cursor: zoom-in; }
.stat { background: var(--pale); border-left: 3px solid var(--teal); padding: 8px 12px; border-radius: 0 6px 6px 0; }
@media (min-width: 900px) and (min-height: 540px) {
  /* the section is never taller than the screen below the header: the figure gives up height first */
  #findings .wrap { max-height: calc(100vh - var(--nav-h) - 44px); max-height: calc(100svh - var(--nav-h) - 44px); }
  #findings .wrap > :not(.finding) { flex: none; }
  .finding { flex: 0 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .finding .ftext { min-height: 0; overflow-y: auto; }
  .finding .fig { align-self: stretch; min-height: 0; display: flex; flex-direction: column; }
  .finding .fig .zoom { flex: 1 1 auto; min-height: 0; display: flex; }
  .finding .fig img { flex: 1 1 auto; min-width: 0; min-height: 0; width: 100%; object-fit: contain; }
  .finding .fig figcaption { flex: none; }
}

/* ---------- limitations and future work ---------- */
.twocol { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 34px; margin-top: 10px; }
.twocol h3 { font-size: 1.05rem; padding-bottom: 8px; border-bottom: 1.5px solid var(--ink); margin-bottom: 4px; }
.limits, .future { margin: 0; padding: 0; list-style: none; counter-reset: lim; }
.limits li, .future li { padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 0.96rem; }
.limits li { counter-increment: lim; position: relative; padding-left: 30px; }
.limits li::before { content: counter(lim); position: absolute; left: 0; font-weight: 700; color: var(--teal-ink); font-variant-numeric: tabular-nums; }
.future li { border-left: 3px solid var(--amber); padding-left: 14px; border-bottom: 0; margin-top: 12px; }

/* ---------- cite ---------- */
.bib { position: relative; }
pre { margin: 0; padding: 16px 18px; background: #f5f7f9; border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; font-family: var(--mono); font-size: 0.84rem; line-height: 1.5; }
.bib button { position: absolute; top: 10px; right: 10px; font: inherit; font-size: 0.8rem; font-weight: 600; padding: 5px 11px; border-radius: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.bib button:hover { background: var(--pale); }

/* ---------- footer ---------- */
.foot { margin-top: 28px; background: #f5f4f1; border-top: 1px solid var(--line); padding-block: 26px 22px; }
.footrow { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 26px; }
.footbrand { margin-right: auto; }
.footbrand p { margin: 6px 0 0; max-width: 19em; color: var(--muted); font-size: 0.95rem; line-height: 1.45; }
.footlinks { display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: 0.97rem; font-weight: 500; }
.footlinks a { color: var(--ink); text-decoration: none; }
.footlinks a:hover { color: var(--teal-ink); text-decoration: underline; }
.footlinks .soon { color: var(--muted); }
.footlogos { display: flex; align-items: center; gap: 18px; }
.footlogo { flex: none; width: 105px; height: 40px; }
.footlogo.stanford { width: 90px; height: 40px; }
.footlogos .footlogo + .footlogo { padding-left: 18px; border-left: 1px solid #d9d6cf; box-sizing: content-box; }
.footnote { margin-top: 18px; padding-top: 14px; border-top: 1px solid #e3e1db; color: var(--muted); font-size: 0.85rem; }
.footnote p { margin: 0 0 4px; }

@media (max-width: 900px) {
  .bib pre { padding-top: 48px; }   /* the Copy button sits in its own row above the entry */
  .tabs { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .finding, .finding.tall { grid-template-columns: 1fr; padding: 16px; }
  .fhead { grid-template-columns: 1fr; gap: 8px; }
  .methodgrid { grid-template-columns: 1fr; gap: 16px; }
  .twocol { grid-template-columns: 1fr; gap: 26px; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding-inline: 16px; }
  section { padding-block: 32px; }
  .fig { padding: 8px; }
  .navrow { gap: 10px; }
  .brand { font-size: 1.08rem; }
  .brand .mark { width: 26px; height: 26px; }
  .navlinks a { padding: 0 9px; font-size: 0.92rem; }
  .navbtn { padding: 7px 13px; }
  .tabs { grid-template-columns: 1fr 1fr; }
  .tabs button { padding: 9px 10px; font-size: 0.9rem; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
