/* Attack views: the timeline chart and the patterns matrix.
   Colors and fonts come from styles.css. Red is the attacker, green is the response. */

.av-root { min-width: 0; font-size: 12.5px; }

/* ---------- Shared pieces ---------- */

.av-dot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--unknown); }
.av-dot.av-attacker, .av-attacker .av-dot { background: var(--crit); }
.av-dot.av-response, .av-response .av-dot { background: var(--ok); }
.av-dot.av-other { background: none; box-shadow: inset 0 0 0 1.5px var(--unknown); }

.av-link { padding: 0; border: 0; background: none; color: var(--muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.av-link:hover { color: var(--text); }

.av-plain-button { height: 24px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: none; color: var(--muted); }
.av-plain-button:hover { color: var(--text); }

.av-close { margin-left: auto; width: 24px; height: 24px; border: 0; border-radius: 5px; background: none; font-size: 16px; line-height: 1; color: var(--faint); }
.av-close:hover { background: var(--hover); color: var(--text); }

.av-count { font-family: var(--mono); font-size: 11.5px; color: var(--muted); fill: var(--muted); }

/* The detail strip: the one picked thing, in full. */
.av-detail { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 12px 0 0; padding: 12px 14px 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.av-detail-head { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 24px; }
.av-detail-when { font-weight: 600; color: var(--text); }
.av-detail-by { color: var(--muted); overflow-wrap: anywhere; }
.av-detail-text { max-width: 900px; font-size: 13px; line-height: 1.5; }
.av-quote { margin: 0; padding-left: 10px; max-width: 900px; border-left: 2px solid var(--line-strong); font-family: var(--mono); font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.av-note { max-width: 900px; color: var(--warn); }

.av-facts { display: grid; grid-template-columns: max-content minmax(0, 900px); gap: 6px 16px; margin: 0; }
.av-facts dt { color: var(--faint); }
.av-facts dd { margin: 0; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- Timeline ---------- */

.av-controls { display: flex; align-items: center; gap: 4px; height: 32px; }
.av-controls .av-plain-button { margin-left: 8px; }

.av-toggle { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border: 0; border-radius: 6px; background: none; color: var(--faint); }
.av-toggle:hover { background: var(--hover); }
.av-toggle.is-on { color: var(--text); }
.av-toggle:not(.is-on) .av-dot { opacity: 0.3; }

.av-chart { display: block; overflow: visible; }
.av-chart text { font-family: var(--font); user-select: none; }

.av-lane-line { stroke: var(--line); }
.av-lane-name { font-size: 12.5px; fill: var(--muted); }
.av-day-line { stroke: var(--line-strong); }
.av-hour-line { stroke: var(--line); stroke-opacity: 0.6; }
.av-hour-name { font-size: 10px; fill: var(--faint); }
.av-day-name { font-size: 12px; font-weight: 500; fill: var(--text); cursor: pointer; outline: none; }
.av-day-name:hover, .av-day-name:focus-visible { fill: var(--accent); }
.av-untimed-name { font-size: 11.5px; fill: var(--muted); }
.av-now-line { stroke: var(--accent); stroke-opacity: 0.7; }
.av-now-name { font-size: 10px; fill: var(--accent); }

.av-mark { cursor: pointer; outline: none; }
.av-mark-hit { fill: transparent; }
/* The thin dark edge keeps two touching marks apart. */
.av-mark-dot { stroke: var(--bg); stroke-width: 1; }
.av-mark.av-attacker .av-mark-dot { fill: var(--crit); }
.av-mark.av-response .av-mark-dot { fill: var(--ok); }
.av-mark.av-other .av-mark-dot { fill: var(--bg); stroke: var(--unknown); stroke-width: 1.5; }
/* Sources disagree about this event. */
.av-mark-ring { fill: none; stroke: var(--text); stroke-opacity: 0.75; stroke-width: 1; }

.av-mark:hover .av-mark-dot, .av-mark:focus-visible .av-mark-dot { stroke: var(--text); stroke-width: 1.5; }
.av-mark.is-selected .av-mark-dot { stroke: var(--text); stroke-width: 2; }
.av-mark.is-selected .av-mark-hit { fill: rgba(255, 255, 255, 0.16); }

.av-tip { position: fixed; z-index: 50; max-width: 340px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--raised); font-size: 12px; line-height: 1.45; color: var(--text); pointer-events: none; }
.av-tip-when { font-weight: 600; }
.av-tip-who { color: var(--muted); overflow-wrap: anywhere; }

/* ---------- Patterns ---------- */

.av-matrix { --av-name-width: 200px; --av-cell-width: 26px; --av-count-width: 34px; padding-top: 4px; }

/* One row: name, one cell per system, the time strip, the number. */
.av-row { display: grid; grid-template-columns: var(--av-name-width) repeat(var(--av-columns), var(--av-cell-width)) minmax(120px, 1fr) var(--av-count-width); align-items: center; column-gap: 0; }
.av-row-pattern, .av-row-address:not(.av-row-head) { height: 28px; border-top: 1px solid var(--line); border-radius: 0; cursor: pointer; outline: none; }
.av-row-pattern:hover, .av-row-address:not(.av-row-head):hover { background: var(--hover); }
.av-row-pattern:focus-visible, .av-row-address:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); }
.av-row.is-selected { background: rgba(255, 255, 255, 0.07); }
.av-row.is-dim { opacity: 0.22; }

.av-name { overflow: hidden; padding-right: 10px; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
.av-row .av-count { text-align: right; }

/* Column names read bottom to top, so a narrow column can carry a whole name. */
.av-row-head { align-items: end; }
.av-column { display: flex; justify-content: center; align-items: flex-end; height: 96px; padding: 0 0 8px; border: 0; background: none; font-size: 11.5px; color: var(--muted); }
.av-column span { writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; }
.av-column:hover, .av-column.is-picked { color: var(--text); }
.av-column.is-picked { font-weight: 600; }

.av-cell { display: flex; justify-content: center; align-items: center; height: 100%; }
.av-cell-dot { display: block; border-radius: 50%; background: var(--crit); opacity: 0.9; }
.av-cell-ring { display: block; width: 6px; height: 6px; border: 1.5px solid var(--crit); border-radius: 50%; opacity: 0.7; }

/* The time strip. Day lines are drawn as a repeating hairline, one per day. */
.av-strip, .av-strip-head { margin-left: 18px; }
.av-strip { position: relative; height: 100%; background-image: linear-gradient(to right, var(--line) 1px, transparent 1px); background-size: calc(100% / var(--av-days)) 100%; border-right: 1px solid var(--line); }
.av-strip-head { display: grid; grid-template-columns: repeat(var(--av-days), 1fr); padding-bottom: 6px; font-size: 11.5px; color: var(--muted); }
.av-strip-head span { padding-left: 5px; white-space: nowrap; overflow: hidden; }

.av-from-to { position: absolute; top: 50%; height: 1px; background: var(--muted); opacity: 0.55; }
.av-seen-bar { position: absolute; top: calc(50% - 2px); height: 5px; border-radius: 2px; background: var(--crit); opacity: 0.4; }
.av-seen-tick { position: absolute; top: calc(50% - 6px); width: 2px; height: 13px; margin-left: -1px; border-radius: 1px; background: var(--crit); }

.av-seen-list { display: flex; flex-direction: column; width: 100%; margin: 4px 0 0; padding: 0; list-style: none; }
.av-seen-line { display: grid; grid-template-columns: 210px 170px minmax(0, 1fr) max-content; gap: 12px; align-items: baseline; padding: 5px 0; border-top: 1px solid var(--line); }
.av-seen-when { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.av-seen-where { color: var(--muted); }
.av-seen-detail { overflow-wrap: anywhere; }

/* Addresses: the address takes the room of the name and the system columns, so its bar lines up with the strips above. */
.av-addresses { margin-top: 28px; }
.av-row-address { grid-template-columns: calc(var(--av-name-width) + var(--av-columns) * var(--av-cell-width)) minmax(120px, 1fr) var(--av-count-width); }
.av-section-name { padding-bottom: 6px; color: var(--muted); }
.av-ip { overflow: hidden; padding-right: 10px; font-family: var(--mono); font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; color: var(--text); }
.av-address-bar { position: absolute; top: calc(50% - 3px); height: 6px; min-width: 6px; margin-left: -3px; border-radius: 3px; background: var(--crit); opacity: 0.85; }

@media (max-width: 1100px) {
  .av-matrix { --av-cell-width: 22px; }
  .av-seen-line { grid-template-columns: 150px 120px minmax(0, 1fr) max-content; }
}

@media (prefers-reduced-motion: reduce) {
  .av-root *, .av-tip { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
