/* Page styles for the SCORE customizing pages (module score.app, /score/w/:code/customizing/...).
   Only what the shared components cannot express: the status graph editor (SVG, enhanced by
   public/js/score-status-graph.js) and the weight editor rows (public/js/score-weights.js).
   Positions are SVG attributes; nothing here relies on inline styles (CSP style-src 'self'). */

/* Weight editor ------------------------------------------------------------------------------ */

.score-weight-row {
  display: grid;
  gap: 0.35rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--color-line);
  border-radius: 0.6rem;
}

.score-weight-row--selected {
  border-color: var(--color-brand-border);
  background: var(--color-brand-soft);
}

.score-weight-row__controls {
  display: grid;
  grid-template-columns: 6.5rem auto minmax(8rem, 1fr);
  align-items: center;
  gap: 0.5rem;
}

.score-weight-row__number {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.score-weight-row__range {
  width: 100%;
  accent-color: var(--color-brand);
}

@media (max-width: 560px) {
  .score-weight-row__controls {
    grid-template-columns: 6.5rem auto;
  }

  .score-weight-row__range {
    grid-column: 1 / -1;
  }
}

.score-level-text {
  white-space: pre-line;
}

/* Status graph editor ------------------------------------------------------------------------ */

.score-graph {
  display: grid;
  gap: 0.6rem;
}

.score-graph__zoom {
  min-width: 3.5rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.score-graph [data-graph-connect][aria-pressed="true"] {
  background: var(--color-brand);
  color: var(--color-on-brand);
}

.score-graph__viewport {
  overflow: hidden;
  border: 1px solid var(--color-line);
  border-radius: 0.6rem;
  background: var(--color-canvas);
}

.score-graph__svg {
  display: block;
  width: 100%;
  height: clamp(280px, 50vh, 560px);
  touch-action: none;
  user-select: none;
  cursor: grab;
}

.score-graph--panning .score-graph__svg,
.score-graph--panning .score-graph__node {
  cursor: grabbing;
}

.score-graph__svg marker path {
  fill: var(--color-muted);
}

.score-graph__svg #score-graph-arrow-active path {
  fill: var(--color-brand);
}

.score-graph__edge {
  fill: none;
  stroke: var(--color-muted);
  stroke-width: 1.7;
  opacity: 0.75;
}

.score-graph__edge--inactive {
  stroke-dasharray: 6 5;
  opacity: 0.4;
}

.score-graph--highlight .score-graph__edge {
  opacity: 0.15;
}

.score-graph--highlight .score-graph__edge.score-graph__edge--highlighted {
  stroke: var(--color-brand);
  stroke-width: 3;
  opacity: 1;
}

.score-graph__edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 10;
  pointer-events: stroke;
  cursor: pointer;
}

.score-graph__edge-group:has(.score-graph__edge-hit:hover) .score-graph__edge,
.score-graph__edge-group:has(.score-graph__edge-hit:focus-visible) .score-graph__edge {
  stroke: var(--color-brand);
  stroke-width: 3;
  opacity: 1;
}

.score-graph__edge-hit:focus {
  outline: none;
}

.score-graph__preview {
  display: none;
  fill: none;
  stroke: var(--color-brand);
  stroke-width: 2.5;
  stroke-dasharray: 7 4;
  pointer-events: none;
}

.score-graph__preview--visible {
  display: inline;
}

.score-graph__node {
  cursor: grab;
}

.score-graph--connecting .score-graph__node {
  cursor: crosshair;
}

.score-graph__node:focus {
  outline: none;
}

.score-graph__node-box {
  fill: var(--color-surface);
  stroke: var(--color-brand);
  stroke-width: 1.7;
}

.score-graph__node--blue .score-graph__node-box {
  fill: light-dark(#edf4ff, #1d2f47);
}

.score-graph__node--amber .score-graph__node-box {
  fill: light-dark(#fff3db, #43361b);
}

.score-graph__node--green .score-graph__node-box {
  fill: light-dark(#e3f4e9, #1d3a2a);
}

.score-graph__node--initial .score-graph__node-box {
  stroke-width: 3.5;
}

.score-graph__node--inactive .score-graph__node-box {
  stroke-dasharray: 5 4;
  opacity: 0.65;
}

.score-graph__node:hover .score-graph__node-box,
.score-graph__node:focus-visible .score-graph__node-box,
.score-graph__node--source .score-graph__node-box {
  stroke-width: 4;
}

.score-graph__node--target .score-graph__node-box {
  stroke: var(--color-success);
  stroke-width: 5;
}

.score-graph__node-inner {
  fill: none;
  stroke: var(--color-brand);
  stroke-width: 1;
}

.score-graph__node-label {
  fill: var(--color-ink);
  font-size: 13px;
  font-weight: 600;
  pointer-events: none;
}

.score-graph__node-kind {
  fill: var(--color-ink-soft);
  font-size: 11px;
  pointer-events: none;
}

.score-graph__port {
  cursor: crosshair;
}

.score-graph__port circle {
  fill: var(--color-brand);
  stroke: var(--color-surface);
  stroke-width: 2;
}

.score-graph__port:hover circle,
.score-graph__port:focus-visible circle {
  fill: var(--color-surface);
  stroke: var(--color-brand);
  stroke-width: 3;
}

.score-graph__port:focus {
  outline: none;
}

@media (forced-colors: active) {
  .score-graph__node-box,
  .score-graph__edge {
    stroke: CanvasText;
  }

  .score-graph__node-label,
  .score-graph__node-kind {
    fill: CanvasText;
  }
}

/* Award badges (gamification): icon in grant lists and the icon picker of the award form. */
.score-award-icon {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
}

.score-award-icon-picker {
  margin: 0;
  padding: 0;
  border: 0;
}

.score-award-icon-picker__options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.5rem, 1fr));
  gap: 0.5rem;
}

.score-award-icon-picker__option {
  display: grid;
  justify-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.25rem;
  font-size: 0.75rem;
  color: var(--color-muted);
  border: 1px solid var(--color-line);
  border-radius: 0.6rem;
  cursor: pointer;
}

.score-award-icon-picker__option:hover {
  color: var(--color-ink);
  border-color: var(--color-brand-border);
}

.score-award-icon-picker__option:has(input:checked) {
  color: var(--color-ink);
  background: var(--color-brand-soft);
  border-color: var(--color-brand);
  box-shadow: inset 0 0 0 1px var(--color-brand);
}

.score-award-icon-picker__option:has(input:focus-visible) {
  outline: 3px solid var(--color-brand);
  outline-offset: 2px;
}

/* Points feedback after an action (public/js/score-points.js): "+N" with the action label floats up
   from where the action was triggered. ZIQAVO palette: Ink tile, Mint value, Glow star. */
.score-points-burst {
  position: fixed;
  z-index: 2000;
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  column-gap: 0.375rem;
  padding: 0.375rem 0.75rem 0.375rem 0.5rem;
  color: #effbf6;
  font-family: Manrope, "DM Sans", "Segoe UI", sans-serif;
  white-space: nowrap;
  pointer-events: none;
  background: linear-gradient(135deg, var(--ziqavo-ink), var(--ziqavo-pine));
  border: 1px solid var(--ziqavo-mint);
  border-radius: 999px;
  box-shadow: 0 10px 28px rgb(4 22 29 / 35%);
  animation: score-points-float 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

.score-points-burst i {
  grid-row: span 2;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--ziqavo-glow);
  clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
  animation: score-points-spin 1.8s ease-out forwards;
}

.score-points-burst strong {
  color: var(--ziqavo-mint);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.score-points-burst span {
  font-size: 0.75rem;
  line-height: 1.1;
  opacity: 0.85;
}

@keyframes score-points-float {
  0% {
    opacity: 0;
    transform: translateY(8px) scale(0.6);
  }
  18% {
    opacity: 1;
    transform: translateY(0) scale(1.08);
  }
  30% {
    transform: translateY(-4px) scale(1);
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-56px) scale(0.96);
  }
}

@keyframes score-points-spin {
  from {
    transform: rotate(-90deg) scale(0.4);
  }
  30% {
    transform: rotate(0) scale(1.15);
  }
  to {
    transform: rotate(45deg) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .score-points-burst {
    animation: score-points-fade 2.2s ease forwards;
  }

  .score-points-burst i {
    animation: none;
  }
}

@keyframes score-points-fade {
  0%,
  70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}
