/* Motif Bubbles' own look, on top of the suite's css/motif.css (the palette, fonts, app bar, menus, dialogs and toasts). */

:root { --good: #0ca30c; --critical: #d03b3b; --nocov: #94A3B8; }

.small { font-size: 12px; }
.linkish { padding: 0; color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }

/* App bar: the source pills and the progress bar under it */
.pill .text { overflow: hidden; text-overflow: ellipsis; color: var(--ink); font-weight: 500; }
.pill + .pill { margin-left: 6px; }
.progress { flex: none; height: 2px; background: linear-gradient(90deg, transparent, var(--accent), transparent) 0 0 / 40% 100% no-repeat; animation: slide 1.1s linear infinite; }
@keyframes slide { from { background-position: -40% 0; } to { background-position: 140% 0; } }

.scroll { flex: 1; min-height: 0; overflow: auto; line-height: 1.5; }

/* Start: the ways in */
.start { max-width: 880px; margin: 0 auto; padding: 48px 20px 40px; }
.start h1 { margin: 0 0 8px; color: var(--ink); font-size: 26px; font-weight: 600; letter-spacing: -.015em; }
.start .lead { margin: 0 0 24px; font-size: 14px; max-width: 680px; }
.ways { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.way { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); text-align: left; white-space: normal; color: var(--text); }
button.way:hover { border-color: var(--accent); }
.way svg.i { width: 22px; height: 22px; color: var(--accent); margin-bottom: 2px; }
.way b { color: var(--ink); font-size: 15px; font-weight: 600; }
.way .help { color: var(--muted); font-size: 12px; }
.repo-form { display: flex; gap: 8px; width: 100%; margin-top: 6px; }
.repo-form input { flex: 1; min-width: 0; font: inherit; color: var(--ink); background: var(--canvas); border: 1px solid var(--line-strong); border-radius: 6px; padding: 5px 9px; height: 32px; }
.repo-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }

/* The graph and the panel beside it */
.stage { flex: 1; display: flex; min-height: 0; background: var(--canvas); }
.graph { flex: 1; min-width: 0; position: relative; overflow: hidden; }
.graph svg.bubbles { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; user-select: none; }
.graph.panning svg.bubbles { cursor: grabbing; }
.graph .fit, .graph .side-toggle { position: absolute; right: 10px; background: var(--bar); border: 1px solid var(--line); }
.graph .fit { bottom: 10px; }
.graph .side-toggle { top: 10px; }
.graph .side-toggle.on { color: var(--accent); }
.side { width: 250px; flex: none; border-left: 1px solid var(--line); background: var(--strip); padding: 14px 16px; overflow: auto; }
.side h3 { margin: 14px 0 6px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.side h3:first-child { margin-top: 0; }
.side label { display: flex; align-items: center; gap: 8px; padding: 3px 0; color: var(--text); cursor: pointer; }
.side .hint { margin: 10px 0 8px; font-size: 12px; line-height: 1.45; }
.key { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.key svg { flex: none; }

.col-head { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; fill: var(--muted); }
.band { fill: var(--strip); }
.name { font-size: 12.5px; font-weight: 600; fill: var(--ink); }
.count { font-size: 12px; font-weight: 600; fill: var(--ink); font-family: "IBM Plex Mono", Consolas, monospace; pointer-events: none; }
/* Under a bubble, a halo keeps the name clear of the links that cross it */
.name { paint-order: stroke; stroke: var(--canvas); stroke-width: 4px; stroke-linejoin: round; }
.name.in { stroke: none; pointer-events: none; }
.node { cursor: default; outline: none; }
.node .body, .k-real { fill: var(--card); stroke: var(--line-strong); stroke-width: 1.5; }
.node.port .body, .k-port { fill: var(--canvas); stroke: var(--text); stroke-width: 1.5; }
.node.fake .body, .k-fake { stroke-dasharray: 4 3; }
.node.specs .body, .k-specs { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 1.5; }
.node.unmutated .body { fill: url(#hatch); }
.node:hover .body, .node:focus-visible .body { stroke: var(--ink); }
.hatch-back { fill: var(--card); }
.hatch-line { stroke: var(--line-strong); stroke-width: 2; }
.ring path { fill: none; stroke-width: 5; }
.ring .caught { stroke: var(--good); }
.ring .survived { stroke: var(--critical); }
.ring .unreached { stroke: var(--nocov); }
.k-caught { fill: var(--good); }
.k-survived { fill: var(--critical); }
.k-unreached { fill: var(--nocov); }
.ring.stale, .k-stale { opacity: .4; }

.link { fill: none; stroke: var(--line-strong); stroke-width: 1.5; }
.link.uses { stroke: var(--muted); }
.link.implements { stroke: var(--muted); stroke-dasharray: 5 4; }
.link.extends { stroke: var(--muted); }
.link.checks { stroke: var(--accent); stroke-width: 2; }
.link.wires { stroke: var(--line-strong); stroke-dasharray: 1 4; stroke-linecap: round; }
.head.uses { fill: var(--muted); }
.head.checks { fill: var(--accent); }
.head.wires { fill: var(--line-strong); }
.head.implements, .head.extends { fill: var(--canvas); stroke: var(--muted); stroke-width: 1.3; }
.dim .link, .dim .node { opacity: .18; transition: opacity .12s; }
.dim .hot { opacity: 1; }

.tip { position: absolute; left: 0; top: 0; pointer-events: none; background: var(--card); color: var(--text); box-shadow: var(--shadow); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font-size: 12px; min-width: 200px; z-index: 5; }
.tip b { color: var(--ink); font-size: 13px; }
.tip .row { display: flex; justify-content: space-between; gap: 16px; }
.tip .row span:last-child { font-family: "IBM Plex Mono", Consolas, monospace; color: var(--ink); }
.tip .role { color: var(--muted); margin-bottom: 6px; }

/* Drag and drop */
.drop-overlay { position: absolute; inset: 0; z-index: 35; display: grid; place-items: center; background: rgba(15,23,42,.18); pointer-events: none; }
.drop-overlay div { padding: 22px 28px; border-radius: 12px; border: 2px dashed var(--accent); background: var(--card); color: var(--ink); font-size: 15px; font-weight: 500; box-shadow: var(--shadow); }

/* Narrow screens: the panel goes under the graph */
@media (max-width: 799px) {
  .stage { flex-direction: column; }
  .graph { flex: 1 1 60%; min-height: 280px; }
  .side { width: auto; flex: 0 1 40%; border-left: 0; border-top: 1px solid var(--line); columns: 2 180px; column-gap: 20px; }
  .side h3 { break-after: avoid; }
}

@media (max-width: 599px) {
  .pill { max-width: 120px; }
  /* A graph's bar has no room for the ways in: Start again leads to them */
  .appbar.drawn .way-in { display: none; }
  .ways { grid-template-columns: 1fr; }
  .start { padding-top: 28px; }
}
