/* Artifact GRID - panel i wizualizacja biegu testowego (27.10.2026).
   SVG: templates/includes/artifact-grid/_svg-*.html.twig (tools/artifact_grid_svg.py), animacja: assets/js/artifact-grid.js.
   Znaczniki SVG opisują stan końcowy; .is-playing (dodawane przez JS) chowa elementy do chwili .on. */
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/jetbrains-mono/jetbrains-mono-v24-latin_latin-ext-regular.woff2') format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-style: normal; font-weight: 700; font-display: swap; src: url('/assets/fonts/jetbrains-mono/jetbrains-mono-v24-latin_latin-ext-700.woff2') format('woff2'); }

.agx {
  --agx-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  position: relative;
  border-radius: 20px;
  padding: 24px 24px 16px;
  background: radial-gradient(120% 90% at 70% 40%, #1d1530 0%, #110d1c 55%, #0b0913 100%);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.22), 0 40px 80px -40px rgba(17, 13, 28, 0.55);
  color: #f4f4f5;
  text-align: left;
}
@media (max-width: 575px) { .agx { padding: 18px 14px 12px; border-radius: 16px; } }

.agx-head { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.agx-lockup { display: flex; align-items: center; gap: 14px; min-width: 0; }
.agx-logo { height: 26px; width: auto; display: block; }
.agx-sep { width: 1px; height: 30px; background: rgba(196, 181, 253, 0.35); flex: none; }
.agx-glyph { width: 27px; height: 30px; flex: none; }
.agx-glyph .g-out { fill: rgba(124, 58, 237, 0.18); stroke: #a78bfa; stroke-width: 1.6; stroke-linejoin: round; }
.agx-glyph .g-in { fill: none; stroke: #c4b5fd; stroke-width: 1.2; opacity: 0.8; }
.agx-glyph .g-core { fill: #ede9fe; }
.agx-word { font-family: var(--agx-mono); font-size: 1rem; letter-spacing: 0.22em; color: #e9e5ff; white-space: nowrap; }
.agx-word b { font-weight: 700; background: linear-gradient(90deg, #60a5fa, #c084fc); -webkit-background-clip: text; background-clip: text; color: transparent; }
.agx-badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--agx-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: #a7f3d0;
  border: 1px solid rgba(52, 211, 153, 0.45); border-radius: 999px; padding: 4px 12px; white-space: nowrap;
}
.agx-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
@media (max-width: 480px) {
  .agx-lockup { gap: 10px; }
  .agx-logo { height: 21px; }
  .agx-sep { height: 24px; }
  .agx-glyph { width: 22px; height: 24px; }
  .agx-word { font-size: 0.82rem; letter-spacing: 0.16em; }
}

.agx p.agx-title { margin: 20px 0 10px; font-family: var(--agx-mono); font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: #a1a1aa; }

/* wariant szeroki od 700 px szerokości tablicy, wąski poniżej (telefon) */
.agx-board { container-type: inline-size; }
.agx-board svg { display: block; width: 100%; height: auto; overflow: visible; }
.agx-board .agx-wide { display: none; }
.agx-board .agx-tall { max-width: 480px; margin: 0 auto; }
@container (min-width: 700px) {
  .agx-board .agx-wide { display: block; }
  .agx-board .agx-tall { display: none; }
}
.agx svg text { font-family: var(--agx-mono); text-rendering: geometricPrecision; }

.agx-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-top: 10px; }
.agx p.agx-cap { margin: 0; font-family: var(--agx-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: #8b8b95; line-height: 1.5; }
@media (max-width: 575px) { .agx p.agx-cap { letter-spacing: 0.04em; } .agx p.agx-title { letter-spacing: 0.1em; margin-top: 16px; } }
.agx-ctl {
  font-family: var(--agx-mono); font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase;
  color: #d4d4d8; background: transparent; border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 3px 12px; cursor: pointer;
}
.agx-ctl:hover { color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.agx-ctl:focus-visible { outline: 2px solid #a78bfa; outline-offset: 2px; }
.agx-ctl[hidden] { display: none; }

/* ---- elementy sceny ---- */
.agx .sd { fill: #34d399; }
.agx .sg { fill: #34d399; transition: fill 0.25s ease; }
.agx .lp-p, .agx .lp-h { stroke: rgba(252, 211, 77, 0.55); }
.agx .lp-p { stroke-dasharray: 0.035 0.025; }

/* pojawianie się (tylko podczas odtwarzania) */
.agx .a { transition: opacity 0.4s ease, transform 0.4s ease; transform-box: fill-box; transform-origin: center; }
.agx.is-playing .a:not(.on) { opacity: 0; }
.agx.is-playing .a.pop:not(.on) { transform: scale(0.92); }
.agx .ln { stroke-dasharray: 1; stroke-dashoffset: 0; transition: stroke-dashoffset 0.7s ease, opacity 0.4s ease; }
.agx.is-playing .ln:not(.on) { stroke-dashoffset: 1; }
.agx.is-playing .sg:not(.on) { fill: rgba(255, 255, 255, 0.12); }
.agx.is-playing .sd { fill: #52525b; }
.agx.is-playing .on .sd { fill: #34d399; transition: fill 0.4s ease 0.5s; }
.agx.no-tr, .agx.no-tr * { transition: none !important; }
.agx.is-fading .agx-board svg > :not(defs) { opacity: 0.25; transition: opacity 0.6s ease; }

/* stany - w znacznikach stan końcowy, JS zmienia data-st w trakcie biegu */
.agx [data-st] .bx { transition: stroke 0.3s ease; }
.agx [data-st] text { transition: opacity 0.25s ease; }
.agx .s-run, .agx .t-run, .agx .t-fail, .agx .s-fix, .agx .l1b { opacity: 0; }
.agx [data-st="run"] .s-run { opacity: 1; }
.agx [data-st="run"] .s-ok { opacity: 0; }
.agx [data-st="run"] .bx { stroke: rgba(196, 181, 253, 0.75); animation: agx-pulse 1s ease-in-out infinite; }
.agx .hc[data-st="run"] .bx { stroke: rgba(196, 181, 253, 0.5); }

.agx .m[data-st="build"] .bx { stroke: rgba(255, 255, 255, 0.22); }
.agx .m[data-st="fix"] .bx { stroke: #fbbf24; }
.agx .m[data-st="fix"] .s-cnt { opacity: 0; }
.agx .m[data-st="fix"] .s-fix { opacity: 1; }
.agx .m .s-cnt { transition: opacity 0.25s ease; }

.agx .r[data-st="run"] .t-ok, .agx .r[data-st="rerun"] .t-ok, .agx .r[data-st="fail"] .t-ok { opacity: 0; }
.agx .r[data-st="run"] .t-run, .agx .r[data-st="rerun"] .t-run { opacity: 1; }
.agx .r[data-st="rerun"] .bx { stroke: rgba(196, 181, 253, 0.75); animation: agx-pulse 1s ease-in-out infinite; }
.agx .r[data-st="fail"] .t-fail { opacity: 1; }
.agx .r[data-st="fail"] .bx { stroke: #f87171; }
.agx .r[data-st="rerun"] .l1a, .agx .r[data-st="ok2"] .l1a { opacity: 0; }
.agx .r[data-st="rerun"] .l1b, .agx .r[data-st="ok2"] .l1b { opacity: 1; }

.agx .lp[data-st="fix"] .lp-p, .agx .lp[data-st="fix"] .lp-h { stroke: #f87171; }
.agx .lp[data-st="fix"] .lp-p { animation: agx-march 0.9s linear infinite; }

@keyframes agx-pulse { 0%, 100% { stroke-opacity: 1; } 50% { stroke-opacity: 0.35; } }
@keyframes agx-march { to { stroke-dashoffset: -0.12; } }

@media (prefers-reduced-motion: reduce) {
  .agx .a, .agx .ln, .agx .sg, .agx [data-st] text, .agx [data-st] .bx { transition: none; }
  .agx [data-st] .bx, .agx .lp-p { animation: none !important; }
}

.agx { margin: 0; }

/* ---- scena 3D (templates/includes/artifact-grid/scene.html.twig, assets/js/artifact-grid-3d.js) ---- */
.agx3-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 2px; }
.agx3-chip {
  font-family: var(--agx-mono); font-size: 0.74rem; line-height: 1.4; color: #d4d4d8; white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.04); border-radius: 999px; padding: 4px 12px;
}
.agx3-chip b { color: #fff; font-weight: 700; }
.agx3-chip i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #c4b5fd; margin-right: 8px; vertical-align: 1px; }
.agx3-chip i.ok { background: #34d399; }
.agx3-chip.is-ok { border-color: rgba(52, 211, 153, 0.38); color: #a7f3d0; }
.agx3-chip.is-ok b { color: #6ee7b7; }
.agx3-chip.is-ghost { border-style: dashed; color: #a1a1aa; }
.agx3-chip.is-ghost b { color: #e9e5ff; }
.agx3-stage { position: relative; aspect-ratio: 16 / 9.2; margin: 4px -10px 0; }
.agx3-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: pan-y; }
.agx3-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
@media (max-width: 640px) {
  .agx3-stage { aspect-ratio: 1 / 1.08; margin: 2px -8px 0; }
  .agx3-chip { font-size: 0.66rem; padding: 3px 9px; }
  .agx3-chips { gap: 6px; margin-top: 14px; }
}
.agx3-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 360px); gap: 12px 28px; align-items: end; margin-top: 4px; }
@media (max-width: 820px) { .agx3-panel { grid-template-columns: minmax(0, 1fr); } }
.agx3-log { list-style: none; margin: 0; padding: 0; font-family: var(--agx-mono); font-size: 0.74rem; line-height: 1.75; min-height: 7em; }
.agx3-log li { color: #a1a1aa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agx3-log li::before { content: '›'; margin-right: 8px; color: #52525b; }
.agx3-log li.is-ok { color: #6ee7b7; }
.agx3-log li.is-no { color: #fca5a5; }
.agx3-log li.is-dep { color: #a1a1aa; }
.agx3-log li.is-sup { color: #93c5fd; }
.agx3-log li.is-art { color: #c4b5fd; }
.agx3-log li.is-fix { color: #fcd34d; }
.agx3-log li:nth-child(2) { opacity: 0.72; }
.agx3-log li:nth-child(3) { opacity: 0.5; }
.agx3-log li:nth-child(4) { opacity: 0.32; }
.agx3-log li.is-new { animation: agx3-in 0.45s ease; }
@keyframes agx3-in { from { opacity: 0; transform: translateY(-4px); } }
@media (max-width: 640px) { .agx3-log { font-size: 0.66rem; } }
.agx3-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: flex-end;
  font-family: var(--agx-mono); font-size: 0.68rem; color: #a1a1aa; }
@media (max-width: 820px) { .agx3-legend { justify-content: flex-start; } }
.agx3-legend li { white-space: nowrap; }
.agx3-legend li::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 0; background: var(--c); }
.agx3-legend .lg-hyp::before { background: rgba(161, 161, 170, 0.25); border: 1px solid #a1a1aa; width: 6px; height: 6px; }
.agx3-legend .lg-sup { --c: #60a5fa; }
.agx3-legend .lg-ver { --c: #34d399; }
.agx3-legend .lg-fal { --c: #f87171; }
.agx3-legend .lg-ret::before { background: none; border: 1px dashed #8b8b95; width: 6px; height: 6px; }
.agx3-legend .lg-art::before { background: #a78bfa; border-radius: 1px; transform: rotate(45deg) scale(0.8); }
.agx3-legend .lg-ref::before { background: #fff; box-shadow: 0 0 6px 2px rgba(237, 233, 254, 0.7); width: 5px; height: 5px; }
.agx > p.agx-title:first-child { margin-top: 0; }
