/* Transcrib Si — the transcription cost calculator.
 *
 * Everything is scoped under .tcc, so the page keeps the design of the site
 * and this file only adds what the tool needs. No build step, no import of
 * anything, no CDN.
 */

/* ------------------------------------------------------------------ tool */

/* The tool stands on the first screen of the page: the block of text above
 * it keeps its air, but not more than the tool needs. */
.tcc-head {
  margin-bottom: var(--space-5);
}

.tcc-head .doc__meta {
  margin-bottom: 0;
}

.tcc {
  display: grid;
  gap: var(--space-5);
}

.tcc__form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: var(--space-4);
  align-items: end;
  background: var(--bg-raised);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-l);
  padding: var(--space-5);
  box-shadow: var(--shadow-s);
}

.tcc__form .field {
  margin-bottom: 0;
}

.tcc__presets {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.tcc__presets-label {
  font-size: var(--fs-300);
  color: var(--text-muted);
  margin-right: var(--space-1);
}

.tcc__preset {
  font: inherit;
  font-size: var(--fs-300);
  cursor: pointer;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: var(--border-w) solid var(--line-strong);
  background: var(--bg);
  color: var(--text-muted);
  transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.tcc__preset:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.tcc__preset[aria-pressed="true"] {
  background: var(--brand-soft);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}

.tcc__preset:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.tcc__summary {
  font-size: var(--fs-500);
  margin: 0;
  color: var(--text);
}

/* ----------------------------------------------------------------- chart */

.tcc__chart-block {
  background: var(--bg-raised);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-l);
  padding: var(--space-5);
  box-shadow: var(--shadow-s);
}

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

.tcc__chart {
  display: block;
  min-width: 34rem;
  width: 100%;
  height: auto;
}

.tcc__track {
  fill: var(--bg-sunken);
}

.tcc__bar {
  transition: width 0.35s ease;
}

.tcc__bar--ai {
  fill: var(--brand);
}

.tcc__bar--human {
  fill: var(--warn);
}

.tcc__bar--unstated {
  fill: var(--line-strong);
}

.tcc__label {
  fill: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.tcc__sublabel {
  fill: var(--text-faint);
  font-size: 11px;
}

.tcc__value {
  fill: var(--text-muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.tcc__legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  margin: var(--space-4) 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--fs-300);
  color: var(--text-muted);
}

.tcc__legend li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tcc__legend span {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 3px;
  display: inline-block;
}

.tcc__legend .tcc__swatch--ai {
  background: var(--brand);
}

.tcc__legend .tcc__swatch--human {
  background: var(--warn);
}

.tcc__legend .tcc__swatch--unstated {
  background: var(--line-strong);
}

/* ----------------------------------------------------------------- table */

.tcc__table {
  background: var(--bg-raised);
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
  box-shadow: var(--shadow-s);
}

.tcc__table table {
  width: 100%;
  border-collapse: collapse;
}

.tcc__table caption {
  text-align: left;
  padding: var(--space-4) var(--space-5) 0;
  color: var(--text-muted);
  font-size: var(--fs-300);
}

.tcc__table th,
.tcc__table td {
  text-align: left;
  padding: var(--space-3) var(--space-5);
  border-top: var(--border-w) solid var(--line);
  vertical-align: top;
  font-size: var(--fs-300);
}

.tcc__table thead th {
  border-top: 0;
  color: var(--text-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: var(--fs-200);
  background: var(--bg-sunken);
}

.tcc__table tbody th {
  font-weight: 600;
  color: var(--text);
}

.tcc__table td a {
  color: var(--brand);
  overflow-wrap: break-word;
}

/* The column with the source of a price needs room for the address of the
 * page and for the date it was checked. */
.tcc__table .ts-table__table th:last-child,
.tcc__table .ts-table__table td:last-child {
  width: 14rem;
  min-width: 12rem;
}

.tcc__checked {
  color: var(--text-faint);
  white-space: nowrap;
}

.tcc__cost {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

/* The shared table widget (assets/table-widget.js) draws the tables of the
 * tool. It brings its own controls and its own source line; here it only
 * needs the padding of the card it sits in. */
.tcc__table .ts-table {
  padding: var(--space-5);
  margin-bottom: 0;
}

.tcc__table .ts-table__table caption.ts-table__caption {
  padding-top: 0;
}

.tcc__table .ts-table__scroll {
  border-radius: var(--radius-m);
}

.tcc__source {
  font-size: var(--fs-300);
  color: var(--text-faint);
  margin: var(--space-3) 0 0;
}

/* ----------------------------------------------------------------- notes */

.tcc__note {
  background: var(--bg-sunken);
  border-radius: var(--radius-m);
  padding: var(--space-4) var(--space-5);
  font-size: var(--fs-300);
  color: var(--text-muted);
}

.tcc__note p {
  margin: 0;
}

.tcc__note p + p {
  margin-top: var(--space-2);
}

.tcc__noscript {
  margin: 0;
}

/* -------------------------------------------------------------- motion */

/* The only movement on the page: the blocks fade in once, when they come
 * into view. With prefers-reduced-motion the classes are applied without
 * any movement at all. */
.tcc__reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.tcc__reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .tcc__reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .tcc__bar {
    transition: none;
  }

  .tcc__preset {
    transition: none;
  }
}

/* -------------------------------------------------------------- narrow */

@media (max-width: 40rem) {
  .tcc__form {
    grid-template-columns: 1fr;
    padding: var(--space-4);
  }

  .tcc__chart-block {
    padding: var(--space-4);
  }

  .tcc__table th,
  .tcc__table td {
    padding: var(--space-3) var(--space-4);
  }

  .tcc__table .ts-table {
    padding: var(--space-4);
  }
}
