/* Source inspection uses the same tokens in Flask and React. */
.wf-source-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wf-space-sm); margin-block: var(--wf-space-md); }
.wf-source-toolbar form { flex: 1; min-width: 240px; }
.wf-source-toolbar input[type=search] { flex: 1; min-width: 0; }
.wf-source-collection { display: grid; gap: var(--wf-space-md); list-style: none; margin-block: var(--wf-space-lg); padding: 0; }
.wf-source-collection[data-view=cards] { grid-template-columns: repeat(auto-fill,minmax(min(100%,300px),1fr)); }
.wf-source-entry { background: var(--wf-color-panel); border: 1px solid var(--wf-color-border); border-radius: var(--wf-radius-panel); padding: var(--wf-space-md); display: grid; gap: var(--wf-space-sm); }
.wf-source-entry h2 { margin: 0; font: 1.35rem/1.4 var(--wf-font-literary); }
.wf-source-entry p { margin: 0; overflow-wrap: anywhere; }
.wf-source-entry span { color: var(--wf-color-muted); font-size: .875rem; }
.wf-source-collection[data-view=list] .wf-source-entry { grid-template-columns: minmax(180px,1.5fr) minmax(120px,1fr) minmax(120px,1fr) auto; align-items: center; }
.wf-source-detail { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); gap: var(--wf-space-lg); }
.wf-source-detail > section { min-width: 0; }
.wf-source-preview { max-height: 30rem; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: var(--wf-space-md); border: 1px solid var(--wf-color-border); border-radius: var(--wf-radius-control); font: inherit; }
.wf-source-preview mark { background: var(--wf-color-selection); color: inherit; }
.wf-source-page { max-width: 100%; height: auto; display: block; border: 1px solid var(--wf-color-border); }
.wf-source-digest { display: block; overflow-wrap: anywhere; margin-block: var(--wf-space-sm); }
.wf-source-form { display: grid; gap: var(--wf-space-md); max-width: 42rem; }
.wf-source-upload { margin-block: var(--wf-space-lg); }
.wf-source-form input[type=file]::file-selector-button { border: 1px solid var(--wf-color-border); background: var(--wf-color-panel); color: var(--wf-color-ink); border-radius: var(--wf-radius-control); padding: var(--wf-space-sm); margin-inline-end: var(--wf-space-sm); }
@media(max-width:900px) { .wf-source-detail { grid-template-columns: minmax(0,1fr); } .wf-source-collection[data-view=list] .wf-source-entry { grid-template-columns: minmax(0,1fr); } }

.wf-source-record { display: grid; gap: var(--wf-space-md); margin-block: var(--wf-space-md); }
.wf-source-record dt { font-weight: 600; text-transform: capitalize; }
.wf-source-record dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Image-bearing catalogue variant of the shared Cards/List collection. */
.wf-catalogue-collection .wf-source-entry { padding: 0; overflow: hidden; gap: 0; grid-template-rows: auto 1fr auto; }
.wf-collection-image { display: flex; align-items: center; justify-content: center; aspect-ratio: 16 / 9; background: var(--wf-color-selection); color: var(--wf-color-muted); font-size: 2rem; overflow: hidden; }
.wf-collection-image img { width: 100%; height: 100%; object-fit: cover; }
.wf-collection-copy { min-width: 0; padding: var(--wf-space-md); display: grid; gap: var(--wf-space-sm); align-content: start; }
.wf-collection-copy h2 { overflow-wrap: anywhere; }
.wf-collection-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--wf-space-sm); padding: var(--wf-space-sm) var(--wf-space-md); border-top: 1px solid var(--wf-color-border); }
.wf-collection-count { color: var(--wf-color-muted); }
.wf-catalogue-collection[data-view=list] { gap: var(--wf-space-sm); }
.wf-catalogue-collection[data-view=list] .wf-source-entry { grid-template-columns: 5rem minmax(0,1fr) auto; grid-template-rows: auto; padding: var(--wf-space-sm); }
.wf-catalogue-collection[data-view=list] .wf-collection-image { width: 5rem; height: 5rem; border-radius: var(--wf-radius-control); }
.wf-catalogue-collection[data-view=list] .wf-collection-copy { padding: 0 var(--wf-space-md); gap: var(--wf-space-xs); }
.wf-catalogue-collection[data-view=list] .wf-collection-copy h2 { font-size: 1.125rem; }
.wf-catalogue-collection[data-view=list] .wf-collection-footer { border-top: 0; flex-direction: column; align-items: flex-end; }
@media(max-width:600px) {
    .wf-catalogue-collection[data-view=list] .wf-source-entry { grid-template-columns: 4rem minmax(0,1fr); }
    .wf-catalogue-collection[data-view=list] .wf-collection-image { width: 4rem; height: 4rem; }
    .wf-catalogue-collection[data-view=list] .wf-collection-footer { grid-column: 2; flex-direction: row; align-items: center; }
}

.extraction-suggestion { border-block-start: 1px solid var(--wf-color-border); padding-block: 1.5rem; }
.extraction-suggestion blockquote { border-inline-start: 3px solid var(--wf-color-accent); padding-inline-start: 1rem; margin: 1rem 0; font-family: var(--wf-font-literary); }
.extraction-fields { display: grid; gap: 1rem; margin-block: 1rem; }
.extraction-match { margin-block: .75rem; padding: 1rem; }
.extraction-confirm { border-block-start: 1px solid var(--wf-color-border); padding-block: 1.5rem; display: grid; gap: 1rem; }
.wf-extracted-image { display: block; max-width: 100%; max-height: 24rem; height: auto; object-fit: contain; border: 1px solid var(--wf-color-border); border-radius: var(--wf-radius-control); }
.wf-image-locations { max-height: 16rem; overflow: auto; padding-inline-start: 1.5rem; overflow-wrap: anywhere; }

/* Books and authors use portrait artwork within the shared collection. */
.wf-discovery-collection[data-view=cards] { grid-template-columns: repeat(auto-fill,minmax(min(100%,240px),1fr)); align-items: start; }
.wf-discovery-collection[data-view=cards] .wf-collection-image { aspect-ratio: auto; background: transparent; }
.wf-discovery-collection[data-view=cards] .book-cover img { display: block; width: 100%; height: auto; }
.wf-discovery-collection[data-view=cards] .author-portrait,
.wf-discovery-collection[data-view=cards] .cover-placeholder { aspect-ratio: 3 / 4; }
.wf-discovery-collection .cover-placeholder { background: var(--wf-color-selection); }
.wf-discovery-collection .author-portrait img { object-position: center top; }
.wf-discovery-collection[data-view=list] .wf-collection-image { height: auto; aspect-ratio: 3 / 4; }
.wf-discovery-collection[data-view=list] .book-cover { background: transparent; }
.discovery-browse .wf-collection-copy p, .discovery-browse .wf-collection-copy h2 { margin: 0; }
.discovery-browse .wf-source-toolbar { align-items: end; }
.discovery-browse .wf-source-toolbar .reader-actions { margin: 0; align-items: end; }
.discovery-browse .reader-actions label { min-width: 0; }
.discovery-browse .reader-actions input, .discovery-browse .reader-actions select { width: 100%; }
@media(max-width:600px) { .discovery-browse .wf-source-toolbar form { min-width: 0; flex-basis: 100%; } .discovery-browse .reader-actions label { flex: 1 1 100%; } }
