/* names-ledger.css: the Book of Names as a ledger (js/names-ledger.js).
 * Built on character-sheet.css: the control band, the parchment sheet, the
 * banded table and the dish-line note are the sheets' own. */

.names-band { margin-bottom: 0; }
.names-sheet h1 { margin-bottom: .1rem; }

.names-ledger { margin-top: .2rem; }
.names-ledger thead th:last-child { text-align: right; }
.names-ledger td { vertical-align: middle; }
.names-ledger td.nm { padding-top: .38rem; padding-bottom: .38rem; }
.names-ledger tr.is-pinned-row td { background-color: rgba(88, 24, 13, .07); }

/* the name is a button: a click copies it */
.ledger-name {
  font-family: BookSanity, "Bookinsanity", Georgia, serif; font-size: 1.02rem; color: #1f1508;
  background: none; border: 0; padding: 0; margin: 0; text-align: left; cursor: copy;
  position: relative;
}
.ledger-name:hover { text-decoration: underline dotted #b89a5a; text-underline-offset: .18em; }
.ledger-name.is-copied::after {
  content: "Copied"; position: absolute; left: calc(100% + .5rem); top: .1rem; white-space: nowrap;
  font-family: ScalySansSmallCaps, ScalySans, sans-serif; font-size: .72rem; letter-spacing: .03em;
  color: #FDF8EB; background: #58180D; border-radius: .2rem; padding: .02rem .4rem;
}
.ledger-style { display: block; font-family: ScalySansSmallCaps, ScalySans, sans-serif; color: #58180D; letter-spacing: .02em; }
.ledger-acts { text-align: right; white-space: nowrap; width: 1%; }
.ledger-acts > * + * { margin-left: .35rem; }
/* the pinned list: the unpin in one column, the door right-aligned in the next */
.names-pinned td.ledger-x { padding-right: .2rem; }
.names-pinned td.ledger-go { padding-left: .2rem; }

/* Pin: idle is a tilted brown pin (better than 3:1 on the parchment);
   pinned stands upright in the sheet's red and tints its row. */
.ledger-pin {
  background: none; border: none; cursor: pointer; color: #7d6235;
  font-size: .9rem; min-width: 1.9rem; min-height: 1.9rem; padding: .2rem .35rem;
  vertical-align: middle; border-radius: .2rem;
}
.ledger-pin i { transform: rotate(40deg); transition: transform .12s; }
.ledger-pin:hover { color: #58180D; background: rgba(88, 24, 13, .06); }
.ledger-pin.is-pinned { color: #58180D; }
.ledger-pin.is-pinned i { transform: none; }
.ledger-door {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 1.9rem; box-sizing: border-box;
  font-family: ScalySansSmallCaps, ScalySans, sans-serif; font-size: .78rem; letter-spacing: .02em;
  color: #58180D; background: #EEE5CE; border: 1px solid #b89a5a; border-radius: .2rem;
  padding: .12rem .55rem; text-decoration: none; vertical-align: middle;
}
.ledger-door:hover { background: #faf7ea; }
.ledger-door i { font-size: .72em; }
.ledger-pin:focus-visible, .ledger-door:focus-visible, .ledger-name:focus-visible, .ledger-retry:focus-visible {
  outline: 2px solid #58180D; outline-offset: 2px;
}
.ledger-empty { font-style: italic; color: #6b5836; }
.ledger-retry {
  font: inherit; font-style: normal; color: #58180D; background: #EEE5CE;
  border: 1px solid #b89a5a; border-radius: .2rem; padding: .1rem .5rem; margin-left: .3rem; cursor: pointer;
}
#ledgerRows.is-rolling { opacity: .45; transition: opacity .15s; }

/* read by a screen reader, not shown */
.ledger-sr {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Pinned names: a folded panel above the list, one line until opened, and
   no taller than about four names when it is */
.char-sheet.names-pinned { padding-top: .7rem; padding-bottom: .7rem; margin-bottom: .9rem; }
.names-pinned summary {
  cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .45rem;
  font-family: MrJeeves, serif; font-size: 1.25rem; color: #58180D;
}
.names-pinned summary::-webkit-details-marker { display: none; }
.names-pinned summary::before {
  content: "\f08d"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .8rem; color: #58180D;
}
.names-pinned summary::after {
  content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: .7rem;
  color: #7d6235; margin-left: auto; transition: transform .15s;
}
.names-pinned[open] summary::after { transform: rotate(180deg); }
.names-pinned[open] summary { border-bottom: 2px solid #c9ad6a; padding-bottom: .1rem; }
.names-pinned .pin-count { font-family: ScalySansSmallCaps, ScalySans, sans-serif; font-size: .9rem; color: #6b5836; }
.names-pinned .pin-note { font-family: ScalySans, sans-serif; font-size: .8rem; color: #6b5333; margin: .35rem 0 .3rem; }
.names-pinned .pin-scroll { max-height: 13.5rem; overflow-y: auto; overscroll-behavior: contain; }
@keyframes pinFlash { from { background-color: #f0dfae; } to { background-color: transparent; } }
.names-pinned.is-new summary { animation: pinFlash 1.1s ease-out; border-radius: .2rem; }
@media (prefers-reduced-motion: reduce) {
  .names-pinned.is-new summary { animation: none; }
  .ledger-pin i { transition: none; }
}

/* below the list: where else the book goes */
.names-cross { font-family: ScalySans, sans-serif; font-size: .9rem; margin: .9rem 0 0; color: #3b2a14; }
.names-cross a { color: #58180D; }

.names-about { margin-top: 1rem; }
.names-about summary {
  cursor: pointer; font-family: MrJeeves, serif; font-size: 1.2rem; color: #58180D;
  border-bottom: 2px solid #c9ad6a;
}
.names-about p { margin-top: .6rem; }

/* The sheets stack every table into "name: role" lines on a phone; the
   ledger is already two columns, the name and its actions, so it keeps them.
   Tap targets grow to a thumb's width, and the door shows only its icon
   (its words stay for a screen reader). */
@media (max-width: 600px) {
  .char-sheet table.names-ledger thead { display: none; }
  .char-sheet table.names-ledger tr { display: table-row; padding: 0; }
  .char-sheet table.names-ledger td { display: table-cell; padding: .32rem .35rem; }
  .char-sheet table.names-ledger td:nth-child(2)::before,
  .char-sheet table.names-ledger td:nth-child(3)::before { content: none; }
  .ledger-pin { min-width: 2.5rem; min-height: 2.5rem; }
  .ledger-door { min-width: 2.5rem; min-height: 2.5rem; justify-content: center; padding: .15rem .5rem; }
  .ledger-acts > * + * { margin-left: .5rem; }
  .ledger-door .door-word {
    position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
  }
  .ledger-door i { font-size: .9em; }
  /* "First, last and town" needs the whole row */
  .sheet-controls label:has(#parts) { flex-basis: 100%; }
}
