/*
  The look of the graph and the miniature. Every color is a token (see the top of application.css), and the tokens change with the
  theme, so there is one rule for each thing here and no second set of rules for the dark theme.
  The shapes (anchor, attribute, ...) are defined in the page and drawn with <use>; what they look like is said here.
*/

/* Names and labels */
#graph { background: transparent; }
#graph .label, #graph .chronicleLabel {
    font-size:          8pt;
    font-family:        var(--font-ui);
    font-weight:        normal;
    text-anchor:        left;
    dominant-baseline:  middle;
    fill:               var(--g-ink);
    pointer-events:     none;
}
#graph .chronicleLabel {
    font-size:          10px;
    text-anchor:        middle;
    dominant-baseline:  central;
}
#graph .edge { pointer-events:none; }

#graph .anchor,
#graph .nexus {
    font-style:         italic;
    font-weight:        bold;
    stroke:             none;
    fill:               var(--g-anchor-name);
    pointer-events:     none;
}
#graph .role {
    font-style:         italic;
    stroke:             none;
    fill:               var(--g-ink);
    pointer-events:     none;
}
/* A halo behind the names, in the color of the canvas, keeps them readable where they cross edges */
#graph #names text {
    paint-order:        stroke;
    stroke:             var(--g-halo);
    stroke-width:       3px;
    stroke-linejoin:    round;
}
#graph .bad { fill: var(--g-bad); }
#graph .end { text-anchor:end; }

/* Key routes */
#graph .route {
    fill:               none;
    stroke:             var(--g-route);
    stroke-width:       32;
    stroke-linecap:     round;
    stroke-linejoin:    round;
    cursor:             pointer;
}
#graph .routeSelected {
    fill:               none;
    stroke:             var(--g-route-selected);
    stroke-width:       42;
    stroke-linecap:     round;
    stroke-linejoin:    round;
    cursor:             text;
}
#graph .routeText, text.routeText {
    font-family:        "Impact", "Haettenschweiler", "Franklin Gothic Bold", "Charcoal", "Helvetica Inserat", "Bitstream Vera Sans Bold", "Arial Black", sans-serif;
    font-size:          20pt;
    font-weight:        normal;
    fill:               #fff;
    dominant-baseline:  middle;
    pointer-events:     none;
}

/* Edges */
g#edges, g.edges {
    stroke:             var(--g-edge);
    stroke-width:       1px;
    fill:               none;
}
#graph .chronicleLabel { stroke: none; }
#minigraph text { fill: var(--g-ink); }

/* Shapes, in the graph and, with nav_ in front of the name, in the miniature */
g#knot rect, g#nav_knot rect                                 { fill: var(--g-card); stroke: var(--g-attribute); stroke-width: 2px; }

g#nexus rect:first-child, g#nav_nexus rect:first-child       { fill: var(--g-anchor); }
g#nexus rect:last-child, g#nav_nexus rect:last-child         { fill: var(--g-card); }
g#nexus_imploded path                                        { fill: var(--g-imploded); }

g#anchor rect, g#nav_anchor rect                             { fill: var(--g-anchor); }
g#anchor_imploded path                                       { fill: var(--g-imploded); }

g#tie rect, g#nav_tie rect                                   { fill: var(--g-tie); }
g#tie_historized rect:first-child, g#nav_tie_historized rect:first-child
                                                             { fill: var(--g-card); stroke: var(--g-tie); stroke-width: 2px; }
g#tie_historized rect:last-child, g#nav_tie_historized rect:last-child
                                                             { fill: var(--g-tie); }

g#attribute circle, g#attribute_historized circle,
g#nav_attribute circle, g#nav_attribute_historized circle    { fill: var(--g-card); stroke: var(--g-attribute); stroke-width: 2px; }

g#identifier > circle, g#identifier_historized > circle,
g#nav_identifier > circle, g#nav_identifier_historized > circle
                                                             { fill: var(--g-card); stroke: var(--g-tie); stroke-width: 2px; }
g#identifier g, g#identifier_historized g,
g#nav_identifier g, g#nav_identifier_historized g            { fill: var(--g-tie); stroke-width: 0; }
g#identifier g polygon, g#identifier_historized g polygon    { stroke-width: 1px; stroke-linejoin: round; stroke-linecap: round; }

/* What a node looks like when the pointer is on it, and when it is selected, and that it is fixed in place */
g#highlight circle                                           { fill: var(--g-card); stroke: var(--g-ring); stroke-width: 10px; }
g#selection circle:first-child                               { fill: var(--g-ring); }
g#selection circle:last-child                                { fill: var(--g-ring); stroke: var(--g-ink); stroke-width: 1px; }
g#fixation circle                                            { fill: var(--g-ink); }

/* The bubbles on the edges: how many, and the number of a chronicle */
g#bubble circle                                              { fill: var(--g-bubble); stroke: none; }
g#bubbleOutline circle                                       { fill: var(--g-bubble); stroke: var(--g-ink); stroke-width: 1px; }
g#one line, g#many line                                      { stroke: var(--g-ink); stroke-width: 1px; }

/* Debug mode: the partitions of the layout and the forces on the nodes */
#debugPartitions rect                                        { fill: var(--g-debug-fill); stroke: var(--g-debug-line); stroke-width: 30px; }
#debugPartitions circle                                      { fill: var(--g-debug-fill); stroke: var(--g-debug-stroke); stroke-opacity: 0.5; }
#graph .forceVector                                          { stroke: var(--g-debug-stroke); stroke-width: 6; }
marker#arrowhead path                                        { fill: var(--g-debug-stroke); }
