:root {
  --bg:        #ffffff;
  --surface:   #ffffff;
  --surface-2: #f5f5f5;
  --text:      #111111;
  --muted:     #555555;
  --faint:     #8a8a8a;
  --line:      #e6e6e6;
  --link:      #1a73e8;
  --pill:      #1f1f1f;
  --pill-text: #ffffff;

  --t-physiological: #cf4b5e;
  --t-sleep:         #5765d4;
  --t-activity:      #1f8f80;
  --t-lifestyle:     #d1892a;
  --t-mental:        #8b56bd;
  --t-environmental: #3d93c9;
  --t-demographic:   #6d7480;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #121212;
    --surface:   #121212;
    --surface-2: #1e1e1e;
    --text:      #e8e8e8;
    --muted:     #a8a8a8;
    --faint:     #7a7a7a;
    --line:      #2c2c2c;
    --link:      #7cacf8;
    --pill:      #e8e8e8;
    --pill-text: #111111;

    --t-physiological: #e8697b;
    --t-sleep:         #808ded;
    --t-activity:      #35b7a5;
    --t-lifestyle:     #e8a745;
    --t-mental:        #ab78d8;
    --t-environmental: #5fb0e3;
    --t-demographic:   #8b93a0;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1000px; margin: 0 auto; padding: 36px 20px 56px; }

section { margin-top: 36px; }
h2 { font-size: 1.3rem; margin: 0 0 10px; }
p { margin: 12px 0; }

/* ---------- header ---------- */

.hero { text-align: center; }
.hero h1 { font-size: 2.1rem; line-height: 1.3; margin: 0 0 10px; }
.venue { font-size: 1.5rem; font-weight: 700; margin: 0 0 10px; }
.authors { font-size: 1.2rem; font-weight: 600; margin: 0 0 4px; }
.authors a, .authors span { color: var(--text); }
.authors sup, .affil sup { font-weight: 400; font-size: .65em; }
.affil { color: var(--muted); font-size: 1.05rem; margin: 0 0 18px; }

.linkrow { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--pill);
  color: var(--pill-text);
  font-size: .98rem;
  font-weight: 600;
}
.pill:hover { text-decoration: none; opacity: .85; }
.pill.disabled { opacity: .45; cursor: default; }
.pill svg {
  width: 17px; height: 17px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.pill svg.solid { fill: currentColor; stroke: none; }

/* ---------- figure ---------- */

.figure {
  display: block;
  width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 8px;
}
.caption {
  color: var(--muted);
  font-size: .92rem;
  text-align: center;
  max-width: 820px;
  margin: 10px auto 0;
}

/* ---------- graph explorer ---------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-top: 16px;
  font-size: .9rem;
}
#search {
  width: 220px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
#search:focus { outline: 2px solid var(--link); outline-offset: -1px; }

.range { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; }
#threshold { width: 140px; accent-color: var(--link); }
#threshold-val { font-variant-numeric: tabular-nums; color: var(--text); }
.hint { color: var(--faint); font-variant-numeric: tabular-nums; }

.toggles { display: inline-flex; align-items: center; gap: 14px; margin-left: auto; }
.check { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--link); }
.mini {
  font: inherit;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.mini:hover { color: var(--text); border-color: var(--faint); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 12px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font: inherit;
  font-size: .8rem;
  padding: 2px 9px 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  user-select: none;
}
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chip .n { opacity: .6; }
.chip.on { border-color: currentColor; }
.chip.off { opacity: .4; color: var(--muted); }

/* category colours — used by chips, nodes, panel accents */
.t-physiological { color: var(--t-physiological); }
.t-sleep         { color: var(--t-sleep); }
.t-activity      { color: var(--t-activity); }
.t-lifestyle     { color: var(--t-lifestyle); }
.t-mental        { color: var(--t-mental); }
.t-environmental { color: var(--t-environmental); }
.t-demographic   { color: var(--t-demographic); }

.explorer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 14px;
  align-items: start;
}

.canvas-wrap {
  position: relative;
  height: 600px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
#graph { display: block; width: 100%; height: 100%; }

/* static fallback drawn by build.py */
.links line { stroke-linecap: round; vector-effect: non-scaling-stroke; }
.nodes circle { fill: currentColor; }
.labels {
  font: 500 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  fill: var(--text);
  stroke: var(--surface);
  stroke-width: 3px;
  paint-order: stroke;
  text-anchor: middle;
  dominant-baseline: hanging;
  pointer-events: none;
}

/* G6 draws into this, layered over the static SVG until it has rendered */
#graph-mount {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity .2s;
}
#graph-mount.ready { opacity: 1; }
#graph-mount canvas { display: block; }

/* only meaningful once G6 is live, and only with a mouse or trackpad */
.zoom-hint {
  display: none;
  position: absolute;
  right: 10px;
  bottom: 8px;
  font-size: .72rem;
  color: var(--faint);
  pointer-events: none;
}
@media (hover: hover) {
  #graph-mount.ready ~ .zoom-hint { display: block; }
}

/* G6's tooltip plugin renders its own div.tooltip with inline styles (and a
   "Roboto-Regular" font most machines lack); give it the page's look */
#graph-mount .tooltip {
  max-width: 260px !important;
  padding: 7px 10px !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  font: 400 .78rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12) !important;
}
#graph-mount .tooltip b { font-weight: 600; }
#graph-mount .tooltip .tt-type { color: var(--muted); }

/* only shown when the interactive graph cannot start; never covers the graph */
.loading.badge {
  position: absolute;
  left: 10px; bottom: 10px; right: 10px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: .78rem;
  z-index: 3;
}

.panel {
  height: 600px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  font-size: .88rem;
}
.panel-empty { color: var(--muted); }
.panel-empty p { margin: 0; }

.panel h4 { margin: 0 0 2px; font-size: 1.02rem; line-height: 1.3; }
.panel .kind {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: .8rem; font-weight: 600;
  margin-bottom: 10px;
}
.panel .kind .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.panel dl { margin: 0; }
.panel dt { font-size: .8rem; font-weight: 600; color: var(--muted); margin-top: 12px; }
.panel dd { margin: 2px 0 0; color: var(--muted); line-height: 1.5; font-size: .84rem; }
.panel dd.body { color: var(--text); }

.tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.tag {
  font-size: .72rem; padding: 1px 8px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted);
}

.neighbors { list-style: none; margin: 6px 0 0; padding: 0; }
.neighbors li { margin: 0; border-top: 1px solid var(--line); }
.neighbors li:first-child { border-top: none; }
.nb {
  width: 100%; text-align: left; background: none; border: 0;
  font: inherit; color: var(--text); cursor: pointer;
  padding: 7px 0; display: grid; gap: 4px;
}
.nb:hover .nb-name { color: var(--link); }
.nb-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.nb-name { font-size: .85rem; }
.nb-w { font-size: .76rem; color: var(--faint); font-variant-numeric: tabular-nums; }
.bar { height: 3px; border-radius: 2px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; background: currentColor; }
.nb-desc { font-size: .79rem; color: var(--muted); line-height: 1.5; padding: 0 0 8px; margin: 0; }

/* ---------- dataset coverage ---------- */

.coverage {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 28px;
  align-items: start;
  margin-top: 14px;
}
.coverage table {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
  line-height: 1.3;
}
.coverage th, .coverage td { padding: 3px 6px; border-bottom: 1px solid var(--line); }
.coverage thead th {
  padding: 3px 4px;
  font-size: .76rem;
  font-weight: 600;
  text-align: center;
  border-top: 1.5px solid var(--text);
  border-bottom: 1px solid var(--text);
  white-space: nowrap;
}
.coverage thead th:first-child, .coverage td:first-child { text-align: left; padding-left: 0; }
.coverage td { text-align: center; }
.coverage thead th + th { width: 64px; }
.coverage td.yes { color: var(--text); font-weight: 600; }
.coverage tr.group th {
  text-align: left;
  font-size: .8rem;
  font-weight: 600;
  padding: 10px 0 3px;
}
.coverage tr.group th .dot {
  display: inline-block;
  width: 8px; height: 8px;
  margin-right: 6px;
  border-radius: 50%;
  background: currentColor;
}
.coverage tbody tr:last-child td { border-bottom: 1.5px solid var(--text); }

/* ---------- resources ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin: 12px 0; }
.card {
  display: block;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .15s, transform .15s;
}
.card:hover { text-decoration: none; border-color: var(--link); transform: translateY(-2px); }
.card h4 { margin: 0 0 6px; font-size: .95rem; }
.card p { margin: 0; font-size: .83rem; color: var(--muted); line-height: 1.55; }
.note { color: var(--muted); font-size: .9rem; }

/* ---------- citation ---------- */

.bibtex { position: relative; }
.bibtex pre {
  margin: 0;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--surface-2);
  overflow-x: auto;
}
.bibtex code { font: .85rem/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.copy {
  position: absolute; top: 10px; right: 10px;
  font: inherit; font-size: .78rem;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.copy:hover { color: var(--text); border-color: var(--faint); }

/* ---------- footer ---------- */

.footer {
  margin-top: 44px;
  text-align: center;
  color: var(--faint);
  font-size: .88rem;
}
.footer p { margin: 4px 0; }

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .explorer { grid-template-columns: 1fr; }
  .coverage { grid-template-columns: 1fr; }
  .coverage table + table thead { display: none; }
  .panel { height: auto; max-height: 420px; }
  .toggles { margin-left: 0; }
}
@media (max-width: 600px) {
  .container { padding: 24px 16px 40px; }
  .hero h1 { font-size: 1.55rem; }
  .venue { font-size: 1.2rem; }
  .authors { font-size: 1.05rem; }
  .affil { font-size: .95rem; }
  #search, .range { width: 100%; }
  .coverage thead th + th { width: 50px; font-size: .7rem; white-space: normal; }
  #threshold { flex: 1; width: auto; min-width: 0; }
  .canvas-wrap { height: 440px; }
}
