/* =========================================================================
/* =========================================================================
   AUDIT REPORT — one continuous column.
   Every chapter and every section opens the same way: number, title, score.
   The section's results follow straight after, in a single card.
   ========================================================================= */

.audit-book-modal {
  width: min(860px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 40px);
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
}

.audit-book-modal::backdrop {
  background: rgba(6, 10, 18, 0.72);
  backdrop-filter: blur(5px);
}

.book {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 40px);
  border-radius: 6px;
  background: var(--paper);
  box-shadow:
    0 0 0 1px var(--line),
    0 30px 70px -30px rgba(0, 0, 0, 0.7);
  font-family: Georgia, "Iowan Old Style", "Times New Roman", serif;
  overflow: hidden;
}

/* --- Toolbar ------------------------------------------------------------- */

.book-toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px 0;
}

.book-tool {
  padding: 6px 12px;
  border: none;
  border-radius: 3px;
  background: transparent;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}

.book-tool:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* --- The single scrolling column ---------------------------------------- */

.book-leaf {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 0 64px;
  scrollbar-width: thin;
}

.book-opening,
.book-flow {
  width: min(66ch, calc(100% - 88px));
  margin-inline: auto;
}

/* --- Opening block ------------------------------------------------------- */

.book-opening {
  padding: 46px 0 40px;
  text-align: center;
  border-bottom: 1px solid var(--line);
}

.book-kicker {
  margin: 0 0 16px;
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--muted);
}

.book-opening h2 {
  margin: 0;
  font-size: clamp(30px, 4.6vw, 42px);
  font-weight: 400;
  font-style: italic;
  line-height: 1.1;
}

.book-site {
  margin: 12px 0 0;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  color: var(--muted);
  word-break: break-all;
}

.book-score {
  margin: 28px 0 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  font-size: 50px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.book-score-unit {
  font-size: 15px;
  color: var(--muted);
}

.book-score .dot {
  align-self: center;
}

.book-headline {
  margin: 16px 0 0;
  font-size: 17px;
  font-style: italic;
}

.book-meta {
  margin: 12px 0 0;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

/* --- Chapter and section openings: number, title, score ----------------- */

.opening-number {
  margin: 0 0 2px;
  font-family: "DM Sans", sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* Title on the left, score on the right, a leader between the two. */
.opening-line {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 0;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.opening-title {
  flex: 0 1 auto;
}

.opening-leader {
  flex: 1 1 auto;
  min-width: 1.5em;
  align-self: flex-end;
  height: 1em;
  border-bottom: 1px dotted rgba(157, 179, 216, 0.3);
  transform: translateY(-0.3em);
}

.opening-score {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.opening-score small {
  font-size: 0.5em;
  color: var(--muted);
}

.opening-score .dot {
  align-self: center;
}

/* A chapter: the larger of the two, with a rule under it. */
.opening-chapter {
  margin-top: 56px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink);
}

.opening-chapter .opening-number {
  font-size: 12px;
}

.opening-chapter .opening-line {
  font-size: clamp(24px, 3.2vw, 32px);
  font-style: italic;
}

.opening-chapter .opening-score {
  font-size: 0.82em;
  font-style: normal;
}

/* A section: same shape, one step down, sitting above its card. */
.opening-section {
  margin-top: 40px;
}

.opening-section .opening-number {
  font-size: 11.5px;
}

.opening-section .opening-line {
  font-size: 20px;
}

.opening-section .opening-score {
  font-size: 0.95em;
}

.opening-score[data-tone="green"] { color: #4cba8d; }
.opening-score[data-tone="orange"] { color: #e5a44e; }
.opening-score[data-tone="red"] { color: #ea7a72; }
.opening-score[data-tone="neutral"] { color: var(--muted); }

/* --- The dot ------------------------------------------------------------- */

.dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  display: inline-block;
  background: #5d6a81;
}

.dot[data-tone="green"] { background: #2fae7c; }
.dot[data-tone="orange"] { background: #e5960f; }
.dot[data-tone="red"] { background: #e05249; }
.dot[data-tone="neutral"] { background: #5d6a81; }

/* --- The results card ---------------------------------------------------- */

.ar-result-card {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.022);
  overflow: hidden;
}

.ar-result-card-summary {
  margin: 0;
  padding: 15px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 14.5px;
  font-style: italic;
  line-height: 1.6;
  color: #b4c0d6;
}

.ar-result-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ar-result {
  padding: 15px 20px;
}

.ar-result + .ar-result {
  border-top: 1px solid rgba(157, 179, 216, 0.09);
}

.ar-result-fail { background: rgba(224, 82, 73, 0.05); }
.ar-result-warn { background: rgba(229, 150, 15, 0.05); }

.ar-result-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 9px;
}

.ar-result-head .dot {
  align-self: center;
}

.ar-result-label {
  flex: 1 1 auto;
  font-size: 16px;
}

/* The value and the verdict travel together, so they never split across
   two lines when the label is long. */
.ar-result-margin {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 9px;
  white-space: nowrap;
}

.ar-result-value {
  flex: 0 0 auto;
  font-family: "DM Sans", sans-serif;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.ar-result-verdict {
  flex: 0 0 auto;
  font-family: "DM Sans", sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ar-result-verdict[data-tone="green"] { color: #4cba8d; }
.ar-result-verdict[data-tone="orange"] { color: #e5a44e; }
.ar-result-verdict[data-tone="red"] { color: #ea7a72; }
.ar-result-verdict[data-tone="neutral"] { color: var(--muted); }

.ar-result-detail {
  margin: 8px 0 0 18px;
  font-size: 15px;
  line-height: 1.7;
  color: #b9c4d8;
}

.ar-result-fix {
  margin: 9px 0 0 18px;
  padding-left: 14px;
  border-left: 2px solid rgba(141, 182, 245, 0.3);
  font-size: 14.5px;
  line-height: 1.65;
  color: #9fb0ca;
}

.ar-result-fix span {
  font-family: "DM Sans", sans-serif;
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--green);
}

.ar-result-fix span::after {
  content: " — ";
  letter-spacing: 0;
}

.ar-result-skip .ar-result-label,
.ar-result-skip .ar-result-detail {
  color: var(--muted);
}

/* --- Closing list -------------------------------------------------------- */

.ar-priority-list {
  counter-reset: ar-priority;
}

.ar-priority {
  counter-increment: ar-priority;
}

.ar-priority .ar-result-label::before {
  content: counter(ar-priority) ". ";
  color: var(--muted);
}

/* --- Narrow screens ------------------------------------------------------ */

@media (max-width: 720px) {
  .audit-book-modal {
    width: 100vw;
    max-height: 100vh;
    border-radius: 0;
  }

  .book {
    max-height: 100vh;
    border-radius: 0;
  }

  .book-opening,
  .book-flow {
    width: calc(100% - 36px);
  }

  .book-opening {
    padding: 28px 0 26px;
  }

  .opening-chapter {
    margin-top: 40px;
  }

  .opening-section {
    margin-top: 30px;
  }

  .opening-line {
    flex-wrap: wrap;
    gap: 6px 10px;
  }

  .opening-leader {
    display: none;
  }

  .opening-score {
    margin-left: auto;
  }

  .ar-result {
    padding: 14px 15px;
  }

  .ar-result-card-summary {
    padding: 13px 15px;
  }

  /* A flex line wraps before it shrinks, so the label is given a small basis:
     it then stays beside the dot and grows, instead of dropping to its own row. */
  .ar-result-label {
    flex: 1 1 60%;
    min-width: 0;
  }

  .ar-result-margin {
    margin-left: 18px;
  }
}

