/* Matrix and reports: shared by the tool (index.html) and the room views (room.html).
   Markup: public/js/matrix.js (report template, symbols) and the matrix markup in both pages.
   All values come from the tokens in /css/site.css. */

.textbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--color-primary); font-weight: 500; cursor: pointer; }
.textbtn:hover { text-decoration: underline; }
.textbtn--muted { color: var(--color-muted); font-weight: 400; }
.hint { color: var(--color-ink); padding-left: 1rem; border-left: 2px solid var(--color-primary); }
.hint[hidden] { display: none; }

/* ---------- Matrix ---------- */
.matrix { display: grid; grid-template-columns: 2rem minmax(0, 1fr); grid-template-rows: auto 2rem; gap: .5rem;
          width: 100%; max-width: 30rem; scroll-margin-top: 6rem; view-transition-name: decision-matrix; }
/* Three tracks (1fr auto 1fr) keep the axis name exactly centered, whatever the length of Low/High.
   The y axis stays in normal flow and only rotates its labels: flex/grid in vertical writing modes misaligns in Safari. */
.axis { color: var(--color-muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.axis > :last-child { justify-self: end; }
.axis--y { grid-template-columns: none; grid-template-rows: 1fr auto 1fr; justify-items: center; }
.axis--y > * { writing-mode: vertical-rl; transform: rotate(180deg); }
.axis--y > :first-child { grid-row: 3; align-self: end; }
.axis--y > :last-child { grid-row: 1; align-self: start; justify-self: center; }
.axis b { font-weight: 500; color: var(--color-ink); }
.plot { position: relative; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; aspect-ratio: 1 / 1; }
.q { display: grid; align-content: start; gap: .125rem; padding: 1rem; background: var(--color-canvas); transition: background-color .3s ease; }
.q[data-q="routine"], .q[data-q="consequential"] { align-content: end; }
.q[data-q="strategic"], .q[data-q="consequential"] { justify-items: end; text-align: right; }
.q__name { color: var(--color-ink); font-family: var(--font-heading); font-size: 1.125rem; transition: color .3s ease; }
.q.is-active { background: var(--color-primary); }
.q.is-active .q__name { color: var(--color-surface); }
/* "Trust the …" (questions.json quadrants.*.trust), only in the quadrant the decision lands in */
.q__trust { display: none; color: var(--color-surface); font-size: var(--size-small); }
.q.is-active .q__trust { display: block; }
@media (width < 48rem) { .q { padding: .75rem; } }

.spread {
  position: absolute; translate: -50% -50%; border: 1px dashed var(--color-ink);
  background: color-mix(in oklab, var(--color-surface) 35%, transparent);
  transition: left .45s ease, top .45s ease, width .45s ease, height .45s ease;
}
/* One marker per decision, told apart by shape only; colour is kept free for a later dimension
   (docs/features/mehrere-auswertungen-hintereinander.md) */
.sym { width: 1em; height: 1em; flex: none; overflow: visible; fill: var(--color-ink); stroke: var(--color-surface); stroke-width: 4; stroke-linejoin: round; paint-order: stroke; }
.marker {
  position: absolute; width: 1.25rem; height: 1.25rem; translate: -50% -50%;
  transition: left .45s cubic-bezier(.2, .7, .2, 1), top .45s cubic-bezier(.2, .7, .2, 1), width .2s ease, height .2s ease;
}
.marker .sym { display: block; width: 100%; height: 100%; }
.marker.is-active { width: 1.625rem; height: 1.625rem; z-index: 1; }
.legend { grid-column: 2; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; font-size: var(--size-small); }
.legend[hidden] { display: none; }
.legend button { display: inline-flex; align-items: center; gap: .4rem; max-width: 16rem; padding: .125rem 0; border: 0; background: none; font: inherit; color: var(--color-copy); cursor: pointer; }
.legend .sym { font-size: 1.125rem; }
.legend button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.legend button:hover span { text-decoration: underline; }
.legend button[aria-pressed="true"] { color: var(--color-ink); font-weight: 500; }
/* Borderline band (scoring.borderline), shown only for a dimension that falls inside it */
.zone {
  position: absolute; pointer-events: none;
  background: repeating-linear-gradient(135deg, color-mix(in oklab, var(--color-surface) 45%, transparent) 0 2px, transparent 2px 7px);
  border: 1px dashed color-mix(in oklab, var(--color-surface) 70%, transparent);
}
.zone--r { top: 0; bottom: 0; border-block: 0; }
.zone--a { left: 0; right: 0; border-inline: 0; }
.spread[hidden], .marker[hidden], .zone[hidden] { display: none; }
.plot__empty {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 2rem; text-align: center;
  color: var(--color-muted);
  background: color-mix(in oklab, var(--color-surface) 55%, transparent);
}
.plot__empty[hidden] { display: none; }
.plot__empty b { color: var(--color-ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.plot__empty small { display: block; margin-top: .35rem; font-size: var(--size-small); }

/* ---------- Report ---------- */
.type { color: var(--color-ink); font-weight: 500; }
.fal { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1.5rem; margin: 0; }
.fal dt { color: var(--color-ink); font-weight: 500; }
.fal dd { margin: 0; display: flex; align-items: center; gap: .5rem; }
.who { display: inline-block; width: .875rem; height: .875rem; border: 1.5px solid var(--color-ink); background: var(--color-surface); }
.who--human { background: var(--color-ink); }
.who--hybrid { background: linear-gradient(135deg, var(--color-ink) 50%, var(--color-surface) 50%); }
.scores { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; color: var(--color-muted); }
.scores b { color: var(--color-ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.note { padding-left: 1rem; border-left: 2px solid var(--color-primary); color: var(--color-ink); }
[data-report][hidden], .note[hidden] { display: none; }
details summary { cursor: pointer; color: var(--color-primary); font-weight: 500; width: fit-content; }
.debug { width: 100%; border-collapse: collapse; margin-top: 1rem; font-variant-numeric: tabular-nums; }
.debug th, .debug td { padding: .35rem .75rem .35rem 0; border-bottom: 1px solid var(--color-line); text-align: left; }
.debug th { color: var(--color-ink); font-weight: 500; }

/* Key facts: wenige grosse Saetze, ein Schluesselbegriff gelb unterstrichen */
.facts-text { gap: calc(var(--stack-gap) * 1.5); }
.facts-text p { color: var(--color-ink); max-width: 46rem; }
.facts-text .mark > img { height: .3em; bottom: -.08em; }
.facts-text q { quotes: "“" "”"; }

/* ---------- Reports: stacked, each one folds ---------- */
.reports__bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .25rem 1rem; }
.reports__bar:empty { display: none; }
#slot-report:not(:empty) { margin-bottom: calc(var(--stack-gap) * 2); }
.reports { display: grid; margin-top: var(--stack-gap); }
.report { border-top: 1px solid var(--color-line); }
.report:last-child { border-bottom: 1px solid var(--color-line); }
.report[hidden] { display: none; }
.report > summary { display: flex; align-items: center; gap: .75rem; width: auto; padding-block: 1.25rem; color: var(--color-ink); font-weight: 400; list-style: none; }
.report > summary::-webkit-details-marker { display: none; }
.report > summary::after {
  content: ""; flex: none; margin-left: auto; width: .55rem; height: .55rem; translate: 0 -25%;
  border: solid var(--color-muted); border-width: 0 1.5px 1.5px 0; rotate: 45deg; transition: rotate .2s ease, translate .2s ease;
}
.report[open] > summary::after { rotate: 225deg; translate: 0 25%; }
.report__sym { display: inline-flex; font-size: 1.5rem; }
.report__title { min-width: 0; overflow-wrap: anywhere; }
.report__type { color: var(--color-muted); white-space: nowrap; }
.report__body { padding-bottom: calc(var(--stack-gap) * 2); }
.report__actions { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.criteria { padding-top: var(--stack-gap); }
.criteria__body { padding-top: calc(var(--stack-gap) * 1.5); }

/* ---------- Alle Kriterien ---------- */
.crit-list { list-style: none; margin: 0; padding: 0; }
.crit { display: grid; grid-template-columns: 2.75rem 1fr 4.5rem; gap: 1rem; align-items: start; padding-block: .75rem; border-top: 1px solid var(--color-line); }
.crit__id { color: var(--color-muted); font-variant-numeric: tabular-nums; }
.crit__text { color: var(--color-ink); display: block; }
.crit__meta { color: var(--color-muted); display: block; }
.crit__bar { height: .5rem; margin-top: .55rem; background: var(--color-canvas); }
.crit__bar i { display: block; height: 100%; background: var(--color-primary); }
.crit.is-ko { box-shadow: inset 3px 0 0 var(--color-primary); padding-left: .75rem; }

/* ---------- Group sessions (docs/features/gruppen-funktion-mit-raeumen.md) ---------- */
/* Symbols in a participant's colour and pattern (matrix.js symbol(shape, slot)); from slot 50 a dark outline,
   from slot 100 a light centre dot */
.sym--c { stroke: var(--color-surface); }
.sym--outline { stroke: var(--color-ink); stroke-width: 3.2; }
.sym__dot { fill: var(--color-surface); stroke: var(--color-ink); stroke-width: 1.4; paint-order: normal; }
/* Markers are larger in rooms, so the patterns stay readable */
.matrix--room .marker { width: 1.75rem; height: 1.75rem; }
.matrix--room .marker.is-active { width: 2.125rem; height: 2.125rem; }
.marker--other { z-index: 0; }
.markers--others .marker { opacity: .92; }

@media (prefers-reduced-motion: reduce) {
  .marker, .spread, .q { transition-duration: .01ms; }
}

/* ---------- Print (index.html and room.html; page-specific rules are in each page) ---------- */
@media print {
  /* Quadrants, markers, the Frame/Act/Learn boxes, bars and highlights are backgrounds: print them even with
     "Background graphics" off, which is the browsers' default */
  .matrix, .matrix *, .report, .report * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .matrix { width: 15cm; max-width: 100% !important; margin-inline: auto; break-inside: avoid; }
  .marker, .spread, .q, .q__name { transition: none !important; }
  .legend { justify-content: center; }
  .legend button { cursor: default; }

  /* Each open report on pages of its own: it starts a new page, and so does whatever follows it (the next report,
     index.html's framework). Only break-before: a break after one report plus one before the next gives a blank
     page in Firefox. */
  .report[open] { break-before: page; border: 0 !important; }
  /* Nothing on the matrix yet (no marker): no matrix to print (the pages add .matrix--empty) */
  .matrix--empty { display: none !important; }
  .report > summary { padding-block: 0 1.25rem; break-after: avoid; }
  .report > summary::after { display: none; }
  .report__body { padding-bottom: 0; }
  .report__actions, [data-r="stale"], [data-r="error"] { display: none !important; }
  .fal, .scores, .note, .facts-text p { break-inside: avoid; }
  .facts-text { gap: var(--stack-gap); }
  .facts-text p { font-size: 13pt; line-height: 1.35; }
  /* All criteria: only if unfolded on screen, then in one column, no item split across pages */
  .criteria:not([open]) { display: none; }
  .criteria > summary { display: none; }
  .criteria, .criteria__body { padding-top: 0; }
  /* Blocks, not grids: Chrome overlaps grid items that are split across pages */
  .criteria__body, .criteria .layout-2col, .criteria .layout-2col > .stack { display: block; }
  .criteria__body > p { margin-bottom: 5mm; }
  .criteria .layout-2col > .stack + .stack { margin-top: 6mm; }
  .criteria .layout-2col > .stack > p { margin-bottom: 2mm; break-after: avoid; }
  .crit { grid-template-columns: 2.25rem minmax(0, 1fr) 4rem; gap: .75rem; padding-block: .4rem; font-size: 9.5pt; line-height: 1.4; break-inside: avoid; }
  .crit__bar { margin-top: .4rem; }
}
