/* works.css: the works records and their index (guides/works.py), the same for every guide that has them.
   Uses the guide's own palette (guide.css); the builder copies this file into the site. */

/* the Guide / Works pair, at the right of the family bar */
.masthead .tabs { margin-left: auto; display: flex; gap: .25rem; align-self: center; }
.masthead .tabs a {
  color: #c9d2f0; text-decoration: none; font: 600 .85rem/1 var(--sans); letter-spacing: .02em;
  padding: .35rem .75rem; border-radius: 4px;
}
.masthead .tabs a:hover { color: #fff; background: rgba(255, 255, 255, .08); text-decoration: none; }
.masthead .tabs a.here { color: #fff; background: rgba(255, 255, 255, .12); box-shadow: inset 0 -2px 0 var(--gold); }

/* a record's heading and infobox */
.work-reading { font: 1.02rem/1.4 var(--sans); color: var(--muted); margin: -.2rem 0 1rem; }
.work-reading i { color: var(--ink); }
aside.work-card {
  max-width: 48rem; margin: 0 0 1.8rem; padding: 1rem 1.2rem;
  background: var(--panel); border: 1px solid var(--rule); border-top: 4px solid var(--gold); border-radius: 6px;
}
aside.work-card.has-pic { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1.4rem; align-items: start; }
aside.work-card figure.shot { margin: 0; }
aside.work-card figure.shot img { width: 256px; }
.work-summary { margin: 0 0 .6rem; font: .95rem/1.5 var(--sans); color: var(--lead, var(--ink)); }
aside.work-card dl { margin: 0; font: .88rem/1.45 var(--sans); }
aside.work-card dl > div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: .6rem; padding: .22rem 0;
  border-top: 1px solid var(--rule); }
aside.work-card dt { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
  font-weight: 600; padding-top: .14rem; }
aside.work-card dd { margin: 0; }
@media (max-width: 760px) {
  aside.work-card.has-pic { display: block; }
  aside.work-card figure.shot { margin-bottom: .8rem; }
  aside.work-card figure.shot img { width: 100%; max-width: 384px; }
}

/* the state, as a small label */
.state {
  display: inline-block; font: 600 .72rem/1.5 var(--sans); letter-spacing: .04em; text-transform: uppercase;
  padding: 0 .45rem; border-radius: 3px; border: 1px solid var(--rule); color: var(--muted); white-space: nowrap;
}
.state.complete { color: var(--heading); border-color: var(--heading); }
.state.unfinished { color: var(--tip-title, var(--gold)); border-color: var(--gold); }
.state.damaged { color: var(--accent); border-color: var(--accent); }
.state.lost { border-style: dashed; }
.state.unexamined { border-style: dotted; }
/* a mended copy (repair:), beside its state: repaired in the accent with a plain border, reconstructed dashed */
.state.repaired { color: var(--accent); }
.state.reconstructed { color: var(--accent); border-color: var(--accent); border-style: dashed; }

/* the index */
.work-filters { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; align-items: center; margin: 1.2rem 0 .4rem;
  font: .85rem var(--sans); }
.work-filters .find input { font: .9rem var(--sans); padding: .3rem .5rem; width: 17rem; max-width: 70vw; margin-left: .3rem;
  border: 1px solid var(--rule); border-radius: 4px; background: var(--paper); color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; }
.chips button {
  font: 600 .8rem var(--sans); padding: .25rem .6rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--paper); color: var(--ink);
}
.chips button span { color: var(--muted); font-weight: 400; }
.chips button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chips button[aria-pressed="true"] span { color: #c9d2f0; }
.work-filters .shown { margin: 0; color: var(--muted); }
table.works td { vertical-align: middle; }
table.works td.pic, table.works th.pic { width: 1%; padding-right: .2rem; }
table.works td.pic img { display: block; width: 128px; height: auto; image-rendering: pixelated;
  border: 1px solid var(--frame); border-radius: 2px; background: #000; }
table.works td.what { min-width: 13rem; }
/* the kind, and its group under it, each on one line: the column takes the width of the longest group */
table.works td.kind { white-space: nowrap; }
@media (max-width: 1200px) { table.works td.pic img { width: 96px; } }
@media (max-width: 760px) {      /* a phone: no thumbnails, and the kind may wrap so the state stays in view */
  table.works td.pic, table.works th.pic { display: none; }
  table.works td.kind { white-space: normal; }
}
table.works td code { white-space: nowrap; }
main > .works-wrap, main > .work-filters { max-width: 52rem; }
table.works td.what a { font-weight: 600; text-decoration: none; }
table.works td.what a:hover { text-decoration: underline; }
table.works .reading { color: var(--muted); }
table.works .sum { display: block; color: var(--muted); font-size: .84rem; margin-top: .15rem; }
table.works th[data-sort] { cursor: pointer; user-select: none; }
table.works th[data-sort]::after { content: " ↕"; opacity: .45; font-weight: 400; }
table.works th[aria-sort="ascending"]::after { content: " ↑"; opacity: 1; }
table.works th[aria-sort="descending"]::after { content: " ↓"; opacity: 1; }
table.works tr[hidden] { display: none; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

nav.side ol.works-list a { font-size: .84rem; padding-top: .1rem; padding-bottom: .1rem; }
/* on a phone the sidebar comes before the page: a record keeps its contents and All works, not the whole list */
@media (max-width: 900px) { body.page-work nav.side .works-groups { display: none; } }

@media print {
  .masthead .tabs, .work-filters { display: none; }
}

/* the works sidebar's sections: a kind, and a group within it, each folding (<details>) */
nav.side details.works-kind { margin: 0 0 .9rem; }
nav.side details > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: .35rem;
  border-radius: 4px; }
nav.side details > summary::-webkit-details-marker { display: none; }
nav.side details > summary::before { content: "▸"; font-size: .7rem; color: var(--muted); width: .7rem; flex: none;
  transition: transform .12s; }
nav.side details[open] > summary::before { transform: rotate(90deg); }
nav.side details > summary:hover { background: var(--note-soft); }
nav.side details > summary .n { color: var(--muted); font-weight: 400; letter-spacing: 0; }
nav.side details.works-kind > summary { margin: 0 0 .3rem; padding: .1rem .2rem; }
nav.side details.works-kind > ol.works-list { margin: 0 0 .4rem; }
nav.side details.works-sub { margin: 0 0 .3rem .7rem; }
nav.side details.works-sub > summary { font-size: .84rem; color: var(--ink); padding: .1rem .2rem; }
nav.side details.works-sub > ol.works-list { margin: .15rem 0 .5rem .9rem; }
@media print { nav.side details:not([open]) { display: none; } }

/* a record's sources: where the copies studied came from (name, link, file, hash, where in it) */
ul.sources { list-style: none; margin: 0; padding: 0; }
ul.sources li { margin: 0 0 .35rem; }
ul.sources li:last-child { margin-bottom: 0; }
ul.sources li > span + span::before { content: " · "; color: var(--muted); }
ul.sources .src-file code, ul.sources .src-hash code { font-size: .8em; overflow-wrap: anywhere; }
ul.sources .src-hash, ul.sources .src-note { color: var(--muted); }
ul.sources ul.src-files { list-style: none; margin: .2rem 0 0; padding: 0 0 0 1rem; border-left: 2px solid var(--rule); }
ul.sources ul.src-files li { margin: 0 0 .15rem; }
