/* ============================================================

   SOURCE VIEWER - Chronicle's slide-in source panel

   Public, no-auth. Slides from right. Holds one source at a

   time: reading text, image, or external-original link.

   Width states: .open = visible 65%; .expanded = 100%.

   Scrim dims the record behind and closes on click.

   R14: CSS variables only. Tokens: --ink* surfaces,

   --paper* text, --rule* borders, --brass accent.

   ============================================================ */

.source-scrim {
  position: fixed; top: 73px; left: 0; right: 0; bottom: 0;

  background: rgba(0, 0, 0, 0);

  z-index: 1099;

  opacity: 0;

  pointer-events: none;

  transition: opacity 0.3s ease;

}

.source-scrim.open {
  opacity: 0.55;

  background: rgba(0, 0, 0, 0.55);

  pointer-events: auto;

}

.source-viewer {
  position: fixed; top: 73px; right: 0;

  width: 65%;

  max-width: none;

  height: calc(100vh - 73px);

  z-index: 1100;

  background: var(--ink);

  border-left: 1px solid var(--rule);

  overflow-y: auto;

  transform: translateX(100%);

  transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);

}

.source-viewer.open { transform: translateX(0); }

.source-viewer.expanded { width: 100%; max-width: none; }

.source-viewer-header {
  position: sticky; top: 0;

  padding: 24px;

  border-bottom: 1px solid var(--rule);

  background: var(--ink);

  z-index: 10;

  display: flex; justify-content: space-between; align-items: flex-start;

}

.source-viewer-eyebrow {
  font-size: 11px; letter-spacing: 0.15em;

  color: var(--paper-dim); font-family: var(--mono);

  margin-bottom: 8px;

}

.source-viewer-title {
  font-size: calc(20px * var(--type-scale));

  font-weight: 600; color: var(--paper);

}

.source-viewer-close {
  background: none; border: none;

  font-size: 24px; cursor: pointer; color: var(--paper);

  padding: 0; width: 32px; height: 32px;

  display: flex; align-items: center; justify-content: center;

}

.source-viewer-close:hover { opacity: 0.7; }

.source-viewer-body {
  padding: 24px; font-family: var(--body);

  color: var(--paper); line-height: 1.7;

}

.sv-source {
  margin-bottom: 40px; padding-bottom: 32px;

  border-bottom: 1px solid var(--rule);

}

.sv-source:last-child {
  border-bottom: none; margin-bottom: 0; padding-bottom: 0;

}

.sv-source-label {
  font-weight: 600; font-size: calc(14px * var(--type-scale));

  margin-bottom: 8px; color: var(--paper);

}

.sv-source-thesis {
  font-size: calc(13px * var(--type-scale));

  color: var(--paper-soft); margin-bottom: 16px;

  line-height: 1.6; font-style: italic;

}

.sv-reading {
  font-size: calc(13px * var(--type-scale));

  color: var(--paper); margin-bottom: 16px; padding: 16px;

  background: var(--ink-2);

  border-left: 3px solid var(--rule-strong);

  line-height: 1.7; white-space: pre-wrap; word-wrap: break-word;

}

.sv-image {
  max-width: 100%; height: auto; margin: 16px 0;

  border: 1px solid var(--rule);

}
.sv-gallery { margin: 0; display: flex; flex-direction: column; height: min(70vh, calc(100vh - 220px)); min-height: 300px; max-height: calc(100vh - 140px); }
.source-viewer.expanded .sv-gallery { height: min(78vh, calc(100vh - 180px)); }
.sv-gallery-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; background: #0a0a0a; border: 1px solid var(--rule); overflow: hidden; }
.sv-gallery-main { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; display: block; }
.sv-gallery-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 64px; border: none; background: rgba(0,0,0,0.45); color: #fff; font-size: 30px; line-height: 1; cursor: pointer; z-index: 2; transition: background 0.2s ease; display: flex; align-items: center; justify-content: center; }
.sv-gallery-arrow:hover { background: rgba(0,0,0,0.75); }
.sv-gallery-prev { left: 0; }
.sv-gallery-next { right: 0; }
.sv-gallery-counter { position: absolute; bottom: 10px; left: 12px; background: rgba(0,0,0,0.55); color: #fff; font-family: var(--mono); font-size: 12px; padding: 3px 8px; border-radius: 2px; z-index: 2; }
.sv-gallery-play { position: absolute; bottom: 10px; right: 12px; width: 34px; height: 34px; border: none; background: rgba(0,0,0,0.55); color: #fff; font-size: 15px; cursor: pointer; border-radius: 50%; z-index: 2; display: flex; align-items: center; justify-content: center; transition: background 0.2s ease; }
.sv-gallery-play:hover, .sv-gallery-play.playing { background: var(--brass); color: var(--ink); }
.sv-gallery-caption { flex: 0 0 auto; font-size: calc(12px * var(--type-scale)); color: var(--ink-2); margin-top: 8px; font-style: italic; }
.sv-gallery-thumbs { flex: 0 0 auto; display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.sv-gallery-thumb { flex: 0 0 auto; padding: 0; border: 1px solid var(--rule); background: none; cursor: pointer; width: 84px; height: 58px; overflow: hidden; opacity: 0.55; transition: opacity 0.2s ease, border-color 0.2s ease; }
.sv-gallery-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.sv-gallery-thumb:hover { opacity: 1; }
.sv-gallery-thumb.active { opacity: 1; border-color: var(--brass); }
.sv-video {
  width: 100%; max-height: 70vh; height: auto; display: block;
  margin: 16px 0; border: 1px solid var(--rule); background: #000;
}
.sv-audio {
  width: 100%; display: block; margin: 16px 0;
}

.sv-open-original {
  display: inline-block; padding: 8px 12px;

  background: var(--ink-2);

  border: 1px solid var(--rule-strong);

  color: var(--paper); text-decoration: none;

  font-size: calc(12px * var(--type-scale));

  margin-right: 8px; margin-bottom: 8px; border-radius: 2px;

  transition: all 0.2s ease;

}

.sv-open-original:hover {
  border-color: var(--brass); color: var(--brass);

}

.sv-source-url {
  display: block; margin-top: 12px;

  font-size: calc(11px * var(--type-scale));

  color: var(--paper-soft); text-decoration: none;

  font-family: var(--mono); word-break: break-all;

}

.sv-source-url:hover { color: var(--paper); }

.event-source-btn {
  font-family: var(--mono); font-size: calc(11px * var(--type-scale));

  letter-spacing: 0.1em; text-transform: uppercase;

  background: var(--ink-2); color: var(--paper);

  border: 1px solid var(--rule-strong);

  padding: 10px 18px; margin-top: 12px; cursor: pointer;

  transition: all 0.2s ease;

}

.event-source-btn:hover {
  border-color: var(--brass); color: var(--brass);

}

body.source-viewer-open { overflow: hidden; }

/* ── Slider header ───────────────────────────────── */

.sv-header {
  position: sticky; top: 0;

  background: var(--ink-2);

  border-bottom: 1px solid var(--rule);

  padding: 20px 28px 18px;

  z-index: 10;

}

.sv-header-top {
  display: flex; justify-content: space-between; align-items: center;

  margin-bottom: 10px;

}

.sv-kicker {
  font-family: var(--mono); font-size: calc(10px * var(--type-scale));

  letter-spacing: 0.28em; text-transform: uppercase;

  color: var(--paper-dim);

}

.sv-kicker-dot { color: var(--brass); margin: 0 4px; }

.sv-controls { display: flex; gap: 6px; }

.sv-ctrl {
  background: none; border: 1px solid transparent;

  color: var(--paper-dim); cursor: pointer;

  width: 34px; height: 34px; padding: 7px;

  display: flex; align-items: center; justify-content: center;

  transition: color 0.2s ease, border-color 0.2s ease;

}

.sv-ctrl:hover { color: var(--brass); border-color: var(--rule-strong); }

.sv-ctrl-icon { width: 18px; height: 18px; display: block; }

.sv-title {
  font-family: var(--display); font-weight: 500;

  font-size: calc(22px * var(--type-scale));

  color: var(--paper); line-height: 1.25; margin: 0;

}

/* ── Slider footer seal ──────────────────────────── */

.sv-footer {
  background: var(--ink-2);

  border-top: 1px solid var(--rule);

  padding: 24px 28px 32px;

  margin-top: 40px;

}

.sv-seal-line {
  font-family: var(--mono); font-size: calc(10px * var(--type-scale));

  letter-spacing: 0.22em; text-transform: uppercase;

  color: var(--brass); margin-bottom: 18px;

}

.sv-seal { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; margin: 0; }

.sv-seal dt {
  font-family: var(--mono); font-size: calc(10px * var(--type-scale));

  letter-spacing: 0.2em; text-transform: uppercase;

  color: var(--paper-dim);

}

.sv-seal dd {
  margin: 0; font-family: var(--mono); font-size: calc(11px * var(--type-scale));

  color: var(--paper-soft); word-break: break-word;

}

.sv-hash { color: var(--paper); letter-spacing: 0.05em; }

.sv-dot { color: var(--rule-strong); margin: 0 4px; }

/* ─ Slider back-to-top ────────────── */
.sv-back-to-top {
  position: fixed; bottom: 32px; right: 32px;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--ink); color: var(--brass);
  border: 1px solid var(--brass-deep); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease, background 0.2s ease, color 0.2s ease;
  z-index: 1102; box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.sv-back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.sv-back-to-top:hover { background: var(--brass-faint); color: var(--paper); border-color: var(--brass); }



/* ── Inline PDF original ─────────────────────────── */

.sv-pdf {

  margin-top: 20px;

}

.sv-pdf-pages {

  display: flex;

  flex-direction: column;

  align-items: center;

  gap: 24px;

}

.sv-pdf-page {

  display: block;

  width: 100%;

  max-width: 850px;

  height: auto;

  background: #fff;

  border: 1px solid var(--rule-strong);

  box-shadow: 0 6px 24px rgba(0,0,0,0.22);

}

.sv-pdf-status {

  font-family: var(--mono);

  font-size: calc(12px * var(--type-scale));

  letter-spacing: 0.08em;

  color: var(--paper-dim);

  text-align: center;

  padding: 32px 0;

}




/* ── PDF viewer toolbar + stage ──────────────────── */

.sv-pdf-toolbar {

  position: sticky; top: 0; z-index: 5;

  display: flex; align-items: center; justify-content: space-between;

  flex-wrap: wrap; gap: 12px;

  background: var(--ink-2);

  border: 1px solid var(--rule);

  border-radius: 4px;

  padding: 10px 14px; margin-bottom: 20px;

}

.sv-pdf-group { display: flex; align-items: center; gap: 6px; }

.sv-pdf-btn {

  background: none; border: 1px solid transparent;

  color: var(--paper-dim); cursor: pointer;

  min-width: 32px; height: 32px; padding: 6px 8px;

  display: flex; align-items: center; justify-content: center;

  font-family: var(--mono); font-size: calc(11px * var(--type-scale));

  letter-spacing: 0.06em; border-radius: 3px;

  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;

}

.sv-pdf-btn svg { width: 17px; height: 17px; display: block; }

.sv-pdf-btn:hover { color: var(--brass); border-color: var(--rule-strong); background: var(--ink); }

.sv-pdf-fit { width: auto; }

.sv-pdf-pageinfo {

  font-family: var(--mono); font-size: calc(11px * var(--type-scale));

  letter-spacing: 0.08em; color: var(--paper-soft); white-space: nowrap;

}

.sv-pdf-pagejump {

  width: 38px; text-align: center;

  background: var(--ink); border: 1px solid var(--rule-strong);

  color: var(--paper); font-family: var(--mono);

  font-size: calc(11px * var(--type-scale)); padding: 3px 4px; border-radius: 3px;

}

.sv-pdf-zoom {

  font-family: var(--mono); font-size: calc(11px * var(--type-scale));

  letter-spacing: 0.05em; color: var(--paper-soft); min-width: 44px; text-align: center;

}

.sv-pdf-stage {

  overflow: auto; text-align: center;

  background: rgba(0,0,0,0.04); border: 1px solid var(--rule);

  padding: 20px; border-radius: 4px;

}

.sv-pdf-canvas {

  background: #fff; border: 1px solid var(--rule-strong);

  box-shadow: 0 6px 24px rgba(0,0,0,0.22); max-width: 100%;

}

/* ── NeuraWeb privacy notice — warm green, soft archival modal ──── */
.nw-notice {
  position: fixed; inset: 0; z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(28, 36, 24, 0.38);
  opacity: 0; visibility: hidden;
  transition: opacity 0.28s ease, visibility 0.28s ease;
}
.nw-notice.visible { opacity: 1; visibility: visible; }
.nw-notice {
  --nw-paper: #ecf0e4; --nw-paper-2: #e3e9d7;
  --nw-edge: #c5d1b2; --nw-edge-strong: #a5B78e;
  --nw-ink: #2a3c24; --nw-ink-soft: #4e5f40;
  --nw-accent: #557a4e; --nw-accent-deep: #3e5c38;
}
.nw-notice-card {
  width: 560px; max-width: 100%;
  background: linear-gradient(165deg, var(--nw-paper), var(--nw-paper-2));
  border: 1px solid var(--nw-edge);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(42, 60, 36, 0.22);
  padding: 48px 48px 40px;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  text-align: center;
}
.nw-notice.visible .nw-notice-card { transform: translateY(0) scale(1); }
.nw-notice-glyph { display: none; }
.nw-notice-kicker {
  font-family: var(--mono, monospace);
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--nw-accent);
  margin-bottom: 16px;
}
.nw-notice-title {
  font-family: var(--display, Georgia, serif);
  font-size: 32px; font-weight: 500; line-height: 1.2;
  color: var(--nw-ink);
  margin: 0 0 20px;
}
.nw-notice-text {
  font-size: 17px; line-height: 1.6;
  color: var(--nw-ink-soft);
  margin: 0 auto 14px; max-width: 420px;
}
.nw-notice-text:last-of-type { margin-bottom: 30px; }
.nw-notice-actions {
  display: flex; gap: 12px; align-items: center; justify-content: center;
  flex-wrap: wrap;
}
.nw-notice-cta {
  display: inline-flex; align-items: center;
  background: var(--nw-accent);
  color: #f4f9f1;
  font-family: var(--mono, monospace);
  font-size: 14px; letter-spacing: 0.03em;
  padding: 13px 24px; border-radius: 7px;
  text-decoration: none;
  transition: background 0.18s ease;
}
.nw-notice-cta:hover { background: var(--nw-accent-deep); }
.nw-notice-dismiss {
  background: none; border: 1px solid var(--nw-edge-strong);
  color: var(--nw-ink-soft);
  font-family: var(--mono, monospace);
  font-size: 14px; letter-spacing: 0.03em;
  padding: 13px 24px; border-radius: 7px; cursor: pointer;
  transition: color 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.nw-notice-dismiss:hover { color: var(--nw-ink); border-color: var(--nw-accent); background: rgba(85, 122, 78, 0.08); }



/* ===== Plain (external/non-web) source presentation in the slider ===== */

.sv-ext-meta { margin: 24px 0; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding: 8px 0; }

.sv-ext-row { display: flex; justify-content: space-between; gap: 24px; padding: 10px 0; border-bottom: 1px solid var(--rule); }

.sv-ext-row:last-child { border-bottom: none; }

.sv-ext-key { font-family: var(--mono); font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--paper-dim); }

.sv-ext-val { font-family: var(--body); font-size: calc(14px * var(--type-scale)); color: var(--paper-soft); text-align: right; }

.sv-ext-note { font-family: var(--body); font-style: italic; font-size: calc(14px * var(--type-scale)); line-height: 1.6; color: var(--paper-soft); margin: 20px 0 24px; }

.sv-ext-link { display: inline-block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink); background: var(--brass); padding: 14px 28px; text-decoration: none; transition: background 0.2s ease, transform 0.2s ease; }

.sv-ext-link:hover { background: var(--paper); transform: translateY(-1px); }

