/* Total Recall graph view. The look follows the Total Recall site: a near-black
   ground with a faint teal glow, a mint accent, Space Grotesk for labels and
   Inter for reading, hairline strokes. Every colour the graph draws is a token
   here; app.js reads them at start, so restyling is a change to this file. */

@font-face { font-family: 'Space Grotesk'; font-weight: 300; font-display: swap; src: url('fonts/space-grotesk-300.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 400; font-display: swap; src: url('fonts/space-grotesk-400.woff2') format('woff2'); }
@font-face { font-family: 'Space Grotesk'; font-weight: 500; font-display: swap; src: url('fonts/space-grotesk-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 300; font-display: swap; src: url('fonts/inter-300.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('fonts/inter-400.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('fonts/inter-500.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('fonts/inter-600.woff2') format('woff2'); }

:root {
  color-scheme: dark;
  --bg: #0b1210;           /* the website's ground (app.<domain>; the 8765 view had #06090b) */
  --bg-glow: #10201e;
  --surface: #0f1815;
  --surface-2: #16201d;
  --ink: #f1f3f2;
  --muted: #a8b3b7;
  --dim: #73858b;
  --line: #ffffff1f;
  --line-strong: #ffffff38;
  --accent: #a7d5cb;

  /* nodes */
  --c-situation-active: #a7d5cb;
  --c-situation-resolved: #6f9c93;
  --c-situation-dormant: #45625d;
  --c-person: #60a5fa;
  --c-person-mentioned: #60a5fa99;
  --c-owner: #dbe7ff;
  --c-place: #f59e0b;
  --c-arc: #a78bfa;
  --c-faded: #172024;

  /* the fourteen areas: one hue each, quiet on the dark ground */
  --area-children: #f9a8d4;
  --area-partner: #fda4af;
  --area-family: #fdba74;
  --area-friends: #fde68a;
  --area-health: #86efac;
  --area-home: #5eead4;
  --area-things: #93c5fd;
  --area-money: #a5b4fc;
  --area-work: #c4b5fd;
  --area-travel: #f0abfc;
  --area-fun: #bef264;
  --area-occasions: #fca5a5;
  --area-learning: #67e8f9;
  --area-community-and-faith: #d6d3d1;

  /* lines */
  --l-structure: #ffffff24;
  --l-person: #60a5fa30;
  --l-owner: #dbe7ff1c;
  --l-connection: #a7d5cbcc;
  --l-focus: #ffffff55;

  --label: #c9d4d6;
  --label-place: #f6c070;
  --label-arc: #c9b8ff;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --panel-w: min(460px, 100vw);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.5 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus { outline: none; }
:focus-visible { outline: 1px solid #ffffffd9; outline-offset: 3px; border-radius: 2px; }

#ground {
  position: fixed; inset: 0;
  background:
    radial-gradient(ellipse at 94% 5%, color-mix(in srgb, var(--bg-glow) 70%, transparent), transparent 50%),
    radial-gradient(ellipse at 8% 100%, color-mix(in srgb, var(--bg-glow) 40%, transparent), transparent 45%),
    var(--bg);
}
#graph { position: fixed; inset: 0; }

/* top bar */
#bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 28px;
  padding: 18px 24px;
  background: linear-gradient(180deg, #0b1210f0 0%, #0b121099 60%, transparent 100%);
  pointer-events: none;
}
#bar > * { pointer-events: auto; }
.wordmark {
  font: 300 15px 'Space Grotesk', sans-serif;
  letter-spacing: 0.42em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.search { position: relative; flex: 0 1 460px; display: flex; align-items: center; }
.search svg { position: absolute; left: 12px; width: 16px; height: 16px; fill: none; stroke: var(--dim); stroke-width: 1.4; pointer-events: none; }
.search input {
  width: 100%;
  height: 38px;
  padding: 0 40px 0 36px;
  background: #0b1114cc;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: 400 14px Inter, sans-serif;
  transition: border-color .25s ease, background .25s ease;
}
.search input::placeholder { color: var(--dim); }
.search input:focus { border-color: #a7d5cb80; background: #0b1114; }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  position: absolute; right: 10px;
  font: 400 11px 'Space Grotesk', sans-serif; color: var(--dim);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; line-height: 18px;
}
#results {
  position: absolute; top: 44px; left: 0; right: 0;
  max-height: min(60vh, 520px); overflow-y: auto;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 6px;
  box-shadow: 0 18px 50px #000a;
}
#results li {
  display: grid; grid-template-columns: 10px 1fr; gap: 2px 10px; align-items: baseline;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
#results li[aria-selected="true"], #results li:hover { background: #ffffff0d; }
#results .dot { width: 8px; height: 8px; border-radius: 50%; align-self: center; }
#results .t { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#results .s { grid-column: 2; color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#results .empty { display: block; color: var(--dim); cursor: default; }
#results li.group {
  display: flex; justify-content: space-between; cursor: default; padding: 10px 10px 4px;
  font: 400 10.5px 'Space Grotesk', sans-serif; letter-spacing: 0.24em; text-transform: uppercase; color: var(--dim);
}
#results li.group:hover { background: none; }
#results li.group + li { margin-top: 0; }
#results li.group:not(:first-child) { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 12px; }
.dot.hollow, #legend i.hollow, .row .sw.hollow { background: transparent !important; box-shadow: inset 0 0 0 1.5px var(--c-person-mentioned); }
.ghost {
  margin-left: auto;
  font: 400 11px 'Space Grotesk', sans-serif; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--muted); padding: 8px 4px;
}
.ghost:hover { color: var(--ink); }

/* filters */
#filters {
  position: fixed; top: 76px; left: 16px; z-index: 4;
  width: 248px;
  padding: 14px 12px 16px;
  background: #0b1210d9;
  border: 1px solid #ffffff10;
  border-radius: 12px;
  max-height: calc(100vh - 140px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: #ffffff22 transparent;
  display: flex; flex-direction: column; gap: 22px;
  transition: opacity .35s ease, transform .5s var(--ease);
}
#filters.closed { opacity: 0; transform: translateX(-12px); pointer-events: none; }
#filters h3 {
  font: 400 10.5px 'Space Grotesk', sans-serif; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 10px;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px; color: var(--dim);
  background: #0b121099;
  transition: color .2s ease, border-color .2s ease, background .2s ease;
}
.chip[aria-pressed="true"] { color: var(--ink); border-color: var(--line-strong); background: #ffffff0a; }
.chip .n { color: var(--dim); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: #ffffff40; }
.rows { display: flex; flex-direction: column; gap: 2px; }
.row {
  display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 10px;
  padding: 5px 2px; font-size: 13px; color: var(--dim); text-align: left;
  transition: color .2s ease;
}
.row[aria-pressed="true"] { color: var(--ink); }
.row .sw { width: 10px; height: 10px; border-radius: 50%; opacity: .35; transition: opacity .2s ease; justify-self: center; }
.row .sw.line { width: 14px; height: 2px; border-radius: 1px; }
.row[aria-pressed="true"] .sw { opacity: 1; }
.row .n { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--dim); }
.hint { font-size: 12px; color: var(--dim); line-height: 1.5; max-width: 22ch; }
#f-areas .chip i { width: 7px; height: 7px; border-radius: 50%; }
.toggle-row { margin-top: 8px; }
.areas-line { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.areas-line .main-tag { font: 400 10px 'Space Grotesk', sans-serif; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); margin-left: 6px; }

/* details panel */
#panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 6;
  width: var(--panel-w);
  background: linear-gradient(180deg, #101a17, #0b1210);
  border-left: 1px solid var(--line);
  box-shadow: -30px 0 80px #000b;
  display: flex; flex-direction: column;
  opacity: 0; transform: translateX(24px); filter: blur(6px);
  pointer-events: none;
  transition: opacity .45s ease, transform .6s var(--ease), filter .45s ease;
}
#panel.open { opacity: 1; transform: none; filter: none; pointer-events: auto; }
.panel-head {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 12px 12px;
  border-bottom: 1px solid var(--line);
}
#panel-type {
  flex: 1;
  font: 400 10.5px 'Space Grotesk', sans-serif; letter-spacing: 0.3em; text-transform: uppercase; color: var(--dim);
}
.icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 6px; color: var(--muted); }
.icon:hover { background: #ffffff0d; color: var(--ink); }
.icon:disabled { opacity: .25; cursor: default; background: none; }
.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
#panel-body { flex: 1; overflow-y: auto; padding: 22px 26px 60px; scrollbar-width: thin; scrollbar-color: #ffffff22 transparent; }
#panel-body.enter > * { animation: rise .55s var(--ease) both; }
#panel-body.enter > *:nth-child(2) { animation-delay: .04s; }
#panel-body.enter > *:nth-child(3) { animation-delay: .08s; }
#panel-body.enter > *:nth-child(n+4) { animation-delay: .12s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.p-title {
  font: 400 24px/1.22 'Space Grotesk', sans-serif; letter-spacing: -0.01em;
  color: var(--ink); text-wrap: balance;
}
.p-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.state { display: inline-flex; align-items: center; gap: 7px; color: var(--ink); }
.state i { width: 7px; height: 7px; border-radius: 50%; }
.p-account { margin-top: 18px; color: #dfe6e5; font-size: 15px; line-height: 1.6; max-width: 65ch; }
.p-sec { margin-top: 30px; }
.p-sec > h4 {
  font: 400 10.5px 'Space Grotesk', sans-serif; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 12px;
  display: flex; justify-content: space-between;
}
.p-sec > h4 .n { letter-spacing: 0.1em; }
.p-sec p, .p-sec li { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.versions { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.versions .chip { font-size: 11.5px; }
.vnote { margin-top: 8px; font-size: 12px; color: var(--dim); }

.links { list-style: none; display: flex; flex-direction: column; }
.links li { border-top: 1px solid #ffffff0b; }
.links li:first-child { border-top: 0; }
.link {
  display: grid; grid-template-columns: 10px 1fr auto; gap: 2px 10px; align-items: baseline;
  width: 100%; text-align: left; padding: 8px 4px; border-radius: 6px;
}
.link:hover { background: #ffffff08; }
.link .dot { width: 7px; height: 7px; border-radius: 50%; align-self: center; }
.link .t { color: var(--ink); font-size: 13.5px; }
.link .d { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.link .s { grid-column: 2 / 4; color: var(--muted); font-size: 12.5px; line-height: 1.5; }

.devs { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.devs li { display: grid; grid-template-columns: 84px 1fr; gap: 12px; }
.devs .d { color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }

.reason {
  border: 1px solid #a7d5cb33; border-radius: 10px; padding: 14px 16px;
  background: #a7d5cb0a; color: #dbe9e5; font-size: 14px; line-height: 1.55;
}
.reason + .reason { margin-top: 10px; }
.reason .by { display: block; margin-top: 8px; font-size: 11.5px; color: var(--dim); }

.cite {
  display: inline-block; margin-left: 2px; padding: 0 4px; min-width: 16px;
  font: 500 10px/15px 'Space Grotesk', sans-serif; color: var(--accent);
  border: 1px solid #a7d5cb40; border-radius: 4px; vertical-align: 1px;
}
.cite:hover { background: #a7d5cb22; }

.msgs { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.msg {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 12px;
  background: #ffffff04;
  transition: border-color .4s ease, background .4s ease;
}
.msg.flash { border-color: #a7d5cbaa; background: #a7d5cb14; }
.msg header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; font-size: 11.5px; color: var(--dim); }
.msg header b { font-weight: 500; color: var(--muted); }
.msg header .k { font: 500 10px 'Space Grotesk', sans-serif; color: var(--accent); }
.msg pre { white-space: pre-wrap; word-break: break-word; font: 400 13px/1.5 Inter, sans-serif; color: #dfe6e5; }
.msg.missing pre { color: var(--dim); font-style: italic; }
.about { color: var(--muted); font-size: 13.5px; line-height: 1.6; margin-top: 14px; }
.aliases { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 5px; }
.aliases span { font-size: 11.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; }
.stats { display: flex; gap: 24px; margin-top: 18px; }
.stats div { display: flex; flex-direction: column; }
.stats b { font: 300 26px 'Space Grotesk', sans-serif; color: var(--ink); font-variant-numeric: tabular-nums; }
.stats span { font-size: 11.5px; color: var(--dim); }
.p-sec h5.group { font: 400 10px 'Space Grotesk', sans-serif; letter-spacing: 0.22em; text-transform: uppercase; color: var(--dim); margin: 12px 0 2px; }
.p-sec .vnote { margin: -4px 0 6px; }
.more { margin-top: 6px; font-size: 12.5px; color: var(--accent); padding: 6px 4px; }

/* legend, zoom, status */
#legend {
  position: fixed; left: 24px; bottom: 20px; z-index: 3;
  display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-size: 12px; color: var(--dim);
  pointer-events: none;
}
#legend span { display: inline-flex; align-items: center; gap: 7px; }
#legend i { width: 8px; height: 8px; border-radius: 50%; }
#legend i.line { width: 14px; height: 2px; border-radius: 1px; }
#legend b { color: var(--muted); font-weight: 400; font-variant-numeric: tabular-nums; }
#zoom {
  position: fixed; right: 24px; bottom: 20px; z-index: 3;
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--line); border-radius: 10px; padding: 3px;
  background: #0b1210cc;
  transition: right .6s var(--ease);
}
body.panel-open #zoom { right: calc(var(--panel-w) + 24px); }
#status {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 9;
  display: flex; align-items: center; gap: 12px;
  font: 400 11px 'Space Grotesk', sans-serif; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted);
  transition: opacity .6s ease;
}
#status.done { opacity: 0; pointer-events: none; }
#status.error { text-transform: none; letter-spacing: 0; font: 400 14px/1.5 Inter, sans-serif; color: var(--ink); max-width: 46ch; text-align: left; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: pulse 1.6s ease-in-out infinite; }
#status.error .pulse { background: #f87171; animation: none; }
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }

@media (max-width: 760px) {
  #bar { gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
  .wordmark { font-size: 12px; letter-spacing: 0.3em; }
  .search { order: 3; flex: 1 1 100%; }
  .search kbd { display: none; }
  #filters { top: 112px; left: 16px; background: #0b1210ee; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
  #filters.closed { display: none; }
  #legend { left: 16px; right: 80px; bottom: 16px; }
  #zoom { right: 16px; bottom: 16px; }
  body.panel-open #zoom { right: 16px; }
  #panel-body { padding: 18px 18px 60px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01s !important; transition-duration: .01s !important; }
}
