/* JSNice — project site. Plain CSS, no build step, no external assets. */

:root {
  color-scheme: light dark;

  --bg:            #fbfbfa;
  --bg-elevated:   #ffffff;
  --bg-sunken:     #f1f1ee;
  --bg-code:       #f5f5f2;
  --text:          #1a1a19;
  --text-muted:    #55554f;
  --text-faint:    #6d6d66;
  --border:        #dededa;
  --border-strong: #8a8a84;
  --accent:        #1c5d8f;
  --accent-hover:  #0f4568;
  --accent-soft:   #e8f1f8;
  --ok:            #1f6a45;

  --maxw: 62rem;
  --radius: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
               Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #14161a;
    --bg-elevated:   #1b1e23;
    --bg-sunken:     #101216;
    --bg-code:       #101318;
    --text:          #e8e9ea;
    --text-muted:    #b1b5bb;
    --text-faint:    #969ba2;
    --border:        #2c3138;
    --border-strong: #666e79;
    --accent:        #7ab6e0;
    --accent-hover:  #a3cef0;
    --accent-soft:   #182430;
    --ok:            #6dbf99;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  overflow-wrap: break-word;
}

@media (min-width: 60rem) { body { font-size: 18px; } }

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 1.15rem;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.015em; }

h1 {
  font-size: clamp(2.2rem, 8vw, 3.4rem);
  margin: 0 0 .3rem;
  font-weight: 700;
}

h2 {
  font-size: clamp(1.35rem, 4.2vw, 1.7rem);
  margin: 0 0 1rem;
  font-weight: 650;
}

h3 { font-size: 1.05rem; margin: 0 0 .35rem; font-weight: 650; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--bg-elevated);
  color: var(--text);
  padding: .6rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 0 0 var(--radius) 0;
  z-index: 10;
}
.skip-link:focus { left: 0; }

/* ---------- Header / hero ---------- */

.hero {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: 3rem 0 2.5rem;
}

.backlink {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .78rem;
  letter-spacing: .04em;
  text-decoration: none;
  margin: 0 0 1.1rem;
}
.backlink:hover { text-decoration: underline; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: .75rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 .9rem;
}

.tagline {
  font-size: clamp(1.05rem, 3.4vw, 1.3rem);
  color: var(--text-muted);
  margin: 0 0 1.6rem;
  max-width: 44ch;
}

.summary {
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  color: var(--text);
  max-width: 52rem;
}

.summary p { font-size: .97rem; margin: 0 0 .7rem; }
.summary p:last-child { margin-bottom: 0; }
.summary strong { font-weight: 600; }

.hero-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: 1.6rem 0 0;
  padding: 0;
}

.btn {
  display: inline-block;
  padding: .55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  font-size: .92rem;
  font-weight: 550;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
@media (prefers-color-scheme: dark) {
  .btn-primary, .btn-primary:hover { color: #0d1116; }
}

.jump { margin-top: .9rem; }
.jump .btn { font-size: .85rem; padding: .38rem .85rem; }

/* ---------- Sections ---------- */

main section {
  padding: 2.75rem 0;
  border-bottom: 1px solid var(--border);
}
main section:last-of-type { border-bottom: 0; }

.lede { max-width: 68ch; color: var(--text-muted); }
.lede strong { color: var(--text); font-weight: 600; }

/* ---------- Code illustration ---------- */

figure.demo { margin: 1.75rem 0 0; }

.panes { display: grid; gap: 1rem; }
@media (min-width: 48rem) {
  .panes { grid-template-columns: 1fr 1fr; }
}

.pane {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.pane pre { flex: 1 1 auto; }

.pane-title {
  font-family: var(--font-mono);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: .5rem .85rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-sunken);
}

pre {
  margin: 0;
  padding: .9rem .95rem;
  overflow-x: auto;
  background: var(--bg-code);
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.6;
  tab-size: 2;
}

pre code { font: inherit; color: var(--text); }

code { font-family: var(--font-mono); font-size: .88em; }

:not(pre) > code {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: .05em .35em;
}

.note {
  margin-top: 1rem;
  font-size: .85rem;
  color: var(--text-faint);
  max-width: 70ch;
}

.citation .links { margin-top: .7rem; }

figcaption {
  margin-top: .8rem;
  font-size: .85rem;
  color: var(--text-faint);
  max-width: 70ch;
}

/* ---------- Lists / cards ---------- */

.points {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0 0;
  display: grid;
  gap: 1.1rem;
}
@media (min-width: 46rem) {
  .points { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.4rem 2rem; }
}

.points li { max-width: 60ch; }
.points p { font-size: .95rem; color: var(--text-muted); margin: 0; }

.stats {
  display: grid;
  gap: .9rem;
  margin: 1.75rem 0 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 40rem) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.stat {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 1rem;
}

.stat b {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat span { font-size: .87rem; color: var(--text-muted); }

.cards {
  list-style: none;
  padding: 0;
  margin: 1.4rem 0 0;
  display: grid;
  gap: 1rem;
}
@media (min-width: 44rem) {
  .cards { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 1.05rem 1.1rem;
}

.card h3 a { text-decoration: none; }
.card h3 a:hover { text-decoration: underline; }

.card p { font-size: .9rem; color: var(--text-muted); margin: .3rem 0 0; }

.card .meta {
  font-family: var(--font-mono);
  font-size: .73rem;
  color: var(--text-faint);
  margin-top: .6rem;
  letter-spacing: .02em;
}

/* ---------- Paper ---------- */

.citation {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  padding: 1.05rem 1.15rem;
  margin: 1.35rem 0 1.25rem;
  max-width: 60rem;
}

.citation .title { font-weight: 650; }
.citation .authors, .citation .venue { color: var(--text-muted); font-size: .95rem; }

.bibtex-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}

.bibtex-head h3 { margin: 0; }

button.copy {
  font: inherit;
  font-size: .82rem;
  padding: .3rem .75rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
}
button.copy:hover { border-color: var(--accent); color: var(--accent); }
button.copy[data-copied="true"] { color: var(--ok); border-color: var(--ok); }

.bibtex {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ---------- Link list ---------- */

.linklist { list-style: none; padding: 0; margin: 1.2rem 0 0; }
.linklist li { padding: .7rem 0; border-top: 1px solid var(--border); }
.linklist li:last-child { border-bottom: 1px solid var(--border); }
.linklist .desc { display: block; font-size: .88rem; color: var(--text-muted); }

/* ---------- Footer ---------- */

footer {
  background: var(--bg-sunken);
  border-top: 1px solid var(--border);
  padding: 2rem 0 2.5rem;
  font-size: .88rem;
  color: var(--text-muted);
}

footer p { max-width: 62ch; }

.ext::after {
  content: "\2197" / "";
  font-size: .75em;
  margin-left: .18em;
  vertical-align: .12em;
  opacity: .65;
}

/* Four repositories read better as a balanced 2x2 than as 3 + 1 orphan. */
@media (min-width: 52rem) {
  #code .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
