/* THE READ-ALONG (transcript.js): the lecture's words set as the text of the edition.
   A mono time stands in the gutter like a line number, the paragraph reads in Fraunces at a book's measure, the one
   being spoken is washed and ruled in red, and each section's title rides the top of the column as a running head.
   Search marks are a wash, never a highlighter. */

.tx { --tx-gut: 64px; position: relative; }

/* the find row opens the section on an ink rule */
/* the glass hangs in the gutter with the times, so what you type starts on the text's edge */
.tx-find { display: grid; grid-template-columns: var(--tx-gut) minmax(0, 1fr) auto auto auto; align-items: center; column-gap: 8px; height: 48px; padding-right: 2px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--rule-2); transition: box-shadow var(--dur-micro) var(--ease-out); }
.tx-find:focus-within { box-shadow: inset 0 -1.5px 0 var(--ink); }
.tx-find > svg { justify-self: end; width: 15px; height: 15px; fill: none; stroke: var(--ink-4); stroke-width: 1.8; transition: stroke var(--dur-micro); }
.tx-find:focus-within > svg { stroke: var(--ink); }
.tx-q { min-width: 0; height: 100%; margin-left: 8px; padding: 0; border: 0; background: transparent; outline: none; font: 400 1rem/1 var(--font-serif); color: var(--ink); }
.tx-q::placeholder { color: var(--ink-3); font-style: italic; }
.tx-n { font: 500 0.75rem/1 var(--font-data); font-variant-numeric: tabular-nums; color: var(--ink-3); white-space: nowrap; }
.tx-n:empty { visibility: hidden; }
.tx-step { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--rule); border-radius: 3px; color: var(--ink-2); transition: border-color var(--dur-micro), color var(--dur-micro), transform var(--dur-micro) var(--ease-out); }
.tx-step svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; transition: transform var(--dur-micro) var(--ease-out); }
.tx-step:hover:not(:disabled) { border-color: var(--ink); color: var(--ink); }
.tx-step[data-d="-1"]:hover:not(:disabled) svg { transform: translateY(-1.5px); }
.tx-step[data-d="1"]:hover:not(:disabled) svg { transform: translateY(1.5px); }
.tx-step:active:not(:disabled) { transform: scale(0.94); }
.tx-step:disabled { opacity: 0.35; cursor: default; }

/* the column */
.tx-frame { position: relative; }
.tx-body { position: relative; max-height: 60vh; overflow-y: auto; padding-bottom: 18px; border-bottom: 1px solid var(--rule); outline: none; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; animation: tx-in var(--dur-state) var(--ease-out); }
.tx-body:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }
.tx-ch + .tx-ch { margin-top: 6px; }

/* the running head: the section number hangs in the gutter, the title sits on the text's edge */
.tx-sec { position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: var(--tx-gut) minmax(0, 1fr); gap: 0 16px; align-items: baseline; margin: 0; padding: 16px 16px 8px 0; background: var(--paper); border-bottom: 1px solid var(--rule-2); font: italic 400 0.9375rem/1.35 var(--font-serif); color: var(--ink-2); user-select: none; -webkit-user-select: none; }
.tx-sec b { justify-self: end; font: normal 600 0.78125rem/1 var(--font-serif); color: var(--rubric); font-variant-numeric: lining-nums; }
.tx-sec span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* a paragraph */
.tx-p { display: grid; grid-template-columns: var(--tx-gut) minmax(0, 40em); gap: 0 16px; align-items: baseline; margin: 0; padding: 11px 16px 11px 0; transition: background var(--dur-state) var(--ease-out), box-shadow var(--dur-state) var(--ease-out); }
.tx-ch > .tx-p:first-child { padding-top: 16px; }
.tx-p[data-now] { background: var(--wash); box-shadow: inset 2px 0 0 var(--rubric); }
.tx-t { justify-self: end; padding: 2px 0; font: 500 0.71875rem/1.2 var(--font-data); font-variant-numeric: tabular-nums; color: var(--ink-3); white-space: nowrap; user-select: none; -webkit-user-select: none; transition: color var(--dur-micro); }
.tx-t::before { content: "▸"; display: inline-block; margin-right: 5px; font-size: 0.5625rem; opacity: 0; transform: translateX(-4px); transition: opacity var(--dur-micro), transform var(--dur-micro) var(--ease-out); }
.tx-t:hover, .tx-p[data-now] .tx-t { color: var(--rubric); }
.tx-t:hover::before, .tx-t:focus-visible::before { opacity: 1; transform: none; }
.tx-x { min-width: 0; font: 400 1.03125rem/1.6 var(--font-serif); color: var(--ink-2); text-wrap: pretty; overflow-wrap: anywhere; transition: color var(--dur-state); }
.tx-p[data-now] .tx-x { color: var(--ink); }

/* search marks, here and in cross-lecture snippets (.tx-snip on the container) */
.tx mark, .tx-snip mark { padding: 0 1px; margin: 0 -1px; border-radius: 2px; background: var(--wash); color: var(--ink); box-shadow: inset 0 -1.5px 0 var(--accent-5); }
.tx mark[data-on] { background: var(--ink); color: var(--leaf); box-shadow: none; }   /* the one you are on, set in reverse */

/* floating controls: follow the lecture again, and note a selection */
.tx-follow, .tx-note { position: absolute; z-index: 3; display: inline-flex; align-items: center; border-radius: 3px; background: var(--ink); color: var(--leaf); white-space: nowrap; box-shadow: 0 14px 28px -14px rgba(27, 25, 22, 0.75); animation: tx-rise var(--dur-state) var(--ease-out); }
.tx-follow[hidden], .tx-note[hidden] { display: none; }
.tx-follow { left: 50%; bottom: 16px; gap: 8px; height: 34px; padding: 0 14px 0 11px; font: 500 0.8125rem/1 var(--font-ui); transform: translateX(-50%); transition: transform var(--dur-micro) var(--ease-out); }
.tx-follow svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; transition: transform var(--dur-micro) var(--ease-out); }
.tx-follow[data-dir="up"] svg { transform: rotate(180deg); }
.tx-follow:hover svg { transform: translateY(2px); }
.tx-follow[data-dir="up"]:hover svg { transform: rotate(180deg) translateY(2px); }
.tx-follow:active { transform: translateX(-50%) scale(0.97); }
.tx-note { height: 30px; padding: 0 12px; font: 500 0.78125rem/1 var(--font-ui); animation-duration: var(--dur-micro); transition: transform var(--dur-micro) var(--ease-out); }
.tx-note:active { transform: scale(0.96); }
.tx-note::after { content: ""; position: absolute; left: 50%; top: 100%; margin-left: -5px; border: 5px solid transparent; border-top-color: var(--ink); }
.tx-note[data-below]::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: var(--ink); }

/* notes under the column, and the empty state */
.tx-foot { margin: 10px 0 0; padding-left: calc(var(--tx-gut) + 16px); font: italic 0.84375rem/1.45 var(--font-serif); color: var(--ink-3); }
.tx-empty { margin: 0; padding: 14px 0 0; border-top: 1px solid var(--ink); font: italic 1rem/1.5 var(--font-serif); color: var(--ink-3); }
.tx-wait { color: var(--ink-3); }

@keyframes tx-in { from { opacity: 0; } }
@keyframes tx-rise { from { opacity: 0; translate: 0 6px; } }

@media (hover: none) { .tx-t::before { display: none; } }
@media (max-width: 760px) {
  .tx { --tx-gut: 44px; }
  .tx-p, .tx-sec { gap: 0 12px; padding-right: 6px; }
  .tx-q { margin-left: 4px; }
  .tx-x { font-size: 1rem; }
  .tx-t { font-size: 0.65625rem; }
  .tx-foot { padding-left: 0; }
}
/* fingers need 44px: the steps and floating buttons grow, a time keeps its size and widens its hit area instead */
@media (pointer: coarse) {
  .tx-step { width: 44px; height: 44px; }
  .tx-follow, .tx-note { height: 44px; }
  .tx-t { position: relative; }
  .tx-t::after { content: ""; position: absolute; inset: -14px -10px; }
}
@media (prefers-reduced-motion: reduce) {
  .tx-follow, .tx-note { animation-name: tx-in; }
  .tx-t::before, .tx-step svg, .tx-follow svg { transition: none; }
}
