/* A report: the blocks js/report.js builds. Every section is a card; a chapter is a heading
   on the page with cards of its own under it. */

.report,
.report-body,
.chapter-body {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* a picker (files, views) and what it shows */
.report-switch {
  display: flex;
  flex-direction: column;
  gap: 28px;
  min-width: 0;
}

.report-section {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
  padding: 36px 40px;
  border-radius: var(--q-l);
  corner-shape: squircle;
  background: var(--paper);
  box-shadow: var(--shadow-1);
}

/* a section in a card lies on the card: its views, its files */
.report-section .report-section {
  padding: 0;
  background: none;
  box-shadow: none;
}

.report-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
}

.report-title {
  font-size: 22px;
  line-height: 30px;
  letter-spacing: -0.01em;
}

.chapter {
  display: flex;
  flex-direction: column;
  gap: 36px;
  min-width: 0;
}

.report > .chapter:not(:first-child) {
  margin-top: 88px;
}

.report > .chapter + :not(.chapter) {
  margin-top: 64px;
}

.chapter-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px 48px;
}

.chapter-head > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.tool-sample > .chapter-head {
  margin-bottom: 36px;
}

.report-empty {
  padding: 36px 16px;
  border-radius: var(--q-l);
  corner-shape: squircle;
  background: var(--paper-2);
  color: var(--ink-3);
  text-align: center;
}

.report-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 44px 56px;
  align-items: start;
}

/* cards side by side, the first across the page */
.report-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
}

.report-cards > .is-wide {
  grid-column: 1 / -1;
}

.report-cards > .is-wide:not(.is-plain) {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2.6fr);
  gap: 56px;
}

.report-cards > .is-wide:not(.is-plain) > .report-head {
  align-self: start;
}

.publication-figure {
  display: block;
  width: 100%;
  height: auto;
}

/* figures: a line to each, its label led by dots to the number */
.ledger {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
  gap: 0 56px;
  margin: 0;
}

.ledger > div {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
  padding-block: 13px;
  border-bottom: 1px solid var(--line);
}

.ledger dt {
  display: flex;
  flex: 1 1 auto;
  align-items: baseline;
  gap: 12px;
  min-width: 40%;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 22px;
}

.ledger dt::after {
  content: "";
  flex: 1;
  min-width: 12px;
  height: 3px;
  background: radial-gradient(circle at 1.5px 1.5px, rgb(18 36 28 / 0.28) 1px, transparent 1.3px) 0 0 / 7px 3px;
}

.ledger dd {
  display: flex;
  flex: 0 1 auto;
  align-items: baseline;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0 10px;
  min-width: 0;
  text-align: right;
}

.ledger-value {
  font-size: 17px;
  font-weight: 500;
  line-height: 22px;
  overflow-wrap: anywhere;
}

.ledger dd small {
  color: var(--ink-3);
  font-size: 14px;
  line-height: 20px;
}

/* on its own in a report, the figures are a card */
.report > .ledger,
.report-body > .ledger,
.chapter-body > .ledger {
  padding: 20px 40px;
  border-radius: var(--q-l);
  corner-shape: squircle;
  background: var(--paper);
  box-shadow: var(--shadow-1);
}

.report-section .report-body > .ledger {
  padding: 0;
  background: none;
  box-shadow: none;
}

/* on the cover and beside a form: one column, without a line under the last */
.slip .ledger,
.tool-aside .ledger {
  grid-template-columns: minmax(0, 1fr);
}

.slip .ledger > div:last-child,
.tool-aside .ledger > div:last-child {
  border-bottom: 0;
}

/* words as running text, strongest first: the count behind each, the highlighter over those
   that have something in common; the line under them reads out the one the pointer is on */
.word-line {
  gap: 30px;
  padding: 44px 48px 0;
  overflow: hidden;
}

.word-line-key {
  color: var(--ink-2);
  font-size: 15px;
}

.word-line-words {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 14px 24px;
  font: 400 36px/44px var(--serif);
  letter-spacing: -0.012em;
}

.word-line-words li {
  display: inline-flex;
  align-items: flex-start;
  cursor: default;
}

.word-line-words li > span {
  padding: 0 6px 2px;
  margin-inline: -6px;
  border-radius: 0.14em 0.42em 0.2em 0.36em;
  background: linear-gradient(var(--lime), var(--lime)) no-repeat 0 0 / 0% 100%;
  line-height: 40px;
  transition: background-size 320ms var(--ease);
}

.word-line-words .is-marked > span {
  background-size: 100% 100%;
}

.word-line-words li:hover > span {
  background-image: linear-gradient(#b9dcfb, #b9dcfb);
  background-size: 100% 100%;
}

.word-line-words sup {
  margin-left: 9px;
  color: var(--ink-3);
  font: 500 14px/18px var(--font);
  letter-spacing: 0;
}

.word-line-read {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 18px;
  margin-inline: -48px;
  padding: 18px 48px 20px;
  background: var(--paper-2);
  color: var(--ink-2);
}

.word-line-read .serif {
  color: var(--ink);
  font-size: 22px;
  line-height: 28px;
}

/* tables */
.table-block {
  min-width: 0;
}

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
  line-height: 22px;
}

.table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-2);
  color: var(--ink-3);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
  text-align: left;
  white-space: nowrap;
}

.table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  /* break a word only when it can't fit on its own line: "anywhere" let a column with a short heading shrink to a letter wide */
  overflow-wrap: break-word;
}

.table tr > :first-child {
  padding-left: 0;
}

.table tr > :last-child {
  padding-right: 0;
}

.table tbody tr:last-child > * {
  border-bottom: 0;
}

.table tbody tr:hover > td {
  background: var(--canvas);
}

.table .is-number {
  text-align: right;
  white-space: nowrap;
}

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
}

.th-sort .icon {
  color: var(--ink-3);
}

.th-sort:hover,
.table th[aria-sort="ascending"],
.table th[aria-sort="descending"] {
  color: var(--ink);
}

.table th[aria-sort="ascending"] .th-sort,
.table th[aria-sort="descending"] .th-sort {
  margin-inline: -4px;
  padding-inline: 4px;
  border-radius: 3px 7px 4px 6px;
  background: var(--lime);
}

.table-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

/* a table alone in a report is a card */
.report > .table-block,
.report-body > .table-block,
.chapter-body > .table-block {
  padding: 28px 40px 32px;
  border-radius: var(--q-l);
  corner-shape: squircle;
  background: var(--paper);
  box-shadow: var(--shadow-1);
}

.report-section .report-body > .table-block {
  padding: 0;
  background: none;
  box-shadow: none;
}

/* where a chart is drawn once it is near the screen (chartNearby in js/report.js) */
.chart-place {
  display: block;
}

/* a chart alone in a report is a card too */
.report > aid-chart,
.report-body > aid-chart,
.chapter-body > aid-chart {
  padding: 28px 40px;
  border-radius: var(--q-l);
  corner-shape: squircle;
  background: var(--paper);
  box-shadow: var(--shadow-1);
}

.report-section .report-body > aid-chart {
  padding: 0;
  background: none;
  box-shadow: none;
}

/* a category's colour beside its name, outside the charts (swatch() in js/report.js) */
.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

/* a chart in a table cell (a MiniBar, a ShareStrip) */
.table aid-chart {
  min-width: 140px;
}

/* words */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 4px 14px;
  border-radius: calc(10px * var(--sq));
  corner-shape: squircle;
  background: var(--paper-2);
  font: 400 17px/26px var(--serif);
}

.chip-count {
  color: var(--ink-3);
  font: 400 13px/18px var(--font);
}

.passage {
  margin: 0;
  padding: 24px 28px;
  max-height: 400px;
  overflow: auto;
  border-radius: var(--q-l);
  corner-shape: squircle;
  background: var(--canvas);
  font: 400 17px/1.7 var(--serif);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.quote {
  color: var(--ink);
  font: 400 17px/27px var(--serif);
}

/* corrections marked in a text (js/tools/punctuation-correct.js): what was written struck out, what is there now under the highlighter */
.fix-was,
.fix-now {
  padding-inline: 0.14em;
}

.fix-was {
  border-radius: 0.16em 0.4em 0.22em 0.34em;
  background: var(--red-soft);
  color: var(--red);
}

.fix-now {
  margin-inline: 0;
  font-weight: 600;
  text-decoration: none;
}

.fixes {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 20px;
  font: 400 17px/28px var(--serif);
}

.proof-key {
  display: flex;
  gap: 16px;
  font: 400 17px/28px var(--serif);
}

.proof .stack {
  gap: 0;
}

.proof-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px 56px;
  padding-block: 24px;
  border-bottom: 1px solid var(--line);
}

.proof-line:last-child {
  border-bottom: 0;
}

.proof-text {
  max-width: 68ch;
  font: 400 20px/36px var(--serif);
  overflow-wrap: anywhere;
}

.proof-notes {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}

.proof-notes dt {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 20px;
}

.proof-notes dd {
  margin: 0;
}

/* a concordance: every line turns on its keyword */
.kwic {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  font: 400 17px/26px var(--serif);
}

.kwic.has-source {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) minmax(72px, 0.3fr);
}

.kwic-line {
  display: contents;
}

.kwic-line > * {
  padding-block: 10px;
  border-bottom: 1px solid var(--line);
}

.kwic-line:last-child > * {
  border-bottom: 0;
}

.kwic-left {
  display: flex;
  justify-content: flex-end;
  overflow: hidden;
  color: var(--ink-3);
  white-space: pre;
  mask: linear-gradient(90deg, transparent, #000 40px);
}

.kwic-key {
  padding-inline: 5px;
  white-space: pre;
}

.kwic-right {
  overflow: hidden;
  color: var(--ink-3);
  white-space: pre;
  mask: linear-gradient(270deg, transparent, #000 40px);
}

.kwic-source {
  overflow: hidden;
  padding-left: 16px;
  color: var(--ink-3);
  font: 400 14px/26px var(--font);
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 1000px) {
  .report-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .report-cards > .is-wide:not(.is-plain) {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }

  .proof-line {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 640px) {
  .report,
  .report-body,
  .chapter-body,
  .report-cards {
    gap: 12px;
  }

  .report-section {
    gap: 18px;
    padding: 22px 16px;
  }

  .report > .ledger,
  .report-body > .ledger,
  .chapter-body > .ledger,
  .report > .table-block,
  .report-body > .table-block,
  .chapter-body > .table-block {
    padding: 14px 16px;
  }

  .word-line {
    gap: 20px;
    padding: 24px 18px 0;
  }

  .word-line-words {
    gap: 8px 16px;
    font-size: 27px;
    line-height: 34px;
  }

  .word-line-words li > span {
    line-height: 32px;
  }

  .word-line-read {
    margin-inline: -18px;
    padding: 14px 18px 16px;
  }

  .kwic {
    font-size: 15px;
    line-height: 23px;
  }

  .report > .chapter:not(:first-child) {
    margin-top: 48px;
  }
}

@media print {
  .report-section,
  .report > .ledger,
  .report-body > .ledger,
  .report > .table-block,
  .report-body > .table-block {
    border: 1px solid var(--line-2);
    box-shadow: none;
  }
}

/* what a report gives a paper (js/pro/measure/paper.js, js/cite.js) */
.pro-card > .stack:has(> .report-section) {
  gap: 44px;
}

.paper-tables {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.paper-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  margin: 0;
}

.paper-table figcaption {
  font-size: 15px;
  line-height: 22px;
}

.paper-table .three-lines {
  font-size: 14px;
  line-height: 20px;
}

.paper-table .three-lines td:first-child {
  font: inherit;
}

.paper-table .three-lines .is-head td {
  padding-top: 12px;
  font-weight: 600;
}

.paper-table .three-lines .is-in td:first-child {
  padding-left: 18px;
}

.paper-table .three-lines td {
  padding-block: 5px;
}

.paper-note {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 20px;
}

.paper-part {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paper-head,
.cite-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.paper-head {
  align-items: center;
}

.paper-text,
.cite-text {
  max-width: 76ch;
  font: 400 17px/28px var(--serif);
}

.paper-text.is-cut {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  line-height: 24px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
}

.paper-refs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 22px;
}

.paper-refs li {
  padding-left: 24px;
  text-indent: -24px;
  overflow-wrap: anywhere;
}

.cite-row {
  padding-block: 4px;
}

.cite-code {
  color: var(--ink-2);
  font: 400 13px/20px var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* the codes checked by hand: the picture of a unit beside the questions about it */
.check-stage {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

.check-picture img {
  max-width: 100%;
  border-radius: var(--radius);
}

.check-point {
  position: relative;
}

.check-point img {
  display: block;
  width: 100%;
}

.check-point span {
  position: absolute;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  border: 3px solid var(--lime);
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--ink);
}

@media (max-width: 760px) {
  .check-stage {
    grid-template-columns: minmax(0, 1fr);
  }
}
