﻿/* --- Lines of Influence â€” a paper-catalog field guide to ideas. --------
   Inherits the full token set + .panel/.btn/.chip-button/.eyebrow/.hero
   components from styles.css (same override pattern as the main page: no
   :root edit, body class scoping only).

   The graph itself is the one earned flourish on this page: era hues are
   information (each ring color is an era key, labeled in the legend and
   repeated as text everywhere), Honey-deep marks selection and traced
   lineage. Everything else stays hairline-on-paper.

   Since the merge into the main page this sheet only carries the graph view's
   own components; shell chrome (topbar/tabs) lives in styles.css. */

/* --- Facts placard ----------------------------------------------------- */

.influence-facts {
    margin: 8px 0 16px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 0.05em;
    color: var(--muted);
}

/* --- Filters row ----------------------------------------------------- */

.influence-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.influence-filter-label {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.influence-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* --- Graph layout ----------------------------------------------------- */

.influence-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 20px;
    align-items: start;
}

.influence-graph-wrap {
    position: relative;
    border: 1px solid var(--border);
    border-radius: var(--radius-card);
    background: var(--bg-soft);
    overflow: hidden;
    /* scrollIntoView from the collection→graph jump leaves the sticky topbar
       its room instead of sliding the wrap's top edge underneath it. */
    scroll-margin-top: 76px;
}

.influence-scroll {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
}

.influence-scroll:focus-visible {
    outline: 2px solid var(--accent-warm-deep);
    outline-offset: -2px;
}

.influence-svg {
    display: block;
    width: 1360px;
    height: auto;
}

/* Nodes */

.influence-node {
    cursor: pointer;
    /* No touch-action override: node dragging is mouse-only (gated in JS), so
       a thumb landing on a node still pans the map instead of hitting a
       dead spot. */
}

.influence-node:focus {
    outline: none;
}

/* Keyboard focus gets the full-strength halo (same as selection) since the
   resting hover halo at 0.28 alpha is too faint to be an AA focus indicator. */
.influence-node:focus-visible .influence-node-halo {
    stroke: rgba(149, 86, 34, 0.45);
}

.influence-node-ring {
    fill: var(--bg);
    stroke-width: 2;
    transition: stroke-opacity var(--t-med) var(--ease-out), fill var(--t-med) var(--ease-out);
}

.influence-node-halo {
    fill: transparent;
    stroke: transparent;
    stroke-width: 10;
    transition: stroke var(--t-med) var(--ease-out);
}

.influence-node.is-focus .influence-node-halo,
.influence-node:hover .influence-node-halo {
    stroke: rgba(149, 86, 34, 0.28);
}

.influence-node.is-selected .influence-node-halo {
    stroke: rgba(149, 86, 34, 0.45);
}

.influence-node.is-lineage .influence-node-ring {
    stroke-opacity: 1;
}

/* Collected from Discovery Packs: --node-era is set inline per owned node,
   so the fill keeps the era coding while clearly departing from the default
   paper disc. */
.influence-node.is-owned .influence-node-ring {
    fill: var(--node-era, var(--bg));
    stroke-opacity: 1;
}

/* Fog of war: uncollected thinkers read as anonymous silhouettes — gray ring,
   hollow paper fill, no era coding — so "who am I missing" is visible at a
   glance without revealing anything. Hover/focus/selection lifts the fog on
   that one node; the side card always tells the full story. The aria-label on
   the node keeps the real name for screen readers. */
.influence-node.is-fogged .influence-node-ring {
    stroke: rgba(26, 23, 20, 0.24);
    fill: var(--bg-soft);
    stroke-opacity: 1;
}

/* The name label stays hidden until collected — that's the fog. Selection,
   focus, and lineage tracing still reveal it (the later label rules win). */
.influence-node.is-fogged.is-major .influence-node-label,
.influence-node.is-fogged.is-lineage .influence-node-label {
    opacity: 0;
}

.influence-node.is-fogged.is-focus .influence-node-label,
.influence-node.is-fogged.is-selected .influence-node-label {
    opacity: 1;
    fill: var(--muted);
    font-weight: 500;
}

/* Era chips carry their collection count so the filter row doubles as the
   completion scoreboard; a filled era gets the Honey-deep "done" tint. */
.influence-chip-count {
    margin-left: 6px;
    font-family: var(--font-mono, monospace);
    font-size: 10px;
    color: var(--muted);
}

.influence-chip.is-complete .influence-chip-count {
    color: #955622;
    font-weight: 600;
}

.influence-node-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 500;
    fill: var(--muted);
    text-anchor: middle;
    paint-order: stroke;
    stroke: var(--bg-soft);
    stroke-width: 3;
    pointer-events: none;
    opacity: 0;
    transition: opacity var(--t-med) var(--ease-out);
}

.influence-node.is-major .influence-node-label,
.influence-node.is-focus .influence-node-label,
.influence-node.is-selected .influence-node-label,
.influence-node.is-lineage .influence-node-label {
    opacity: 1;
}

.influence-node.is-focus .influence-node-label,
.influence-node.is-selected .influence-node-label {
    fill: var(--text);
    font-weight: 600;
}

/* Dimming: anything outside the traced lineage or active era */

.influence-graph.has-focus .influence-edge:not(.is-lineage),
.influence-graph.has-era .influence-edge:not(.is-era) {
    opacity: 0.07;
}

.influence-graph.has-focus .influence-node:not(.is-lineage):not(.is-selected),
.influence-graph.has-era .influence-node:not(.is-era) {
    opacity: 0.18;
}

.influence-node,
.influence-edge {
    transition: opacity var(--t-med) var(--ease-out);
}

.influence-edge {
    fill: none;
    stroke: rgba(26, 23, 20, 0.16);
    stroke-width: 1;
}

.influence-edge.is-lineage {
    stroke: var(--accent-warm-deep);
    stroke-width: 1.6;
}

/* A line whose both endpoints sit in the player's collection: solid ink,
   slightly heavier than the dim default. Deliberately NOT honey — honey-deep
   is the selection/lineage-tracing signal; owned lines are quiet proven fact. */
.influence-edge.is-owned {
    stroke: rgba(26, 23, 20, 0.42);
    stroke-width: 1.4;
}

/* Time axis ticks */

.influence-tick {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.08em;
    fill: var(--muted);
    opacity: 0.75;
    text-anchor: middle;
}

.influence-tick-line {
    stroke: rgba(26, 23, 20, 0.06);
    stroke-width: 1;
}

/* Tooltip placard */

.influence-tip {
    position: absolute;
    z-index: 5;
    max-width: 220px;
    padding: 8px 10px;
    background: var(--panel-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow);
    pointer-events: none;
}

.influence-tip-name {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: 1.25;
}

.influence-tip-meta {
    margin: 2px 0 0;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--muted);
}

/* --- Side panel ------------------------------------------------------ */

.influence-side {
    position: sticky;
    top: 80px;
}

.influence-side-empty {
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-card);
    padding: 20px 18px;
    background: transparent;
}

.influence-side-hint {
    margin: 0;
    color: var(--muted);
    font-size: var(--text-sm);
    line-height: 1.55;
}

.influence-card {
    border: 1px solid var(--border);
    border-top: 3px solid var(--card-era, var(--border-strong));
    border-radius: var(--radius-card);
    background: var(--bg-soft);
    box-shadow: var(--shadow);
    padding: 18px 16px 16px;
    /* When a selection on a narrow screen scrolls the card into view, the
       sticky topbar needs the same room the graph wrap gets. */
    scroll-margin-top: 76px;
}

.influence-card-head {
    display: flex;
    gap: 12px;
    align-items: center;
}

.influence-portrait {
    width: 64px;
    height: 64px;
    flex: none;
    border-radius: var(--radius-card);
    object-fit: cover;
    border: 1px solid var(--border-strong);
    background: var(--panel-solid);
}

.influence-monogram {
    width: 64px;
    height: 64px;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-card);
    border: 1px solid var(--border-strong);
    background: var(--panel-solid);
    color: var(--card-era-text, var(--muted));
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
}

.influence-card h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.25;
    text-wrap: balance;
}

.influence-card-years {
    margin: 2px 0 0;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    letter-spacing: 0.06em;
    color: var(--muted);
}

.influence-owned-badge {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    border: 1px solid var(--accent-warm-deep);
    border-radius: var(--radius-button);
    color: var(--accent-warm-deep);
    font-size: var(--text-2xs);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.influence-card-bio {
    margin: 12px 0 0;
    font-size: var(--text-sm);
    line-height: 1.6;
}

.influence-rel {
    margin-top: 14px;
}

.influence-rel + .influence-rel {
    margin-top: 10px;
}

.influence-rel-label {
    margin: 0 0 6px;
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
}

.influence-rel-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.influence-rel-btn {
    min-height: 28px;
    padding: 4px 10px;
    border-radius: var(--radius-button);
    border: 1px solid var(--border-strong);
    background: transparent;
    color: var(--text);
    font-family: var(--font-display);
    font-size: var(--text-xs);
    font-weight: 500;
    cursor: pointer;
    transition: border-color var(--t-med) var(--ease-out), transform var(--t-med) var(--ease-out), background var(--t-med) var(--ease-out);
}

.influence-rel-btn:hover {
    border-color: var(--accent-warm-deep);
    transform: translateY(-1px);
    background: rgba(26, 23, 20, 0.04);
}

.influence-rel-btn:focus-visible {
    outline: 2px solid var(--accent-warm-deep);
    outline-offset: 2px;
}

.influence-rel-none {
    margin: 0;
    font-size: var(--text-xs);
    color: var(--muted);
}

.influence-card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.influence-wiki-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 32px;
    color: var(--accent-warm-deep);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    transition: color var(--t-med) var(--ease-out);
}

.influence-wiki-link:hover {
    color: var(--text);
}

.influence-wiki-link:focus-visible {
    outline: 2px solid var(--accent-warm-deep);
    outline-offset: 2px;
}

/* "View card in collection" — the graph→shelf half of the bridge. Same
   placard voice as the wiki link, but a button with the dotted-underline
   affordance so it reads as an app action, not an outbound link. */
.influence-shelf-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--accent-warm-deep);
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    cursor: pointer;
    text-decoration: underline dotted currentColor;
    text-underline-offset: 3px;
    transition: color var(--t-med) var(--ease-out);
}

.influence-shelf-link:hover {
    color: var(--text);
}

.influence-shelf-link:focus-visible {
    outline: 2px solid var(--accent-warm-deep);
    outline-offset: 2px;
}

.influence-close {
    min-height: 32px;
    min-width: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-button);
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    transition: color var(--t-med) var(--ease-out), border-color var(--t-med) var(--ease-out);
}

.influence-close:hover {
    color: var(--text);
    border-color: var(--text);
}

.influence-close:focus-visible {
    outline: 2px solid var(--accent-warm-deep);
    outline-offset: 2px;
}

/* --- Note ------------------------------------------------------------ */

.influence-note {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px 16px;
    margin: 16px 0 0;
    font-size: var(--text-xs);
    color: var(--muted);
}

.map-key {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px 14px;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}

.map-key-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.map-key-sw {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* Entrance: one short fade for the whole map. The default state is fully
   visible - animation only enhances it, and collapses entirely under reduced
   motion. (No per-node stagger: the in-pack reveal is the app's only
   sanctioned orchestrated cascade.) */

@media (prefers-reduced-motion: no-preference) {
    .influence-graph.is-entering {
        opacity: 0;
        animation: influence-graph-in 0.25s var(--ease-out) forwards;
    }
}

@keyframes influence-graph-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* --- Responsive ------------------------------------------------------- */

@media (max-width: 900px) {
    .influence-layout {
        grid-template-columns: 1fr;
    }

    .influence-side {
        position: static;
    }
}


/* Touch targets: side-panel controls clear 44px on coarse pointers. */
@media (pointer: coarse) {
    .influence-rel-btn,
    .influence-close,
    .influence-wiki-link {
        min-height: 44px;
    }

    .influence-close {
        min-width: 44px;
    }
}
