/**
 * XERB0XI0N Encyclopedia — Content Typography
 *
 * Applied automatically inside the `<article class="xr-content">` wrapper
 * produced by `resources/views/xerboxion/_layout.blade.php`. Every topic
 * chapter (Markdown or Blade) is rendered inside that wrapper, so this file
 * carries the entire typographic identity of the encyclopedia.
 *
 * The class is intentionally scoped: the stylesheet is inert outside
 * `.xr-content`, which means a dropped-in chapter inherits the cyberpunk look
 * without having to style individual tags.
 *
 * Authoring guidance
 * ------------------
 *   - Write plain Markdown — headings, paragraphs, lists, tables, code,
 *     blockquotes, images all get styled here.
 *   - For xref links use `[[slug]]` (Markdown) or `@xref('slug')` (Blade);
 *     both resolve to `<a class="xr-xref">` / `<span class="xr-xref--missing">`.
 *   - For richer layouts, drop into Blade and reach for the ambient
 *     `--xr-*` custom properties defined in xerboxion.css.
 *
 * @author J0bot
 * @version 1.0.0
 */

/* ========================================
   LAYOUT
   ========================================
   The topic "viewer" is a single contained block (header + nav + chapters)
   sitting on top of the neural-network canvas background. Without an opaque
   surface the animated bg renders the prose illegible — so we mirror the
   `.paper-viewer` treatment from xerboxion.css: translucent dark surface,
   cyan border, subtle backdrop blur, soft outer glow. */
.xr-topic-page {
    position: relative;
    min-height: 70vh;
    max-width: 960px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 5rem;
}

.xr-topic-header,
.xr-chapter-nav,
.xr-content {
    background: var(--xr-surface, rgba(10, 10, 15, 0.7));
    border: 1px solid rgba(0, 243, 255, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    box-shadow: 0 0 12px rgba(0, 255, 255, 0.08);
}

.xr-content {
    max-width: none;
    margin: 0;
    padding: 3rem 2.5rem 4rem;
    font-family: var(--xr-font-ui, 'Orbitron', sans-serif);
    color: var(--xr-text, rgba(220, 220, 220, 0.92));
    line-height: 1.75;
    font-size: 1rem;
    /* Collapse the border with the nav/header above for a unified panel. */
    border-top-width: 0;
}

/* ========================================
   TOPIC HEADER
   ======================================== */
.xr-topic-header {
    margin: 0;
    padding: 3rem 2.5rem 2rem;
    text-align: center;
}

.xr-topic-title {
    font-family: 'Orbitron', sans-serif;
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 3.5rem);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin: 0 0 0.75rem;
    background: linear-gradient(160deg,
        #7c3aed 0%,
        #4c1d95 45%,
        #1a0533 85%
    );
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 14px rgba(124, 58, 237, 0.55));
}

.xr-topic-summary {
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 1rem;
    color: var(--xr-muted, rgba(220, 220, 220, 0.55));
    max-width: 640px;
    margin: 0 auto;
}

/* ========================================
   CHAPTER NAV
   ======================================== */
.xr-chapter-nav {
    margin: 0;
    padding: 1rem 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    /* Sit flush against both header (above) and content (below). */
    border-top-width: 0;
    border-bottom-width: 0;
}
.xr-chapter-nav a {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    border: 1px solid rgba(0, 243, 255, 0.25);
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.85rem;
    text-decoration: none;
    transition: background-color 160ms ease, border-color 160ms ease;
}
.xr-chapter-nav a:hover {
    background: rgba(0, 243, 255, 0.08);
    border-color: rgba(0, 243, 255, 0.6);
}

/* ========================================
   HEADINGS
   ======================================== */
.xr-content h1,
.xr-content h2,
.xr-content h3,
.xr-content h4 {
    font-family: 'Orbitron', sans-serif;
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 3rem 0 1rem;
    line-height: 1.2;
}
.xr-content h1 {
    font-size: 2.25rem;
    text-shadow: 0 0 18px rgba(0, 243, 255, 0.35);
}
.xr-content h2 {
    font-size: 1.65rem;
    border-left: 3px solid var(--xr-accent2, rgba(255, 0, 200, 0.85));
    padding-left: 0.9rem;
}
.xr-content h3 {
    font-size: 1.25rem;
    color: var(--xr-accent2, rgba(255, 0, 200, 0.85));
}
.xr-content h4 {
    font-size: 1rem;
    color: rgba(220, 220, 220, 0.85);
}

/* Heading permalink icons injected by commonmark stay subtle — they are here
   to give a shareable anchor, not to distract from the prose. */
.xr-content .heading-permalink {
    margin-left: 0.5rem;
    opacity: 0.3;
    color: var(--xr-accent);
    text-decoration: none;
    transition: opacity 160ms ease;
}
.xr-content h1:hover .heading-permalink,
.xr-content h2:hover .heading-permalink,
.xr-content h3:hover .heading-permalink,
.xr-content h4:hover .heading-permalink {
    opacity: 1;
}

/* ========================================
   TEXT BLOCKS
   ======================================== */
.xr-content p {
    margin: 0 0 1.2rem;
}

.xr-content strong {
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    font-weight: 700;
}

.xr-content em {
    color: rgba(255, 0, 200, 0.75);
    font-style: italic;
}

.xr-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--xr-accent, rgba(0, 243, 255, 0.9));
    background: rgba(0, 243, 255, 0.04);
    color: rgba(220, 220, 220, 0.82);
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
}

.xr-content hr {
    margin: 3rem auto;
    border: 0;
    border-top: 1px dashed rgba(0, 243, 255, 0.3);
    max-width: 50%;
}

/* ========================================
   LISTS
   ======================================== */
.xr-content ul,
.xr-content ol {
    margin: 0 0 1.2rem;
    padding-left: 1.5rem;
}
.xr-content li {
    margin-bottom: 0.4rem;
}
.xr-content ul li::marker {
    color: var(--xr-accent2, rgba(255, 0, 200, 0.85));
}
.xr-content ol li::marker {
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
}

/* ========================================
   CODE
   ======================================== */
.xr-content code {
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    background: rgba(0, 243, 255, 0.08);
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    padding: 0.15rem 0.4rem;
    font-size: 0.95em;
}
.xr-content pre {
    background: rgba(5, 5, 5, 0.85);
    border: 1px solid rgba(0, 243, 255, 0.25);
    padding: 1rem 1.25rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}
.xr-content pre code {
    background: transparent;
    color: rgba(220, 220, 220, 0.9);
    padding: 0;
}

/* ========================================
   TABLES
   ========================================
   Tables can easily exceed the chapter width (long concept tables, comparison
   matrices). We expose the overflow on a wrapper rather than clipping it so
   the table remains horizontally scrollable on narrow screens without
   forcing the whole page to scroll. */
.xr-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.95rem;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.xr-content th {
    text-align: left;
    padding: 0.6rem 0.85rem;
    border-bottom: 2px solid var(--xr-accent, rgba(0, 243, 255, 0.9));
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.xr-content td {
    padding: 0.55rem 0.85rem;
    border-bottom: 1px solid rgba(0, 243, 255, 0.15);
    vertical-align: top;
}

/* ========================================
   IMAGES / FIGURES
   ======================================== */
.xr-content img {
    max-width: 100%;
    height: auto;
    border: 1px solid rgba(0, 243, 255, 0.3);
    margin: 1.5rem 0;
}
.xr-content figure {
    margin: 2rem 0;
    text-align: center;
}
.xr-content figcaption {
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.85rem;
    color: var(--xr-muted, rgba(220, 220, 220, 0.55));
    margin-top: 0.5rem;
}

/* ========================================
   LINKS (non-xref)
   ======================================== */
.xr-content a:not(.xr-xref):not(.heading-permalink) {
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
    transition: color 160ms ease, border-color 160ms ease;
}
.xr-content a:not(.xr-xref):not(.heading-permalink):hover {
    color: var(--xr-accent2, rgba(255, 0, 200, 0.85));
    border-bottom-style: solid;
}

/* ========================================
   XREF — cross-references between topics
   ========================================
   Live xrefs point to an authored topic; missing xrefs render as a span with
   `.xr-xref--missing` so the reader can see the term exists in the idea-graph
   but has not been written up yet. The `data-slug` attribute is the hook for
   the future hover-preview feature (V2). */
.xr-content .xr-xref {
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    text-decoration: none;
    border-bottom: 1px solid rgba(0, 243, 255, 0.5);
    padding: 0 0.15rem;
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
}
.xr-content .xr-xref:hover {
    background: rgba(0, 243, 255, 0.12);
    color: #fff;
    border-bottom-color: var(--xr-accent2, rgba(255, 0, 200, 0.85));
}

.xr-content .xr-xref--missing {
    color: var(--xr-muted, rgba(220, 220, 220, 0.55));
    border-bottom: 1px dashed rgba(220, 220, 220, 0.3);
    cursor: help;
    padding: 0 0.15rem;
}

/* ========================================
   TOPIC LIST CARDS (hub)
   ========================================
   Used on `/xerboxion` to list the authored encyclopedia topics alongside the
   existing paper/research/GitHub links. Intentionally mirrors the .xr-card
   aesthetic from xerboxion.css without coupling the two files — updating this
   block should only affect the encyclopedia hub section.

   `auto-fit` (not `auto-fill`) so the tracks collapse cleanly on narrow
   viewports — avoids a phantom 240px column that would otherwise force a
   horizontal scroll on mobile. */
.xr-topics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 1rem;
    max-width: 960px;
    margin: 2rem auto 0;
    padding: 0 1.5rem;
}
.xr-topic-card {
    display: block;
    padding: 1.25rem;
    border: 1px solid rgba(0, 243, 255, 0.35);
    background: var(--xr-surface, rgba(10, 10, 15, 0.7));
    color: var(--xr-text, rgba(220, 220, 220, 0.92));
    text-decoration: none;
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.xr-topic-card:hover {
    border-color: var(--xr-accent2, rgba(255, 0, 200, 0.85));
    box-shadow: 0 0 20px rgba(0, 243, 255, 0.25);
    transform: translateY(-2px);
}
.xr-topic-card h3 {
    margin: 0 0 0.4rem;
    font-family: 'Orbitron', sans-serif;
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.xr-topic-card p {
    margin: 0;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.85rem;
    color: var(--xr-muted, rgba(220, 220, 220, 0.55));
}

/* ========================================
   VECTEUR XERION — ROLE COLOURS
   ========================================
   The 8 Vecteur Xerion roles carry semantic meaning and consistent colours
   across the original research document. These CSS variables make them
   reusable by any chapter component (callout, role-card, figure, tag).
   Do NOT rename them — chapter content relies on these exact slugs. */
.xr-content {
    --xr-role-chasseur:    #ff6b35;
    --xr-role-cartographe: #3b82f6;
    --xr-role-sentinelle:  #eab308;
    --xr-role-shaman:      #a855f7;
    --xr-role-eclaireur:   #f59e0b;
    --xr-role-capteur:     #2dd4bf;
    --xr-role-batisseur:   #cd7f32;
    --xr-role-diplomate:   #84cc16;
    --xr-role-accent:      rgba(0, 243, 255, 0.9);
    --xr-role-magenta:     rgba(255, 0, 200, 0.85);
    --xr-role-warn:        #ef4444;
    /* Short aliases reused by inline SVGs lifted from the original research
       docs — the SVGs reference `var(--chasseur)` etc. without prefix. */
    --chasseur:    var(--xr-role-chasseur);
    --cartographe: var(--xr-role-cartographe);
    --sentinelle:  var(--xr-role-sentinelle);
    --shaman:      var(--xr-role-shaman);
    --eclaireur:   var(--xr-role-eclaireur);
    --capteur:     var(--xr-role-capteur);
    --batisseur:   var(--xr-role-batisseur);
    --diplomate:   var(--xr-role-diplomate);
    --accent:      var(--xr-role-shaman);
    --muted:       var(--xr-muted);
}

/* ========================================
   COMPONENT — CALLOUT
   ======================================== */
.xr-callout {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border-left: 3px solid var(--xr-accent, rgba(0, 243, 255, 0.9));
    background: rgba(0, 243, 255, 0.05);
    font-size: 0.95rem;
    line-height: 1.65;
}
.xr-callout--magenta    { border-left-color: var(--xr-role-magenta);    background: rgba(255, 0, 200, 0.05); }
.xr-callout--warn       { border-left-color: var(--xr-role-warn);       background: rgba(239, 68, 68, 0.06); }
.xr-callout--chasseur   { border-left-color: var(--xr-role-chasseur);   background: rgba(255, 107, 53, 0.06); }
.xr-callout--cartographe{ border-left-color: var(--xr-role-cartographe);background: rgba(59, 130, 246, 0.06); }
.xr-callout--sentinelle { border-left-color: var(--xr-role-sentinelle); background: rgba(234, 179, 8, 0.06); }
.xr-callout--shaman     { border-left-color: var(--xr-role-shaman);     background: rgba(168, 85, 247, 0.06); }
.xr-callout--eclaireur  { border-left-color: var(--xr-role-eclaireur);  background: rgba(245, 158, 11, 0.06); }
.xr-callout--capteur    { border-left-color: var(--xr-role-capteur);    background: rgba(45, 212, 191, 0.06); }
.xr-callout--batisseur  { border-left-color: var(--xr-role-batisseur);  background: rgba(205, 127, 50, 0.06); }
.xr-callout--diplomate  { border-left-color: var(--xr-role-diplomate);  background: rgba(132, 204, 22, 0.06); }

/* ========================================
   COMPONENT — VOICE
   ======================================== */
.xr-voice {
    margin: 1.5rem 0;
    padding: 1rem 1.25rem;
    border: 1px dashed rgba(220, 220, 220, 0.2);
    background: rgba(255, 255, 255, 0.02);
    font-style: italic;
    font-size: 0.95rem;
}
.xr-voice__label {
    display: block;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-style: normal;
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--xr-muted, rgba(220, 220, 220, 0.5));
    margin-bottom: 0.5rem;
}
.xr-voice__body { line-height: 1.65; }
.xr-voice__audio {
    width: 100%;
    margin-bottom: 0.6rem;
}

/* ========================================
   COMPONENT — FIGURE
   ======================================== */
.xr-figure {
    margin: 2rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.xr-figure__body {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}
.xr-figure__body svg,
.xr-figure__body img {
    max-width: 100%;
    height: auto;
    border: none;          /* override the .xr-content img border */
    margin: 0;
}
.xr-figure__caption {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.85rem;
    color: var(--xr-muted, rgba(220, 220, 220, 0.55));
    text-align: center;
}
.xr-figure__source { font-size: 0.75rem; opacity: 0.75; }

/* ========================================
   COMPONENT — ROLE CARD
   ======================================== */
.xr-role-card {
    position: relative;
    margin: 1.5rem 0;
    padding: 1.5rem 1.5rem 1.25rem;
    border: 1px solid rgba(220, 220, 220, 0.1);
    background: rgba(10, 10, 15, 0.35);
    overflow: hidden;
}
.xr-role-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--xr-role-accent);
}
.xr-role-card--chasseur::before    { background: var(--xr-role-chasseur); }
.xr-role-card--cartographe::before { background: var(--xr-role-cartographe); }
.xr-role-card--sentinelle::before  { background: var(--xr-role-sentinelle); }
.xr-role-card--shaman::before      { background: var(--xr-role-shaman); }
.xr-role-card--eclaireur::before   { background: var(--xr-role-eclaireur); }
.xr-role-card--capteur::before     { background: var(--xr-role-capteur); }
.xr-role-card--batisseur::before   { background: var(--xr-role-batisseur); }
.xr-role-card--diplomate::before   { background: var(--xr-role-diplomate); }
.xr-role-card__header {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 0.85rem;
}
.xr-role-card__icon  { font-size: 1.5rem; }
.xr-role-card__label {
    display: block;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--xr-muted, rgba(220, 220, 220, 0.5));
}
.xr-role-card__name {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.15rem;
    letter-spacing: 0.04em;
}

/* ========================================
   COMPONENT — NOTE (handwritten annotation or photo of notebook)
   ========================================
   Text-mode notes use a tilted dashed frame to feel "dropped in". Photo-
   mode notes (`.xr-note--photo`) drop the tilt and show the scan full
   width inside the frame — the photo IS the note, no need to add chrome
   that competes with the handwriting.  */
.xr-note {
    margin: 1.5rem 0;
    padding: 0.85rem 1rem;
    border: 1px dashed rgba(255, 0, 200, 0.35);
    background: rgba(255, 0, 200, 0.04);
    font-style: italic;
    color: rgba(220, 220, 220, 0.78);
    font-size: 0.92rem;
    transform: rotate(-0.35deg);
    max-width: 85%;
}
.xr-note--right { margin-left: auto;  transform: rotate(-0.35deg); }
.xr-note--left  { margin-right: auto; transform: rotate(0.35deg); }
.xr-note--photo {
    transform: none;
    max-width: 100%;
    padding: 0.75rem;
    font-style: normal;
}
.xr-note__date {
    display: block;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-style: normal;
    font-size: 0.7rem;
    color: var(--xr-role-magenta, rgba(255, 0, 200, 0.75));
    margin-bottom: 0.3rem;
    letter-spacing: 0.1em;
}
.xr-note__figure { margin: 0; }
.xr-note__image {
    display: block;
    width: 100%;
    height: auto;
    border: none;
    margin: 0;
}
.xr-note__caption {
    margin-top: 0.5rem;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.82rem;
    color: var(--xr-muted, rgba(220, 220, 220, 0.55));
    text-align: center;
}

/* ========================================
   COMPONENT — XERION PANEL (2-col description card)
   ======================================== */
.xr-xerion-panel {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1.5rem;
    margin: 1.5rem 0;
    padding: 1.5rem;
    border: 1px solid rgba(155, 109, 255, 0.25);
    background: rgba(155, 109, 255, 0.04);
}
@media (max-width: 600px) { .xr-xerion-panel { grid-template-columns: 1fr; gap: 0.75rem; } }
.xr-xerion-panel__sidebar { display: flex; flex-direction: column; gap: 0.2rem; }
.xr-xerion-panel__title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--xr-role-shaman, #a855f7);
    letter-spacing: 0.04em;
}
.xr-xerion-panel__subtitle {
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.78rem;
    color: var(--xr-muted, rgba(220, 220, 220, 0.5));
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.xr-xerion-panel__body { font-size: 0.95rem; line-height: 1.65; }

/* ========================================
   COMPONENT — PAIR (complementary comparison)
   ======================================== */
.xr-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin: 1.25rem 0;
}
@media (max-width: 600px) { .xr-pair { grid-template-columns: 1fr; } }
.xr-pair__side {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(220, 220, 220, 0.08);
}
.xr-pair__label {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    margin: 0 0 0.5rem;
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.xr-pair__body { font-size: 0.92rem; color: var(--xr-muted, rgba(220, 220, 220, 0.55)); }

/* ========================================
   COMPONENT — COLLAPSE-BOX (danger / pathology)
   ======================================== */
.xr-collapse-box {
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem;
    border: 1px solid rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.04);
}
.xr-collapse-box__title {
    font-family: 'Orbitron', sans-serif;
    font-size: 1rem;
    color: var(--xr-role-warn, #ef4444);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.65rem;
}

/* ========================================
   COMPONENT — OPS-BOX (operator mini-box)
   ======================================== */
.xr-ops-box {
    margin: 1rem 0;
    padding: 0.9rem 1rem;
    font-size: 0.9rem;
    border: 1px solid rgba(220, 220, 220, 0.08);
}
.xr-ops-box--chasseur    { border-color: rgba(255,107,53,0.3);  background: rgba(255,107,53,0.04); }
.xr-ops-box--cartographe { border-color: rgba(59,130,246,0.3);  background: rgba(59,130,246,0.04); }
.xr-ops-box--sentinelle  { border-color: rgba(234,179,8,0.3);   background: rgba(234,179,8,0.04); }
.xr-ops-box--shaman      { border-color: rgba(168,85,247,0.3);  background: rgba(168,85,247,0.04); }
.xr-ops-box--eclaireur   { border-color: rgba(245,158,11,0.3);  background: rgba(245,158,11,0.04); }
.xr-ops-box--capteur     { border-color: rgba(45,212,191,0.3);  background: rgba(45,212,191,0.04); }
.xr-ops-box--batisseur   { border-color: rgba(205,127,50,0.3);  background: rgba(205,127,50,0.04); }
.xr-ops-box--diplomate   { border-color: rgba(132,204,22,0.3);  background: rgba(132,204,22,0.04); }
.xr-ops-box__title {
    display: block;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    margin-bottom: 0.4rem;
}
.xr-ops-box__body p { margin: 0.2rem 0; }

/* ========================================
   COMPONENT — OPERATOR TABLE (dense reference)
   ======================================== */
.xr-content table.xr-op-table {
    font-size: 0.85rem;
}
.xr-content table.xr-op-table th {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.xr-content table.xr-op-table .xr-op-name {
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-weight: 600;
    white-space: nowrap;
}

/* ========================================
   COMPONENT — REFERENCE LIST
   ======================================== */
.xr-ref-list {
    list-style: none;
    padding: 0;
    font-size: 0.88rem;
}
.xr-ref-list li {
    padding: 0.45rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.xr-ref-list .xr-ref-author { font-weight: 600; }
.xr-ref-list .xr-ref-title  { color: var(--xr-muted); font-style: italic; }

/* ========================================
   UTILITY — TWO-COLUMN GRID
   ======================================== */
.xr-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin: 1rem 0;
}
@media (max-width: 600px) { .xr-grid-2 { grid-template-columns: 1fr; } }

/* ========================================
   UTILITY — CALLOUT VARIANTS (ok / bad)
   ======================================== */
.xr-callout--ok  { border-left-color: #4ade80; background: rgba(74, 222, 128, 0.05); }
.xr-callout--bad { border-left-color: #ef4444; background: rgba(239, 68, 68, 0.05); }

/* ========================================
   UTILITY — TEXT HELPERS
   ========================================
   Mirrors the `.bold`, `.hl`, `.mt`, `.small`, `.xsmall`, `.mono` utility
   classes from the original vector-xerion standalone doc, scoped to
   `.xr-content` so they can be used freely in migrated chapters. */
.xr-content .xr-bold  { font-weight: 600; }
.xr-content .xr-hl    { color: var(--xr-accent, rgba(0, 243, 255, 0.9)); font-weight: 600; }
.xr-content .xr-muted { color: var(--xr-muted, rgba(220, 220, 220, 0.5)); }
.xr-content .xr-small { font-size: 0.88rem; }
.xr-content .xr-xsmall{ font-size: 0.75rem; }
.xr-content .xr-mono  { font-family: var(--xr-font-mono, 'Share Tech Mono', monospace); font-size: 0.88rem; }

/* ========================================
   COMPONENT — VIDEO
   ======================================== */
.xr-video {
    margin: 1.5rem 0;
    padding: 0.9rem 0.9rem 0.75rem;
    border: 1px solid rgba(0, 243, 255, 0.25);
    background: rgba(0, 243, 255, 0.025);
}
.xr-video__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    margin-bottom: 0.55rem;
}
.xr-video__dot {
    width: 8px; height: 8px;
    background: var(--xr-role-magenta, rgba(255, 0, 200, 0.85));
    box-shadow: 0 0 8px rgba(255, 0, 200, 0.55);
    border-radius: 50%;
}
.xr-video__player {
    display: block;
    width: 100%;
    height: auto;
    border: none;
    margin: 0;
}
.xr-video__caption {
    margin: 0.55rem 0 0;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.82rem;
    color: var(--xr-muted, rgba(220, 220, 220, 0.55));
}

/* ========================================
   COMPONENT — AUDIO
   ======================================== */
.xr-audio {
    margin: 1.5rem 0;
    padding: 1rem 1.15rem;
    border: 1px solid rgba(0, 243, 255, 0.25);
    background: rgba(0, 243, 255, 0.03);
}
.xr-audio__label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--xr-accent, rgba(0, 243, 255, 0.9));
    margin-bottom: 0.55rem;
}
.xr-audio__dot {
    width: 8px; height: 8px;
    background: var(--xr-accent, rgba(0, 243, 255, 0.9));
    box-shadow: 0 0 8px rgba(0, 243, 255, 0.65);
    border-radius: 50%;
    animation: xr-audio-pulse 1.8s ease-in-out infinite;
}
@keyframes xr-audio-pulse {
    0%, 100% { opacity: 0.4; }
    50%      { opacity: 1; }
}
.xr-audio__player { width: 100%; }
.xr-audio__note {
    margin: 0.5rem 0 0;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.8rem;
    color: var(--xr-muted, rgba(220, 220, 220, 0.55));
}

/* ========================================
   HOVER PREVIEW (xref tooltip)
   ========================================
   Injected by public/js/xerboxion-hover-preview.js when an xref to an
   existing topic is hovered. Positioned absolutely by the JS.  */
.xr-preview {
    position: absolute;
    z-index: 9000;
    max-width: 320px;
    padding: 0.85rem 1rem;
    background: rgba(5, 5, 5, 0.96);
    border: 1px solid rgba(0, 243, 255, 0.55);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.7),
                0 0 18px rgba(0, 243, 255, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--xr-text, rgba(220, 220, 220, 0.92));
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 140ms ease, transform 140ms ease;
    pointer-events: none;
}
.xr-preview--visible {
    opacity: 1;
    transform: translateY(0);
}
.xr-preview__title {
    display: block;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.95rem;
    color: var(--xr-accent, rgba(0, 243, 255, 0.95));
    letter-spacing: 0.03em;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
}
.xr-preview__summary {
    margin: 0;
    color: rgba(220, 220, 220, 0.78);
}
.xr-preview__hint {
    display: block;
    margin-top: 0.5rem;
    font-family: var(--xr-font-mono, 'Share Tech Mono', monospace);
    font-size: 0.7rem;
    color: var(--xr-muted, rgba(220, 220, 220, 0.45));
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 720px) {
    .xr-topic-page {
        padding: 1.5rem 0.75rem 3rem;
    }
    .xr-content {
        padding: 2rem 1.25rem 3rem;
        font-size: 0.95rem;
    }
    .xr-topic-header {
        padding: 2rem 1rem 1.25rem;
    }
    .xr-chapter-nav {
        padding: 0.75rem 1rem;
    }
    .xr-content h1 { font-size: 1.7rem; }
    .xr-content h2 { font-size: 1.35rem; }
    .xr-content h3 { font-size: 1.1rem; }
    .xr-content pre { padding: 0.75rem 0.9rem; font-size: 0.85rem; }
    .xr-topics { padding: 0 0.75rem; }
}

/* Small phones — take the full width for max readability. The topic viewer
   becomes edge-to-edge with minimal internal padding so the prose fills the
   screen instead of swimming in gutters. */
@media (max-width: 420px) {
    .xr-topic-page {
        padding: 0.5rem 0 2rem;
    }
    .xr-topic-header,
    .xr-chapter-nav,
    .xr-content {
        border-left: none;
        border-right: none;
    }
    .xr-content {
        padding: 1.5rem 1rem 2.5rem;
    }
    .xr-topic-header {
        padding: 1.75rem 0.85rem 1rem;
    }
    .xr-topic-title {
        font-size: 1.8rem;
        letter-spacing: 0.03em;
    }
    .xr-topic-summary {
        font-size: 0.9rem;
    }
    .xr-chapter-nav {
        padding: 0.6rem 0.75rem;
    }
    .xr-chapter-nav a {
        font-size: 0.78rem;
        padding: 0.3rem 0.65rem;
    }
    .xr-content blockquote,
    .xr-callout,
    .xr-voice {
        padding: 0.75rem 0.9rem;
    }
    .xr-role-card {
        padding: 1.1rem 1rem 1rem;
    }
    .xr-ops-box {
        padding: 0.75rem 0.85rem;
    }
}
