/* Showcase memory graph page (graph.html, T-57). Loaded after styles.css, which provides the font,
   theme tokens, nav and aurora. The graph rules below are copied from dashboard/style.css ("graph
   (graph.js)" section and the small components the inspector uses), scoped under .graph-app so they
   never touch the main page. Inspector text is a little larger than in the dashboard (no small print). */
.graph-app {
  --fill: rgba(255, 255, 255, 0.06);
  --fill-2: rgba(255, 255, 255, 0.1);
  --fill-3: rgba(255, 255, 255, 0.16);
  --line-2: rgba(255, 255, 255, 0.18);
  --accent-soft: rgba(255, 255, 255, 0.12);
  --accent-line: rgba(255, 255, 255, 0.3);
  --focus-ring: #ffffff;
  --ok: #86efac;
  --ok-soft: rgba(74, 222, 128, 0.14);
  --ok-line: rgba(74, 222, 128, 0.34);
  --font: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

.graph-app [hidden] { display: none !important; }

/* page */
.graph-page { width: var(--wrap); margin: 0 auto; padding: 8px 0 40px; }
.graph-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 24px; }
.graph-intro h1 { font-size: clamp(36px, 4vw, 56px); line-height: 1.08; }
.graph-intro .lede { margin-top: 14px; font-size: 19px; max-width: 34em; }
.graph-try { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--ink-2); font-size: 18px; }
.graph-try button {
  padding: 7px 14px; border-radius: 999px; border: 1px solid var(--glass-border); border-top-color: var(--glass-border-top);
  background: var(--glass-bg); color: var(--ink); font: 600 16px/1 var(--sans); cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s;
}
.graph-try button:hover { transform: translateY(-1px); background: linear-gradient(rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.08)), var(--glass-bg); }
.graph-note { margin-top: 18px; color: var(--ink-2); font-size: 18px; }


/* components the inspector uses (from dashboard/style.css) */
.graph-app .icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
:where(.graph-app) .glass { /* low specificity so the graph rules below win, as in the dashboard */
  position: relative; isolation: isolate;
  background: var(--glass-bg); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-top-color: var(--glass-border-top); box-shadow: var(--glass-shadow);
}
.graph-app .muted { color: var(--ink-2); }
.graph-app .small { font-size: 15px; }
.graph-app .section-label { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-2); margin: 0; }
.graph-app .section-label::before { content: ""; width: 18px; height: 1.5px; background: rgba(255, 255, 255, 0.5); }
.graph-app .empty-line { color: var(--ink-2); font-size: 15px; }
.graph-app .count {
  min-width: 24px; height: 22px; padding: 0 8px; border-radius: 999px; display: inline-grid; place-items: center;
  font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--fill-2);
}
.graph-app .avatar {
  display: grid; place-items: center; flex: none; border-radius: 50%; object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 1px var(--glass-border), 0 10px 26px rgba(0, 0, 0, 0.4);
  color: var(--ink); font-weight: 600; letter-spacing: 0.01em;
}
.graph-app .avatar.md { width: 54px; height: 54px; font-size: 17px; }
.graph-app .tag {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px;
  border-radius: 999px; background: var(--fill);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), inset 0 0 0 1px var(--line);
  font-size: 13px; font-weight: 500; color: var(--ink-2); white-space: nowrap;
}
.graph-app .tag .icon { width: 14px; height: 14px; }
.graph-app .tag.accent {
  height: 22px; padding: 0 9px; background: var(--accent-soft); color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-line);
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
}
.graph-app .chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.graph-app .chip {
  display: inline-block; padding: 3px 11px; border-radius: 999px;
  background: var(--fill); box-shadow: inset 0 0 0 1px var(--line);
  font-size: 13.5px; color: var(--ink-2);
}
.graph-app .icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; flex: none;
  border-radius: 999px; border: 0; background: transparent;
  color: var(--ink-3); cursor: pointer; transition: background-color 0.2s, color 0.2s;
}
.graph-app .icon-btn:hover { background: var(--fill-2); color: var(--ink); }
.gi-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(226, 231, 238, 0.88));
  border: 1px solid rgba(255, 255, 255, 0.6); border-top-color: #ffffff; color: #0b0d12;
  font: 600 14px/1 var(--sans); cursor: pointer; transition: transform 0.25s var(--ease);
}
.gi-btn:hover { transform: translateY(-1px); background: #ffffff; }
.gi-btn .icon { width: 16px; height: 16px; }

/* graph (copied from dashboard/style.css) */
.graph-stage {
  position: relative;
  container-type: inline-size;
  width: 100%;
  height: clamp(520px, calc(100vh - 290px), 860px);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, rgba(148, 163, 224, 0.045) 0%, rgba(15, 18, 28, 0.45) 58%, rgba(7, 8, 12, 0.88) 100%);
  border: 1px solid var(--glass-border);
  border-top-color: var(--glass-border-top);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 24px 56px rgba(0, 0, 0, 0.42);
  touch-action: none;
  user-select: none;
}

.graph-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}
.graph-canvas:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -3px; border-radius: 28px; }

.graph-hud-top {
  position: absolute;
  top: 16px; left: 16px; right: 16px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  pointer-events: none;
}
.graph-hud-top > * { pointer-events: auto; }

.graph-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px 0 14px;
  border-radius: 999px;
  flex: 1 1 190px;
  max-width: 264px;
}
.graph-search .icon { width: 16px; height: 16px; color: var(--ink-3); }
.graph-search-input {
  flex: 1; min-width: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0 !important;
  font: inherit;
  font-size: 15px !important;
  outline: none;
  color: var(--ink);
}
.graph-search-input:focus-visible { outline: none; box-shadow: none !important; background: transparent !important; }
.graph-search:focus-within {
  border-color: rgba(255, 255, 255, 0.45);
  box-shadow: var(--glass-shadow), 0 0 0 3px rgba(255, 255, 255, 0.1);
}
.graph-search-clear {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; border: 0; border-radius: 999px;
  background: var(--fill-2); color: var(--ink-2); cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}
.graph-search-clear:hover { background: var(--fill-3); color: var(--ink); }
.graph-search-clear .icon { width: 13px; height: 13px; color: inherit; }

.graph-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.graph-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 12px; border-radius: 999px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border); border-top-color: var(--glass-border-top);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 8px 20px rgba(0, 0, 0, 0.28);
  color: var(--ink-2); font: 600 13px/1 var(--font); cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.graph-pill .icon { width: 15px; height: 15px; }
.graph-pill:hover { color: var(--ink); transform: translateY(-1px); border-color: rgba(255, 255, 255, 0.36); }
.graph-pill:active { transform: scale(0.96); }
.graph-pill.active {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(226, 231, 238, 0.86));
  border-color: rgba(255, 255, 255, 0.6); border-top-color: #ffffff;
  color: #0b0d12;
  box-shadow: inset 0 1px 0 #ffffff, 0 0 10px rgba(255, 255, 255, 0.1), 0 8px 20px rgba(0, 0, 0, 0.3);
}

/* Materializing floating glass inspector drawer (symmetric right-edge path) */
.graph-inspector {
  position: absolute;
  top: 72px; right: 16px; bottom: 68px;
  width: min(360px, calc(100% - 32px));
  z-index: 5;
  border-radius: 24px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  background: linear-gradient(155deg, rgba(255, 255, 255, 0.12) 0%, rgba(255, 255, 255, 0.03) 48%, rgba(255, 255, 255, 0.06) 100%), rgba(12, 15, 22, 0.78);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(26px, 0, 0) scale(0.96);
  filter: blur(8px);
  transition: opacity 0.34s var(--ease), transform 0.44s var(--ease), filter 0.34s var(--ease);
}
.graph-inspector.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) scale(1);
  filter: blur(0);
}

.gi-head { display: flex; align-items: flex-start; gap: 12px; }
.gi-title-wrap { flex: 1; min-width: 0; }
.gi-title-wrap h2 { font: 700 21px/1.18 var(--font); letter-spacing: -0.02em; overflow-wrap: anywhere; }
.gi-fact-heading { font-size: 18px !important; line-height: 1.3 !important; font-weight: 600 !important; }
.gi-copy { font-size: 15px; color: var(--ink-2); }
.gi-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.gi-stat {
  padding: 12px 14px; border-radius: 16px; background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line); display: grid; gap: 2px;
}
.gi-stat strong { font: 700 22px/1 var(--font); letter-spacing: -0.02em; }
.gi-stat span { font-size: 12px; color: var(--ink-2); }

.gi-section { display: grid; gap: 8px; }
.gi-section .section-label { margin-bottom: 0; }
.gi-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.gi-facts { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gi-fact-btn {
  width: 100%; text-align: left;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 11px; border-radius: 14px; border: 0;
  background: var(--fill); color: var(--ink-2); font: 400 15px/1.45 var(--font);
  box-shadow: inset 0 0 0 1px var(--line);
  cursor: pointer; transition: background-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.gi-fact-btn:hover { background: var(--fill-2); color: var(--ink); transform: translateX(2px); }
.gi-fact-dot {
  width: 7px; height: 7px; border-radius: 50%; flex: none; margin-top: 6px;
  background: #cbd5e1; box-shadow: 0 0 4px rgba(203, 213, 225, 0.3);
}
.gi-fact-dot.post { background: var(--ok); box-shadow: 0 0 5px rgba(134, 239, 172, 0.42); }
.gi-fact-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }

.gi-starters { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gi-starters li {
  padding: 8px 11px; border-radius: 14px; background: var(--fill);
  box-shadow: inset 0 0 0 1px var(--line); font-size: 15px; color: var(--ink-2);
}

.gi-photo {
  margin: 0; border-radius: 16px; overflow: hidden;
  background: rgba(5, 6, 10, 0.5); box-shadow: inset 0 0 0 1px var(--line-2);
}
.gi-photo img { width: 100%; max-height: 170px; object-fit: cover; }
.gi-photo figcaption { padding: 8px 12px; font-size: 12px; color: var(--ink-2); }

.gi-inline-link {
  border: 0; padding: 0; background: none; color: var(--ink); font: inherit; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}
.gi-chip-btn {
  border: 0; cursor: pointer; font: inherit;
  transition: background-color 0.2s, color 0.2s, transform 0.2s var(--ease);
}
.gi-chip-btn:hover { background: var(--fill-3); color: var(--ink); transform: translateY(-1px); }

.tag.ok {
  background: var(--ok-soft); color: var(--ok);
  box-shadow: inset 0 0 0 1px var(--ok-line);
}

.gi-foot {
  margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.gi-foot .btn { height: 36px; padding: 0 14px; font-size: 13px; }

.graph-legend {
  position: absolute;
  left: 16px; bottom: 16px;
  z-index: 4;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 9px 16px; border-radius: 999px;
  font-size: 13.5px; color: var(--ink-2);
  max-width: calc(100% - 32px);
}
.graph-stat { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.graph-dot-item { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.gdot { width: 8px; height: 8px; flex: none; border-radius: 50%; display: inline-block; }
.gdot.gcore { background: #ffffff; box-shadow: 0 0 4px rgba(255, 255, 255, 0.42); }
.gdot.gperson { background: #cbd5e1; box-shadow: 0 0 3px rgba(203, 213, 225, 0.3); }
.gdot.gfact { background: #a5b4fc; box-shadow: 0 0 3px rgba(165, 180, 252, 0.3); }
.gdot.gpost { background: var(--ok); box-shadow: 0 0 4px rgba(134, 239, 172, 0.42); }
.graph-hint { color: var(--ink-3); border-left: 1px solid var(--line); padding-left: 12px; }

@container (max-width: 860px) {
  .graph-hint { display: none; }
  .graph-inspector { top: auto; left: 12px; right: 12px; bottom: 12px; width: auto; max-height: 50%; }
}
@media (max-width: 960px) {
  .graph-stage { height: clamp(500px, calc(100vh - 170px), 740px); }
}
@media (prefers-reduced-transparency: reduce) {
  .graph-search, .graph-pill, .graph-inspector, .graph-legend {
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    background: #12151c;
  }
}
@media (prefers-reduced-motion: reduce) {
  .graph-inspector { filter: none; transform: none; transition: opacity 0.15s ease; }
}
