/* One stylesheet, no build step. Colours are chosen so that the generated
   pages, the index lists and the graph read as one site. */
:root {
  --ink: #1c2430;
  --muted: #6b7785;
  --line: #dce1e7;
  --paper: #ffffff;
  --wash: #f5f7f9;
  --person: #4a6fa5;
  --event: #b5651d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font: 16px/1.6 ui-serif, Georgia, "Times New Roman", serif;
}

.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--wash);
  font-family: ui-sans-serif, system-ui, sans-serif;
}

.site-title { font-weight: 600; text-decoration: none; color: var(--ink); }
.site-header nav a { margin-left: 1rem; color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--ink); }

main { max-width: 60rem; margin: 0 auto; padding: 1.5rem; }
/* Set by `main_class` in front matter, for pages that are not prose (the
   graph needs the full window). */
.main-wide { max-width: none; padding: 1.25rem 1.5rem 2rem; }

h1 { font-size: 1.75rem; line-height: 1.2; margin-top: 0; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }

a { color: var(--person); }

.prose { max-width: 42rem; }
.kicker { font-family: ui-sans-serif, system-ui, sans-serif; font-size: 0.8rem;
          letter-spacing: 0.04em; text-transform: uppercase; margin: 0; }
.muted { color: var(--muted); }

ul.index { list-style: none; padding: 0; }
ul.index li { padding: 0.15rem 0; border-bottom: 1px solid var(--line); }
ul.index li a { text-decoration: none; }
ul.index .muted { margin-left: 0.5rem; font-size: 0.85rem; }

.columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
           gap: 2rem; }

.site-footer {
  max-width: 60rem;
  margin: 2rem auto 0;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
}

/* The graph page is a dark surface on purpose. It is a map rather than prose,
   and hairline links read far better on a dark ground than on white — the same
   reason Obsidian's graph view is dark. The canvas needs an explicit height:
   cytoscape measures the container once, and only re-measures when called. */
.graph-page {
  font-family: ui-sans-serif, system-ui, sans-serif;
  color: #e6e9ef;
  background: #16171d;
  border-radius: 18px;
  padding: 1.1rem 1.25rem 1.35rem;
  box-shadow: 0 1px 2px rgba(16, 18, 24, 0.3),
              0 30px 70px -50px rgba(16, 18, 24, 0.9);
}

.graph-intro {
  display: flex;
  align-items: baseline;
  gap: 0.25rem 2rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.graph-intro h1 {
  margin: 0;
  color: #f4f6fa;
  font-family: ui-serif, Georgia, "Times New Roman", serif;
}
.graph-blurb { max-width: 40rem; margin: 0; font-size: 0.9rem; color: #99a2b1; }
.graph-blurb p { margin: 0; }
.graph-blurb a { color: #a9bdf7; }

.graph-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}

.graph-toolbar input[type="search"],
.graph-toolbar select {
  font: inherit;
  font-size: 0.9rem;
  color: #e6e9ef;
  background: #1d1f27;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
}

.graph-toolbar input[type="search"] { flex: 1 1 12rem; max-width: 22rem; }
.graph-toolbar input[type="search"]::placeholder { color: #6d7684; }
.graph-toolbar input[type="search"]:focus,
.graph-toolbar select:focus { outline: 2px solid #6f86f0; outline-offset: 1px; }

.graph-actions { display: flex; gap: 0.25rem; margin-left: auto; }
/* The generic `.graph-actions button` rule below is written for light pages;
   on this dark surface the same controls need their own colours. */
.graph-page .graph-actions button {
  color: #d3d8e2;
  background: #1d1f27;
  border-color: rgba(255, 255, 255, 0.09);
}
.graph-page .graph-actions button:hover { background: #262935; color: #ffffff; }
.graph-page .graph-actions button:focus-visible {
  outline: 2px solid #6f86f0;
  outline-offset: 1px;
}

.graph-actions button {
  display: grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.graph-actions button:hover { background: var(--wash); }

.graph-toolbar input:focus-visible,
.graph-toolbar select:focus-visible,
.graph-actions button:focus-visible,
.chip:focus-visible { outline: 2px solid var(--person); outline-offset: 2px; }

.legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 0.75rem;
  padding: 0;
  font-size: 0.78rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  font: inherit;
  cursor: pointer;
  color: #cfd4de;
  background: #1d1f27;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
}

.chip:hover { background: #262935; }

.chip[aria-pressed="false"] {
  color: #6d7684;
  background: transparent;
  border-style: dashed;
  text-decoration: line-through;
}

.swatch { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: #7d9df0; }
.swatch.event { background: #e0913f; }
.swatch.line { width: 0.9rem; height: 0.16rem; border-radius: 2px; }

.graph-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 19rem;
  gap: 0.75rem;
  align-items: start;
}

.graph {
  height: clamp(26rem, 72vh, 50rem);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  overflow: hidden;
  background-color: #101117;
  background-image: radial-gradient(120% 120% at 50% 0%,
                                    #1c1e27 0%, #14151b 55%, #101117 100%);
}

.panel {
  position: sticky;
  top: 1rem;
  max-height: calc(72vh + 2px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  background: #1a1c23;
  color: #d8dde7;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.panel p { margin: 0.4rem 0; }
.panel h2 { margin: 0.15rem 0 0.25rem; font-size: 1.1rem; line-height: 1.25; color: #f2f4f8; }
.panel h3 {
  margin: 1rem 0 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b93a2;
}

.panel a { color: #a9bdf7; }
.panel .muted { color: #8b93a2; }
.panel .small { font-size: 0.8rem; }
.panel .error { color: #ff9b9b; }

.panel .badge {
  display: inline-block;
  margin: 0;
  padding: 0.05rem 0.5rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #11131a;
  background: #7d9df0;
}

.panel .badge[data-kind="event"] { background: #e0913f; }

.panel-list { list-style: none; margin: 0; padding: 0; }
.panel-list li {
  display: flex;
  gap: 0.5rem;
  padding: 0.35rem 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.panel-list a { text-decoration: none; }
.panel-list a:hover { text-decoration: underline; }
.panel-list .small { display: block; color: #8b93a2; }

.dot { flex: none; width: 0.55rem; height: 0.55rem; border-radius: 50%; margin-top: 0.45rem; }

.panel-foot { margin-top: 1rem; }

.button {
  display: inline-block;
  padding: 0.35rem 0.8rem;
  border-radius: 8px;
  background: #4f63d8;
  color: #ffffff;
  font-size: 0.85rem;
  text-decoration: none;
}
.button:hover { background: #6175e6; }

@media (max-width: 60rem) {
  .graph-shell { grid-template-columns: minmax(0, 1fr); }
  .panel { position: static; max-height: none; }
}

@media (max-width: 48rem) {
  .graph-page { border-radius: 12px; padding: 0.9rem 0.85rem 1rem; }
  .graph { height: 62vh; min-height: 20rem; }
  .graph-blurb { font-size: 0.86rem; }
}

/* The view switch reads as a segmented control, not as one of the legend's
   filter chips: those grey out and strike through, which would be a lie here. */
.view-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  background: #1d1f27;
}
.view-switch button {
  font: inherit;
  font-size: 0.78rem;
  padding: 0.2rem 0.7rem;
  color: #a8b0bd;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
}
.view-switch button:hover { color: #ffffff; }
.view-switch button[aria-pressed="true"] { color: #11131a; background: #dfe4ec; }
.view-switch button:focus-visible { outline: 2px solid #6f86f0; outline-offset: 1px; }

/* While the timeline is up the graph's own controls would be dead weight. */
.graph-page.is-timeline .graph-actions,
.graph-page.is-timeline .graph-toolbar select { display: none; }

/* The timeline: the same data and the same dark surface as the graph, read as
   time. A rail of events along the top, one row per person, one mark per
   authored link. It has no fixed height because its content is the point —
   seven rows today, and the rows are the reading. Only one of #graph and
   #timeline is ever rendered, so the shell's two columns keep their slots. */
.timeline {
  min-height: 14rem;
  padding: 0.4rem 0.6rem 0.2rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 14px;
  background: #101117;
  font-family: ui-sans-serif, system-ui, sans-serif;
  overflow-x: auto;
}
.timeline[hidden] { display: none; }

.timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.1rem 0.2rem 0.3rem;
}
.timeline-range { margin: 0; font-size: 0.72rem; letter-spacing: 0.04em; color: #8b93a2; }

.timeline-toggle {
  font: inherit;
  font-size: 0.72rem;
  padding: 0.15rem 0.6rem;
  color: #cfd4de;
  background: #1d1f27;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  cursor: pointer;
}
.timeline-toggle:hover { background: #262935; color: #ffffff; }
.timeline-toggle[aria-pressed="true"] { color: #11131a; background: #dfe4ec; }
.timeline-toggle:focus-visible { outline: 2px solid #6f86f0; outline-offset: 1px; }

.tl-svg { display: block; }

.tl-grid line { stroke: rgba(255, 255, 255, 0.05); stroke-width: 1; }
.tl-grid text { fill: #6d7684; font-size: 10px; text-anchor: middle; }

.tl-label { fill: #9aa4b2; font-size: 11px; }
.tl-band { fill: transparent; }
.tl-row:hover .tl-band { fill: rgba(255, 255, 255, 0.035); }
.tl-row:hover .tl-label { fill: #eef1f6; }
.tl-life { fill: rgba(255, 255, 255, 0.15); }

.tl-event { cursor: pointer; }
.tl-event circle, .tl-event rect { fill: #e0913f; }
.tl-event-name { fill: #d8dde7; font-size: 10px; opacity: 0; pointer-events: none; }
.tl-event:hover .tl-event-name,
.tl-event.tl-hot .tl-event-name { opacity: 1; }

.tl-dot { cursor: pointer; }
.tl-dot circle { stroke: #101117; stroke-width: 1; }
.tl-dot .tl-span { opacity: 0.55; }

.tl-guide { stroke: rgba(255, 255, 255, 0.16); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0; }
.timeline.is-focus .tl-guide { opacity: 1; }

/* Hover leaves only the marks of one event lit, the way the graph leaves only
   a neighbourhood lit. */
.timeline.is-focus .tl-dot,
.timeline.is-focus .tl-event { opacity: 0.12; }
.timeline.is-focus .tl-dot.tl-hot,
.timeline.is-focus .tl-event.tl-hot { opacity: 1; }

.timeline.is-search .tl-dot,
.timeline.is-search .tl-row { opacity: 0.18; }
.timeline.is-search .tl-dot.is-hit,
.timeline.is-search .tl-row.is-hit { opacity: 1; }

/* Last, so a filtered-out link stays out even while another event is lit. */
.timeline .tl-dot.is-hidden { opacity: 0; pointer-events: none; }

.timeline-empty { margin: 1rem 0.4rem; font-size: 0.85rem; color: #8b93a2; }

@media (max-width: 48rem) {
  .timeline { border-radius: 12px; padding: 0.35rem 0.35rem 0.15rem; }
  .view-switch button { padding: 0.2rem 0.55rem; }
  .timeline-toggle { font-size: 0.68rem; }
}

