/* Intake on the left, live scope document on the right. */

.tool-grid--doc {
  @media (min-width: 68em) {
    grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
  }
}

.hint-top {
  margin-top: -0.5rem;
  margin-bottom: 1.25rem;
}

/* ---------- repeatable rows ---------- */

.row-card {
  padding: 1rem;
  border: 1px solid var(--rule);
  border-radius: 0.625rem;
}

.row-card + .row-card {
  margin-top: 0.875rem;
}

.row-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.875rem;
}

.row-index {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.row-remove {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 0.75rem;
  color: var(--ink-muted);
  text-decoration: underline;
  cursor: pointer;
}

.row-remove:hover {
  color: var(--ink);
}

.row-fields {
  display: grid;
  gap: 0.875rem;

  @media (min-width: 30em) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.row-fields > .field {
  margin-top: 0;
  grid-column: 1 / -1;
}

.row-fields > .field-half {
  @media (min-width: 30em) {
    grid-column: auto;
  }
}

/* ---------- dictation ---------- */

.with-mic {
  position: relative;
}

.mic {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  width: 1.875rem;
  height: 1.875rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background-color: var(--card);
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
}

.mic:hover {
  border-color: var(--ink-muted);
}

.mic.is-live {
  border-color: transparent;
  background-color: var(--accent);
  animation: mic-pulse 1.2s ease-in-out infinite;
}

@keyframes mic-pulse {
  50% {
    opacity: 0.55;
  }
}

/* ---------- the document ---------- */

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.doc {
  padding: clamp(1.75rem, 4vw, 3.5rem);
  border-radius: 0.75rem;
  background-color: var(--card);
  box-shadow: 0 1px 2px hsl(0 0% 0% / 0.06), 0 10px 24px hsl(0 0% 0% / 0.06);
  font-size: 0.9375rem;
  line-height: 1.65;
}

.doc-title {
  font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.doc-sub {
  margin-top: 0.25rem;
  color: var(--ink-muted);
}

.doc-meta {
  display: grid;
  gap: 0.5rem 2rem;
  margin: 1.75rem 0 0;
  padding-block: 1.25rem;
  border-block: 1px solid var(--rule);

  @media (min-width: 34em) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.doc-meta > div {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  font-size: 0.875rem;
}

.doc-meta dt {
  color: var(--ink-muted);
}

.doc-meta dd {
  margin: 0;
  font-weight: 500;
  text-align: right;
}

.doc-h1 {
  margin-top: 2.75rem;
  padding-top: 1.25rem;
  border-top: 2px solid var(--ink);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.doc-h2 {
  margin-top: 1.75rem;
  font-size: 1rem;
  font-weight: 700;
}

.doc-h3 {
  margin-top: 1.5rem;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--accent-deep);
}

.doc-p {
  margin-top: 0.75rem;
}

.doc-p.is-muted {
  color: var(--ink-muted);
  font-style: italic;
}

.doc-ul {
  margin-top: 0.75rem;
  padding-left: 1.125rem;
  list-style: disc;
}

.doc-ul li {
  list-style: inherit;
}

.doc-ul li + li {
  margin-top: 0.375rem;
}

.doc-table-wrap {
  margin-top: 1rem;
  overflow-x: auto;
}

.doc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.doc-table th,
.doc-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  vertical-align: top;
}

.doc-table th {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom-color: var(--ink);
}

.doc-table td:last-child {
  color: var(--ink-muted);
}

.doc-table td:first-child {
  font-weight: 500;
  color: var(--ink);
  white-space: nowrap;
}

@media (max-width: 34em) {
  .doc-table td:first-child {
    white-space: normal;
  }
}

/* ---------- print ---------- */

@media print {
  .no-print,
  .intake {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .tool {
    width: 100%;
    padding: 0;
  }

  .tool-grid--doc {
    display: block;
  }

  .doc {
    padding: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .doc-h1 {
    break-before: page;
    break-after: avoid;
  }

  .doc-title,
  .doc-meta + .doc-h1 {
    break-before: auto;
  }

  .doc-h2,
  .doc-h3 {
    break-after: avoid;
  }

  .doc-table,
  .doc-ul {
    break-inside: avoid;
  }
}
