/* 6.6 Risk communication (`ui/pages/clauses/communication/`). Two registers,
   the risks to communicate and the stakeholders, then the documents written
   from them. The risk row is 6.5's shape with the chips replaced by the 6.5
   treatment read only and the communication pair. */

/* The mockup's row: the same air above and below the line, as on 6.5. */
.aucra-comm-risks .aucra-register-line,
.aucra-comm-people .aucra-register-line {
  padding: 8px 18px;
}
/* The pair stacks into two lines of one, as 6.4.5's does, so neither word is
   cut in the flat 170px column. */
.aucra-comm-risks .aucra-verdict {
  flex-direction: column;
  align-items: stretch;
}
.aucra-comm-risks .aucra-verdict-option + .aucra-verdict-option {
  border-left: 0;
  border-top: 1px solid var(--line-control);
}
/* Neither register has a Remove column, so the strip of gap lines under a row
   runs from the Threat or Stakeholder column to the end (ruling 8). */
.aucra-comm-risks .aucra-register-under-cell,
.aucra-comm-people .aucra-register-under-cell {
  grid-column: 3 / -1;
}
.aucra-comm-risks .aucra-register-under {
  padding-top: 0;
}
/* Hold only a strip that occupied space before the press. Revealing an
   already empty row on pointerdown would move the clicked control. */
.aucra-register-under:has(.aucra-comm-strip:empty:not(.aucra-strip-held)) {
  display: none;
}
/* Each line is kept as its own element across a save; the wrapper adds no box. */
.aucra-comm-strip-line {
  display: contents;
}

/* The two cells after the risk: the 6.5 treatment read only, and the answer
   with the lines under it. */
.aucra-comm-treatment,
.aucra-comm-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 4px;
  min-height: 40px;
  font-size: 12.5px;
  line-height: 1.35;
}
.aucra-comm-tag {
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 11px;
  color: var(--muted);
  background: var(--mist);
}
.aucra-comm-inherent {
  font-size: 12.5px;
  line-height: 1.35;
}
.aucra-comm-gaps {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.aucra-comm-gaps-row {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0 16px;
}
/* Every gap a closed row shows, gold, at the 24px floor a target is asked
   for, as 6.5's lines are. */
.aucra-comm-gap {
  display: flex;
  align-items: center;
  min-height: 24px;
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--gold-deep);
  text-align: left;
}
/* "not answered yet" is counted in the footer, so it is muted, not gold. */
.aucra-comm-open {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--muted);
}
/* The two uncounted lines of plan D6: gold, never a button. */
.aucra-comm-note {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--gold-deep);
}

/* The open band: the 6.5 decision read only, then the boxes and the chips. */
.aucra-comm-read,
.aucra-comm-disclosed {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12.5px;
  line-height: 1.5;
}
.aucra-comm-read-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}
/* The band's facts at the mockup's spacing (ruling 20): the verdict and the
   6.5 decision one block 4px apart, each lead on its line's own height, the
   way back to 6.5 at the right edge, the justification running on inline. */
.aucra-comm-facts,
.aucra-comm-facts > .aucra-comm-read {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.aucra-comm-risks .aucra-register-detail .aucra-points-lead {
  line-height: 1.5;
}
.aucra-comm-read-line > .aucra-comm-open-row {
  margin-left: auto;
}
.aucra-comm-read-inline > * {
  display: inline;
}
.aucra-comm-read-inline > .aucra-points-lead {
  margin-right: 8px;
}
.aucra-comm-read-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.aucra-comm-read-title {
  font-size: 13px;
  font-weight: 500;
}
.aucra-comm-read-text {
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.aucra-comm-open-row {
  font-size: 12.5px;
  white-space: nowrap;
  color: var(--gold-deep);
}
.aucra-comm-lower:not(:empty) {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.aucra-comm-label {
  font-size: 13px;
  font-weight: 500;
}
.aucra-comm-tell,
.aucra-comm-told {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* A stakeholder's band: the name and the kind side by side, then the rest. */
.aucra-comm-pair-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.aucra-comm-access {
  display: flex;
  align-items: center;
  gap: 12px;
}
.aucra-comm-kind,
.aucra-comm-count {
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aucra-comm-none {
  color: var(--muted);
}

/* The footers, the assumptions block and the documents. */
.aucra-comm-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0 6px;
}
.aucra-comm-next {
  color: var(--gold-deep);
}
.aucra-comm-block,
.aucra-comm-destination {
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.aucra-comm-block .aucra-block-body {
  gap: 12px;
}
.aucra-comm-context {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 8px;
}
.aucra-comm-docs {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 18px;
}
/* "Read it in C1" stands on its own line above the draft line, underlined as
   the canvas draws it, so it is not told apart by colour alone (ruling 26). */
.aucra-read-in {
  font-size: 12.5px;
  margin-bottom: 8px;
}
.aucra-read-in .aucra-gap-link {
  color: var(--gold-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Below 1200px the risk and the treatment give way so the threat's name keeps
   its share; the stakeholder's kind does the same. The track lists are the
   registers' own with the page columns narrowed: chevron, id, name, then the
   page's cells. */
@media (max-width: 1200px) {
  .aucra-comm-risks {
    --aucra-cols-narrow: 20px 44px minmax(130px, 1fr) 84px 110px 170px;
  }
  .aucra-comm-people {
    --aucra-cols-narrow: 20px 44px minmax(130px, 1fr) 140px 90px;
  }
  .aucra-comm-risks .aucra-register-line,
  .aucra-comm-risks .aucra-register-head,
  .aucra-comm-people .aucra-register-line,
  .aucra-comm-people .aucra-register-head {
    padding-left: 12px;
    padding-right: 12px;
  }
}
@media (max-width: 720px) {
  .aucra-comm-pair-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* A gap link inside a card's line runs on in the text beside it, so colour
   alone would be all that tells it apart (Lighthouse's link in text block,
   ruling 13): it keeps an underline, the gap's own gold. */
.aucra-doc-line a.aucra-gap-link,
.aucra-doc-how a.aucra-gap-link {
  text-decoration: underline;
  text-decoration-color: currentColor;
  text-underline-offset: 2px;
}

/* "Risks not communicated, and why": the risk's id and name are weighted
   (kit.css's strong part), its 6.5 treatment after them muted (ruling 7). */
.aucra-doc-not_communicated .aucra-doc-treatment {
  color: var(--muted);
}

/* Below 640px a register scrolls inside its box (kit.css); `scroll_cue.py`
   says so (ruling 42): a muted line above it until it is first scrolled, and
   a shadow on the right edge while there is more to the right. */
.aucra-scroll-cue {
  display: none;
}
@media (max-width: 639px) {
  .aucra-scroll-cue {
    display: block;
    margin: 0 18px 6px;
    font-size: 12px;
    color: var(--muted);
  }
  .aucra-scroll-cue:has(+ .aucra-comm-risks .aucra-register.aucra-scrolled),
  .aucra-scroll-cue:has(+ .aucra-comm-people .aucra-register.aucra-scrolled) {
    display: none;
  }
  .aucra-comm-risks,
  .aucra-comm-people {
    position: relative;
  }
  .aucra-comm-risks::after,
  .aucra-comm-people::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 18px;
    pointer-events: none;
    background: linear-gradient(to left, rgba(15, 23, 42, 0.14), rgba(15, 23, 42, 0));
    transition: opacity 0.15s;
  }
  .aucra-comm-risks:has(.aucra-register.aucra-scroll-end)::after,
  .aucra-comm-people:has(.aucra-register.aucra-scroll-end)::after {
    opacity: 0;
  }
}
@media (max-width: 639px) and (prefers-reduced-motion: reduce) {
  .aucra-comm-risks::after,
  .aucra-comm-people::after {
    transition: none;
  }
}

/* C1 and C2 each quote a whole 6.6.4 output. From 640px the words wrap beside
   the tag, as C1's do, and the head stays one row (ruling 9); below it the
   head wraps as every region head does. */
@media (min-width: 640px) {
  .aucra-comm-output-head {
    flex-wrap: nowrap;
  }
  .aucra-comm-output-head .aucra-region-name {
    min-width: 0;
  }
  .aucra-comm-output-head > :not(.aucra-region-name) {
    flex-shrink: 0;
  }
}

/* The kind fills its half of the pair at the name box's height (ruling 10).
   Its head carries the (i), so both heads take that height and the two boxes
   start on one line. */
.aucra-comm-pair-grid .aucra-field-head {
  min-height: 26px;
  align-items: center;
}
.aucra-comm-pair-grid .aucra-select {
  align-self: stretch;
}
.aucra-comm-pair-grid .aucra-select .q-field__control,
.aucra-comm-pair-grid .aucra-select .q-field__marginal {
  height: 40px;
  min-height: 40px;
}

/* Each risk told to a stakeholder is a box of its own: the id and the name,
   then "Measures in their words" with its Suggest, then the box (ruling 11). */
.aucra-comm-told .aucra-picked {
  gap: 8px;
}
.aucra-comm-told .aucra-picked-item {
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}
.aucra-comm-told .aucra-picked-head {
  font-size: 12.5px;
}
.aucra-comm-told .aucra-picked-head .aucra-pick-tag {
  font-size: 11px;
  color: var(--muted);
}

/* The assumptions on a card read at the card's own size (ruling 24). */
.aucra-comm-docs .aucra-formatted {
  font-size: inherit;
  line-height: inherit;
}

/* The five tabs wrap at 1024 and 390 (ruling 27). The space between them is
   the row's gap rather than each tab's right margin, so a row breaks only
   where the next tab does not fit and every row starts at the left edge. */
.aucra-comm-tabs .aucra-tabs .q-tabs__content {
  column-gap: 22px;
  row-gap: 0;
}
.aucra-comm-tabs .aucra-tabs .q-tab {
  margin-right: 0;
}

/* Where "Read it in C1" and "Read it in C2" land: clear of the sticky header. */
.aucra-comm-read-target {
  scroll-margin-top: 72px;
}
