/* AUTHORBOT_THEME_IMPORT_START */
@import url("../_astro/_chapterPath_.4eKiHlNq.css");
/* AUTHORBOT_THEME_IMPORT_END */

:root {
  --page: var(--surface-page);
  --panel: var(--surface-card);
  --panel-raised: var(--surface-raised);
  --panel-soft: var(--surface-sunken);
  --line: var(--border-default);
  --line-bright: var(--border-strong);
  --text: var(--text-strong);
  --muted: var(--text-muted);
  --quiet: var(--text-faint);
  --accent: var(--orange-500);
  --accent-soft: var(--orange-300);
  --focus: var(--blue-300);
  --premise: var(--gray-50);
  --arc: var(--orange-500);
  --character: var(--green-400);
  --concept: var(--blue-300);
  --theme: #b68cff;
  --motif: var(--amber-400);
  --unknown: var(--text-muted);
  --shadow: var(--shadow-md);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-height: 100vh;
  color: var(--text);
  background: var(--page);
}

button,
input {
  font: inherit;
}

button,
a,
input {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.65rem 0.9rem;
  color: var(--gray-50);
  background: var(--focus);
  border-radius: 0.4rem;
  transform: translateY(-180%);
}

.skip-link:focus {
  transform: translateY(0);
}

main {
  width: min(100% - 2rem, 1680px);
  margin: 0 auto;
  padding: 3rem 0 1.5rem;
}

.page-heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 34rem);
  align-items: end;
  gap: 2rem;
  margin: 0 auto 1.65rem;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 0.45rem;
  color: var(--orange-500);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: clamp(34px, 7vw, 56px);
  font-weight: 630;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

.page-intro {
  max-width: 50ch;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font: 20px/1.6 var(--font-body);
}

.workspace {
  display: grid;
  height: clamp(620px, 72vh, 840px);
  min-height: 620px;
  grid-template-columns: 285px minmax(420px, 1fr) 320px;
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel-soft);
  box-shadow: var(--shadow);
}

.control-panel,
.detail-panel {
  min-width: 0;
  min-height: 0;
  padding: 1rem;
  background: var(--panel);
}

.control-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--line);
}

.detail-panel {
  overflow-y: auto;
  border-left: 1px solid var(--line);
}

.panel-heading,
.node-list-heading,
.graph-toolbar,
.detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.panel-heading h2,
.detail-panel h2 {
  margin-bottom: 0;
  color: var(--text-strong);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}

.data-state {
  padding: 0.2rem 0.48rem;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 999px;
  font: 600 10px/18px var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.data-state.is-ready {
  color: var(--green-400);
  background: var(--tint-success);
}

.data-state.is-error {
  color: var(--on-tint-danger);
  background: var(--tint-danger);
}

.search-field {
  display: grid;
  gap: 0.42rem;
  margin: 1.15rem 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.search-field input {
  width: 100%;
  min-height: 2.45rem;
  padding: 0 0.72rem;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: var(--panel-soft);
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0;
  text-transform: none;
}

.search-field input:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--focus) 14%, transparent);
}

.type-filter {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.type-filter legend,
.node-list-heading {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.type-filter-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.42rem;
  margin-top: 0.55rem;
}

.type-chip {
  position: relative;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 0.42rem;
  min-height: 2.55rem;
  padding: 0.52rem 0.58rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-sunken);
  cursor: pointer;
}

.type-chip:hover {
  border-color: var(--line-bright);
}

.type-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.type-chip:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.type-chip:has(input:not(:checked)) {
  opacity: 0.42;
}

.type-dot,
.node-list-dot,
.detail-type-dot {
  flex: 0 0 auto;
  width: 0.52rem;
  height: 0.52rem;
  border-radius: 50%;
  background: var(--type-color, var(--unknown));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--type-color, var(--unknown)) 13%, transparent);
}

.type-chip-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.type-chip-count {
  margin-left: auto;
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: 11px;
}

.structure-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin: 1rem 0;
  padding: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-sunken);
  cursor: pointer;
}

.structure-toggle:hover {
  border-color: var(--line-bright);
}

.structure-toggle:has(input:checked) {
  border-color: color-mix(in srgb, var(--focus) 62%, var(--line));
  background: color-mix(in srgb, var(--focus) 8%, var(--surface-sunken));
}

.structure-toggle:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.structure-toggle input {
  width: 0.9rem;
  height: 0.9rem;
  margin: 0.12rem 0 0;
  accent-color: var(--accent);
}

.structure-toggle span {
  display: grid;
  gap: 0.12rem;
}

.structure-toggle strong {
  font-family: var(--font-display);
  font-size: 13px;
}

.structure-toggle:has(input:checked) strong {
  color: var(--focus);
}

.structure-toggle small {
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.35;
}

.node-list-heading {
  margin: 0.15rem 0 0.5rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.node-list {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-right: 0.25rem;
  scrollbar-color: var(--line-bright) transparent;
  scrollbar-width: thin;
}

.node-list-button {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.05rem 0.55rem;
  min-height: 3.2rem;
  padding: 0.62rem 0.58rem;
  color: var(--text);
  border: 0;
  border-radius: 0.42rem;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.node-list-button:hover {
  background: var(--panel-raised);
}

.node-list-button.is-selected {
  background: var(--surface-selected);
  box-shadow: inset 2px 0 var(--type-color, var(--accent));
}

.node-list-dot {
  grid-row: 1 / span 2;
  margin-top: 0.24rem;
}

.node-list-title {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-list-meta {
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.graph-panel {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px),
    var(--surface-sunken);
  background-size: 36px 36px;
}

.graph-toolbar {
  min-height: 4rem;
  padding: 0.68rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-card);
}

.graph-toolbar p {
  margin-bottom: 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 14px;
}

.graph-actions {
  display: flex;
  gap: 0.42rem;
}

.graph-actions button {
  min-height: 2.35rem;
  padding: 0 0.72rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-raised);
  font-size: 12px;
  cursor: pointer;
}

.graph-actions button:hover {
  color: var(--text);
  border-color: var(--line-bright);
}

.graph-frame {
  position: relative;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
}

#outline-graph {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  cursor: grab;
  touch-action: none;
}

#outline-graph:active {
  cursor: grabbing;
}

.graph-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.8rem;
  color: var(--muted);
  background: color-mix(in srgb, var(--surface-sunken) 86%, transparent);
  font-size: 13px;
  transition:
    opacity 180ms ease,
    visibility 180ms ease;
}

.graph-loading.is-hidden {
  visibility: hidden;
  opacity: 0;
}

.loading-orbit {
  width: 2.3rem;
  height: 2.3rem;
  border: 1px solid var(--line-bright);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: orbit 900ms linear infinite;
}

@keyframes orbit {
  to {
    transform: rotate(1turn);
  }
}

.graph-hint {
  position: absolute;
  right: 0.75rem;
  bottom: 0.6rem;
  margin: 0;
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: 10px;
  pointer-events: none;
}

.cluster-region {
  fill: var(--cluster-color);
  fill-opacity: 0.045;
  stroke: var(--cluster-color);
  stroke-dasharray: 4 7;
  stroke-opacity: 0.44;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.cluster.is-hidden {
  display: none;
}

.cluster-label {
  fill: var(--cluster-color);
  fill-opacity: 0.82;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.relation-link,
.structure-link {
  fill: none;
  vector-effect: non-scaling-stroke;
  transition:
    opacity 130ms ease,
    stroke 130ms ease;
}

.relation-link {
  stroke: var(--text-faint);
  stroke-opacity: 0.55;
  stroke-width: 1.1;
}

.relation-link.is-active {
  stroke: var(--accent-soft);
  stroke-opacity: 0.95;
  stroke-width: 1.8;
}

.relation-link.is-dimmed {
  stroke-opacity: 0.055;
}

.structure-link {
  stroke: var(--focus);
  stroke-dasharray: 2 6;
  stroke-linecap: round;
  stroke-opacity: 0.72;
  stroke-width: 1.25;
}

.structure-link.is-hidden,
.relation-link.is-hidden {
  display: none;
}

.node {
  cursor: pointer;
  outline: none;
}

.node-halo {
  fill: var(--node-color);
  fill-opacity: 0;
  stroke: var(--node-color);
  stroke-opacity: 0;
  transition:
    fill-opacity 130ms ease,
    stroke-opacity 130ms ease;
}

.node-core {
  fill: var(--surface-card);
  stroke: var(--node-color);
  stroke-width: 2.2;
  vector-effect: non-scaling-stroke;
  transition:
    fill 130ms ease,
    opacity 130ms ease,
    stroke-width 130ms ease;
}

.node-label {
  fill: var(--text-strong);
  paint-order: stroke;
  stroke: var(--surface-sunken);
  stroke-linejoin: round;
  stroke-width: 3px;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  pointer-events: none;
  transition: opacity 130ms ease;
}

.node:hover .node-halo,
.node:focus-visible .node-halo,
.node.is-selected .node-halo {
  fill-opacity: 0.12;
  stroke-opacity: 0.35;
}

.node:hover .node-core,
.node:focus-visible .node-core,
.node.is-selected .node-core {
  fill: color-mix(in srgb, var(--node-color) 25%, var(--surface-card));
  stroke-width: 3;
}

.node.is-selected .node-label {
  fill: var(--gray-50);
}

.node.is-dimmed .node-core,
.node.is-dimmed .node-label {
  opacity: 0.13;
}

.node.is-hidden {
  display: none;
}

.detail-empty {
  padding-top: 0.15rem;
}

.detail-empty p:last-child,
.detail-summary {
  color: var(--muted);
  font: 15px/1.6 var(--font-body);
}

.detail-heading {
  align-items: flex-start;
}

.detail-type {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.detail-id {
  display: block;
  margin: 0.55rem 0 1rem;
  overflow-wrap: anywhere;
  color: var(--quiet);
  font-family: var(--font-mono);
  font-size: 11px;
}

.detail-summary {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.detail-section {
  margin-top: 1rem;
}

.detail-section h3 {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.relation-list {
  display: grid;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.relation-button {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.08rem 0.48rem;
  padding: 0.55rem 0.58rem;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 0.42rem;
  text-align: left;
  background: var(--panel-soft);
  cursor: pointer;
}

.relation-button:hover {
  border-color: var(--line-bright);
  background: var(--panel-raised);
}

.relation-direction {
  grid-row: 1 / span 2;
  color: var(--accent-soft);
  font-family: var(--font-mono);
  font-size: 13px;
}

.relation-title {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.relation-type {
  color: var(--quiet);
  font-size: 11px;
  line-height: 1.25;
}

.character-link {
  display: inline-flex;
  margin-top: 1rem;
  padding: 0.5rem 0.68rem;
  color: var(--text);
  border: 1px solid var(--line-bright);
  border-radius: 0.42rem;
  font-size: 12px;
  text-decoration: none;
}

.character-link:hover {
  border-color: var(--accent);
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0.2rem 0;
  color: var(--quiet);
  font-size: 11px;
}

.page-footer p {
  margin: 0;
}

.page-footer code {
  color: var(--muted);
}

.page-footer a {
  color: var(--muted);
  text-underline-offset: 0.18em;
}

.noscript {
  position: fixed;
  inset: auto 1rem 1rem;
  z-index: 40;
  padding: 0.8rem 1rem;
  color: var(--text);
  border: 1px solid var(--line);
  background: var(--panel-raised);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 270px minmax(400px, 1fr) 300px;
  }

  .control-panel,
  .detail-panel {
    padding: 0.9rem;
  }

  .node-label {
    font-size: 10px;
  }
}

@media (max-width: 960px) {
  main {
    width: min(100% - 1.2rem, 900px);
    padding-top: 1.5rem;
  }

  .page-heading {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .workspace {
    height: auto;
    min-height: 0;
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: auto auto;
  }

  .graph-frame,
  #outline-graph {
    min-height: 560px;
  }

  .detail-panel {
    grid-column: 1 / -1;
    max-height: 360px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 700px) {
  h1 {
    font-size: 32px;
  }

  .page-intro {
    font: 17px/1.55 var(--font-body);
  }

  .workspace {
    display: flex;
    min-height: 0;
    flex-direction: column;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .type-filter-list {
    grid-template-columns: repeat(2, 1fr);
  }

  .node-list-heading,
  .node-list {
    display: none;
  }

  .graph-toolbar {
    align-items: flex-start;
  }

  .graph-toolbar p {
    max-width: 19ch;
  }

  .graph-frame,
  #outline-graph {
    min-height: 66vh;
  }

  .graph-hint {
    left: 0.75rem;
    right: auto;
  }

  .node-label {
    display: none;
  }

  .node.is-selected .node-label {
    display: block;
    font-size: 11px;
  }

  .detail-panel {
    max-height: none;
    border-top: 1px solid var(--line);
  }

  .page-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
