/*
 * ============================================================================
 * TOKENS
 * ============================================================================
 * The site lives in the app's world, so these are the app's tokens
 * (src/renderer/styles.css in the Edith repo), with a type scale sized for a
 * page you read instead of a dense desktop panel.
 *
 * Rules this file keeps, same as the app:
 *   - radius is always --r (4px); the only exception is a dot (50%)
 *   - surfaces and lines come from the alpha ladder, never a new hex
 *   - colour only ever means state (--live), never decoration
 *   - no box-shadows anywhere
 *   - one easing curve, --ease, for everything that moves
 */
@font-face {
  font-family: "Host Grotesk";
  src: url("/assets/fonts/host-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Host Grotesk";
  src: url("/assets/fonts/host-grotesk-latin-wght-italic.woff2") format("woff2");
  font-weight: 300 800;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Commit Mono";
  src: url("/assets/fonts/commit-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* --- ground --- */
  --bg: #0a0a0a;

  /* --- ink --- */
  --text: #f2f2f2;  /* headings, the lead, anything lit */
  --read: #c9c9c9;  /* body copy: a step under --text so a long read stays calm */
  --muted: #9a9a9a; /* labels, keys, captions */
  --dim: #6b6b6b;   /* punctuation and rules that should recede */

  /* --- glass: one slab holds the note --- */
  --glass: rgba(10, 10, 10, 0.56);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-lip: rgba(255, 255, 255, 0.18);
  --sheen: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015) 42%);

  /* --- the alpha ladder --- */
  --a-hairline: rgba(255, 255, 255, 0.04);
  --a-surface: rgba(255, 255, 255, 0.06);
  --a-raised: rgba(255, 255, 255, 0.09);
  --a-hover: rgba(255, 255, 255, 0.12);
  --a-strong: rgba(255, 255, 255, 0.22);
  --a-edge: rgba(255, 255, 255, 0.4);
  --fill-hover: rgba(255, 255, 255, 0.05);
  --fill-primary: rgba(255, 255, 255, 0.14);

  /* --- state: the only colour --- */
  --live: #7dd3fc;

  /* --- form --- */
  --r: 4px;

  /* --- type --- */
  --sans: "Host Grotesk", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono: "Commit Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --fs-mono: 0.78125rem; /* 12.5px: frontmatter, tool calls, paths */
  --fs-small: 0.8125rem; /* 13px: captions, meta */
  --fs-ui: 0.9375rem;    /* 15px: buttons, tables, the nameplate */
  --fs-body: 1.0625rem;  /* 17px */
  --fs-lead: 1.25rem;    /* 20px */
  --fs-h2: 1.625rem;     /* 26px */
  --fs-h1: clamp(2.25rem, 1.2rem + 3vw, 3.375rem);

  /* --- motion --- */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t-snap: 0.12s;
  --t-move: 0.2s;
  --t-fade: 0.4s;

  /* --- layout --- */
  --plate-h: 56px;
  --edge: max(16px, 7vw);
  --sheet-w: 720px;
  --sheet-pad: 40px;
  --sheet-top: clamp(240px, 100vh - 352px, 660px); /* the headline, lead and button stay on the first screen; the brain has the rest */
}

/*
 * ============================================================================
 * GROUND
 * ============================================================================
 */
*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color-scheme: dark;
  scroll-padding-top: calc(var(--plate-h) + 20px);
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--a-strong) transparent;
  scrollbar-width: thin;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--read);
  font: 400 var(--fs-body)/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--a-strong); color: #fff; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--a-hover);
  border-radius: var(--r);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--a-strong); }

/* One focus ring everywhere: a true 1px line, held off the element. */
:focus-visible {
  outline: 1px solid #fff;
  outline-offset: 3px;
  border-radius: var(--r);
}
h1:focus { outline: none; }

[hidden] { display: none !important; }

.skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  border-radius: var(--r);
  font-size: var(--fs-ui);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* Page-truth switches: copy that is only true with the graph running. */
html:not(.js) .js-only { display: none; }
@media (max-width: 1199.98px) {
  .wide-only { display: none; }
}

/*
 * ============================================================================
 * THE STAGE: the brain, full-bleed, under everything
 * ============================================================================
 */
.stage {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--bg);
}
html:not(.js) .stage { display: none; }

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: pan-y;
}
.stage canvas.is-over-note { cursor: pointer; }
.stage canvas.is-held { cursor: grabbing; }

/* On a phone, once the note covers the whole screen, the graph rests. */
.stage { transition: opacity var(--t-fade) var(--ease); }
.stage.is-resting { opacity: 0; }

/* Names that ride along with a particle. */
.chip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  pointer-events: none;
  padding: 3px 7px;
  font: var(--fs-mono)/1.5 var(--mono);
  color: var(--text);
  white-space: nowrap;
  background: rgba(8, 8, 8, 0.5);
  -webkit-backdrop-filter: blur(9px) saturate(150%);
  backdrop-filter: blur(9px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  will-change: transform, opacity;
}
.chip--tip {
  z-index: 40;
  font: var(--fs-small)/1.4 var(--sans);
  padding: 5px 9px;
}

/*
 * ============================================================================
 * THE NAMEPLATE
 * ============================================================================
 */
.plate {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 30;
  height: var(--plate-h);
  padding-inline: var(--edge);
  padding-top: env(safe-area-inset-top);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid transparent;
  transition: background-color var(--t-fade) var(--ease), border-color var(--t-fade) var(--ease);
}
.plate.is-raised {
  background: rgba(10, 10, 10, 0.62);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  border-bottom-color: var(--a-raised);
}

.plate-name {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
}
/* LOGO PLACEHOLDER: an empty slot where the mark will go. */
.mark-slot {
  display: block;
  width: 20px;
  height: 20px;
  border: 1px dashed var(--a-edge);
  border-radius: var(--r);
}

/*
 * ============================================================================
 * BUTTONS
 * ============================================================================
 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border-radius: var(--r);
  font: 500 var(--fs-ui)/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t-snap) var(--ease), border-color var(--t-snap) var(--ease), transform var(--t-snap) var(--ease);
}
.btn:active { transform: translateY(1px); }

/* The one action the page exists for: solid, and the only solid thing here. */
.btn--solid {
  padding: 13px 18px 13px 15px;
  background: var(--text);
  color: var(--bg);
  border: 1px solid var(--text);
}
.btn--solid:hover { background: #fff; border-color: #fff; }

.btn--glass {
  padding: 9px 13px;
  background: var(--fill-primary);
  color: var(--text);
  border: 1px solid var(--glass-border);
}
.btn--glass:hover { background: var(--a-strong); border-color: var(--a-strong); }

.text-btn {
  padding: 4px 8px;
  margin: -4px -8px -4px 0;
  border: 0;
  border-radius: var(--r);
  background: transparent;
  color: var(--text);
  font: 500 var(--fs-small)/1.4 var(--sans);
  white-space: nowrap;
  cursor: pointer;
}
.text-btn:hover { background: var(--fill-hover); }

/*
 * ============================================================================
 * THE SHEET: one slab of frosted glass holds the note
 * ============================================================================
 */
.glass {
  background: var(--sheen), var(--glass);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid var(--glass-border);
  border-top-color: var(--glass-lip);
}

.sheet {
  position: relative;
  z-index: 10;
  width: min(var(--sheet-w), 100% - 2 * var(--edge));
  min-height: 100vh;
  margin: var(--sheet-top) 0 0 var(--edge);
  padding: 34px var(--sheet-pad) 0;
  margin-bottom: 72px;
  border-radius: var(--r);
}
html:not(.js) .sheet { margin-top: calc(var(--plate-h) + 24px); }

@media (max-width: 1199.98px) {
  :root { --edge: max(16px, 4vw); --sheet-top: clamp(260px, 100svh - 390px, 560px); }
  .sheet { margin-inline: auto; margin-bottom: 40px; }
}
@media (max-width: 640px) {
  :root { --sheet-pad: 20px; --edge: 12px; --sheet-top: clamp(230px, 100svh - 420px, 470px); --fs-lead: 1.125rem; }
  .sheet { padding-top: 24px; }
}

/*
 * ============================================================================
 * THE NOTE
 * ============================================================================
 */
.note { padding-bottom: 72px; }
/* Until page.js takes over, a scripted page shows the opening note alone. */
.js:not(.ready) .sheet:not(.sheet--stub) .note:not(.note--home) { display: none; }
html:not(.js) .note + .note { border-top: 1px solid var(--a-raised); padding-top: 48px; }

.note.is-entering { animation: note-in 0.32s var(--ease) both; }
@keyframes note-in {
  from { opacity: 0.001; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Frontmatter, as written on disk. */
.fm {
  margin: 0 0 24px;
  font: var(--fs-mono)/1.55 var(--mono);
  color: var(--read);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 2;
}
.fm-rule { color: var(--dim); }
.fm-k { color: var(--muted); }
.fm a {
  color: var(--read);
  text-decoration: none;
  border-radius: var(--r);
  transition: color var(--t-snap) var(--ease), background-color var(--t-snap) var(--ease);
}
.fm a:hover, .fm a:focus-visible { color: #fff; background: var(--a-hover); }

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 18px -6px;
  padding: 3px 8px 3px 6px;
  border-radius: var(--r);
  font: var(--fs-mono)/1.5 var(--mono);
  color: var(--muted);
  text-decoration: none;
  transition: color var(--t-snap) var(--ease), background-color var(--t-snap) var(--ease);
}
.crumb:hover { color: var(--text); background: var(--fill-hover); }

h1, h2 {
  margin: 0;
  color: var(--text);
  font-weight: 500;
  text-wrap: balance;
}
h1 {
  font-size: var(--fs-h1);
  line-height: 1.02;
  letter-spacing: -0.035em;
  margin-bottom: 16px;
}
.note:not(.note--home) h1 {
  font-size: clamp(1.875rem, 1.4rem + 1.6vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: -0.028em;
  margin-bottom: 22px;
}
h2 {
  font-size: var(--fs-h2);
  line-height: 1.15;
  letter-spacing: -0.022em;
  margin: 84px 0 14px;
}

p { margin: 0 0 1em; max-width: 62ch; text-wrap: pretty; }
em { font-style: italic; color: var(--text); }
b { font-weight: 600; color: var(--text); }

.lead {
  max-width: 35em;
  font-size: var(--fs-lead);
  line-height: 1.5;
  letter-spacing: -0.008em;
  color: var(--text);
  margin-bottom: 26px;
}

.cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
  margin: 0;
  max-width: none;
}
.cta-meta { font-size: var(--fs-small); color: var(--muted); }
.stage-note { margin: 10px 0 0; max-width: 44ch; font-size: var(--fs-small); line-height: 1.5; color: var(--muted); }

code {
  font: 0.8em/1 var(--mono);
  padding: 2px 5px;
  border-radius: var(--r);
  background: var(--a-surface);
  color: var(--text);
  overflow-wrap: anywhere;
}

/* Links in prose: lit text on a quiet rule. */
.il {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--a-edge);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-color var(--t-snap) var(--ease);
}
.il:hover { text-decoration-color: #fff; }
.cta-meta .il { color: var(--read); }

/* Wiki links, written the way the file writes them. */
.links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  margin: 22px 0 0 -6px;
  max-width: none;
  font: var(--fs-mono)/1.5 var(--mono);
}
.wl {
  padding: 3px 6px;
  border-radius: var(--r);
  color: var(--read);
  text-decoration: none;
  transition: color var(--t-snap) var(--ease), background-color var(--t-snap) var(--ease);
}
.wl::before { content: "[["; color: var(--dim); }
.wl::after { content: "]]"; color: var(--dim); }
.wl:hover, .wl:focus-visible { color: #fff; background: var(--a-hover); }

.backlinks {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--a-raised);
}
.backlinks-label {
  margin: 0 0 2px;
  font-size: var(--fs-small);
  color: var(--muted);
}
.backlinks .links-row { margin-top: 0; }

.vault-note {
  margin-top: 28px;
  font-size: var(--fs-small);
  color: var(--muted);
  max-width: 56ch;
}

/*
 * A session, replayed. Every line is on the page from the start; a replay
 * only walks the light down them, so nothing is ever hidden from a reader.
 */
.session, .file {
  margin: 28px 0 0;
  border: 1px solid var(--a-raised);
  border-radius: var(--r);
  background: var(--a-hairline);
}

.session-lines { list-style: none; margin: 0; padding: 12px 0 10px; }

.line {
  display: grid;
  grid-template-columns: 3.75rem minmax(0, 1fr) auto;
  gap: 4px 14px;
  align-items: baseline;
  padding: 6px 18px;
  font: var(--fs-mono)/1.6 var(--mono);
  color: var(--read);
  transition: opacity var(--t-fade) var(--ease);
}
.who { color: var(--muted); }
.line--you .say { color: var(--text); }
.line--you .say::before { content: "> "; color: var(--dim); }
.line--say .say, .line--you .say { grid-column: 2 / -1; }
.line--say .say {
  font: var(--fs-ui)/1.55 var(--sans);
  color: var(--read);
  max-width: 54ch;
}
.call b { font-weight: 400; color: var(--text); }
.result {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
}
.result::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--a-edge);
  transition: background-color var(--t-move) var(--ease);
}

/* Unlit lines stay readable: the step to lit is small on purpose, the dot carries the rest. */
.session.is-armed .line { opacity: 0.72; }
.session.is-armed .line.is-live,
.session.is-armed .line.is-done { opacity: 1; }
.line.is-live .result::before { background: var(--live); }
.line.is-done .result::before { background: var(--text); }

.session figcaption {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 18px 12px;
  border-top: 1px solid var(--a-raised);
  font-size: var(--fs-small);
  line-height: 1.5;
  color: var(--muted);
}

/* A file on disk. */
.file-path {
  padding: 10px 18px;
  border-bottom: 1px solid var(--a-raised);
  font: var(--fs-mono)/1.5 var(--mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}
.file-body {
  margin: 0;
  padding: 14px 18px 16px;
  font: var(--fs-mono)/1.65 var(--mono);
  color: var(--read);
  overflow-x: auto;
  tab-size: 2;
}

/* Get Edith. */
.get {
  display: flex;
  align-items: center;
  gap: 22px;
  margin: 24px 0 30px;
}
.app-icon { display: block; width: 88px; height: 88px; flex: none; }
/* LOGO PLACEHOLDER: the app icon's slot. */
.icon-slot {
  flex: none;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border: 1px dashed var(--a-edge);
  border-radius: var(--r);
  font: var(--fs-mono)/1 var(--mono);
  color: var(--muted);
}

.steps {
  margin: 0 0 1.2em;
  padding: 0;
  list-style: none;
  counter-reset: step;
  max-width: 62ch;
}
.steps li {
  counter-increment: step;
  position: relative;
  padding: 10px 0 10px 2.4rem;
  border-top: 1px solid var(--a-raised);
}
.steps li:last-child { border-bottom: 1px solid var(--a-raised); }
.steps li::before {
  content: counter(step);
  position: absolute;
  left: 2px;
  top: 12px;
  font: var(--fs-mono)/1.6 var(--mono);
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.plain { margin: 0 0 1.2em; padding: 0; list-style: none; max-width: 62ch; }
.plain li { position: relative; padding: 4px 0 4px 1.3rem; }
.plain li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 0.95em;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--dim);
}

.table-wrap { margin: 22px 0 24px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); line-height: 1.5; }
th {
  text-align: left;
  font-weight: 400;
  font-size: var(--fs-small);
  color: var(--muted);
  padding: 0 16px 8px 0;
  border-bottom: 1px solid var(--a-strong);
}
td {
  vertical-align: top;
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--a-raised);
}
td:first-child { white-space: nowrap; color: var(--text); }
td:last-child, th:last-child { padding-right: 0; }

.eq {
  display: grid;
  gap: 6px;
  margin: 24px 0;
  padding: 16px 20px;
  border: 1px solid var(--a-raised);
  border-radius: var(--r);
  background: var(--a-hairline);
  font-size: 1.125rem;
  color: var(--text);
  overflow-x: auto;
  white-space: nowrap;
}
.eq i { font-style: italic; padding-inline: 0.04em; }
.eq sup { font-size: 0.68em; line-height: 0; }

.colophon {
  padding: 22px 0 44px;
  border-top: 1px solid var(--a-raised);
  font-size: var(--fs-small);
  color: var(--muted);
}
.colophon p { margin: 0 0 4px; max-width: none; }
.colophon-repo { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.repo-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  background: var(--a-surface);
  color: var(--read);
  text-decoration: none;
  font-family: var(--mono);
  font-size: var(--fs-mono);
  transition: background var(--t-move) var(--ease), color var(--t-move) var(--ease);
}
.repo-link:hover { background: var(--a-hover); color: var(--text); }
.repo-link svg { flex: none; opacity: 0.85; }
.colophon-sep { color: var(--dim); }
.colophon .il { color: var(--read); }

@media (max-width: 640px) {
  h2 { margin-top: 64px; }
  .line { grid-template-columns: 3.25rem minmax(0, 1fr); padding-inline: 14px; }
  .result { grid-column: 2; }
  .session figcaption { flex-direction: column; gap: 8px; padding-inline: 14px; }
  .text-btn { margin: 0 0 0 -8px; }
  .file-path, .file-body { padding-inline: 14px; }
  .get { gap: 16px; }
  .app-icon, .icon-slot { width: 64px; height: 64px; }
  td:first-child { white-space: normal; }
}

/*
 * ============================================================================
 * STUB PAGES: not-yet and 404 are notes that do not exist yet
 * ============================================================================
 */
html .sheet.sheet--stub {
  min-height: 0;
  width: min(560px, 100% - 2 * var(--edge));
  margin: calc(var(--plate-h) + 12vh) auto 0;
  border-bottom: 1px solid var(--glass-border);
  border-radius: var(--r);
}
.sheet--stub .note { padding-bottom: 40px; }
.sheet--stub h1 { font-size: clamp(1.875rem, 1.4rem + 1.6vw, 2.5rem); line-height: 1.08; letter-spacing: -0.028em; margin-bottom: 18px; }

/* ------------------------------------------------------------ the fade
 * A chat losing its thread: four lines, each a step dimmer than the one
 * before. Deliberately still - the point lands at a glance, and there is
 * nothing to wait for.
 */
.fade-demo { margin: 20px 0 0; }
.fade-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.fade-lines li {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 14px;
  align-items: baseline;
  font-family: var(--mono);
  font-size: var(--fs-mono);
}
.fade-when { color: var(--dim); }
.fade-what { color: var(--text); }
.fade-lines li:nth-child(2) .fade-what { color: var(--read); }
.fade-lines li:nth-child(3) .fade-what { color: var(--muted); }
.fade-what--gone { color: var(--dim); font-style: italic; }
.fade-demo figcaption {
  margin-top: 12px;
  font-size: var(--fs-small);
  color: var(--muted);
}

/* ------------------------------------------------------------ the wire
 * Three boxes and two links: your AI, Edith, your notes. A dot travels out
 * on the question and back with the answer, so the drawing says "one hop,
 * on your own machine" without explaining a protocol.
 */
.wire {
  margin: 20px 0 0;
  padding: 16px 14px 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  background: var(--a-hairline);
}
.wire-row { display: grid; grid-template-columns: 1fr 52px 1fr 52px 1fr; align-items: center; }
.wire-node {
  padding: 10px 12px;
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  background: var(--a-surface);
  text-align: center;
}
.wire-node--mid { background: var(--a-raised); }
/* Each box lifts for a moment as the dot reaches it: brightness, not colour. */
.wire-node { animation: node-lift 3.6s var(--ease) infinite; }
.wire-node:nth-child(1) { animation-delay: 3.1s; }
.wire-node--mid { animation-delay: 0.5s; }
.wire-node:nth-child(5) { animation-delay: 1.5s; }
@keyframes node-lift {
  0%, 6% { border-color: var(--glass-border); background: var(--a-surface); }
  10% { border-color: var(--a-edge); background: var(--a-hover); }
  28%, 100% { border-color: var(--glass-border); background: var(--a-surface); }
}
.wire-node b { display: block; font-weight: 400; color: var(--text); font-size: var(--fs-ui); }
.wire-node span { display: block; margin-top: 2px; color: var(--muted); font-size: var(--fs-small); }
.wire-link { position: relative; height: 1px; background: var(--a-strong); }
.wire-dot {
  position: absolute;
  top: -2px;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--live);
  opacity: 0;
}
.wire-dot::after {
  content: "";
  position: absolute;
  top: 2px;
  right: 4px;
  width: 22px;
  height: 1px;
  background: linear-gradient(to left, var(--live), transparent);
}
.wire-dot--out { animation: wire-trip 3.6s linear infinite; }
.wire-dot--in { animation: wire-trip 3.6s linear infinite 0.45s; }
@keyframes wire-trip {
  0%, 4% { left: 0; opacity: 0; }
  8% { opacity: 1; }
  38% { left: calc(100% - 5px); opacity: 1; }
  44%, 54% { left: calc(100% - 5px); opacity: 0; }
  60% { left: calc(100% - 5px); opacity: 1; }
  90% { left: 0; opacity: 1; }
  96%, 100% { left: 0; opacity: 0; }
}
.wire figcaption { margin-top: 12px; font-size: var(--fs-small); color: var(--muted); }

/* --------------------------------------------------- Edith's own voice
 * What the app prints back inside the chat, shown the way it really looks.
 */
.edith-out {
  margin: 14px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--glass-border);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--muted);
  font-family: var(--mono);
  font-size: var(--fs-mono);
  line-height: 1.7;
  overflow-x: auto;
}
.edith-mark { color: var(--text); letter-spacing: 0.06em; }
.edith-bar { color: var(--dim); }
.result--edith .edith-mark { font-size: var(--fs-mono); }

/* ------------------------------------------------- Edith as a speaker
 * Edith answers in the transcript like anyone else in it: its own row, its
 * own mark, and the reply printed the way the app prints it. The relevance
 * bars fill on arrival, which is the one flourish - it is the app's own
 * visual language, and it is brightness, never colour.
 */
.line--edith .edith-say {
  grid-column: 2 / -1;
  display: grid;
  gap: 3px;
  color: var(--muted);
}
.who--edith { color: var(--text); }
.edith-head { color: var(--read); }
.edith-hit { color: var(--text); }
.edith-foot { color: var(--dim); }
.edith-foot b { font-weight: 400; color: var(--read); }

.bar {
  position: relative;
  display: inline-block;
  width: 5ch;
  margin-right: 6px;
  vertical-align: baseline;
}
.bar u { text-decoration: none; color: var(--dim); }
.bar i {
  position: absolute;
  inset: 0 auto 0 0;
  overflow: hidden;
  white-space: nowrap;
  font-style: normal;
  color: var(--text);
}
/* Without JavaScript the bars simply read as full. The replay resets them. */
.session.is-armed .bar i { width: 0; }
.session.is-armed .line.is-done .bar i { animation: bar-fill 0.5s steps(5) forwards; }
@keyframes bar-fill { to { width: calc(var(--n) * 1ch); } }

@media (max-width: 640px) {
  .wire-row { grid-template-columns: 1fr; gap: 6px; }
  .wire-link { width: 1px; height: 18px; margin: 0 auto; background: var(--a-strong); }
  .wire-dot { display: none; }
  .fade-lines li { grid-template-columns: 1fr; gap: 2px; }
  .result { white-space: normal; }
}

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